/// <summary> /// Move the rotor to the next letter. If the current letter is the notch letter, the next rotor has to me move /// </summary> /// <returns>True if the next rotor has to be moved, false if hasn't </returns> public bool MoveRotor() { var moveNextRotor = TurnOverNotchLetter == CurrentLetter; CurrentLetter = AlphabetHelper.GetNextChar(CurrentLetter); return(moveNextRotor); }
public char Encode(char character) { var offsetedCharacter = AlphabetHelper.GetNextChar(character, GetOffset()); var mappedCharacter = Mapping[offsetedCharacter]; return(AlphabetHelper.GetNextChar(mappedCharacter, GetInverseOffset())); }
public char InverseEncode(char character) { var offsetedCharacter = AlphabetHelper.GetNextChar(character, GetOffset()); var mappedCharacter = Mapping.Where(x => x.Value == offsetedCharacter).FirstOrDefault().Key; return(AlphabetHelper.GetNextChar(mappedCharacter, GetInverseOffset())); }