Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        public char Encode(char character)
        {
            var offsetedCharacter = AlphabetHelper.GetNextChar(character, GetOffset());
            var mappedCharacter   = Mapping[offsetedCharacter];

            return(AlphabetHelper.GetNextChar(mappedCharacter, GetInverseOffset()));
        }
Exemplo n.º 3
0
        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()));
        }