Exemplo n.º 1
0
    public static void StartMorse()
    {
        bool exitStr = true;

        while (exitStr)
        {
            try
            {
                ClassMessDisplay.MorseScreen();
                string choise = Console.ReadLine();
                if (GeneralCipherClass.SelectEnterForExit(choise))
                {
                    break;
                }
                int          number = int.Parse(choise);
                Morse_Cipher morseCode;
                if (number <= 3 & number >= 1)
                {
                    switch (number)
                    {
                    case 1:
                        Console.Clear();
                        Console.WriteLine("Enter Word");
                        string val1 = Console.ReadLine();
                        morseCode = new Morse_Cipher(val1);
                        morseCode.crypt(val1);
                        ClassMessDisplay.OutQuestionOfContinueScreen();
                        val1    = Console.ReadLine();
                        exitStr = SelectContinueAct(val1);
                        break;

                    case 2:
                        Console.WriteLine("Enter Word");
                        string val2 = Console.ReadLine();
                        morseCode = new Morse_Cipher(val2);
                        morseCode.decrypt(val2);
                        break;

                    case 3:
                        Console.WriteLine("Enter Word Or Signal");
                        string val3 = Console.ReadLine();
                        morseCode = new Morse_Cipher(val3);
                        morseCode.SoundOfMorse(val3);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Wrong digit entered");
            }
        }
    }
Exemplo n.º 2
0
    private void CipherChoise(int num)
    {
        switch (num)
        {
        case 1:
            Morse_Cipher.StartMorse();
            break;

        case 3:
            CesarCipher.StartCaesar();
            break;

        case 2:
            Console.WriteLine("It is the Transposition code!");
            Console.WriteLine("Enter the number for action!");
            Console.WriteLine("1. To Transposition");
            Console.WriteLine("2. From Transposition");
            break;

        case 4:
            Console.WriteLine("Hello!");
            Console.WriteLine("Enter the number of cipher!");
            Console.WriteLine("1. Morse");
            Console.WriteLine("2. Transposition");
            Console.WriteLine("3. Caesar's");
            Console.WriteLine("4. Combo");
            break;

        default:
            break;
        }
    }