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


C# TextWriter.WriteLine方法代码示例

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


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

示例1: PrintCaseStatements

 private static void PrintCaseStatements(TextWriter output, int branchCount, int value, int off)
 {
     for (var i = branchCount; i > 0; i >>= 1)
     {
         if ((i & value) != 0)
         {
             switch (i)
             {
                 case 32:
                     if (gEnableAvx) output.WriteLine("\t_memcpy32_avx(dst + {0}, src + {0});", off);
                     else output.WriteLine("\t_memcpy32_sse2(dst + {0}, src + {0});", off);
                     break;
                 case 16:
                     output.WriteLine("\t_memcpy16_sse2(dst + {0}, src + {0});", off);
                     break;
                 case 8:
                     output.WriteLine("\t*reinterpret_cast<uint64_t*>(dst + {0}) = *reinterpret_cast<uint64_t const*>(src + {0});", off);
                     break;
                 case 4:
                     output.WriteLine("\t*reinterpret_cast<uint32_t*>(dst + {0}) = *reinterpret_cast<uint32_t const*>(src + {0});", off);
                     break;
                 case 2:
                     output.WriteLine("\t*reinterpret_cast<uint16_t*>(dst + {0}) = *reinterpret_cast<uint16_t const*>(src + {0});", off);
                     break;
                 case 1:
                     output.WriteLine("\tdst[{0}] = src[{0}];", off);
                     break;
             }
             off += i;
         }
     }
 }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:32,代码来源:Tool.cs

示例2: toXML

 public override void toXML(TextWriter tw)
 {
     tw.WriteLine("<" + Constants.BINC45MODELSELECTION_ELEMENT + " " +
     Constants.MIN_NO_OBJ_ATTRIBUTE + "=\"" + this.m_minNoObj + "\"   " +
     " xmlns=\"urn:mites-schema\">\n");
     tw.WriteLine("</" + Constants.BINC45MODELSELECTION_ELEMENT + ">");           
 }
开发者ID:intille,项目名称:mitessoftware,代码行数:7,代码来源:BinC45ModelSelection.cs

示例3: foreach

        void IDumpableAsText.DumpAsText(TextWriter writer)
        {
            var pbag = new List<KeyValuePair<String, String>>();
            Func<KeyValuePair<String, String>, String> fmt = kvp =>
            {
                var maxKey = pbag.Max(kvp1 => kvp1.Key.Length);
                return String.Format("    {0} : {1}", kvp.Key.PadRight(maxKey), kvp.Value);
            };

            Action<String> fillPbag = s =>
            {
                foreach (var line in s.SplitLines().Skip(1).SkipLast(1))
                {
                    var m = Regex.Match(line, "^(?<key>.*?):(?<value>.*)$");
                    var key = m.Result("${key}").Trim();
                    var value = m.Result("${value}").Trim();
                    pbag.Add(new KeyValuePair<String, String>(key, value));
                }
            };

            writer.WriteLine("Device #{0} \"{1}\" (/pci:{2}/dev:{3})", Index, Name, PciBusId, PciDeviceId);
            fillPbag(Simd.ToString());
            fillPbag(Clock.ToString());
            fillPbag(Memory.ToString());
            fillPbag(Caps.ToString());
            pbag.ForEach(kvp => writer.WriteLine(fmt(kvp)));
        }
开发者ID:xeno-by,项目名称:libcuda,代码行数:27,代码来源:CudaDevice.Core.cs

示例4: ToGraphic

        public static void ToGraphic(this ByteMatrix matrix, TextWriter output)
        {
            output.WriteLine(matrix.Width.ToString());
            for (int j = 0; j < matrix.Width; j++)
            {
                for (int i = 0; i < matrix.Width; i++)
                {

                    char charToPrint;
                    switch (matrix[i, j])
                    {
                        case 0:
                            charToPrint = s_0Char;
                            break;

                        case 1:
                            charToPrint = s_1Char;
                            break;

                        default:
                            charToPrint = s_EmptyChar;
                            break;

                    }
                    output.Write(charToPrint);
                }
                output.WriteLine();
            }
        }
