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


C# System.IO.TextWriter.Write方法代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            nick = "SecureIRC";
            owner = "SecureIRC";
            server = "irc.entalyan.com";
            port = 6999;
            chan = "#SecureIRC";
            pass = ""; //Enter just the password

            //Connect to irc server and get input and output text streams from TcpClient.
            sock.Connect(server, port);
            if (!sock.Connected)
            {
                Console.WriteLine("Failed to connect!");
                return;
            }
            input = new System.IO.StreamReader(sock.GetStream());
            output = new System.IO.StreamWriter(sock.GetStream());

            //Starting USER and NICK login commands 
            output.Write(
                "PASS " + nick + ":" + pass + "\r\n" +
                "USER " + nick + " 0 * :" + owner + "\r\n" +
                "NICK " + nick + "\r\n" +
                "PRIVMSG #SecureIRC Successful login at: " + DateTime.Now.ToString() + "\r\n"
            );
            output.Flush();

            Listen();

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

        }
开发者ID:Entalyan,项目名称:Simple-IRC-Tests,代码行数:34,代码来源:Program.cs

示例2: Format

        /// <summary>
        /// Formats a complete HTML document describing the given 
        /// <see cref="Error"/> instance.
        /// </summary>

        public override void Format(TextWriter writer, Error error)
        {
            if (writer == null) throw new ArgumentNullException("writer");
            if (error == null) throw new ArgumentNullException("error");

            var page = new ErrorMailHtmlPage(error);
            writer.Write(page.TransformText());
        }
开发者ID:ramsenthil18,项目名称:elmah,代码行数:13,代码来源:ErrorMailHtmlFormatter.cs

示例3: DumpChildren

 protected override void DumpChildren(TextWriter Out, uint Depth)
 {
     foreach (VEntry e in Fields.Values) {
     Indent(Out, Depth);
     Out.Write(e.Name);
     Out.WriteLine(" =");
     e.Value.Dump(Out, Depth+1);
     }
 }
开发者ID:cakoose,项目名称:cks,代码行数:9,代码来源:VRecord.cs

示例4: Indent

 protected static void Indent(TextWriter Out, uint Depth)
 {
     for (uint i = 0; i < Depth; i++) {
     Out.Write("  ");
     }
 }
开发者ID:cakoose,项目名称:cks,代码行数:6,代码来源:Node.cs

示例5: EmitLocals

        private void EmitLocals(string caption, TextWriter writer)
        {
            if (StackVarsOut.Count <= 0)
                return;

            writer.Write(caption);
            SortedList<string, string> list = new SortedList<string, string>();
            foreach (KeyValuePair<Storage, int> de in StackVarsOut)
            {
                Storage id = (Storage)de.Key;
                StringWriter sb = new StringWriter();
                id.Write(sb);
                string sName = sb.ToString();

                list[sName] = string.Format("{0}({1})", sName, de.Value);
            }
            foreach (string s in list.Values)
            {
                writer.Write(" ");
                writer.Write(s);
            }
            writer.WriteLine();
        }
开发者ID:nemerle,项目名称:reko,代码行数:23,代码来源:BlockFlow.cs

