public void ChangeRotor(int position, Rotor r) { if (position >= 0 && position < Rotores.Length) { Rotores[position] = r; } }
private void ChangeEnigma() { Rotor[] rotors = new Rotor[3] { cbbRotor1.SelectedItem as Rotor, cbbRotor2.SelectedItem as Rotor, cbbRotor3.SelectedItem as Rotor }; Enigma = new Socket(rotors, P); }
private void EventoRotacion(object sender, EventArgs e) { Rotor r = sender as Rotor; for (int i = 0; i < Rotores.Length; ++i) { if (Rotores[i] == r) { OnEventoRotacionRotor(i); } } }
public void ChangeOffset(Rotor r, int offset) { //if (offset == 26) //CHANGED //{ // for(int i=0; i< Rotores.Length; i++) // { // if (Rotores[i] == r) // { // this.rotorArotar = i; // } // } //} r.ChangeOffset(offset); }
private void EventoCicloCompleto(object sender, EventArgs e) { Rotor r = sender as Rotor; for (int i = 0; i < Rotores.Length; ++i) { if (Rotores[i] == r && i < Rotores.Length - 1) { //this.rotorArotar = i+1; //CHANGED Rotores[i + 1].Rotar(); } } }
static void Main(string[] args) { string input; Rotor[] rotors = new Rotor[3]; Reflector reflector = new Reflector(Ref.ReflectorB); Reflector steckerbrett = new Reflector(Ref.steckerbrett); rotors[2] = new Rotor(Ref.I, 1, 0, 17); rotors[1] = new Rotor(Ref.II, 2, 0, 5); rotors[0] = new Rotor(Ref.III, 3, 0, 22); input = Console.ReadLine(); Console.WriteLine(shift_message(input, rotors, reflector, steckerbrett)); Console.ReadLine(); }