public Rotor(FixedMechanicRotor rot) { this.permutation = rot.Permutation.ToUpper().ToCharArray(); this.knocker = rot.Knocker; this.reverse = new char[26]; for (int i = 0; i < permutation.Length; i++) { int revIndex = permutation[i] - 'A'; reverse[revIndex] = (char)('A' + i); } }
public Rotor(FixedMechanicRotor rot) { this.permutation = rot.Permutation.ToUpper().ToCharArray(); this.knocker = rot.Knocker; this.reverse = new char[26]; for (int i = 0; i < permutation.Length; i++) { int revIndex = permutation[i] - 'A'; reverse[revIndex] = (char)('A' + i); } }