示例6: RunTest

 /// <summary>
 /// Runs the test.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="testMethod">Test method.</param>
 /// <param name="output">Output.</param>
 public static void RunTest(string name, Action testMethod, TextWriter output = null)
 {
     if (output == null)
         output = Console.Out;
     string _oldNL = output.NewLine;
     try
     {
         output.WriteLine(_runTestFormatStart, name);
         testMethod();
         output.WriteLine(_runTestFormatSuccess, name);
     }
     catch (FaultException<ExceptionDetail> ex)
     {
         output.WriteLine(_runTestFormatError, name);
         output.WriteLine(_runTestFormatException, ex.GetType().FullName, ex.Message, ex.StackTrace);
         foreach (DictionaryEntry de in ex.Data)
             output.Write("\t{0} = {1}\n", de.Key.ToString(), de.Value.ToString());
         int indent = 0;
         for (ExceptionDetail detail = ex.Detail; detail != null; detail = detail.InnerException)
             output.WriteLine(string.Concat(" ------ Inner Exception ------\n",
                 string.Format(_runTestFormatException, detail.Type, detail.Message, detail.StackTrace))
                 .Replace("\n", string.Concat("\n", new string(' ', ++indent * 2))).TrimStart('\n'));
     }
     catch (Exception ex)
     {
         output.WriteLine(_runTestFormatError, name);
         output.WriteLine(_runTestFormatException, ex.GetType().FullName, ex.Message, ex.StackTrace);
         foreach (DictionaryEntry de in ex.Data)
             output.Write("\t{0} = {1}\n", de.Key.ToString(), de.Value.ToString());
         int indent = 0;
         for (Exception innerEx = ex.InnerException; innerEx != null; innerEx = innerEx.InnerException)
             output.WriteLine(string.Concat("\n ------ Inner Exception ------\n",
                 string.Format(_runTestFormatException, innerEx.GetType().FullName, innerEx.Message, innerEx.StackTrace))
                 .Replace("\n", string.Concat("\n", new string(' ', ++indent * 2))).TrimStart('\n'));
     }
     finally
     {
         output.NewLine = _oldNL;			// you COULD wrap this in a using() if you write a class implementing IDisposable with this line in Dispose()
     }
 }
开发者ID:jbowwww,项目名称:ArtefactService,代码行数:46,代码来源:Program.cs

示例7: xmlSerializeRootClose

		public virtual void  xmlSerializeRootClose(TextWriter outWriter)
		{
			outWriter.Write("</" + GetType().FullName + ">\n");
		}
开发者ID:fgq841103,项目名称:spring-net,代码行数:4,代码来源:BaseAST.cs

示例8: xmlSerializeRootOpen

		public virtual void  xmlSerializeRootOpen(TextWriter outWriter)
		{
			StringBuilder buf = new StringBuilder(100);
			buf.Append("<");
			buf.Append(GetType().FullName + " ");
			buf.Append("text=\"" + encode(getText()) + "\" type=\"" + Type + "\">\n");
			outWriter.Write(buf.ToString());
		}
开发者ID:fgq841103,项目名称:spring-net,代码行数:8,代码来源:BaseAST.cs

示例9: sqlite3VdbePrintOp

    /*
** Print a single opcode.  This routine is used for debugging only.
*/
    static void sqlite3VdbePrintOp( FILE pOut, int pc, Op pOp )
    {
      string zP4;
      string zPtr = null;
      string zFormat1 = "%4d %-13s %4d %4d %4d %-4s %.2X %s\n";
      if ( pOut == null ) pOut = System.Console.Out;
      zP4 = displayP4( pOp, zPtr, 50 );
      string zOut = "";
      sqlite3_snprintf( 999, ref zOut, zFormat1, pc,
      sqlite3OpcodeName( pOp.opcode ), pOp.p1, pOp.p2, pOp.p3, zP4, pOp.p5,
#if  SQLITE_DEBUG
 pOp.zComment != null ? pOp.zComment : ""
#else
""
#endif
 );
      pOut.Write( zOut );
      //fflush(pOut);
    }
开发者ID:koush,项目名称:csharp-sqlite,代码行数:22,代码来源:vdbeaux_c.cs

示例10: writePropertyName

 private void writePropertyName(string propertyName, TextWriter writer)
 {
     bool escapeRequired = this.AlwaysDoubleQuotePropertyNames || (propertyName.IndexOf('.') >= 0);
     if (escapeRequired) writer.Write('\"');
     writer.Write(propertyName);
     if (escapeRequired) writer.Write('\"');
 }
开发者ID:houseelectricsopen,项目名称:dotnetserializer,代码行数:7,代码来源:Object2Json.cs

示例11: writeIndent

 void writeIndent(TextWriter writer, Stack<ExploreStackFrame> exploreStack)
 {
     if (IndentSize != null)
     {
         writer.Write(NewLine);
         int fullIndentSize = ((int)IndentSize) * exploreStack.Count;
         for (int done = 0; done < fullIndentSize; done++)
         {
             writer.Write(' ');
         }
     }
 }
开发者ID:houseelectricsopen,项目名称:dotnetserializer,代码行数:12,代码来源:Object2Json.cs

示例12: writeTypeAliasProperty

