private void OpenFile() { // if file exist if (System.IO.File.Exists(openedFile)) { KeyInputForm inputForm = new KeyInputForm(); DialogResult dr = inputForm.ShowDialog(); if (dr == DialogResult.OK) { encriptionKey = inputForm.key; // decript file with key //MessageBox.Show(key); ReadPskFile(); //DecriptFile(); this.Text = shortFileName + DEMOCAPTION; } else { encriptionKey = string.Empty; openedFile = string.Empty; shortFileName = string.Empty; } } else { MessageBox.Show("Файл \"" + openedFile + "\" не найден!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); openedFile = string.Empty; shortFileName = string.Empty; } }
private void changeCodeToolStripMenuItem_Click(object sender, EventArgs e) { KeyInputForm inputForm = new KeyInputForm(); DialogResult dr = inputForm.ShowDialog(); if (dr == DialogResult.OK) { encriptionKey = inputForm.key; needSave = true; } else { //encriptionKey = string.Empty; } }