?? framefile.cs
字號(hào):
namespace FrameCountry.FrameBuild
{
using FrameCountry;
using System;
using System.IO;
public class FrameFile
{
private string ClassAlias = "FL";
private FrameCity frameCity = new FrameCity();
public bool TxtRead(string FilePath, ref string ReadStr, ref string ErrorInfo)
{
string functionAlias = "01";
try
{
if (!File.Exists(FilePath))
{
throw new Exception("文件 " + FilePath + " 不存在!");
}
StreamReader reader = File.OpenText(FilePath);
ReadStr = reader.ReadToEnd();
reader.Close();
}
catch (Exception exception)
{
ErrorInfo = "讀取文件 " + FilePath + " 錯(cuò)誤!\n\r錯(cuò)誤信息如下:\n\r" + exception.Message;
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, ErrorInfo);
return false;
}
return true;
}
public bool TxtWrite(string FilePath, string WriteStr, ref string ErrorInfo)
{
string functionAlias = "00";
try
{
StreamWriter writer;
if (File.Exists(FilePath))
{
writer = File.AppendText(FilePath);
}
else
{
writer = File.CreateText(FilePath);
}
writer.Write(WriteStr);
writer.Close();
}
catch (Exception exception)
{
ErrorInfo = "寫(xiě)入文件 " + FilePath + " 錯(cuò)誤!錯(cuò)誤信息如下:\n\r" + exception.Message;
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, ErrorInfo);
return false;
}
return true;
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -