示例#1
0
        public override void Work()
        {
            string encryptedText = "";

            image = Image.FromFile(prefsInstance.ImagePath);
            byte[] hiddenArrayBytes = null;
            switch (prefsInstance.EncodingDataIndex)
            {
            case 0x01:
            {
                if (prefsInstance.UsePassword == true)
                {
                    encryptedText = Crypto.EncryptStringAES(prefsInstance.PlainText, prefsInstance.Password);
                }
                else
                {
                    encryptedText = prefsInstance.PlainText;
                }
                hiddenArrayBytes = Encoding.ASCII.GetBytes(encryptedText);
            }
            break;

            case 0x02:
            {
                hiddenArrayBytes = Utils.BitmapToByteArray(Image.FromFile(prefsInstance.HiddenImagePath));
            }
            break;

            default:
                MessageBox.Show("Completati campurile din setari!", "Atentie!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            AlgoFormatImpl = stegaFactory.GetImplementationByFormat(ESupportedAlgorithms.ClasicAlgo);

            AlgoFormatImpl.Encode(ref image, hiddenArrayBytes);
            OnWorkDone(EventArgs.Empty);
        }