コード例 #1
0
        private void buttonEncryptData_Click(object sender, RoutedEventArgs e)
        {
            //EncryptData Button --> 1st Tab

            //De verificat partea cu codul!

            if (textBox_TextInput || textBox_ImageInput)
            {
                Classes.EncryptImage_LastTwoBits ApplyEncryption = new Classes.EncryptImage_LastTwoBits(ref ImageToEncrypt, !isGrayScale(ImageToEncrypt));
                if (textBox_TextInput && textBox_TextToEncrypt.Text.Length > 0)
                {
                    if (!ApplyEncryption.EncryptText(textBox_TextToEncrypt.Text, "cod"))
                    {
                        MessageBox.Show("Encryption Failed!", "Error", MessageBoxButton.OK);
                        return;
                    }
                    ImageBox_imageEncrypt.Source = ToBitmapImage(ImageToEncrypt);
                    MessageBox.Show("Encryption Completed!");
                }
            }
            else
            {
                MessageBox.Show("There is nothing to Encrypt", "Error!", MessageBoxButton.OK);
            }
        }
コード例 #2
0
        private void buttonDecryptData_Click(object sender, RoutedEventArgs e)
        {
            //DecryptData Button --> 2nd Tab

            //Nu uita sa aplici codul!

            if (ImageLoaded_Decryption)
            {
                Classes.EncryptImage_LastTwoBits ApplyDecryption = new Classes.EncryptImage_LastTwoBits(ref ImageToDecode, !isGrayScale(ImageToDecode));
                string ResultedText = "";
                ApplyDecryption.DecryptText(ref ResultedText, "cod");
                textBox_DecryptedText.Text = ResultedText;
                MessageBox.Show("Decryption Completed!");
            }
            else
            {
                MessageBox.Show("There is nothing to Decrypt", "Error!", MessageBoxButton.OK);
            }
        }