Пример #1
0
        /// <summary>
        ///     Extracts the secret text message.
        /// </summary>
        public async Task ExtractSecretMessage()
        {
            var modifiedImageData = await ImageUtilities.GetImageData(this.ModifiedImage);

            if (HeaderUtilities.IsMessageEmbedded(modifiedImageData, this.ModifiedImage.PixelWidth) &&
                HeaderUtilities.GetMessageType(modifiedImageData, this.ModifiedImage.PixelWidth) == MessageType.Text)
            {
                var textEncoder =
                    new TextEncoder(
                        HeaderUtilities.GetBitsPerColorChannel(modifiedImageData, this.ModifiedImage.PixelWidth));

                this.SecretMessage = textEncoder.DecodeMessage(modifiedImageData);
            }
            else
            {
                throw new ArgumentException("Modified Image doesn't contain Secret Text Message");
            }
        }