コード例 #1
0
        // To decrypt the file
        private void btn_unlock_click(object sender, EventArgs e)
        {
            try
            {
                DataAccessClass dac = new DataAccessClass();
                Boolean         s   = dac.PassKey(textBox_key.Text);
                if (s == true)
                {
                    LogicClass lc1  = new LogicClass();
                    Boolean    stat = lc1.DecryptingMethod(textBox_fLocation.Text, textBox_rKey.Text);
                    if (stat)
                    {
                        MessageBox.Show("Decryption Succesful!", "Decryption", MessageBoxButtons.OK);

                        dac.DeleteFileLockList(textBox_fLocation.Text);

                        dac.DeleteFileLockPassword(textBox_fLocation.Text);
                        MessageBox.Show("Data Inserted into Password Bank.", "DONE", MessageBoxButtons.OK);
                        textBox_fLocation.Clear();
                    }
                    else
                    {
                        MessageBox.Show("Decryption Error!", "Error", MessageBoxButtons.OK);
                    }
                }
                else
                {
                    MessageBox.Show("Wrong Password!", "Error", MessageBoxButtons.OK);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
            }



            textBox_key.Clear();
            textBox_rKey.Clear();
        }