Esempio n. 1
0
 public MainWindow()
 {
     InitializeComponent();
     plugBoard = new PlugBoard(plugListBox);
     encoder   = new Encoder(plugBoard);
     DataBinding();
 }
Esempio n. 2
0
        /*
         * It takes first positions of rotors and its
         * numbers that STARTS FROM 1!
         *
         * commutatorsString is string like AB CD OP
         * and so on...
         */
        public EnigmaMachine(
            RotorTypes firstRotorNumber, int firstRotorStartPosition,
            RotorTypes secondRotorNumber, int secondRotorStartPosition,
            RotorTypes thirdRotorNumber, int thirdRotorStartPosition,
            ReflectorTypes reflectorNumber,
            string commutatorsString
            )
        {
            /* if yout want to try make all rotors in array
             * can try to uncomment it and rewrite CipherChar
             *
             * m_rotors = new Rotor[]
             * {
             *  RotorFactory((int)firstRotorNumber,   firstRotorStartPosition),
             *  RotorFactory((int)secondRotorNumber,  secondRotorStartPosition),
             *  RotorFactory((int)thirdRotorNumber,   thirdRotorStartPosition),
             * };
             */

            m_first  = RotorFactory((int)firstRotorNumber, firstRotorStartPosition);
            m_second = RotorFactory((int)secondRotorNumber, secondRotorStartPosition);
            m_third  = RotorFactory((int)thirdRotorNumber, thirdRotorStartPosition);

            m_reflector = ReflectorFactory((int)reflectorNumber);

            m_commutators = new PlugBoard(commutatorsString);
        }
Esempio n. 3
0
        public void testPlugBoard()
        {
            PlugBoard p = new PlugBoard();

            p.setPlugs("RS TU VW YZ LX MK JI HG EF QP CD ON AB");

            Console.WriteLine(p.swapLetter('R'));
            Console.WriteLine(p.swapLetter('S'));
        }
Esempio n. 4
0
 public void resetPlugBoard()
 {
     plugBoard = new PlugBoard();
 }
Esempio n. 5
0
 public Encoder(PlugBoard p)
 {
     plugBoard = p;
 }