/// <summary> /// Checks if the rotor needs to be advanced /// </summary> /// <param name="r">the previous rotor</param> /// <returns></returns> private bool CheckToAdvance(Rotor r) { // stores the list of values that rotate the rotor List <char> values = RotorInformation.RotateValues(r.RotorIndex()); // if the list contains the previous letter, return true if (values.Contains(r.LetterInAlpha(25))) { return(true); } // does not need to be rotated return(false); }
/// <summary> /// Checks the letter in the alphabet and the index of the cipher /// </summary> /// <param name="l">the stored letter</param> /// <param name="i">the stored index</param> /// <param name="r">the rotor to check</param> private void LeftToRight(ref char l, ref int i, Rotor r) { l = r.LetterInAlpha(i); i = r.CipherIndexOfLetter(l); }