/// <summary>
        /// PinPadCryptographyMethodController string parser.
        /// </summary>
        /// <param name="reader">String reader.</param>
        /// <returns>PinPadCryptographyMethodController</returns>
        public static CryptographyMethod CustomStringParser(StringReader reader)
        {
            int intValue = StringParser.IntegerStringParser(reader, 1).Value;

            int keyManagementMethodValue          = (intValue / 2) + 1;
            KeyManagementMode keyManagementMethod = (KeyManagementMode)keyManagementMethodValue;

            int cryptographyMethodValue         = (intValue % 2) + 1;
            CryptographyMode cryptographyMethod = (CryptographyMode)cryptographyMethodValue;

            CryptographyMethod value = new CryptographyMethod(keyManagementMethod, cryptographyMethod);

            return(value);
        }
        /// <summary>
        /// PinPadCryptographyMethodController string formatter.
        /// </summary>
        /// <param name="obj">Value to convert.</param>
        /// <returns>Value of the property as string or InvalidCastException for invalid values.</returns>
        public static string StringFormatter(CryptographyMethod obj)
        {
            // Validates parameter value:
            if (obj.KeyManagement == KeyManagementMode.Undefined || obj.Cryptography == CryptographyMode.Undefined)
            {
                throw new InvalidCastException("KeyManagementMethod and CryptographyMethod cannot be undefined.");
            }

            // Converts to string:
            int value = (((int)obj.KeyManagement) - 1) * 2;

            value += ((int)obj.Cryptography) - 1;

            return(value.ToString());
        }