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


C# IndentedTextWriter.WriteLineNoTabs方法代码示例

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


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

示例1: Generate

        public void Generate(IndentedTextWriter writer, string className, bool isStatic)
        {
            foreach (GenSpec spec in genSpecs)
            {
                if (spec.ClassName == className)
                {
                    if (currentRegion == null)
                    {
                        //currentRegion = spec.LeftPart;
                        //int dot = currentRegion.IndexOf('.');
                        //if (dot > 0) currentRegion = currentRegion.Substring(dot + 1);
                        currentRegion = spec.MethodName;
                        int lpar = currentRegion.IndexOf('(');
                        if (lpar > 0) currentRegion = currentRegion.Substring(0, lpar);

                        writer.WriteLine("#region " + currentRegion);
                        writer.WriteLine();
                    }

                    if (spec.IsGeneric)
                        writer.WriteLineNoTabs("#if NET_2_0");

                    if (spec.ClassName == "Assert")
                        GenerateAssertOverloads(writer, isStatic, spec);
                    else
                        GenerateMethod(writer, isStatic, spec);

                    if (spec.IsGeneric)
                        writer.WriteLineNoTabs("#endif");
                }
            }

            if (currentRegion != null)
            {
                writer.WriteLine("#endregion");
                writer.WriteLine();
                currentRegion = null;
            }
        }
开发者ID:scottwis,项目名称:eddie,代码行数:39,代码来源:Stanza.cs

示例2: Writes_ProducesExpectedOutput

        public static async Task Writes_ProducesExpectedOutput(string newline)
        {
            var sb = new StringBuilder();
            var sw = new StringWriter(sb, CultureInfo.InvariantCulture);
            var itw = new IndentedTextWriter(sw, "t");
            itw.Indent = 1;
            itw.NewLine = newline;
            itw.WriteLine();

            itw.Write(true);
            itw.Write('a');
            itw.Write(new char[] { 'b', 'c' });
            itw.Write(new char[] { 'd', 'e' }, 0, 2);
            itw.Write(4m);
            itw.Write(5.6);
            itw.Write(6.7f);
            itw.Write(8);
            itw.Write(9L);
            itw.Write((object)10);
            itw.Write("11");
            itw.Write(12u);
            itw.Write(13uL);
            itw.Write("{0}", 14);
            itw.Write("{0} {1}", 15, 16);
            itw.Write("{0} {1} {2}", 15, 16, 17);
            itw.Write("{0} {1} {2} {3}", 15, 16, 17, 18);

            itw.WriteLine(true);
            itw.WriteLine('a');
            itw.WriteLine(new char[] { 'b', 'c' });
            itw.WriteLine(new char[] { 'd', 'e' }, 0, 2);
            itw.WriteLine(4m);
            itw.WriteLine(5.6);
            itw.WriteLine(6.7f);
            itw.WriteLine(8);
            itw.WriteLine(9L);
            itw.WriteLine((object)10);
            itw.WriteLine("11");
            itw.WriteLine(12u);
            itw.WriteLine(13uL);
            itw.WriteLine("{0}", 14);
            itw.WriteLine("{0} {1}", 15, 16);
            itw.WriteLine("{0} {1} {2}", 15, 16, 17);
            itw.WriteLine("{0} {1} {2} {3}", 15, 16, 17, 18);

            await itw.WriteAsync('a');
            await itw.WriteAsync(new char[] { 'b', 'c' });
            await itw.WriteAsync(new char[] { 'd', 'e' }, 0, 2);
            await itw.WriteAsync("1");

            await itw.WriteLineAsync('a');
            await itw.WriteLineAsync(new char[] { 'b', 'c' });
            await itw.WriteLineAsync(new char[] { 'd', 'e' }, 0, 2);
            await itw.WriteLineAsync("1");

            itw.WriteLineNoTabs("notabs");

            Assert.Equal(
                "" + newline +
                "tTrueabcde45.66.789101112131415 1615 16 1715 16 17 18True" + newline +
                "ta" + newline +
                "tbc" + newline +
                "tde" + newline +
                "t4" + newline +
                "t5.6" + newline +
                "t6.7" + newline +
                "t8" + newline +
                "t9" + newline +
                "t10" + newline +
                "t11" + newline +
                "t12" + newline +
                "t13" + newline +
                "t14" + newline +
                "t15 16" + newline +
                "t15 16 17" + newline +
                "t15 16 17 18" + newline +
                "tabcde1a" + newline +
                "tbc" + newline +
                "tde" + newline +
                "t1" + newline +
                "notabs" + newline,
                sb.ToString());
        }
