?? 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 + -