📄 framefile.cs
字号:
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 + " 错误!\n\r错误信息如下:\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 = "写入文件 " + FilePath + " 错误!错误信息如下:\n\r" + exception.Message;
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, ErrorInfo);
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -