Exemplo n.º 1
0
        public static void DecryptMenu(CaesarCipher caesarCipher)
        {
            string userInput = "Yes";

            do
            {
                Console.Write("\tMessage to decrypt: ");
                userInput = Console.ReadLine();
                string encrypted = caesarCipher.Decrypt(userInput);
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"\tMessage: {encrypted}");
                Console.ResetColor();
                Console.Write("Decrypt another message [Yes/No]: ");
                userInput = Console.ReadLine();
            } while (userInput.Equals("Yes", StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int          userSelection = 0;
            CaesarCipher caesarCipher  = new CaesarCipher(SHIFT_KEY);

            do
            {
                Console.Clear();

                userSelection = MainMenu(userSelection);

                switch (userSelection)
                {
                case 1: EncryptMenu(caesarCipher); break;

                case 2: DecryptMenu(caesarCipher); break;
                }
            }while (userSelection != 3);
        }