public static void DoBackup() { string DEFAULT_FILENAME = String.Format("QiqqaBackup.{0}.qiqqa_backup", DateFormatter.asYYYYMMDDHHMMSS(DateTime.Now)); SaveFileDialog save_file_dialog = new SaveFileDialog(); save_file_dialog.AddExtension = true; save_file_dialog.CheckPathExists = true; save_file_dialog.DereferenceLinks = true; save_file_dialog.OverwritePrompt = true; save_file_dialog.ValidateNames = true; save_file_dialog.DefaultExt = "qiqqa_backup"; save_file_dialog.Filter = "Qiqqa backup files (*.qiqqa_backup)|*.qiqqa_backup|All files (*.*)|*.*"; save_file_dialog.FileName = DEFAULT_FILENAME; save_file_dialog.Title = "Please select the file to which you want to backup."; if (true != save_file_dialog.ShowDialog()) { MessageBoxes.Warn("You have cancelled your backup of the Qiqqa database."); return; } string target_filename = save_file_dialog.FileName; string source_directory = ConfigurationManager.Instance.BaseDirectoryForQiqqa; string parameters = String.Format("a -tzip -mm=Deflate -mmt=on -mx9 \"{0}\" \"{1}\\*\"", target_filename, source_directory); Process.Start(ConfigurationManager.Instance.Program7ZIP, parameters); }
private void PopulateException(Exception ex, bool display_exception_section) { if (display_exception_section) { StringBuilder sb = new StringBuilder(); sb.Append(DateFormatter.asYYYYMMDDHHMMSS(DateTime.UtcNow) + ":"); Exception current_exception = ex; while (null != current_exception) { sb.AppendLine(current_exception.ToString()); sb.AppendLine(); sb.AppendLine("--------------------------------------------"); sb.AppendLine(); current_exception = current_exception.InnerException; } TextExceptions.Text = sb.ToString(); TextExceptionSummary.Text = ex.Message; } else { TextExceptionsRegion.Visibility = Visibility.Collapsed; } }
public void AddRecentlyRead(PDFDocument pdf_document) { using (StreamWriter sr = new StreamWriter(Filename_Store, append: true)) { sr.WriteLine( "{0},{1},{2}", Guid.NewGuid().ToString(), DateFormatter.asYYYYMMDDHHMMSS(DateTime.UtcNow), pdf_document.Fingerprint ); } }