📄 actfile.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace schoolManager
{
class actFile
{
public static string readFile(string filePath)
{
if (!File.Exists(filePath))
{
System.Windows.Forms.MessageBox.Show("文件不存在!","错误");
return "";
}
return File.ReadAllText(filePath,File.OpenText(filePath).CurrentEncoding);
}
public static bool readFile(string filePath,string info)
{
if (!File.Exists(filePath))
{
System.Windows.Forms.MessageBox.Show("文件不存在!", "错误");
return false;
}
try
{
File.WriteAllText(filePath, info);
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show("由于"+ex.Message.ToString()+"写入文件出错!", "错误");
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -