Exemplo n.º 1
0
        private async void openSecretFileButton_Click(object sender, RoutedEventArgs e)
        {
            this.clearErrorMessage();
            if (this.stegafyManager.OriginalImage == null)
            {
                return;
            }

            var sourceSecretFile = await selectSourceFile();

            if (sourceSecretFile == null)
            {
                return;
            }

            if (await HeaderUtilities.IsImageFile(sourceSecretFile))
            {
                await this.embedSecretImage(sourceSecretFile);

                if (this.stegafyManager.ModifiedImage == null)
                {
                    return;
                }
                this.unencryptedSecretImageDisplay.Visibility = Visibility.Visible;
                this.unencryptedSecretImageDisplay.Source     = this.stegafyManager.SecretImage;
                this.modifiedImageDisplay.Source        = this.stegafyManager.ModifiedImage;
                this.embedSecretMessageButton.IsEnabled = false;
            }
            else
            {
                await this.stegafyManager.ReadSecretMessageFromTextFile(sourceSecretFile);

                if (this.stegafyManager.SecretMessage == null)
                {
                    return;
                }
                this.unencryptedSecretMessageTextBlock.Visibility = Visibility.Visible;
                this.unencryptedSecretMessageTextBlock.Text       = this.stegafyManager.SecretMessage;
                this.modifiedImageDisplay.Source = this.stegafyManager.ModifiedImage;
            }

            this.saveButton.IsEnabled      = true;
            this.encryptCheckbox.IsEnabled = true;
        }