private void ShowFileDialog(FileDialog dlg, DialogResult dlgResult) { dlg.DefaultExt = ".stf"; dlg.Filter = _filter; var result = dlg.ShowDialog(); if (result == true) { if (dlg.FilterIndex == 1) dlgResult.SelectedFileType = SecureFileType.Encrypted; else dlgResult.SelectedFileType = SecureFileType.ClearText; dlgResult.FilePath = dlg.FileName; //dlgResult.DialogType = dlg.GetType() == typeof(OpenFileDialog) ? FileDialogType.Open : FileDialogType.Save; _main.ProcessDialog(dlgResult); } }
private void ShowPasswordDialog(DialogResult dlgResult) { if (_main.UserSettings.AESKeyType == KeyType.Password) { if (dlgResult.DialogType == FileDialogType.Open) dlgResult.Password = GetPassword("Enter password used to encrypt the file"); else dlgResult.Password = GetPassword("Enter password to encrypt the file", true); } else if (_main.UserSettings.AESKeyType == KeyType.KeyFile) { dlgResult.Password = GetPassword("Enter password used to protect key file (leave blank for unencrypted key)"); } _main.ProcessDialog(dlgResult); }
private void ProcessCLI() { if (App.CLIArgs.Length > 0) { var dr = new DialogResult { FilePath = App.CLIArgs[0], DialogType = FileDialogType.Open }; if (dr.FilePath.EndsWith(".stf")) dr.SelectedFileType = SecureFileType.Encrypted; else dr.SelectedFileType = SecureFileType.ClearText; _main.ProcessDialog(dr); } }