コード例 #1
0
        public static string GetData()
        {
            var data = string.Empty;

            CreateFile(fullFileName);

            var reader = new StreamReader(fullFileName);

            data = reader.ReadToEnd();
            reader.Close();

            if (OnLoadHandler != null)
            {
                OnLoadHandler.Invoke(new FileLoadingEventArgs(fullFileName, data));
            }

            return(data);
        }
コード例 #2
0
        public static void LoadBackup()
        {
            if (File.Exists(fullFileName) && File.Exists(fullBackupFileName))
            {
                var    reader = new StreamReader(fullBackupFileName);
                string data   = reader.ReadToEnd();
                reader.Close();

                if (!string.IsNullOrEmpty(data))
                {
                    File.WriteAllText(fullFileName, data);
                }

                if (OnLoadHandler != null)
                {
                    OnLoadHandler.Invoke(new FileLoadingEventArgs(fullBackupFileName, data));
                }
            }
        }