예제 #1
0
        /// <summary>
        /// Check the OPOS result code from last operation.
        /// </summary>
        /// <param name="resultCode"></param>
        /// <exception cref="IOException"></exception>
        internal static void CheckResultCode(IPeripheral source, int resultCode)
        {
            OPOS_Constants result = (OPOS_Constants)resultCode;

            if (result != OPOS_Constants.OPOS_SUCCESS)
            {
                string message = string.Format("{0} device failed with error '{1}'.", source.GetType().Name, result);
                throw new IOException(message);
            }
        }
예제 #2
0
            /// <summary>
            /// Check the OPOS result code from last operation.
            /// </summary>
            /// <param name="source">Source of result code.</param>
            /// <param name="resultCode">Result code returned from last operation.</param>
            /// <exception cref="IOException">Device IO error.</exception>
            public static void CheckResultCode(object source, int resultCode)
            {
                if (source == null)
                {
                    throw new ArgumentNullException("source");
                }

                OPOS_Constants result = (OPOS_Constants)resultCode;

                if (result != OPOS_Constants.OPOS_SUCCESS)
                {
                    string message = string.Format(CultureInfo.InvariantCulture, "{0} device failed with error '{1}'.", source.GetType().Name, result);
                    throw new IOException(message);
                }
            }