public static bool FileExist(string FileName) { if (FileName == null || FileName.Trim() == "") { return(false); } bool exist = File.Exists(FileName); if (!exist) { MessageBox.Show(FileName + GetSetting("OpenFileNoExistText").Replace(@"\r\n", "\r\n"), Pub.GetSetting("OpenFileNoExistTitle"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(exist); }
public static string SaveFile(string FileBuffer, string FileName, bool OverWrite) { if (!OverWrite && File.Exists(FileName)) { if (MessageBox.Show(FileName + GetSetting("SaveFileOverWriteText").Replace(@"\r\n", "\r\n"), GetSetting("SaveFileOverWriteTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return(""); } } StreamWriter sw = new StreamWriter(FileName, false, Encoding.Default); sw.Write(Loging(FileBuffer)); sw.Close(); switch (Pub.SaveDoType) { case SaveDoType.Dialog: if (MessageBox.Show(FileName + GetSetting("SaveFileSucceedText").Replace(@"\r\n", "\r\n"), Pub.GetSetting("SaveFileSucceedTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { goto case SaveDoType.View; } break; case SaveDoType.View: System.Diagnostics.Process.Start("notepad.exe", FileName); break; } return(FileName); }
public static Caption Parse(string FileName) { return(Parse(Pub.ReadFile(FileName))); }