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


C# ICodeWriter.WriteLine方法代码示例

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


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

示例1: WriteAccessor

 public static void WriteAccessor(ICodeWriter o, string typeName, string variableNameInLowerCamelCase)
 {
     o.BeginBlock("public {0} {1} {{", typeName, GetVariableNameInUpperCamelCase(variableNameInLowerCamelCase));
     o.WriteLine("get {{ return {0}; }}", variableNameInLowerCamelCase);
     o.WriteLine("set {{ {0} = value; }}", variableNameInLowerCamelCase);
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:7,代码来源:ClassGeneratorHelper.cs

示例2: Render

        public void Render(ICodeWriter renderer)
        {
            if (!SingleLine)
            {
                renderer.WriteLine("");
                renderer.WriteLine("{");
                renderer.PushIndent();

                foreach (ICode codeLine in codes)
                {
                    renderer.WriteLine("{0}", codeLine);
                }

                renderer.PopIndent();
                renderer.WriteLine("}");
            }
            else
            {
                renderer.Write("{ ");

                foreach (ICode codeLine in codes)
                {
                    renderer.Write("{0}", codeLine);
                }

                renderer.Write(" }");
            }
        }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:28,代码来源:Brace.cs

示例3: WriteSingleton

 public static void WriteSingleton(ICodeWriter o, string className)
 {
     o.WriteLine("private static {0} instance = new {0}();", className);
     o.BeginBlock("public static {0} Instance {{", className);
     o.WriteLine("get { return instance; }");
     o.EndBlock("}");
     o.WriteLine("private {0}() {{ }}", className);
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:8,代码来源:ClassGeneratorHelper.cs

示例4: WriteEvents

 private void WriteEvents(ICodeWriter o)
 {
     foreach (EventInfo ei in eventInfos)
     {
         o.WriteLine("public event GenericEventHandler<{0}> {1};", ei.Type.Name, GetHandlerName(ei.Type.Name));
     }
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:7,代码来源:EventHandlersGenerator.cs

示例5: Write

 public void Write(ICodeWriter o)
 {
     o.WriteLine("[Transient]");
     o.BeginBlock("internal sealed class {0} : IEventFactory {{", factoryName);
     WriteRecreateEvent(o);
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:7,代码来源:EventFactoryGenerator.cs

示例6: Write

 public void Write(ICodeWriter o)
 {
     o.WriteLine("[Transient]");
     o.BeginBlock("internal sealed class {0} : IEventHandlers {{", handlersName);
     WriteCallHandler(o);
     WriteEvents(o);
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:8,代码来源:EventHandlersGenerator.cs

示例7: WriteCallHandler

 private void WriteCallHandler(ICodeWriter o)
 {
     o.BeginBlock("public void CallHandler(IEvent e) {");
     o.BeginBlock("switch (e.Id) {");
     foreach (EventInfo ei in eventInfos)
     {
         o.BeginBlock("case {0}:", ei.EventId);
         string handlerName = GetHandlerName(ei.Type.Name);
         o.BeginBlock("if ({0} != null)", handlerName);
         o.WriteLine("{0}(({1})e);", handlerName, ei.Type.Name);
         o.EndBlock("break;");
         o.EndBlock("");
     }
     o.BeginBlock("default:");
     o.WriteLine("throw new UnknownEventIdException(e.Id, \"{0}\");", handlersName + ".CallHandler()");
     o.EndBlock("");
     o.EndBlock("}");
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:19,代码来源:EventHandlersGenerator.cs

示例8: WriteRecreateEvent

 private void WriteRecreateEvent(ICodeWriter o)
 {
     o.BeginBlock("public IEvent RecreateSimpleEvent(BitStream source) {");
     o.WriteLine("Debug.Assert(source != null);");
     o.WriteLine("IEvent _event;");
     o.WriteLine("int id;");
     o.WriteLine("if(!source.Read(out id)) throw new DeserializationException();");
     o.WriteLine("source.ResetReadPointer();");
     o.BeginBlock("switch (id) {");
     foreach (EventInfo ei in eventInfos)
     {
         o.BeginBlock("case {0}:", ei.EventId);
         o.WriteLine("_event = new {0}(source);", ei.Type.Name);
         o.WriteLine("break;");
         o.EndBlock("");
     }
     o.BeginBlock("default:");
     o.WriteLine("throw new UnknownEventIdException(id, \"{0}\");", factoryName + ".RecreateEvent()");
     o.EndBlock("");
     o.EndBlock("}");
     o.WriteLine("return _event;");
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:23,代码来源:EventFactoryGenerator.cs

示例9: WritePropertyImpl

        /// <summary>
        /// 
        /// </summary>
        /// <param name="o"></param>
        /// <param name="typeName"></param>
        /// <param name="variableNameInLowerCamelCase"></param>
        /// <param name="defaultValue">Can be null</param>
        /// <param name="doesWriteGetter"></param>
        /// <param name="getterAccessibility">Can be null</param>
        /// <param name="doesWriteSetter"></param>
        /// <param name="setterAccessibility">Can be null</param>
        private static void WritePropertyImpl(ICodeWriter o, string typeName, string variableNameInLowerCamelCase, string defaultValue, bool doesWriteGetter, string getterAccessibility, bool doesWriteSetter, string setterAccessibility)
        {
            string getterAccessibilityWithSpace = "";
            string setterAccessibilityWithSpace = "";
            string defaultValueWithAssignMark = "";

            if (getterAccessibility != null)
            {
                getterAccessibilityWithSpace = getterAccessibility + " ";
            }
            if (setterAccessibility != null)
            {
                setterAccessibilityWithSpace = setterAccessibility + " ";
            }
            if (defaultValue != null)
            {
                defaultValueWithAssignMark = " = " + defaultValue;
            }

            string variableNameInUpperCamelCase = GetVariableNameInUpperCamelCase(variableNameInLowerCamelCase);

            o.BeginBlock("public {0} {1} {{", typeName, variableNameInUpperCamelCase);
            if (doesWriteGetter)
            {
                o.WriteLine("{0}get {{ return {1}; }}", getterAccessibilityWithSpace, variableNameInLowerCamelCase);
            }
            if (doesWriteSetter)
            {
                o.WriteLine("{0}set {{ {1} = value; }}", setterAccessibilityWithSpace, variableNameInLowerCamelCase);
            }
            o.EndBlock("}");
            o.WriteLine("{0} {1}{2};", typeName, variableNameInLowerCamelCase, defaultValueWithAssignMark);
        }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:44,代码来源:ClassGeneratorHelper.cs

示例10: Render

        public override void Render(ICodeWriter renderer)
        {
            blockStatement.AddStatement(GetAccesor);
            blockStatement.AddStatement(SetAccesor);

            if (attributes.Count > 0)
            {
                renderer.Write("{0} ", attributes.First());
                renderer.WriteLine("");
                foreach (AttributeStatement attribute in attributes.Skip(1))
                {
                    renderer.WriteLine("{0} ", attribute);
                }

                renderer.WriteLine(snippet, AccessModifier, Modifier, ReturnType, name, blockStatement);
            }
            else
            {
                renderer.Write(snippet, AccessModifier, Modifier, ReturnType, name, blockStatement);
            }
        }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:21,代码来源:PropertyStatement.cs

示例11: WriteSerializeFieldStatementRecursive

 private static void WriteSerializeFieldStatementRecursive(ICodeWriter o, bool writeToBitstream, Type variableType, string variableName)
 {
     if (variableType.IsArray)
     {
         Type elemType = variableType.GetElementType();
         if (writeToBitstream)
         {
             WriteStreamWriteStatement(o, variableName + ".Length");
             o.BeginBlock("for (int i = 0; i < {0}.Length; i++) {{", variableName);
             WriteSerializeFieldStatementRecursive(o, writeToBitstream, elemType, variableName + "[i]");
             o.EndBlock("}");
         }
         else
         {
             string lengthVariableName = "_" + variableName + "Length";
             o.WriteLine("int {0};", lengthVariableName);
             WriteStreamReadStatement(o, "out", lengthVariableName);
             o.WriteLine("{0} = new {1}[{2}];", variableName, elemType.ToString(), lengthVariableName);
             o.BeginBlock("for (int i = 0; i < {0}; i++) {{", lengthVariableName);
             WriteSerializeFieldStatementRecursive(o, writeToBitstream, elemType, variableName + "[i]");
             o.EndBlock("}");
         }
     }
     else
     {
         WriteSerializeNonCollectionStatement(o, writeToBitstream, variableType, variableName);
     }
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:28,代码来源:EventClassGenerator.cs

示例12: WriteSetData

 private void WriteSetData(ICodeWriter o)
 {
     StringBuilder arg = new StringBuilder();
     FieldInfo[] fields = GetSerializableFields();
     for (int i = 0; i < fields.Length; i++)
     {
         if (0 < i) arg.Append(", ");
         arg.Append(fields[i].FieldType.ToString());
         arg.Append(" ");
         arg.Append(fields[i].Name);
     }
     o.BeginBlock("public void SetData({0}) {{", arg.ToString());
     foreach (FieldInfo field in fields)
     {
         o.WriteLine("this.{0} = {0};", field.Name);
     }
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:18,代码来源:EventClassGenerator.cs

示例13: WriteGetStream

        // TODO: ProtocolGenerator can't handle null reference.
        private void WriteGetStream(ICodeWriter o)
        {
            o.BeginBlock("public BitStream Stream {");
            o.BeginBlock("get {");
            o.WriteLine("BitStream eventStream = new BitStream();");
            WriteStreamWriteStatement(o, "id");
            WriteStreamWriteStatement(o, "sourceOId");
            WriteStreamWriteStatement(o, "targetOId");

            foreach (FieldInfo field in GetSerializableFields())
            {
                WriteSerializeFieldStatementRecursive(o, true, field.FieldType, field.Name);
            }
            o.WriteLine("return eventStream;");
            o.EndBlock("}");
            o.EndBlock("}");
        }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:18,代码来源:EventClassGenerator.cs

示例14: WriteCtorWithId

 private void WriteCtorWithId(ICodeWriter o)
 {
     o.BeginBlock("public {0}() {{", type.Name);
     o.WriteLine("id = {0};", eventId);
     o.EndBlock("}");
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:6,代码来源:EventClassGenerator.cs

示例15: WriteStreamWriteStatement

 private static void WriteStreamWriteStatement(ICodeWriter o, string variableName)
 {
     o.WriteLine("eventStream.Write({0});", variableName);
 }
开发者ID:JetCrusherTorpedo,项目名称:raknetdotnet,代码行数:4,代码来源:EventClassGenerator.cs


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