コード例 #1
0
ファイル: Enigma.cs プロジェクト: randomCharacter/Enigma
        /// <summary>
        /// Simulates key press.
        /// </summary>
        /// <param name="value">Decimal value of pressed key.</param>
        /// <returns>Converted value in decimal mode.</returns>
        public int Convert(int value)
        {
            AdvanceRotors();
            var res = value;

            res = _plugboard.Convert(res);
            res = _right.Convert(res);
            res = _center.Convert(res);
            res = _left.Convert(res);
            res = _reflector.Convert(res);
            res = _left.ConvertInv(res);
            res = _center.ConvertInv(res);
            res = _right.ConvertInv(res);
            res = _plugboard.Convert(res);
            return(res);
        }