Ejemplo n.º 1
0
        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";
        }
Ejemplo n.º 2
0
 public Rotor(string layout, Label lbl, char notchPos)
 {
     this.layout   = layout;
     this.previous = previous;
     this.next     = next;
     this.lbl      = lbl;
     this.notchPos = notchPos;
     offset        = 0;
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public void SetPreviousRotor(Rotor previous)
 {
     this.previous = previous;
 }
Ejemplo n.º 5
0
 public void SetNextRotor(Rotor next)
 {
     this.next = next;
 }