private void button1_Click(object sender, EventArgs e) { var txt = new StreamWriter(file, true); var inp = AesEncDec.Encrypt(textBox1.Text); txt.WriteLine(inp); txt.Close(); textBox1.Clear(); }
private void button2_Click_1(object sender, EventArgs e) { listBox1.Items.Clear(); try { StreamReader sr = new StreamReader(file); while ((line = sr.ReadLine()) != null) { listBox1.Items.Add(AesEncDec.Decrypt(line)); if (line == "") { continue; } } sr.Close(); } catch (FileNotFoundException) { MessageBox.Show("File already deleted, please set key again !"); } }