private void CreateBackup(string backupPath) { var dir = Path.Combine(backupPath, GetUniqueBackupName()); try { Directory.CreateDirectory(dir); } catch (Exception ex) { PremadeDialogs.GenericError(ex); throw new OperationCanceledException(); } try { FilesystemTools.CompressDirectory(dir); } catch { // Ignore, not important } RunBackup(dir); }
private void buttonAccept_Click(object sender, EventArgs e) { var filters = SelectedJunk.OfType <DriveJunkNode>().Select(x => x.FullName).ToArray(); if (!Uninstaller.CheckForRunningProcesses(filters, false, this)) { return; } if (SelectedJunk.Any(x => !(x is DriveJunkNode))) { switch (MessageBoxes.BackupRegistryQuestion(this)) { case MessageBoxes.PressedButton.Yes: if (backupDirDialog.ShowDialog() != DialogResult.OK) { return; } var dir = Path.Combine(backupDirDialog.SelectedPath, GetUniqueBackupName()); try { Directory.CreateDirectory(dir); } catch (Exception ex) { PremadeDialogs.GenericError(ex); goto case MessageBoxes.PressedButton.Yes; } try { FilesystemTools.CompressDirectory(dir); } catch { // Ignore, not important } if (!RunBackup(dir)) { return; } break; case MessageBoxes.PressedButton.No: break; default: return; } } DialogResult = DialogResult.OK; Close(); }