debug.cs
来自「语音视频功能 里面实现了基本的QQ与语音对话」· CS 代码 · 共 56 行
CS
56 行
using System;
using System.IO;
namespace gowk.utility.Diagnostics
{
/// <summary>
/// Debug 的摘要说明。
/// </summary>
public class Debug
{
public Debug()
{
}
public static void Write(System.Exception ex)
{
string file=System.Environment.CurrentDirectory+"\\exception.log";
try
{
System.IO.StreamWriter sw=new StreamWriter(file,true);
sw.WriteLine("#######################################");
sw.WriteLine("message:"+ex.Message);
sw.WriteLine("Source:"+ex.Source);
sw.WriteLine("StackTrace:"+ex.StackTrace);
sw.WriteLine("InnerException:"+ex.InnerException);
sw.WriteLine("#######################################");
sw.Close();
System.Diagnostics.Trace.WriteLine("#######################################");
System.Diagnostics.Trace.WriteLine("message:"+ex.Message);
System.Diagnostics.Trace.WriteLine("Source:"+ex.Source);
System.Diagnostics.Trace.WriteLine("StackTrace:"+ex.StackTrace);
System.Diagnostics.Trace.WriteLine("InnerException:"+ex.InnerException);
System.Diagnostics.Trace.WriteLine("#######################################");
}
catch
{
}
}
public static void Write(string message)
{
string file=System.Environment.CurrentDirectory+"\\exception.log";
try
{
System.IO.StreamWriter sw=new StreamWriter(file,true);
sw.WriteLine("#######################################");
sw.WriteLine("message:"+message);
sw.WriteLine("#######################################");
sw.Close();
}
catch
{
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?