开发者ID:dotnet,项目名称:corefx,代码行数:83,代码来源:IndentedTextWriter.cs

示例3: WriteTerminatingStringTemplate

        private static void WriteTerminatingStringTemplate(IList<DocCode> list,
            IndentedTextWriter writer, IList<TerminatingStringTemplate> templates)
        {
            //TerminatingStringTemplate.WriteDoc(writer, template);

            var parameterDocs = new Dictionary<string, List<string>>(
                StringComparer.CurrentCultureIgnoreCase);

            var templatesSortedByGame = new Dictionary<string, List<TerminatingStringTemplate>>();

            for (int i = 0; i < templates.Count; i++)
            {
                string key = list[i].languages.ToHumanString();
                List<TerminatingStringTemplate> tempList = templatesSortedByGame.GetOldOrSetNew(key);
                tempList.Add(templates[i]);

                List<string> values = parameterDocs.GetOldOrSetNew(templates[i].Parameter.Name);
                values.AddRange(list[i].parameterDocs[templates[i].Parameter.Name]);
            }

            foreach (var item in templatesSortedByGame)
            {
                writer.WriteLine(item.Key + ":");
                writer.Indent++;
                foreach (var template in item.Value)
                {
                    WriteDoc(writer, template);
                }
                writer.Indent--;
            }
            writer.WriteLineNoTabs("");

            writer.Indent++;

            string[] mainDoc = null;
            foreach (var item in list)
            {
                if (item.mainDoc.Count > 0)
                {
                    mainDoc = item.mainDoc.ToArray();
                    break;
                }
            }

            if (mainDoc != null)
            {
                foreach (var item in list[0].mainDoc)
                {
                    writer.WriteLine(item);
                }
            }
            #if DEBUG
            else
            {
                writer.WriteLine("No doc for this code found.");
            }
            #endif
            if (parameterDocs.Count > 0)
            {
                WriteParameters(writer, parameterDocs);
            }
            writer.Indent--;
        }
开发者ID:TimoVesalainen,项目名称:Event-Assembler,代码行数:63,代码来源:LanguageProcessor.cs

示例4: WriteParameters

        private static void WriteParameters(IndentedTextWriter indentedWriter, 
            Dictionary<string, List<string>> parameterDocs)
        {
            indentedWriter.WriteLineNoTabs("");
            indentedWriter.WriteLine("Parameters:");
            indentedWriter.Indent++;

            foreach (var item in parameterDocs)
            {
                if (item.Value.Count > 0)
                {
                    indentedWriter.WriteLine("{0} = {1}", item.Key, item.Value[0]);
                    indentedWriter.Indent += item.Key.Length + 3;
                    for (int i = 1; i < item.Value.Count; i++)
                    {
                        indentedWriter.WriteLine(item.Value[i]);
                    }
                    indentedWriter.Indent -= item.Key.Length + 3;
                }
                else
                {
                    indentedWriter.WriteLine("{0}", item.Key);
                }
            }
            indentedWriter.Indent--;
        }
开发者ID:TimoVesalainen,项目名称:Event-Assembler,代码行数:26,代码来源:LanguageProcessor.cs

