当前位置: 首页>>代码示例>>C#>>正文


C# BraceStyle类代码示例

本文整理汇总了C#中BraceStyle的典型用法代码示例。如果您正苦于以下问题:C# BraceStyle类的具体用法?C# BraceStyle怎么用?C# BraceStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BraceStyle类属于命名空间,在下文中一共展示了BraceStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenBrace

        public virtual void OpenBrace(BraceStyle style)
        {
            if (!_startOfLine)
            {
                switch (style)
                {
                    case BraceStyle.EndOfLineNoSpacing:
                        break;

                    case BraceStyle.EndOfLine:
                        WriteSpace();
                        break;

                    case BraceStyle.NextLine:
                        WriteLine();
                        break;

                    case BraceStyle.NextLineIndented:
                        WriteLine();
                        Indent();
                        break;
                }
            }

            Output.Write('{');
            Indent();
            WriteLine();
        }
开发者ID:JerreS,项目名称:AbstractCode,代码行数:28,代码来源:TextOutputFormatter.cs

示例2: CloseBrace

 public void CloseBrace(BraceStyle style)
 {
     switch (style) {
     case BraceStyle.DoNotChange:
     case BraceStyle.EndOfLine:
     case BraceStyle.EndOfLineWithoutSpace:
     case BraceStyle.NextLine:
         Unindent();
         WriteIndentation();
         textWriter.Write('}');
         break;
     case BraceStyle.NextLineShifted:
         WriteIndentation();
         textWriter.Write('}');
         Unindent();
         break;
     case BraceStyle.NextLineShifted2:
         Unindent();
         WriteIndentation();
         textWriter.Write('}');
         Unindent();
         break;
     default:
         throw new ArgumentOutOfRangeException ();
     }
 }
开发者ID:holmak,项目名称:NRefactory,代码行数:26,代码来源:TextWriterOutputFormatter.cs

示例3: CloseBrace

        public void CloseBrace(BraceStyle style)
        {
            Unindent();
            WriteIndentation();

            Write("}");
        }
开发者ID:GunioRobot,项目名称:sdb-cli,代码行数:7,代码来源:DecompilerFormatter.cs

