private void Decrypt_Click(object sender, EventArgs e) { var localLink = FileNameBox.Text.Split('.')[0] + "decrypted.txt"; DecryptedTextBox.Text = AesEncry.AesDecryptas(EncryptedTextBox.Text); File.WriteAllText(localLink, DecryptedTextBox.Text); }
private void EncryptButton_Click(object sender, EventArgs e) { string filetext; var localLink = FileNameBox.Text.Split('.')[0] + ".aes"; FileStream fs = new FileStream(FileNameBox.Text, FileMode.Open); paswordas = PasswordBox.Text; if (checkBox1.Checked) { mode = true; } using (StreamReader rd = new StreamReader(fs)) { filetext = rd.ReadToEnd(); } fs.Close(); // MessageBox.Show(filetext); EncryptedTextBox.Text = AesEncry.AesEncryptas(filetext); File.WriteAllText(localLink, EncryptedTextBox.Text); }