Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (p1.Text != "" && t1.Text != "")
            {
                DialogResult dr    = new DialogResult();
                AreYouUSureD form1 = new AreYouUSureD();
                dr = form1.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    foreach (string s in tempE)
                    {
                        AEScryptdecryptutil.EncryptFile(s, p1.Text);
                    }

                    MessageBox.Show("Encryption Succesful!");
                }
                else if (dr == DialogResult.Cancel)
                {
                }
            }
            else
            {
                MessageBox.Show("Please fill all fields!");
            }
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (p2.Text != "" && t2.Text != "")
            {
                DialogResult dr    = new DialogResult();
                AreYouSureD  form2 = new AreYouSureD();
                dr = form2.ShowDialog();
                bool control = false;
                if (dr == DialogResult.OK)
                {
                    foreach (string s in tempD)
                    {
                        try { control = AEScryptdecryptutil.DecryptFile(s, p2.Text); }
                        catch (UnauthorizedAccessException e1)
                        {
                            control = false;

                            if (Directory.Exists(Path.GetDirectoryName(s) + "\\Decrypted"))
                            {
                                Directory.Delete(Path.GetDirectoryName(s) + "\\Decrypted", true);
                            }
                        }
                        if (control == false)
                        {
                            break;
                        }
                    }
                    if (control == true)
                    {
                        MessageBox.Show("Decryption Succesful!");
                    }
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show("Please fill all fields!");
            }
        }