示例#1
0
        private Reflector(string code, string mapping)
        {
            Code    = code;
            Mapping = new Dictionary <char, char>();
            var alphabet = AlphabetHelper.GetAlphabet().ToList();

            for (int idx = 0; idx < 26; idx++)
            {
                Mapping[alphabet[idx]] = mapping[idx];
            }
        }
示例#2
0
        /// <summary>
        /// Create the rotor with the given configuration
        /// </summary>
        /// <param name="code"></param>
        /// <param name="turnOverNotchLetter"></param>
        /// <param name="mapping"></param>
        /// <param name="startingLetter"></param>
        private Rotor(string code, char turnOverNotchLetter, string mapping, char startingLetter)
        {
            Code = code;
            TurnOverNotchLetter = turnOverNotchLetter;
            StartingLetter      = startingLetter;
            CurrentLetter       = startingLetter;
            Mapping             = new Dictionary <char, char>();
            var alphabet = AlphabetHelper.GetAlphabet().ToList();

            for (int idx = 0; idx < 26; idx++)
            {
                Mapping[alphabet[idx]] = mapping[idx];
            }
        }