示例#1
0
        private void btnDecryptFile_Click(object sender, EventArgs e)
        {
            if (txtFilePath.Text == "")
            {
                MessageBox.Show("Please Choose a File to Decrypt", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                btnBrowse.Focus();
            }
            else if (txtDeKey.Text == "")
            {
                MessageBox.Show("Enter Key for Decryption", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtDeKey.Focus();
            }
            else
            {
                pgsDecryptionBar.Show();

                Thread.Sleep(500);

                pgsDecryptionBar.Value = 20;
                Thread.Sleep(500);

                String inputString = rtbShowContent.Text;
                String key         = txtDeKey.Text;

                VigenereCipher vc = new VigenereCipher();

                DecryptedText = vc.DecryptText(inputString, key);

                pgsDecryptionBar.Value = 60;

                Thread.Sleep(500);

                pgsDecryptionBar.Value = pgsDecryptionBar.Maximum;
                lblDone.Show();

                Thread.Sleep(1500);

                btnViewFile.Show();
                btnClearAll.Show();
            }
        }
示例#2
0
        private void btnDecryptText_Click(object sender, EventArgs e)
        {
            if (rtbInputText.Text == "")
            {
                MessageBox.Show("Please Enter the text to Decrypt", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else if (txtKey.Text == "")
            {
                MessageBox.Show("Please Enter Decryption Key", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                String inputString = rtbInputText.Text;
                String key         = txtKey.Text;

                VigenereCipher vc = new VigenereCipher();

                String DecryptedText = vc.DecryptText(inputString, key);

                rtbDecryptedText.Text = DecryptedText;
            }
        }