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


C# IndentedTextWriter.WriteLine方法代码示例

本文整理汇总了C#中System.CodeDom.Compiler.IndentedTextWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# IndentedTextWriter.WriteLine方法的具体用法?C# IndentedTextWriter.WriteLine怎么用?C# IndentedTextWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.CodeDom.Compiler.IndentedTextWriter的用法示例。


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

示例1: PrintException

		private static void PrintException(IndentedTextWriter iWriter, Exception ex) {
			if (ex == null) {
				iWriter.WriteLine("(null)");
				return;
			}
			iWriter.WriteLine("[{0}]", ex.GetType());
			iWriter.Indent++;
			iWriter.WriteLine("Message: {0}", ex.Message);
			iWriter.WriteLine("Source: {0}", ex.Source);
			iWriter.WriteLine("TargetSite: {0}", ex.TargetSite);
			iWriter.WriteLine("HelpLink: {0}", ex.HelpLink);
			if (ex.Data.Count > 0) {
				iWriter.WriteLine("Data:");
				iWriter.Indent++;
				foreach (var key in ex.Data.Keys) {
					iWriter.WriteLine("• {0} = {1}", key, ex.Data[key]);
				}
				iWriter.Indent--;
			}
			iWriter.WriteLine("Full Stack Trace:");
			iWriter.Indent++;
			PrintStackTrace(iWriter, new StackTrace(ex, true));
			iWriter.Indent--;
			iWriter.WriteLine("Inner Exception: ");
			iWriter.Indent++;
			PrintException(iWriter, ex.InnerException);
			iWriter.Indent--;
		}
开发者ID:RAlexander4287,项目名称:IEMod.pw,代码行数:28,代码来源:IEDebug.cs