示例4: OpenBrace

		public void OpenBrace(BraceStyle style)
		{
			WriteIndentation();
			textWriter.Write(' ');
			textWriter.Write('{');
			Indent();
			NewLine();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:8,代码来源:TextWriterOutputFormatter.cs

示例5: CloseBrace

		public void CloseBrace(BraceStyle style)
		{
			output.Unindent();
			output.Write('}');
			if (nodeStack.OfType<BlockStatement>().Count() <= 1)
				output.MarkFoldEnd();
			if (braceLevelWithinType >= 0)
				braceLevelWithinType--;
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:9,代码来源:TextOutputFormatter.cs

示例6: OpenBrace

		public void OpenBrace(BraceStyle style)
		{
			if (braceLevelWithinType >= 0 || nodeStack.Peek() is TypeDeclaration)
				braceLevelWithinType++;
			if (nodeStack.OfType<BlockStatement>().Count() <= 1) {
				output.MarkFoldStart(defaultCollapsed: braceLevelWithinType == 1);
			}
			output.WriteLine();
			output.WriteLine("{");
			output.Indent();
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:11,代码来源:TextOutputFormatter.cs

示例7: CloseBrace

 public void CloseBrace(BraceStyle style, out TextLocation? start, out TextLocation? end)
 {
     output.Unindent();
     start = output.Location;
     output.WriteRightBrace();
     end = output.Location;
     if (nodeStack.OfType<BlockStatement>().Count() <= 1)
         output.MarkFoldEnd();
     if (braceLevelWithinType >= 0)
         braceLevelWithinType--;
 }
开发者ID:damnya,项目名称:dnSpy,代码行数:11,代码来源:TextTokenWriter.cs

示例8: OpenBrace

        public void OpenBrace(BraceStyle style)
        {
            if (!_firstBrace)
                NewLine();
            else
                _firstBrace = false;

            WriteIndentation();

            Write("{");

            Indent();
            NewLine();
        }
开发者ID:GunioRobot,项目名称:sdb-cli,代码行数:14,代码来源:DecompilerFormatter.cs

示例9: BeginBrace

		public void BeginBrace(BraceStyle style, bool indent)
		{
			switch (style) {
				case BraceStyle.EndOfLine:
					if (!LastCharacterIsWhiteSpace) {
						Space();
					}
					PrintToken(Tokens.OpenCurlyBrace);
					NewLine();
					if (indent)
						++IndentationLevel;
					break;
				case BraceStyle.EndOfLineWithoutSpace:
					PrintToken(Tokens.OpenCurlyBrace);
					NewLine();
					if (indent)
						++IndentationLevel;
					break;
				case BraceStyle.NextLine:
					NewLine();
					Indent();
					PrintToken(Tokens.OpenCurlyBrace);
					NewLine();
					if (indent)
						++IndentationLevel;
					break;
				case BraceStyle.NextLineShifted:
					NewLine();
					if (indent)
						++IndentationLevel;
					Indent();
					PrintToken(Tokens.OpenCurlyBrace);
					NewLine();
					break;
				case BraceStyle.NextLineShifted2:
					NewLine();
					if (indent)
						++IndentationLevel;
					Indent();
					PrintToken(Tokens.OpenCurlyBrace);
					NewLine();
					++IndentationLevel;
					break;
			}
			braceStack.Push(style);
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:46,代码来源:OutputFormatter.cs

示例10: OpenBrace

		public void OpenBrace(BraceStyle style)
		{
			switch (style) {
				case BraceStyle.DoNotChange:
				case BraceStyle.EndOfLine:
				case BraceStyle.BannerStyle:
					WriteIndentation();
					if (!isAtStartOfLine)
						textWriter.Write(' ');
					textWriter.Write('{');
					break;
				case BraceStyle.EndOfLineWithoutSpace:
					WriteIndentation();
					textWriter.Write('{');
					break;
				case BraceStyle.NextLine:
					if (!isAtStartOfLine)
						NewLine();
					WriteIndentation();
					textWriter.Write('{');
					break;
					
				case BraceStyle.NextLineShifted:
					NewLine ();
					Indent();
					WriteIndentation();
					textWriter.Write('{');
					NewLine();
					return;
				case BraceStyle.NextLineShifted2:
					NewLine ();
					Indent();
					WriteIndentation();
					textWriter.Write('{');
					break;
				default:
					throw new ArgumentOutOfRangeException ();
			}
			Indent();
			NewLine();
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:41,代码来源:TextWriterOutputFormatter.cs

示例11: CloseBrace

        public virtual void CloseBrace(BraceStyle style)
        {
            Unindent();

            if (!_startOfLine)
            {
                switch (style)
                {
                    case BraceStyle.EndOfLine:
                        WriteSpace();
                        break;

                    case BraceStyle.NextLine:
                        WriteLine();
                        break;
                }
            }

            Output.Write('}');
            _startOfLine = false;
        }
开发者ID:JerreS,项目名称:AbstractCode,代码行数:21,代码来源:TextOutputFormatter.cs

示例12: AddIndentation

        void AddIndentation(BraceStyle braceStyle)
        {
            switch (braceStyle) {
                case BraceStyle.DoNotChange:
                case BraceStyle.EndOfLine:
                case BraceStyle.EndOfLineWithoutSpace:
                case BraceStyle.NextLine:
                case BraceStyle.NextLineShifted:
                case BraceStyle.BannerStyle:
                    indentDelta.Push(IndentType.Block);
                    break;

                case BraceStyle.NextLineShifted2:
                    indentDelta.Push(IndentType.DoubleBlock);
                    break;
            }
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:17,代码来源:CSharpIndentEngine.cs

示例13: OpenBrace

		void OpenBrace(BraceStyle style)
		{
			WriteSpecialsUpToRole(Roles.LBrace);
			formatter.OpenBrace(style);
			lastWritten = LastWritten.Other;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:6,代码来源:CSharpOutputVisitor.cs

示例14: FixClosingBrace

        void FixClosingBrace(BraceStyle braceStyle, AstNode rbrace)
        {
            if (rbrace.IsNull)
                return;
            switch (braceStyle) {
                case BraceStyle.DoNotChange:
                    return;

                case BraceStyle.NextLineShifted:
                case BraceStyle.BannerStyle:
                    curIndent.Push(IndentType.Block);
                    CorrectClosingBrace (rbrace);
                    curIndent.Pop ();
                    break;
                case BraceStyle.EndOfLineWithoutSpace:
                case BraceStyle.EndOfLine:
                case BraceStyle.NextLine:
                    CorrectClosingBrace (rbrace);
                    break;

                case BraceStyle.NextLineShifted2:
                    curIndent.Push(IndentType.Block);
                    CorrectClosingBrace (rbrace);
                    curIndent.Pop ();
                    break;
            }
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:27,代码来源:FormattingVisitor.cs

示例15: FixOpenBrace

        void FixOpenBrace(BraceStyle braceStyle, AstNode lbrace)
        {
            if (lbrace.IsNull)
                return;
            switch (braceStyle) {
                case BraceStyle.DoNotChange:
                    return;

                case BraceStyle.BannerStyle:
                case BraceStyle.EndOfLine:
                    var prev = lbrace.GetPrevNode (NoWhitespacePredicate);
                    if (prev is PreProcessorDirective)
                        return;
                    int prevOffset = document.GetOffset(prev.EndLocation);

                    if (prev is Comment || prev is PreProcessorDirective) {
                        int next = document.GetOffset(lbrace.GetNextNode ().StartLocation);
                        AddChange(prevOffset, next - prevOffset, "");
                        while (prev is Comment || prev is PreProcessorDirective)
                            prev = prev.GetPrevNode();
                        prevOffset = document.GetOffset(prev.EndLocation);
                        AddChange(prevOffset, 0, " {");
                    } else {
                        int braceOffset2 = document.GetOffset(lbrace.StartLocation);
                        AddChange(prevOffset, braceOffset2 - prevOffset, " ");
                    }
                    break;
                case BraceStyle.EndOfLineWithoutSpace:
                    prev = lbrace.GetPrevNode (NoWhitespacePredicate);
                    if (prev is PreProcessorDirective)
                        return;
                    prevOffset = document.GetOffset(prev.EndLocation);
                    int braceOffset = document.GetOffset(lbrace.StartLocation);
                    AddChange(prevOffset, braceOffset - prevOffset, "");
                    break;

                case BraceStyle.NextLine:
                    prev = lbrace.GetPrevNode (NoWhitespacePredicate);
                    if (prev is PreProcessorDirective)
                        return;
                    prevOffset = document.GetOffset(prev.EndLocation);
                    braceOffset = document.GetOffset(lbrace.StartLocation);
                    AddChange(prevOffset, braceOffset - prevOffset, options.EolMarker + curIndent.IndentString);
                    break;
                case BraceStyle.NextLineShifted:
                    prev = lbrace.GetPrevNode (NoWhitespacePredicate);
                    if (prev is PreProcessorDirective)
                        return;
                    prevOffset = document.GetOffset(prev.EndLocation);
                    braceOffset = document.GetOffset(lbrace.StartLocation);
                    curIndent.Push(IndentType.Block);
                    AddChange(prevOffset, braceOffset - prevOffset, options.EolMarker + curIndent.IndentString);
                    curIndent.Pop();
                    break;
                case BraceStyle.NextLineShifted2:
                    prev = lbrace.GetPrevNode (NoWhitespacePredicate);
                    if (prev is PreProcessorDirective)
                        return;
                    prevOffset = document.GetOffset(prev.EndLocation);
                    braceOffset = document.GetOffset(lbrace.StartLocation);
                    curIndent.Push(IndentType.Block);
                    AddChange(prevOffset, braceOffset - prevOffset, options.EolMarker + curIndent.IndentString);
                    curIndent.Pop();
                    break;
            }
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:66,代码来源:FormattingVisitor.cs


注:本文中的BraceStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。