Ejemplo n.º 1
0
        static decimal DecodeValue(ByteBuffer buffer, FormatCode formatCode)
        {
            decimal value = 0;

            switch (formatCode)
            {
            case FormatCode.Decimal32:
                value = DecimalEncoding.DecodeDecimal32(buffer);
                break;

            case FormatCode.Decimal64:
                value = DecimalEncoding.DecodeDecimal64(buffer);
                break;

            case FormatCode.Decimal128:
                value = DecimalEncoding.DecodeDecimal128(buffer);
                break;

            default:
                throw AmqpEncoding.GetInvalidFormatCodeException(formatCode, buffer.Offset);
            }
            ;

            return(value);
        }
Ejemplo n.º 2
0
        private static decimal DecodeValue(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode)
        {
            decimal num  = new decimal(0);
            byte    num1 = formatCode;

            if (num1 == 116)
            {
                num = DecimalEncoding.DecodeDecimal32(buffer);
            }
            else if (num1 == 132)
            {
                num = DecimalEncoding.DecodeDecimal64(buffer);
            }
            else
            {
                if (num1 != 148)
                {
                    throw AmqpEncoding.GetEncodingException(SRAmqp.AmqpInvalidFormatCode(formatCode, buffer.Offset));
                }
                num = DecimalEncoding.DecodeDecimal128(buffer);
            }
            return(num);
        }