コード例 #1
0
ファイル: Rotor.cs プロジェクト: Zapafaz/CIS220-OOP-enigma
 /// <summary>
 /// Constructor for the Rotor class. Uses the RotorSettings class to initialize.
 /// </summary>
 /// <param name="settings">The set of rotor settings this rotor should use.</param>
 public Rotor(RotorSettings settings)
 {
     Offset           = settings.Offset;
     rotation         = settings.Rotation;
     originalRotation = settings.Rotation;
     toRotateNext     = settings.ToRotateNext;
 }
コード例 #2
0
 public void SetRotor(int n, RotorSettings rotorSettings)
 {
     if (n < rotors.Length)
     {
         rotors[n].SetSettings(rotorSettings);
     }
     rotors[n].Refresh();
 }
コード例 #3
0
        public EnigmaSettings GetSettings()
        {
            var rotorSettings = new RotorSettings[this.rotors.Length];

            for (int i = 0; i < this.rotors.Length; i++)
            {
                rotorSettings[i] = this.rotors[i].GetSettings();
            }

            var enigmaSettings = new EnigmaSettings(rotorSettings, this.reflector.GetSettings(), this.plugBoard.GetSettings());

            return(enigmaSettings);
        }
コード例 #4
0
 public void SetReflector(RotorSettings reflector)
 {
     this.reflector.SetSettings(reflector);
 }
コード例 #5
0
 public void SetSettings(RotorSettings rotorSettings)
 {
     this.wiring = rotorSettings.wiring;
     this.notch  = rotorSettings.notch;
     this.offset = rotorSettings.offset;
 }
コード例 #6
0
        public RotorSettings GetSettings()
        {
            var rotorSetting = new RotorSettings(this.wiring, this.notch, this.offset);

            return(rotorSetting);
        }
コード例 #7
0
 public Rotor(RotorSettings rotorSettings)
 {
     this.wiring = rotorSettings.wiring;
     this.notch  = rotorSettings.notch;
 }