public LoadResult Load(string filename, bool autoBackup = false) { var result = LoadResult.Success; FileInfo = new FileInfo(filename); _entries = null; if (FileInfo.Exists) { _msbt = new MSBT(FileInfo.OpenRead()); var backupFilePath = FileInfo.FullName + ".bak"; if (File.Exists(backupFilePath)) { _msbtBackup = new MSBT(File.OpenRead(backupFilePath)); } else if (autoBackup || MessageBox.Show("Would you like to create a backup of " + FileInfo.Name + "?\r\nA backup allows the Original text box to display the source text before edits were made.", "Create Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { File.Copy(FileInfo.FullName, backupFilePath); _msbtBackup = new MSBT(File.OpenRead(backupFilePath)); } else { _msbtBackup = null; } } else { result = LoadResult.FileNotFound; } return(result); }
public LoadResult Load(string filename, bool autoBackup = false) { var result = LoadResult.Success; FileInfo = new FileInfo(filename); _entries = null; if (FileInfo.Exists) { _msbt = new MSBT(FileInfo.OpenRead()); } else { result = LoadResult.FileNotFound; } return(result); }