/// ------------------------------------------------------------------------------------ private void WriteLogMessagesForFileType(string initialMsg, IEnumerable <string> fileNames) { var list = fileNames.ToArray(); if (list.Length == 0) { return; } LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, initialMsg); foreach (var filename in list) { LogBox.WriteMessage("\t" + filename); } }
/// ------------------------------------------------------------------------------------ protected override void PerformZipWork(ZipFile zip) { var restoreFolder = OtherDestFolder ?? SuggestedDestFolder; _targetFolderPreexisted = Directory.Exists(restoreFolder); zip.ExtractProgress += HandleZipExtractProgress; var text = LocalizationManager.GetString("DialogBoxes.RestoreDlg.RestoringProjectFilesMsg", "Restoring Project Files..."); LogBox.Invoke((Action)(() => LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, text))); zip.ExtractSelectedEntries("*", string.Empty, restoreFolder, ExtractExistingFileAction.OverwriteSilently); if (_dataSourceFiles.Count > 0) { text = LocalizationManager.GetString("DialogBoxes.RestoreDlg.RestoringDataSourceFilesMsg", "Restoring Data Source Files..."); LogBox.Invoke((Action)(() => LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text))); zip.ExtractSelectedEntries("*.*", "Data", restoreFolder, ExtractExistingFileAction.OverwriteSilently); } if (_audioFiles.Count > 0) { text = LocalizationManager.GetString("DialogBoxes.RestoreDlg.RestoringAudioFilesMsg", "Restoring Audio Files..."); LogBox.Invoke((Action)(() => LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text))); zip.ExtractSelectedEntries("*.*", "Audio", restoreFolder, ExtractExistingFileAction.OverwriteSilently); } if (File.Exists(Path.Combine(restoreFolder, kBackupInfoFileName))) { File.Delete(Path.Combine(restoreFolder, kBackupInfoFileName)); } if (Cancel || BackupRestoreException != null) { CleanUpAfterCancel(restoreFolder); } else { var updater = new RestoredPapDataSourceUpdater { PapFile = CurrentProjectFileName }; updater.Modify(restoreFolder, Path.Combine(restoreFolder, "Data"), false); } }
/// ------------------------------------------------------------------------------------ private void WriteLogMessageForFileName(string filename) { if (Path.GetFileName(_prjFiles[0]) == filename) { var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpProjectFilesMsg", "Backing Up Project Files..."); LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, text); } if (_dataSourceFiles.Count > 0 && Path.GetFileName(_dataSourceFiles[0]) == filename) { var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpDataSourceFilesMsg", "Backing Up Data Source Files..."); LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text); } if (_audioFiles.Count > 0 && Path.GetFileName(_audioFiles[0]) == filename) { var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpAudioFilesMsg", "Backing Up Audio Files..."); LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text); } LogBox.WriteMessage("\t" + filename); }