Example #1
0
 /// <summary>
 /// Constructs the <see cref="RotorCollection"/>.
 /// </summary>
 /// <param name="letterSet">The letterset used by the rotors for calculation.</param>
 /// <param name="rotorCount">The number of rotors to use.</param>
 public RotorCollection(LetterSet letterSet, int rotorCount)
 {
     if (rotorCount < 1)
     {
         throw new ArgumentException(nameof(rotorCount));
     }
     if (letterSet == null)
     {
         throw new ArgumentNullException(nameof(letterSet));
     }
     rotors = new Rotor[rotorCount];
     for (int i = 0; i < rotorCount; i++)
     {
         rotors[i] = new Rotor(letterSet, PrimeNumbers[i]);
     }
 }
Example #2
0
 /// <summary>
 /// Constructs the <see cref="RotorCollection"/>.
 /// </summary>
 /// <param name="letterSet">The letterset used by the rotors for calculation.</param>
 /// <param name="rotorKeys">
 /// The list of prime number keys describing the offset and number of rotors.
 /// </param>
 public RotorCollection(LetterSet letterSet, RotorKeys rotorKeys, bool rotateRotors)
 {
     if (letterSet == null)
     {
         throw new ArgumentNullException(nameof(letterSet));
     }
     if (rotorKeys == null)
     {
         throw new ArgumentNullException(nameof(rotorKeys));
     }
     rotors = new Rotor[rotorKeys.Count];
     for (int i = 0; i < rotorKeys.Count; i++)
     {
         rotors[i] = new Rotor(letterSet, rotorKeys[i]);
     }
     this.rotateRotors = rotateRotors;
 }