/// <summary>
        /// Convert System.Decimal type to DigitexWire.Decimal.
        /// </summary>
        /// <param name="decValue">Original value.</param>
        /// <returns>Value converted to DigitexWire.Decimal. <see cref="DigitexWire.Decimal"/></returns>
        static public DigitexWire.Decimal ToProtoDecimal(decimal decValue)
        {
            uint    scale    = 0;
            decimal reminder = decValue % 1;
            long    value64  = (long)(decValue - reminder);

            while (reminder != 0)
            {
                reminder *= 10;
                value64  *= 10;
                scale    += 1;
                value64  += (long)(reminder - (reminder % 1));
                reminder %= 1;
            }
            DigitexWire.Decimal value = new DigitexWire.Decimal();
            value.Value64 = value64;
            value.Scale   = scale;
            return(value);
        }
 /// <summary>
 /// Convert DigitexWire.Decimal to System.Decimal.
 /// </summary>
 /// <param name="value">Original DigitexWire.Decimal value. <see cref="DigitexWire.Decimal"/></param>
 /// <returns>Value converted to System.Decimal.</returns>
 static public decimal FromProtoDecimal(DigitexWire.Decimal value)
 {
     return(value == null ? 0 : (decimal)(value.Value64 * Math.Pow(10, -value.Scale)));
 }