开发者ID:fengdc,项目名称:QrCode.Net,代码行数:29,代码来源:ByteMatrixToGraphicExtensions.cs

示例5: Dump

        /// <summary>
        /// Hex dump byte array to Text writer
        /// </summary>
        /// <param name="writer">Text writer to write hex dump to</param>
        /// <param name="bytes">Data to dump as hex</param>
        /// <param name="maxLength">Optional max bytes to dump</param>
        public static void Dump(TextWriter writer, byte[] bytes, int maxLength = int.MaxValue)
        {
            const int rowSize = 16;
            var hex = new StringBuilder(rowSize * 3);
            var ascii = new StringBuilder(rowSize);
            var offset = 0;

            foreach (var b in bytes.Take(maxLength))
            {
                hex.AppendFormat("{0:X2} ", b);
                ascii.Append(Char.IsControl((char)b) ? '.' : (char)b);

                if (ascii.Length == rowSize)
                {
                    writer.WriteLine("{0:X4} : {1}{2} {0}", offset, hex, ascii);
                    hex.Clear();
                    ascii.Clear();
                    offset += rowSize;
                }
            }

            if (ascii.Length != 0)
            {
                while (hex.Length < (rowSize*3)) hex.Append(' ');
                while (ascii.Length < rowSize) ascii.Append(' ');
                writer.WriteLine("{0:X4} : {1}{2} {0}", offset, hex, ascii);
            }

            if (bytes.Length > maxLength)
                writer.WriteLine("(More data... 0x{0:X}({0}))", bytes.Length);
        }
开发者ID:PolarbearDK,项目名称:Miracle.FileZilla.Api,代码行数:37,代码来源:Hex.cs

示例6: Write_Main_Viewer_Section

        /// <summary> Stream to which to write the HTML for this subwriter  </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("EAD_Description_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Get the metadata module for EADs
            EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);

            // Build the value
            Output.WriteLine("          <td>");
            Output.WriteLine("            <div id=\"sbkEad_MainArea\">");

            if ( !String.IsNullOrWhiteSpace(CurrentMode.Text_Search))
            {
                // Get any search terms
                List<string> terms = new List<string>();
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
            }
            else
            {
                Output.Write(eadInfo.Full_Description);
            }

            Output.WriteLine("            </div>");
            Output.WriteLine("          </td>");
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:37,代码来源:EAD_Description_ItemViewer.cs

示例7: Host

        public static void Host(TextWriter log, CancellationToken cancellationToken)
        {
            var configuration = new BusConfiguration();
            configuration.UseTransport<AzureStorageQueueTransport>();
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.Conventions()
                .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Commands"))
                .DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Events"))
                .DefiningMessagesAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("RequestResponse"))
                .DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted"));
            configuration.RijndaelEncryptionService();
            configuration.EnableInstallers();
            
            var startableBus = Bus.Create(configuration);
            startableBus.Start();
            log.WriteLine("The VideoStore.Sales endpoint is now started and ready to accept messages");

            while (!cancellationToken.IsCancellationRequested)
            {
                Thread.Sleep(3000);
            }

            startableBus.Dispose();
            log.WriteLine("Host: stopped at " + DateTime.UtcNow);
        }
开发者ID:nigelhamer,项目名称:VideoStore.DistributedAppDemo,代码行数:25,代码来源:Functions.cs

示例8: Summary

		static void Summary(TextWriter c)
		{
			Header(c, "Summary", "$(\"a.type\").click (function (e) { $(this).append ('<div></div>'); $(this).children ().load ('/type/'); console.log ($(this).contents ()); e.preventDefault ();});");
			//Header (c, "Summary", "alert ('loaded');");
			var weakList = MonoTouch.ObjCRuntime.Runtime.GetSurfacedObjects();
			c.WriteLine("<div id='foo'></div>");
			c.WriteLine("<p>Total surfaced objects: {0}", weakList.Count);
			var groups = from weak in weakList
				let nso =  weak.Target
				where nso != null
				let typeName = nso.GetType().FullName
				orderby typeName
				group nso by typeName into g
				let gCount = g.ToList().Count
				orderby gCount descending
				select new { Type = g.Key, Instances = g };
			var list = groups.ToList();
			c.WriteLine("<p>Have {0} different types surfaced", list.Count);
			c.WriteLine("<ul>");
			foreach (var type in list)
			{
				c.WriteLine("<li>{1} <a href='' class='type'>{0}</a>", type.Type, type.Instances.ToList().Count);
			}
			c.WriteLine("</ul>");
			c.WriteLine("</body></html>");
		}
