actfile.cs
来自「data structure c 学校管理系统」· CS 代码 · 共 39 行
CS
39 行
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 + =
减小字号Ctrl + -
显示快捷键?