Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public static Caption Parse(string FileName)
 {
     return(Parse(Pub.ReadFile(FileName)));
 }