public MainWindow() { InitializeComponent(); plugBoard = new PlugBoard(plugListBox); encoder = new Encoder(plugBoard); DataBinding(); }
/* * 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); }
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')); }
public void resetPlugBoard() { plugBoard = new PlugBoard(); }
public Encoder(PlugBoard p) { plugBoard = p; }