开发者ID:RobertKozak,项目名称:MonoMobile.Views,代码行数:26,代码来源:HttpDebug.cs

示例9: AsyncRedisConnection

 /// <summary>
 /// Construct a new redis connection (which will be actually setup on demand)
 /// with an object to synchronize access on.
 /// </summary>
 public AsyncRedisConnection(string tier, string delimitedConfiguration, Func<bool> shouldPromoteSlaveToMaster, string tieBreakerKey, string name, bool preserveAsyncOrder = false, bool shareSocketManager = false, TextWriter log = null)
 {
     if (log != null) log.WriteLine("{0} > AsyncRedisConnection", DateTime.UtcNow.ToShortDateString());
     var options = ConfigurationOptions.Parse(delimitedConfiguration, true);
     muxer = Create(tier, options, tieBreakerKey, name, preserveAsyncOrder, shareSocketManager, log, out subscriber);
     if (log != null) log.WriteLine("{0} < AsyncRedisConnection", DateTime.UtcNow.ToShortDateString());
 }
开发者ID:kpitt,项目名称:RyuJIT-TailCallBug,代码行数:11,代码来源:AsyncRedisConnection.cs

示例10: ExtractQuery

        public static string ExtractQuery(string fileName, TextWriter errorlogger)
        {
            try
            {
                string data = File.ReadAllText(fileName);
                XmlParserContext context = new XmlParserContext(null, null, null, XmlSpace.None);
                Stream xmlFragment = new MemoryStream(Encoding.UTF8.GetBytes(data));
                XmlTextReader reader = new XmlTextReader(xmlFragment, XmlNodeType.Element, context);
                reader.MoveToContent();
                if (reader.NodeType == XmlNodeType.Text)
                {
                    return data;
                }
                XmlReader reader2 = reader.ReadSubtree();
                StringBuilder output = new StringBuilder();
                using (XmlWriter writer = XmlWriter.Create(output))
                {
                    writer.WriteNode(reader2, true);
                }

                StringReader reader3 = new StringReader(data);
                for (int i = 0; i < reader.LineNumber; i++)
                {
                    reader3.ReadLine();
                }
                return reader3.ReadToEnd().Trim();
            }
            catch (Exception ex)
            {
                errorlogger.WriteLine(ex.Message);
                errorlogger.WriteLine(ex.StackTrace);
            }

            return string.Format("//Error loading the file - {0} .The the linq file might be a linqpad expression which is not supported in the viewer currently." ,fileName);
        }
开发者ID:aelij,项目名称:svcperf,代码行数:35,代码来源:LinqpadHelpers.cs

示例11: PrintLogo

 public override void PrintLogo(TextWriter consoleOutput)
 {
     Assembly thisAssembly = typeof(Csi).Assembly;
     consoleOutput.WriteLine(CsiResources.LogoLine1, FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion);
     consoleOutput.WriteLine(CsiResources.LogoLine2);
     consoleOutput.WriteLine();
 }
开发者ID:noahstein,项目名称:roslyn,代码行数:7,代码来源:Csi.cs

