本文整理汇总了C#中System.IO.TextWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.TextWriter.WriteLine方法的具体用法?C# System.IO.TextWriter.WriteLine怎么用?C# System.IO.TextWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.TextWriter
的用法示例。
在下文中一共展示了System.IO.TextWriter.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintStackTrace
internal static void PrintStackTrace(this Exception e, TextWriter writer)
{
writer.WriteLine(e.ToString());
string trace = e.StackTrace ?? string.Empty;
foreach (string line in trace.Split('\n', '\r'))
{
if (!string.IsNullOrEmpty(line))
writer.WriteLine(" " + line);
}
}
示例2: Emit
public override void Emit(IProcessorArchitecture arch, TextWriter writer)
{
EmitRegisters(arch, "// DataOut:", DataOut, writer);
writer.WriteLine();
EmitFlagGroup(arch, "// DataOut (flags):", grfOut, writer);
writer.WriteLine();
SymbolicIn.Emit(arch, "// SymbolicIn:", writer);
writer.WriteLine();
EmitLocals("// LocalsOut:", writer);
if (TerminatesProcess)
writer.WriteLine("// Terminates process");
}
示例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);
}
}
示例4: DumpChildren
protected override void DumpChildren(TextWriter Out, uint Depth)
{
foreach (Element e in Elements) {
e.First.Dump(Out, Depth);
if (e.ArrowPos != null) {
Indent(Out, Depth+1);
Out.WriteLine("->");
e.Second.Dump(Out, Depth+1);
}
}
}
示例5: 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()
}
}
示例6: Dump
public void Dump(TextWriter Out, uint Depth)
{
Indent(Out, Depth);
Out.WriteLine(DumpHeader());
DumpChildren(Out, Depth+1);
}
示例7: DisplayVersion
private void DisplayVersion(TextWriter stdout)
{
stdout.WriteLine("Pickles version {0}", Assembly.GetExecutingAssembly().GetName().Version);
}
示例8: 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();
}
示例9: WriteBefore
/// <summary>
/// Writes flow state that is true on entry to the basic block.
/// </summary>
/// <param name="arch"></param>
/// <param name="writer"></param>
public void WriteBefore(IProcessorArchitecture arch, TextWriter writer)
{
SymbolicIn.Emit(arch, "// SymbolicIn:", writer);
writer.WriteLine();
}
示例10: WriteAfter
/// <summary>
/// Writes flow state that is true on exit from the basic block.
/// </summary>
/// <param name="arch"></param>
/// <param name="writer"></param>
public void WriteAfter(IProcessorArchitecture arch, TextWriter writer)
{
EmitRegisters(arch, "// DataOut:", DataOut, writer);
writer.WriteLine();
EmitFlagGroup(arch, "// DataOut (flags):", grfOut, writer);
writer.WriteLine();
EmitLocals("// LocalsOut:", writer);
if (TerminatesProcess)
writer.WriteLine("// Terminates process");
}
示例11: Stats
private static void Stats(TextWriter writer)
{
MemoryManager memmgr = MemoryManager.Global;
writer.WriteLine("-- Used: {0}", memmgr.UsedBytes);
writer.WriteLine("-- Allocated: {0}", memmgr.AllocatedBytes);
VirtualMemoryManager vmm = memmgr as VirtualMemoryManager;
if (vmm != null)
vmm.Dump(writer);
}
示例12: PrintGrammar
public virtual void PrintGrammar( TextWriter output )
{
ANTLRTreePrinter printer = new ANTLRTreePrinter( new Antlr.Runtime.Tree.CommonTreeNodeStream( grammarTree ) );
//printer.setASTNodeClass( "org.antlr.tool.GrammarAST" );
try
{
string g = printer.toString( this, false );
output.WriteLine( g );
}
catch ( RecognitionException re )
{
ErrorManager.Error( ErrorManager.MSG_SYNTAX_ERROR, re );
}
}
示例13: TimedWriteLine
public TimedWriteLine(System.IO.TextWriter output, string testName = null)
{
this.output = output;
this._testName = testName ??
new StackTrace(1, fNeedFileInfo: false).GetFrame(0).GetMethod().Name;
output.WriteLine(_testName);
_sw.Start();
}
示例14: InitLog
public static void InitLog()
{
Writer = new System.IO.StreamWriter("log.log");
Writer.WriteLine("----------log started------------");
}
示例15: LogSuspiciousResults
private void LogSuspiciousResults()
{
LogWriter = System.IO.File.CreateText("E:\\temp\\sorata\\result.txt");
foreach (MIPSEvaluator.Result res in MIPS.Results)
{
bool log = false;
for (int i = 0; i < res.Arguments.Length; i++)
if ((res.Arguments[i] >> 24) == 0x04 || (res.Arguments[i] >> 24) == 0x05 || (res.Arguments[i] >> 24) == 0x06)
log = true;
if (log) LogWriter.WriteLine(res.ToString());
}
LogWriter.Close();
}