Esempio n. 1
0
        public void ChangeRotors(string rot1, string rotName1, char rotNotch1,
                                 string rot2, string rotName2, char rotNotch2,
                                 string rot3, string rotName3, char rotNotch3)
        {
            lblRotorS.Text = rotName1;
            lblRotorM.Text = rotName2;
            lblRotorD.Text = rotName3;
            rr             = null;
            rm             = null;
            rl             = null;

            rr = new Rotor(rot3, lblRotor1, rotNotch3);
            rm = new Rotor(rot2, lblRotor2, rotNotch2);
            rl = new Rotor(rot1, lblRotor3, rotNotch1);

            rr.ResetOffset();
            rm.ResetOffset();
            rl.ResetOffset();

            rr.Next = rm;
            rm.Next = rl;
            rl.Next = reflector;

            rm.Previous        = rr;
            rl.Previous        = rm;
            reflector.Previous = rl;

            lblRotor1.Text = "A";
            lblRotor2.Text = "A";
            lblRotor3.Text = "A";
        }
Esempio n. 2
0
        /// <summary>
        /// Inicia todos los componentes de la aplicación.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EnigmaXD_Load(object sender, EventArgs e)
        {
            rr        = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", lblRotor1, 'V');
            rm        = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", lblRotor2, 'E');
            rl        = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", lblRotor3, 'Q');
            reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT", null, '\0');

            //J,Z

            rr.Next            = rm;
            rm.Next            = rl;
            rl.Next            = reflector;
            rm.Previous        = rr;
            rl.Previous        = rm;
            reflector.Previous = rl;
        }
Esempio n. 3
0
 /// <summary>
 /// Cambia la configuración del reflector en el programa actual.
 /// </summary>
 /// <param name="refl"> Nueva configuración de reflector </param>
 public void SetReflector(string refl)
 {
     reflector          = new Rotor(refl, null, '\0');
     reflector.Previous = rl;
     rl.Next            = reflector;
 }