Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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 !");
            }
        }