示例#1
0
        /// <summary>
        /// Runs the plugboard randomizer.
        /// </summary>
        public void RandomizePlugboard()
        {
            if (letterSetConfig.LetterSet == null)
            {
                PrintError("Cannot configure Plugboard without a loaded letterset!");
                return;
            }
            Console.Write("Enter the path to save the plugboard file to: ");
            string file = Console.ReadLine();

            try {
                plugboardConfig.RandomizePlugboard(letterSetConfig.LetterSet, file);
                machineConfig.SetupMachineIfReady();
            }
            catch (Exception ex) {
                PrintError(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// Runs the plugboard randomizer.
        /// </summary>
        public void RandomizePlugboard()
        {
            if (letterSetConfig.LetterSet == null)
            {
                PrintError("Cannot configure Plugboard without a loaded letterset!");
                return;
            }
            Console.Write("Randomize the plugboard (y/n): ");
            string input = Console.ReadLine().ToLower();

            if (input == "yes" || input == "y")
            {
                try {
                    plugboardConfig.RandomizePlugboard(letterSetConfig.LetterSet);
                    machineConfig.SetupMachineIfReady();
                } catch (Exception ex) {
                    PrintError(ex.Message);
                }
            }
            else if (input != "no" && input != "n")
            {
                PrintError("Invalid input. Must be y/yes/n/no!");
            }
        }