/**        Need to take note of AlwaysDoubleQuotePropertyNames when writing property type
Always escape property name with double quotes
**/
 int writeTypeAliasProperty(TextWriter writer, Object to, TypeAliaser typeAliaser, int currentFramePropertyCount)
        {
            if (typeAliaser != null)
            {
                if (currentFramePropertyCount > 0) writer.Write(',');
                string strAliasPropertyWrapper = AlwaysDoubleQuotePropertyNames ? "\"" : "";
                writer.Write(strAliasPropertyWrapper + this.TypeAliasProperty + strAliasPropertyWrapper + ":\"" + typeAliaser(to.GetType()) + "\"");
                return 1;
            }
            else
            {
                return 0;
            }
        }
开发者ID:houseelectricsopen,项目名称:dotnetserializer,代码行数:17,代码来源:Object2Json.cs

示例13: writeAsJson

        public void writeAsJson(Object o, TextWriter writer, TypeAliaser typeAliaser=null)
        {
            if (LeafDefaultSet != null && OmitDefaultLeafValuesInJs && OmitMarkAsArrayFunction)
            {
                throw new Exception("Leaf defaulting requires Array marker for js code");
            }


            ObjectIDGenerator idGenerator = null;

            if (UseReferences)
            {
                idGenerator=new ObjectIDGenerator();
            }
            Stack<ExploreStackFrame> exploreStack = new Stack<ExploreStackFrame>();
            Explorer explorerImpl = ExplorerFactory();
            ((Explorer)explorerImpl).NodeExpander = NodeExpander;
            MoveAway down = delegate (Object from, string propertyName, Object to, bool isIndexed, int? index)
            {
                ExploreStackFrame currentFrame = exploreStack.Count>0 ? exploreStack.Peek():null;
                if (currentFrame != null)
                {
                    if (currentFrame.propertyCount > 0) writer.Write(", ");
                    currentFrame.propertyCount++;
                }
                if (from != null && propertyName != null)
                {
                    writePropertyName(propertyName, writer);
                    writer.Write(":");
                }
                ExploreStackFrame childFrame = new ExploreStackFrame();
                exploreStack.Push(childFrame);
                writeIndent(writer, exploreStack);
                if (UseReferences)
                {
                    bool firstTime;
                    long objectid = idGenerator.GetId(to, out firstTime);
                    if (firstTime)
                    {
                        // could be done like this ! (function() {var x=[1,2]; x.id="uuu";return x;})()
                        if (!isIndexed)
                        {
                            writer.Write("{" + this.IdTag + ":" + objectid + ' ');
                            childFrame.propertyCount++;
                            childFrame.propertyCount += writeTypeAliasProperty(writer, to, typeAliaser, childFrame.propertyCount);
                            
                        }
                        else
                        {
                            // no need for type alias
                            writer.Write(AttachId2ArrayFunctionName + "(" + objectid + ",[");
                        }
                        
                    }
                    else
                    {
                        writer.Write("{" + this.ReferenceTag + ":" + objectid);
                        return false;
                    }
                }
                else // !Use References
                {
                    if (!isIndexed)
                    {
                        writer.Write('{');
                        // todo -- check this out ............
                        childFrame.propertyCount += writeTypeAliasProperty(writer, to, typeAliaser, childFrame.propertyCount);
                    }
                    else
                    {
                        if (!OmitMarkAsArrayFunction)
                        {
                            writer.Write(markAsArrayFunctionName);
                            writer.Write("([");
                        }
                        else
                        {
                            writer.Write("[");
                        }
                    }
                }

                return true;
            };

            MoveBack up = (from, propertyName, to, isIndexed) => 
                {
                    if (!isIndexed) writer.Write('}');
                    else
                    {
                        writer.Write(']');
                        // is there a function wrapper ?
                        if (!OmitMarkAsArrayFunction || UseReferences) writer.Write(")");
                    }
                    exploreStack.Pop();
                    writeIndent(writer, exploreStack);
                };

            OnLeaf leaf = (from, propertyName, to, index) => 
              {
//.........这里部分代码省略.........
开发者ID:houseelectricsopen,项目名称:dotnetserializer,代码行数:101,代码来源:Object2Json.cs


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