public void ChangeRotors(string rot1, char rotNotch1, string rot2, char rotNotch2, string rot3, char rotNotch3, string refl) { rr = null; rm = null; rl = null; rr = new Rotor(rot1, lblRotor1, rotNotch3); rm = new Rotor(rot2, lblRotor2, rotNotch2); rl = new Rotor(rot3, lblRotor3, rotNotch1); reflector = new Rotor(refl, null, '\0'); rr.ResetOffset(); rm.ResetOffset(); rl.ResetOffset(); rr.SetNextRotor(rm); rm.SetNextRotor(rl); rl.SetNextRotor(reflector); rm.SetPreviousRotor(rr); rl.SetPreviousRotor(rm); reflector.SetPreviousRotor(rl); lblRotor1.Text = "A"; lblRotor2.Text = "A"; lblRotor3.Text = "A"; }
public Form1() { InitializeComponent(); cmbR1.SelectedIndex = 2; cmbR2.SelectedIndex = 1; cmbR3.SelectedIndex = 0; cmbReflector.SelectedIndex = 0; rr = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", lblRotor1, 'V'); rm = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", lblRotor2, 'E'); rl = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", lblRotor3, 'Q'); reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT", null, '\0'); rr.SetNextRotor(rm); rm.SetNextRotor(rl); rl.SetNextRotor(reflector); rm.SetPreviousRotor(rr); rl.SetPreviousRotor(rm); reflector.SetPreviousRotor(rl); }