Пример #1
0
        private void decrypterButton_Click(object sender, EventArgs e)
        {
            if (!IsReady())
            {
                return;
            }

            if (_inputDir != null && _outputDir != null)
            {
                Metadata met = new Metadata(_inputDir, _outputDir, State.Decode, _keepInvalidChar, _codeAndTranslate,
                                            _type, _cesarKey);

                ICrypt crypt = (_algorithm == TypeC.Aero) ? new Aero(met, _aeroUseInt)
                    : (_algorithm == TypeC.Cesar) ? new Cesar(met, _cesarLeftToRight)
                    : (_algorithm == TypeC.Morse) ? new Morse(met)
                    : (_algorithm == TypeC.Navajo) ? new Navajo(met)
                    : (_algorithm == TypeC.Vigenere) ? new Vigenere(met, _vigenereKey)
                    : new Binaire(met);

                crypt.Translate();
                crypt.WriteResult();
            }
            else
            {
                string message = "Erreur: paramètre inexistant, veuillez entrer une valeur.";
                string source  = (_inputDir is null) ? nameof(_inputDir) : nameof(_outputDir);
                string details = $"Error in Decrypt method: {source} should not be null";
                Error  err     = new Error(message, source, details);
                Error = err;
            }

            CryptoStatusCheck(State.Decode);
        }