示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            reflector = new Rotor("YRUHQSLDPXNGOKMIEBFZCWVJAT", null, '\0');
            rotor_3   = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", rot_3_lbl, 'V');
            rotor_2   = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", rot_2_lbl, 'E');
            rotor_1   = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", rot_1_lbl, 'Q');

            SetValuesElements();

            reflectorLabel.Text = "Рефлектор: B";
        }
示例#2
0
        public void ChangeRotors(string rot_value1, string rot_value2, string rot_value3)
        {
            rotor1_lbl.Text = rot_value1;
            rotor2_lbl.Text = rot_value2;
            rotor3_lbl.Text = rot_value3;

            switch (rotor1_lbl.Text)
            {
            case "I":
            {
                rotor_1 = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", rot_1_lbl, 'Q');
            }
            break;

            case "II":
            {
                rotor_1 = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", rot_1_lbl, 'Q');
            }
            break;

            case "III":
            {
                rotor_1 = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", rot_1_lbl, 'Q');
            }
            break;

            case "IV":
            {
                rotor_1 = new Rotor("ESOVPZJAYQUIRHXLNFTGKDCMWB", rot_1_lbl, 'Q');
            }
            break;

            case "V":
            {
                rotor_1 = new Rotor("VZBRGITYUPSDNHLXAWMJQOFECK", rot_1_lbl, 'Q');
            }
            break;
            }

            switch (rotor2_lbl.Text)
            {
            case "I":
            {
                rotor_2 = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", rot_2_lbl, 'E');
            }
            break;

            case "II":
            {
                rotor_2 = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", rot_2_lbl, 'E');
            }
            break;

            case "III":
            {
                rotor_2 = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", rot_2_lbl, 'E');
            }
            break;

            case "IV":
            {
                rotor_2 = new Rotor("ESOVPZJAYQUIRHXLNFTGKDCMWB", rot_2_lbl, 'E');
            }
            break;

            case "V":
            {
                rotor_2 = new Rotor("VZBRGITYUPSDNHLXAWMJQOFECK", rot_2_lbl, 'E');
            }
            break;
            }

            switch (rotor3_lbl.Text)
            {
            case "I":
            {
                rotor_3 = new Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", rot_3_lbl, 'V');
            }
            break;

            case "II":
            {
                rotor_3 = new Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", rot_3_lbl, 'V');
            }
            break;

            case "III":
            {
                rotor_3 = new Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", rot_3_lbl, 'V');
            }
            break;

            case "IV":
            {
                rotor_3 = new Rotor("ESOVPZJAYQUIRHXLNFTGKDCMWB", rot_3_lbl, 'V');
            }
            break;

            case "V":
            {
                rotor_3 = new Rotor("VZBRGITYUPSDNHLXAWMJQOFECK", rot_3_lbl, 'V');
            }
            break;
            }

            SetValuesElements();

            rotor_1.ResetOffset();
            rotor_2.ResetOffset();
            rotor_3.ResetOffset();

            rot_1_lbl.Text = "A";
            rot_2_lbl.Text = "A";
            rot_3_lbl.Text = "A";
        }
示例#3
0
 public void ChangeReflector(string reflectorAlphabet)
 {
     reflector = new Rotor(reflectorAlphabet, null, '\0');
     reflector.SetPreviousRotor(rotor_1);
     rotor_1.SetNextRotor(reflector);
 }
示例#4
0
 // Установить предыдущую позицию ротора
 public void SetPreviousRotor(Rotor previousPosition)
 {
     this.previousPosition = previousPosition;
 }
示例#5
0
 // Установить следующую позицию ротора
 public void SetNextRotor(Rotor nextPosition)
 {
     this.nextPosition = nextPosition;
 }