private void decryptButton_Click(object sender, EventArgs e) { selectFileDialog.Multiselect = false; selectFileDialog.FileName = Properties.Settings.Default.LastDecryptFilePath; selectFolderDialog.SelectedPath = Properties.Settings.Default.LastDecryptSavePath; var result = selectFileDialog.ShowDialog(); if (result == DialogResult.OK) { // get password value string password = ""; bool cont = false; GetPasswordForm pwf = new GetPasswordForm(); if (pwf.ShowDialog(this) == DialogResult.OK) { password = pwf.Password; cont = true; } pwf.Dispose(); if (cont) { result = selectFolderDialog.ShowDialog(); if (result == DialogResult.OK) { DecryptBlockFile(selectFileDialog.FileName, selectFolderDialog.SelectedPath, password); Properties.Settings.Default.LastDecryptFilePath = selectFileDialog.FileName; Properties.Settings.Default.LastDecryptSavePath = selectFolderDialog.SelectedPath; Properties.Settings.Default.Save(); } } } }
private void encryptFilesButton_Click(object sender, EventArgs e) { selectFileDialog.Multiselect = true; selectFileDialog.FileName = Properties.Settings.Default.LastEncryptFilesPath; saveFileDialog.FileName = Properties.Settings.Default.LastEncryptSavePath; // get password value string password = ""; bool cont = false; GetPasswordForm pwf = new GetPasswordForm(); if (pwf.ShowDialog(this) == DialogResult.OK) { password = pwf.Password; cont = true; } pwf.Dispose(); if (cont) { var result = selectFileDialog.ShowDialog(); if (result == DialogResult.OK) { result = saveFileDialog.ShowDialog(); if (result == DialogResult.OK) { EncryptBlockFile(selectFileDialog.FileNames, saveFileDialog.FileName, password); Properties.Settings.Default.LastEncryptFilesPath = Path.GetDirectoryName(selectFileDialog.FileName); Properties.Settings.Default.LastEncryptSavePath = saveFileDialog.FileName; Properties.Settings.Default.Save(); } } } }