當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。