示例12: Write_Main_Viewer_Section

        /// <summary> Stream to which to write the HTML for this subwriter  </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("YouTube_Embedded_Video_ItemViewer.Write_Main_Viewer_Section", "");
            }

            //Determine the name of the FLASH file
            string youtube_url = CurrentItem.Bib_Info.Location.Other_URL;
             if ( youtube_url.IndexOf("watch") > 0 )
                 youtube_url = youtube_url.Replace("watch?v=","v/") + "?fs=1&amp;hl=en_US";
            const int width = 600;
            const int height = 480;

            // Add the HTML for the image
            StringBuilder result = new StringBuilder(500);
            Output.WriteLine("          <td><div id=\"sbkEmv_ViewerTitle\">Streaming Video</div></td>");
            Output.WriteLine("        </tr>");
            Output.WriteLine("        <tr>");
            Output.WriteLine("          <td id=\"sbkEmv_MainArea\">");
            Output.WriteLine("            <object style=\"width:" + width + ";height:" + height + "\">");
            Output.WriteLine("              <param name=\"allowscriptaccess\" value=\"always\" />");
            Output.WriteLine("              <param name=\"movie\" value=\"" + youtube_url + "\" />");
            Output.WriteLine("              <param name=\"allowFullScreen\" value=\"true\"></param>");
            Output.WriteLine("              <embed src=\"" + youtube_url + "\" type=\"application/x-shockwave-flash\" AllowScriptAccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
            Output.WriteLine("            </object>");
            Output.WriteLine("          </td>" );
        }
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:31,代码来源:YouTube_Embedded_Video_ItemViewer.cs

示例13: WriteDomain

 private static void WriteDomain(TextWriter writer, MBeanDomain domain)
 {
     writer.WriteLine("<span class=\"folder\">{0}</span>", domain.Name);
     writer.WriteLine("<ul>");
     WriteDomainItems(writer, domain);
     writer.WriteLine("</ul>");
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:7,代码来源:MBeanServerHtmlFormatter.cs

示例14: WriteResource

        public static void WriteResource(TextWriter writer, ResourceDefinition resource, string url, string condition, Dictionary<string, string> attributes) {
            if (!string.IsNullOrEmpty(condition)) {
                if (condition == NotIE) {
                    writer.WriteLine("<!--[if " + condition + "]>-->");
                }
                else {
                    writer.WriteLine("<!--[if " + condition + "]>");
                }
            }

            var tagBuilder = GetTagBuilder(resource, url);
            
            if (attributes != null) {
                // todo: try null value
                tagBuilder.MergeAttributes(attributes, true);
            }

            writer.WriteLine(tagBuilder.ToString(resource.TagRenderMode));
            
            if (!string.IsNullOrEmpty(condition)) {
                if (condition == NotIE) {
                    writer.WriteLine("<!--<![endif]-->");
                }
                else {
                    writer.WriteLine("<![endif]-->");
                }
            }
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:28,代码来源:ResourceManager.cs

示例15: WritePotHeader

		private void WritePotHeader(TextWriter writer)
		{
			/* Note:
			 * Since the Transifex upgrade to 1.0 circa 2010-12 the pot file is now required to have
			 * a po header that passes 'msgfmt -c'.
			 * POEdit does not expect a header in the pot file and doesn't read one if present.  The
			 * user is invited to enter the data afresh for the po file which replaces any data we have
			 * provided.  To preserve the original data from the pot we also include the header info
			 * as a comment.
			 */
			writer.WriteLine(@"msgid """"");
			writer.WriteLine(@"msgstr """"");
			writer.WriteLine(@"""Project-Id-Version: " + ProjectId + @"\n""");
			writer.WriteLine(@"""POT-Creation-Date: " + DateTime.UtcNow.ToString("s") + @"\n""");
			writer.WriteLine(@"""PO-Revision-Date: \n""");
			writer.WriteLine(@"""Last-Translator: \n""");
			writer.WriteLine(@"""Language-Team: \n""");
			writer.WriteLine(@"""Plural-Forms: \n""");
			writer.WriteLine(@"""MIME-Version: 1.0\n""");
			writer.WriteLine(@"""Content-Type: text/plain; charset=UTF-8\n""");
			writer.WriteLine(@"""Content-Transfer-Encoding: 8bit\n""");
			writer.WriteLine();

			/* As noted above the commented version below isn't read by POEdit, however it is preserved in the comments */
			writer.WriteLine("# Project-Id-Version: {0}", ProjectId);
			writer.WriteLine("# Report-Msgid-Bugs-To: {0}", MsdIdBugsTo);
			writer.WriteLine("# POT-Creation-Date: {0}", DateTime.UtcNow.ToString("s"));
			writer.WriteLine("# Content-Type: text/plain; charset=UTF-8");
			writer.WriteLine();

		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:31,代码来源:MakePot.cs


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