/// <summary>
/// 写入数据
/// </summary>
/// <param name="io">文件内容</param>
public static void Write(string io)
{
string path = "Logs\\errorlogs.txt";
if (!File.Exists(path))
{
//将异常显示到文本框中
FileInfo myfile = new FileInfo(path);
FileStream fs = myfile.Create();
fs.Close();
}
StreamWriter sw = File.AppendText(path);
//开始写入
sw.Write(io + "\r\n");
//清空缓冲区
sw.Flush();
//关闭流
sw.Close();
//fs.Close();
}
/// <summary>
/// 写入数据
/// </summary>
/// <param name="io">文件内容</param>
public static void WriteNull(string io)
{
string path = "Logs\\errorlogs.txt";
if (!File.Exists(path))
{
//将异常显示到文本框中
FileInfo myfile = new FileInfo(path);
FileStream fs = myfile.Create();
fs.Close();
}
StreamWriter sw = new StreamWriter(path);
//开始写入
sw.Write(io);
//清空缓冲区
sw.Flush();
//关闭流
sw.Close();
//fs.Close();
}