示例2: WriteCode

		//===========================================================================================
		public virtual void WriteCode(IndentedTextWriter writer)
		{
			writer.Write(TypeName);
			writer.Write(" MagickScript::Create");
			writer.Write(ClassName);
			writer.WriteLine("(XmlElement^ element)");
			WriteStartColon(writer);
			WriteMethod(writer, Constructors);
			WriteEndColon(writer);

			if (!WriteEnumerable)
				return;

			writer.Write("Collection<");
			writer.Write(TypeName);
			writer.Write(">^  MagickScript::Create");
			writer.Write(ClassName);
			writer.WriteLine("s(XmlElement^ element)");
			WriteStartColon(writer);
			writer.Write("Collection<");
			writer.Write(TypeName);
			writer.Write(">^ collection = gcnew Collection<");
			writer.Write(TypeName);
			writer.WriteLine(">();");
			writer.WriteLine("for each (XmlElement^ elem in element->SelectNodes(\"*\"))");
			WriteStartColon(writer);
			writer.Write("collection->Add(Create");
			writer.Write(TypeName.Replace("^", ""));
			writer.WriteLine("(elem));");
			WriteEndColon(writer);
			writer.WriteLine("return collection;");
			WriteEndColon(writer);
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:34,代码来源:ConstructorCodeGenerator.cs

示例3: WriteText

            public void WriteText(IndentedTextWriter writer)
            {
                writer.WriteLine("ResourceEditStringData_t");
                writer.WriteLine("{");
                writer.Indent++;
                writer.WriteLine("CResourceString m_Name = \"{0}\"", Name);

                var lines = Value.Split(new [] { "\r\n", "\n" }, StringSplitOptions.None);

                if (lines.Length > 1)
                {
                    writer.Indent++;

                    writer.Write("CResourceString m_String = \"");

                    foreach (var line in lines)
                    {
                        writer.WriteLine(line);
                    }

                    writer.WriteLine("\"");

                    writer.Indent--;
                }
                else
                {
                    writer.WriteLine("CResourceString m_String = \"{0}\"", Value);
                }

                writer.Indent--;
                writer.WriteLine("}");
            }
开发者ID:babelshift,项目名称:ValveResourceFormat,代码行数:32,代码来源:ExtraStringData.cs

示例4: WriteText

 public void WriteText(IndentedTextWriter writer)
 {
     writer.WriteLine();
     writer.WriteLine("{0:F4} {1:F4} {2:F4} {3:F4}", field0, field1, field2, field3);
     writer.WriteLine("{0:F4} {1:F4} {2:F4} {3:F4}", field4, field5, field6, field7);
     writer.WriteLine("{0:F4} {1:F4} {2:F4} {3:F4}", field8, field9, field10, field11);
 }
开发者ID:githubron726,项目名称:ValveResourceFormat,代码行数:7,代码来源:Matrix3x4.cs

示例5: WriteExceptions

		//===========================================================================================
		private void WriteExceptions(IndentedTextWriter writer)
		{
			foreach (Type type in _Exceptions)
			{
				if (type.IsSealed)
					writer.Write("public sealed class ");
				else
					writer.Write("public class ");
				WriteType(writer, type);
				writer.Write(" : ");
				WriteType(writer, type.BaseType);
				WriteStartColon(writer);
				writer.Write("internal ");
				WriteType(writer, type);
				writer.WriteLine("(Exception exception)");
				writer.Indent++;
				writer.Write(": base(");
				if (type.BaseType == typeof(Exception))
					writer.Write("exception.Message, ");
				writer.WriteLine("exception)");
				writer.Indent--;
				WriteStartColon(writer);
				WriteEndColon(writer);
				WriteEndColon(writer);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:27,代码来源:ExceptionGenerator.cs

示例6: WriteHelper

		//===========================================================================================
		private void WriteHelper(IndentedTextWriter writer)
		{
			writer.WriteLine("public static class ExceptionHelper");
			WriteStartColon(writer);
			writer.WriteLine("public static Exception Create(Exception exception)");
			WriteStartColon(writer);
			writer.WriteLine("if (ReferenceEquals(exception, null))");
			writer.Indent++;
			writer.WriteLine("return null;");
			writer.Indent--;

			writer.WriteLine("switch(exception.GetType().Name)");
			WriteStartColon(writer);
			foreach (Type exception in _Exceptions)
			{
				writer.Write("case \"");
				writer.Write(exception.Name);
				writer.WriteLine("\":");
				writer.Indent++;
				writer.Write("return new ");
				writer.Write(exception.Name);
				writer.WriteLine("(exception);");
				writer.Indent--;
			}
			writer.WriteLine("default:");
			writer.Indent++;
			writer.WriteLine("return exception;");
			writer.Indent--;
			WriteEndColon(writer);
			WriteEndColon(writer);
			WriteEndColon(writer);
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:33,代码来源:ExceptionGenerator.cs

示例7: Write

 void Write(IndentedTextWriter writer, GmlFormatter formatter, bool semicolon, bool curlyBraces)
 {
     Sequence seq;
     if (curlyBraces)
     {
         writer.WriteLine("{");
         writer.Indent++;
     }
     if (First.Kind == StatementKind.Sequence)
     {
         // Write the sequence without curly braces.
         seq = (Sequence)First;
         seq.Write(writer, formatter, semicolon, false);
     }
     else
         First.Write(writer, formatter);
     if (Second.Kind == StatementKind.Sequence)
     {
         // Write the sequence without curly braces.
         seq = (Sequence)Second;
         seq.Write(writer, formatter, semicolon, false);
     }
     else
         Second.Write(writer, formatter);
     if (curlyBraces)
     {
         writer.Indent--;
         writer.WriteLine("}");
     }
 }
开发者ID:MilesBoulanger,项目名称:game-creator,代码行数:30,代码来源:Sequence.cs

示例8: WriteWhenInState

        public virtual void WriteWhenInState(IndentedTextWriter indentedTextWriter, StateCollection stateCollection, State state)
        {
            int stateId = stateCollection[state];

            indentedTextWriter.WriteLine(AssertCharactersInStack(MainStateStackName, stateId));
            indentedTextWriter.WriteLine(@"(?<-{0}>)", MainStateStackName);
        }
开发者ID:kobi,项目名称:RecreationalRegex,代码行数:7,代码来源:SingleStackStateWriter.cs

示例9: DumpValue

		private void DumpValue(IndentedTextWriter writer, string key, Func<object> getter) {
			object o;
			try {
				o = getter();
			}
			catch (Exception ex) {
				writer.WriteLine("{0} = !! {1} !! //an exception occured while evaluating this", key, ex.GetType());
				return;
			}
			if (o == null) {
				writer.WriteLine("{0} = {1}", key, "(null)");
				return;
			}
			var valueString = o.ToString();
			var lines = valueString.Split(new[] {
				'\r',
				'\n'
			},
				StringSplitOptions.RemoveEmptyEntries).ToList();

			if (lines.Count <= 1) {
				writer.WriteLine("{0} = {1}", key, valueString);
			} else {
				writer.WriteLine("{0} = ", key);
				writer.Indent++;
				lines.ForEach(writer.WriteLine);
				writer.Indent--;
			}
		}
开发者ID:RAlexander4287,项目名称:IEMod.pw,代码行数:29,代码来源:UnityObjectDumper.cs

示例10: WriteCode

    protected override void WriteCode(IndentedTextWriter writer)
    {
      foreach (Type type in SupportedTypes)
      {
        string typeName = GetName(type);

        writer.Write("private ");
        writer.Write("Collection<");
        writer.Write(typeName);
        writer.Write(">");
        writer.Write(" Create");
        writer.Write(type.Name);
        writer.Write("Collection");
        writer.Write("(XmlElement element)");
        writer.WriteLine();
        WriteStartColon(writer);
        writer.Write("Collection<");
        writer.Write(typeName);
        writer.Write("> collection = new ");
        writer.Write("Collection<");
        writer.Write(typeName);
        writer.WriteLine(">();");
        writer.WriteLine("foreach (XmlElement elem in element.SelectNodes(\"*\"))");
        WriteStartColon(writer);
        writer.Write("collection.Add(Variables.GetValue<");
        writer.Write(typeName);
        writer.WriteLine(">(elem, \"value\"));");
        WriteEndColon(writer);
        writer.WriteLine("return collection;");
        WriteEndColon(writer);
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:32,代码来源:CollectionGenerator.cs

示例11: WriteText

            public void WriteText(IndentedTextWriter writer)
            {
                writer.WriteLine("CResourceDiskStruct");
                writer.WriteLine("{");
                writer.Indent++;
                writer.WriteLine("uint32 m_nIntrospectionVersion = 0x{0:X8}", IntrospectionVersion);
                writer.WriteLine("uint32 m_nId = 0x{0:X8}", Id);
                writer.WriteLine("CResourceString m_pName = \"{0}\"", Name);
                writer.WriteLine("uint32 m_nDiskCrc = 0x{0:X8}", DiskCrc);
                writer.WriteLine("int32 m_nUserVersion = {0}", UserVersion);
                writer.WriteLine("uint16 m_nDiskSize = 0x{0:X4}", DiskSize);
                writer.WriteLine("uint16 m_nAlignment = 0x{0:X4}", Alignment);
                writer.WriteLine("uint32 m_nBaseStructId = 0x{0:X8}", BaseStructId);

                writer.WriteLine("Struct m_FieldIntrospection[{0}] =", FieldIntrospection.Count);
                writer.WriteLine("[");
                writer.Indent++;

                foreach (var field in FieldIntrospection)
                {
                    field.WriteText(writer);
                }

                writer.Indent--;
                writer.WriteLine("]");
                writer.WriteLine("uint8 m_nStructFlags = 0x{0:X2}", StructFlags);
                writer.Indent--;
                writer.WriteLine("}");
            }
开发者ID:githubron726,项目名称:ValveResourceFormat,代码行数:29,代码来源:ResourceIntrospectionManifest.cs

示例12: WriteMatchers

        private void WriteMatchers(Grammar grammar, IndentedTextWriter output)
        {
            output.WriteLine("// Scanner Conditions: ");
            output.WriteLine();

            foreach (var condition in grammar.Conditions)
            {
                output.WriteLine("condition {0}", condition.Name);
                output.WriteLine("{");
                ++output.Indent;

                foreach (var matcher in condition.Matchers)
                {
                    var transition = matcher.NextCondition == null
                                   ? ""
                                   : string.Format("{{goto {0}}}", matcher.NextCondition.Name);
                    output.WriteLine(
                        "{0} {1}: /{2}/;",
                        Name(matcher.Outcome),
                        transition,
                        matcher.Pattern);
                }

                --output.Indent;
                output.WriteLine("}");
                output.WriteLine();
            }
        }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:28,代码来源:DefaultGrammarTextWriter.cs

示例13: WriteProductions

        private static void WriteProductions(Grammar grammar, IndentedTextWriter output)
        {
            output.WriteLine("// Production rules:");
            output.WriteLine();

            foreach (var prod in grammar.Productions)
            {
                output.WriteLine("// {0}:", prod.Index);
                output.Write("{0} :", prod.Outcome.Name);
                if (prod.Pattern.Length == 0)
                {
                    output.Write(" /*empty*/");
                }
                else
                {
                    foreach (var symb in prod.Pattern)
                    {
                        output.Write(' ');
                        output.Write(symb.Name);
                    }
                }

                output.WriteLine(";");
                output.WriteLine();
            }
        }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:26,代码来源:DefaultGrammarTextWriter.cs

示例14: Run

        public static void Run(Expression<Action<Spec>> action)
        {
            var output = new IndentedTextWriter(Output ?? Console.Out);

            try
            {
                var callingMethod = new StackFrame(1).GetMethod().Name;
                output.WriteLine(callingMethod);
                output.Indent++;
            }
            catch{}

            var parser = new SpecExpressionParser();
            var steps = parser.Parse(action);
            Exception exception = null;
            foreach (var step in steps)
            {
                if (step.Expression == null)
                {
                    output.Write(step);
                }
                else
                {
                    output.Write("{0,-50} => ", step);
                    try
                    {
                        Expression<Action> stepAction = step.Expression.NodeType == ExpressionType.Lambda
                            ? (Expression<Action>) step.Expression
                            : Expression.Lambda<Action>(step.Expression);
                        var compiledAction = stepAction.Compile();
                        compiledAction();
                        output.Write("Passed");
                    }
                    catch(Exception ex)
                    {
                        if (exception == null)
                        {
                            exception = ex;
                        }
                        output.Write("Failed");
                        output.WriteLine();
                        output.WriteLine();
                        output.WriteLine(ex.Message);
                    }
                    output.WriteLine();
                }

                if (step.StepType == StepType.AsA)
                {
                    output.Indent++;
                }

                if (exception != null)
                {
                    throw exception;
                }
            }
        }
开发者ID:ryascl,项目名称:CLRSpec,代码行数:58,代码来源:Spec.cs

示例15: WriteCode

    protected override void WriteCode(IndentedTextWriter writer)
    {
      writer.WriteLine("IReadDefines CreateIReadDefines(XmlElement parent)");
      WriteStartColon(writer);
      writer.WriteLine("return CreateIDefines(parent) as IReadDefines;");
      WriteEndColon(writer);

      base.WriteCode(writer);
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:9,代码来源:IDefinesGenerator.cs


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