示例5: TouchEverything

		private void TouchEverything (IndentedTextWriter itw)
		{
			Assert.AreSame (writer.Encoding, itw.Encoding, "Encoding");
			Assert.AreEqual (0, itw.Indent, "Indent");
			itw.Indent = 1;
			Assert.AreSame (writer, itw.InnerWriter, "InnerWriter");
			Assert.AreEqual (writer.NewLine, itw.NewLine, "NewLine");

			itw.Write (true);
			itw.Write (Char.MinValue);
			itw.Write (Path.InvalidPathChars); // char[]
			itw.Write (Double.MinValue);
			itw.Write (Int32.MinValue);
			itw.Write (Int64.MaxValue);
			itw.Write (new object ());
			itw.Write (Single.MinValue);
			itw.Write (String.Empty);
			itw.Write ("{0}", String.Empty);
			itw.Write ("{0}{1}", Int32.MinValue, Int32.MaxValue);
			itw.Write ("{0}{1}{2}", Int32.MinValue, 0, Int32.MaxValue);
			itw.Write (Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
			itw.WriteLine ();
			itw.WriteLine (true);
			itw.WriteLine (Char.MinValue);
			itw.WriteLine (Path.InvalidPathChars); // char[]
			itw.WriteLine (Double.MinValue);
			itw.WriteLine (Int32.MinValue);
			itw.WriteLine (Int64.MaxValue);
			itw.WriteLine (new object ());
			itw.WriteLine (Single.MinValue);
			itw.WriteLine (String.Empty);
			itw.WriteLine (UInt32.MaxValue);
			itw.WriteLine ("{0}", String.Empty);
			itw.WriteLine ("{0}{1}", Int32.MinValue, Int32.MaxValue);
			itw.WriteLine ("{0}{1}{2}", Int32.MinValue, 0, Int32.MaxValue);
			itw.WriteLine (Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
			itw.WriteLineNoTabs (String.Empty);
			itw.Flush ();
			itw.Close ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:40,代码来源:IndentedTextWriterCas.cs

示例6: WriteCodeTemplates

        private static void WriteCodeTemplates(IList<DocCode> list, 
            IndentedTextWriter indentedWriter, 
            IList<CodeTemplate> templates)
        {
            var parameterDocs = new Dictionary<string, List<string>>(
                StringComparer.CurrentCultureIgnoreCase);

            var templatesSortedByGame = new Dictionary<string, List<CodeTemplate>>();

            for (int i = 0; i < templates.Count; i++)
            {
                string key = list[i].languages.ToHumanString();
                List<CodeTemplate> tempList = templatesSortedByGame.GetOldOrSetNew(key);
                tempList.Add(templates[i]);

                foreach (var parameter in templates[i])
                {
                    List<string> values = parameterDocs.GetOldOrSetNew(parameter.name);
                    values.AddRange(list[i].parameterDocs[parameter.name]);
                }
            }

            foreach (var item in templatesSortedByGame)
            {
                indentedWriter.WriteLine(item.Key + ":");
                indentedWriter.Indent++;
                foreach (var template in item.Value)
                {
                    CodeTemplate.WriteDoc(indentedWriter, template);
                }
                indentedWriter.Indent--;
            }

            indentedWriter.Indent++;

            List<string> mainDoc = new List<string>();
            foreach (var item in list)
            {
                if (item.mainDoc.Count > 0)
                {
                    mainDoc.AddRange(item.mainDoc);
                    break;
                }
            }

            if (mainDoc.Count > 0)
            {
                indentedWriter.WriteLineNoTabs("");
                foreach (var item in mainDoc)
                {
                    indentedWriter.WriteLine(item);
                }
            }
            #if DEBUG
            else
            {
                indentedWriter.WriteLine("No doc for this code found.");
            }
            #endif
            if (parameterDocs.Count > 0)
            {
                WriteParameters(indentedWriter, parameterDocs);
            }
            indentedWriter.Indent--;
        }
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor-old,代码行数:65,代码来源:LanguageProcessor.cs


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