Esempio n. 1
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Role = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.First = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Last = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Settled = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer);
            }

            if (count-- > 0)
            {
                this.Batchable = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 2
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Durable = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Priority = AmqpCodec.DecodeUByte(buffer);
            }

            if (count-- > 0)
            {
                this.Ttl = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.FirstAcquirer = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.DeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }
        }
Esempio n. 3
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.NextIncomingId = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.IncomingWindow = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.NextOutgoingId = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.OutgoingWindow = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Handle = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.DeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.LinkCredit = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Available = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Drain = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Echo = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Properties = AmqpCodec.DecodeMap <Fields>(buffer);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Decodes the fields from the buffer.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="count">The number of fields.</param>
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Address = Address.Decode(buffer);
            }

            if (count-- > 0)
            {
                this.Durable = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.ExpiryPolicy = AmqpCodec.DecodeSymbol(buffer);
            }

            if (count-- > 0)
            {
                this.Timeout = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Dynamic = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.DynamicNodeProperties = AmqpCodec.DecodeMap <Fields>(buffer);
            }

            if (count-- > 0)
            {
                this.DistributionMode = AmqpCodec.DecodeSymbol(buffer);
            }

            if (count-- > 0)
            {
                this.FilterSet = AmqpCodec.DecodeMap <FilterSet>(buffer);
            }

            if (count-- > 0)
            {
                this.DefaultOutcome = (Outcome)AmqpCodec.DecodeAmqpDescribed(buffer);
            }

            if (count-- > 0)
            {
                this.Outcomes = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }

            if (count-- > 0)
            {
                this.Capabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Decodes the fields from the buffer.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="count">The number of fields.</param>
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Handle = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.DeliveryId = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.DeliveryTag = AmqpCodec.DecodeBinary(buffer);
            }

            if (count-- > 0)
            {
                this.MessageFormat = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Settled = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.More = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.RcvSettleMode = AmqpCodec.DecodeUByte(buffer);
            }

            if (count-- > 0)
            {
                this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer);
            }

            if (count-- > 0)
            {
                this.Resume = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Aborted = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Batchable = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 6
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.TxnId = AmqpCodec.DecodeBinary(buffer);
            }

            if (count-- > 0)
            {
                this.Fail = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 7
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.Address = Microsoft.ServiceBus.Messaging.Amqp.Framing.Address.Decode(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.Durable = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.ExpiryPolicy = AmqpCodec.DecodeSymbol(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.Timeout = AmqpCodec.DecodeUInt(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.Dynamic = AmqpCodec.DecodeBoolean(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.DynamicNodeProperties = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.Fields>(buffer);
            }
            int num6 = count;

            count = num6 - 1;
            if (num6 > 0)
            {
                this.Capabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
        }
Esempio n. 8
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.DeliveryFailed = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.UndeliverableHere = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.MessageAnnotations = AmqpCodec.DecodeMap <Fields>(buffer);
            }
        }
Esempio n. 9
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.TxnId = AmqpCodec.DecodeBinary(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.Fail = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 10
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Handle = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Closed = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.Error = AmqpCodec.DecodeKnownType <Error>(buffer);
            }
        }
Esempio n. 11
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.Role = AmqpCodec.DecodeBoolean(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.First = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.Last = AmqpCodec.DecodeUInt(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.Settled = AmqpCodec.DecodeBoolean(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.Batchable = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 12
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.Durable = AmqpCodec.DecodeBoolean(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.Priority = AmqpCodec.DecodeUByte(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.Ttl = AmqpCodec.DecodeUInt(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.FirstAcquirer = AmqpCodec.DecodeBoolean(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.DeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }
        }
Esempio n. 13
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.Address = Address.Decode(buffer);
            }

            if (count-- > 0)
            {
                this.Durable = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.ExpiryPolicy = AmqpCodec.DecodeSymbol(buffer);
            }

            if (count-- > 0)
            {
                this.Timeout = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Dynamic = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.DynamicNodeProperties = AmqpCodec.DecodeMap <Fields>(buffer);
            }

            if (count-- > 0)
            {
                this.Capabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
        }
Esempio n. 14
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.DeliveryFailed = AmqpCodec.DecodeBoolean(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.UndeliverableHere = AmqpCodec.DecodeBoolean(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.MessageAnnotations = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.Fields>(buffer);
            }
        }
Esempio n. 15
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                base.Handle = AmqpCodec.DecodeUInt(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.Closed = AmqpCodec.DecodeBoolean(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.Error = AmqpCodec.DecodeKnownType <Microsoft.ServiceBus.Messaging.Amqp.Framing.Error>(buffer);
            }
        }
Esempio n. 16
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            if (count-- > 0)
            {
                this.LinkName = AmqpCodec.DecodeString(buffer);
            }

            if (count-- > 0)
            {
                this.Handle = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.Role = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.SndSettleMode = AmqpCodec.DecodeUByte(buffer);
            }

            if (count-- > 0)
            {
                this.RcvSettleMode = AmqpCodec.DecodeUByte(buffer);
            }

            if (count-- > 0)
            {
                this.Source = AmqpCodec.DecodeObject(buffer);
            }

            if (count-- > 0)
            {
                this.Target = AmqpCodec.DecodeObject(buffer);
            }

            if (count-- > 0)
            {
                this.Unsettled = AmqpCodec.DecodeMap(buffer);
            }

            if (count-- > 0)
            {
                this.IncompleteUnsettled = AmqpCodec.DecodeBoolean(buffer);
            }

            if (count-- > 0)
            {
                this.InitialDeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }

            if (count-- > 0)
            {
                this.MaxMessageSize = AmqpCodec.DecodeULong(buffer);
            }

            if (count-- > 0)
            {
                this.OfferedCapabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }

            if (count-- > 0)
            {
                this.DesiredCapabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }

            if (count-- > 0)
            {
                this.Properties = AmqpCodec.DecodeMap <Fields>(buffer);
            }
        }
Esempio n. 17
0
        public void AmqpCodecSingleValueTest()
        {
            byte[]     workBuffer = new byte[2048];
            ByteBuffer buffer;

            // boolean true
            AmqpCodec.EncodeBoolean(boolTrue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(boolTrueBin, 0, boolTrueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            bool?bv = AmqpCodec.DecodeBoolean(new ByteBuffer(new ArraySegment <byte>(boolTrueBin)));

            Assert.True(bv.Value, "Boolean value is not true.");

            // boolean false
            AmqpCodec.EncodeBoolean(boolFalse, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(boolFalseBin, 0, boolFalseBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            bv = AmqpCodec.DecodeBoolean(new ByteBuffer(new ArraySegment <byte>(boolFalseBin)));
            Assert.False(bv.Value, "Boolean value is not false.");

            // ubyte
            AmqpCodec.EncodeUByte(ubyteValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(ubyteValueBin, 0, ubyteValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            byte?bytev = AmqpCodec.DecodeUByte(new ByteBuffer(new ArraySegment <byte>(ubyteValueBin)));

            Assert.True(bytev == ubyteValue, "UByte value is not equal.");

            // ushort
            AmqpCodec.EncodeUShort(ushortValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(ushortValueBin, 0, ushortValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ushort?ushortv = AmqpCodec.DecodeUShort(new ByteBuffer(new ArraySegment <byte>(ushortValueBin)));

            Assert.True(ushortv == ushortValue, "UShort value is not equal.");

            // uint0
            AmqpCodec.EncodeUInt(uint0Value, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(uint0ValueBin, 0, uint0ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            uint?uint0v = AmqpCodec.DecodeUInt(new ByteBuffer(new ArraySegment <byte>(uint0ValueBin)));

            Assert.True(uint0v == uint0Value, "UInt0 value is not equal.");

            // uint small
            AmqpCodec.EncodeUInt(uintSmallValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(uintSmallValueBin, 0, uintSmallValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            uint?uintSmallV = AmqpCodec.DecodeUInt(new ByteBuffer(new ArraySegment <byte>(uintSmallValueBin)));

            Assert.True(uintSmallV == uintSmallValue, "UIntSmall value is not equal.");

            // uint
            AmqpCodec.EncodeUInt(uintValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(uintValueBin, 0, uintValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            uint?uintv = AmqpCodec.DecodeUInt(new ByteBuffer(new ArraySegment <byte>(uintValueBin)));

            Assert.True(uintv == uintValue, "UInt value is not equal.");

            // ulong0
            AmqpCodec.EncodeULong(ulong0Value, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(ulong0ValueBin, 0, ulong0ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ulong?ulong0v = AmqpCodec.DecodeULong(new ByteBuffer(new ArraySegment <byte>(ulong0ValueBin)));

            Assert.True(ulong0v == ulong0Value, "ULong0 value is not equal.");

            // ulong small
            AmqpCodec.EncodeULong(ulongSmallValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(ulongSmallValueBin, 0, ulongSmallValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ulong?ulongSmallV = AmqpCodec.DecodeULong(new ByteBuffer(new ArraySegment <byte>(ulongSmallValueBin)));

            Assert.True(ulongSmallV == ulongSmallValue, "ULong value is not equal.");

            // ulong
            AmqpCodec.EncodeULong(ulongValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(ulongValueBin, 0, ulongValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ulong?ulongv = AmqpCodec.DecodeULong(new ByteBuffer(new ArraySegment <byte>(ulongValueBin)));

            Assert.True(ulongv == ulongValue, "ULong value is not equal.");

            // byte
            AmqpCodec.EncodeByte(byteValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(byteValueBin, 0, byteValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            sbyte?sbytev = AmqpCodec.DecodeByte(new ByteBuffer(new ArraySegment <byte>(byteValueBin)));

            Assert.True(sbytev == byteValue, "Byte value is not equal.");

            // short
            AmqpCodec.EncodeShort(shortValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(shortValueBin, 0, shortValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            short?shortv = AmqpCodec.DecodeShort(new ByteBuffer(new ArraySegment <byte>(shortValueBin)));

            Assert.True(shortv == shortValue, "Short value is not equal.");

            // int small
            AmqpCodec.EncodeInt(intSmallValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(intSmallValueBin, 0, intSmallValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            int?intSmallV = AmqpCodec.DecodeInt(new ByteBuffer(new ArraySegment <byte>(intSmallValueBin)));

            Assert.True(intSmallV == intSmallValue, "Int small value is not equal.");

            // int
            AmqpCodec.EncodeInt(intValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(intValueBin, 0, intValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            int?intv = AmqpCodec.DecodeInt(new ByteBuffer(new ArraySegment <byte>(intValueBin)));

            Assert.True(intv == intValue, "Int value is not equal.");

            // long
            AmqpCodec.EncodeLong(longSmallValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(longSmallValueBin, 0, longSmallValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            long?longSmallV = AmqpCodec.DecodeLong(new ByteBuffer(new ArraySegment <byte>(longSmallValueBin)));

            Assert.True(longSmallV == longSmallValue, "Long small value is not equal.");

            // long
            AmqpCodec.EncodeLong(longValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(longValueBin, 0, longValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            long?longv = AmqpCodec.DecodeLong(new ByteBuffer(new ArraySegment <byte>(longValueBin)));

            Assert.True(longv == longValue, "Long value is not equal.");

            // float
            AmqpCodec.EncodeFloat(floatValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(floatValueBin, 0, floatValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            float?floatv = AmqpCodec.DecodeFloat(new ByteBuffer(new ArraySegment <byte>(floatValueBin)));

            Assert.True(floatv == floatValue, "Float value is not equal.");

            // double
            AmqpCodec.EncodeDouble(doubleValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(doubleValueBin, 0, doubleValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            double?doublev = AmqpCodec.DecodeDouble(new ByteBuffer(new ArraySegment <byte>(doubleValueBin)));

            Assert.True(doublev == doubleValue, "Double value is not equal.");

            //decimal
            decimal?dec32 = AmqpCodec.DecodeDecimal(new ByteBuffer(new ArraySegment <byte>(decimal32ValueBin)));

            Assert.True(dec32.Value == decimal32Value, "Decimal32 value is not equal");

            decimal?dec64 = AmqpCodec.DecodeDecimal(new ByteBuffer(new ArraySegment <byte>(decimal64ValueBin)));

            Assert.True(dec64.Value == decimal64Value, "Decimal64 value is not equal");

            decimal?dec128 = AmqpCodec.DecodeDecimal(new ByteBuffer(new ArraySegment <byte>(decimal128ValueBin)));

            Assert.True(dec128.Value == decimal128Value, "Decimal128 value is not equal");

            // char
            AmqpCodec.EncodeChar(charValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(charValueBin, 0, charValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            char?charv = AmqpCodec.DecodeChar(new ByteBuffer(new ArraySegment <byte>(charValueBin)));

            Assert.True(charv == charValue, "Char value is not equal.");

            // timestamp
            AmqpCodec.EncodeTimeStamp(dtValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(dtValueBin, 0, dtValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            DateTime?dtv = AmqpCodec.DecodeTimeStamp(new ByteBuffer(new ArraySegment <byte>(dtValueBin)));

            Assert.True(dtv == dtValue.ToUniversalTime(), "UByte value is not equal.");

            // uuid
            AmqpCodec.EncodeUuid(uuidValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(uuidValueBin, 0, uuidValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            Guid?uuidv = AmqpCodec.DecodeUuid(new ByteBuffer(new ArraySegment <byte>(uuidValueBin)));

            Assert.True(uuidv == uuidValue, "Uuid value is not equal.");

            // binary 8
            AmqpCodec.EncodeBinary(bin8Value, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(bin8ValueBin, 0, bin8ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ArraySegment <byte> bin8v = AmqpCodec.DecodeBinary(new ByteBuffer(new ArraySegment <byte>(bin8ValueBin)));

            EnsureEqual(bin8v.Array, bin8v.Offset, bin8v.Count, bin8Value.Array, bin8Value.Offset, bin8Value.Count);

            // binary 32
            AmqpCodec.EncodeBinary(bin32Value, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(bin32ValueBin, 0, bin32ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            ArraySegment <byte> bin32v = AmqpCodec.DecodeBinary(new ByteBuffer(new ArraySegment <byte>(bin32ValueBin)));

            EnsureEqual(bin32v.Array, bin32v.Offset, bin32v.Count, bin32Value.Array, bin32Value.Offset, bin32Value.Count);

            // symbol 8
            AmqpCodec.EncodeSymbol(strValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(sym8ValueBin, 0, sym8ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            AmqpSymbol symbol8v = AmqpCodec.DecodeSymbol(new ByteBuffer(new ArraySegment <byte>(sym8ValueBin)));

            Assert.True(symbol8v.Value == strValue, "Symbol8 string value is not equal.");

            // symbol 32
            AmqpSymbol symbol32v = AmqpCodec.DecodeSymbol(new ByteBuffer(new ArraySegment <byte>(sym32ValueBin)));

            Assert.True(symbol32v.Value == strValue, "Symbol32 string value is not equal.");

            // string 8 UTF8
            AmqpCodec.EncodeString(strValue, buffer = new ByteBuffer(workBuffer));
            EnsureEqual(str8Utf8ValueBin, 0, str8Utf8ValueBin.Length, buffer.Buffer, buffer.Offset, buffer.Length);
            string str8Utf8 = AmqpCodec.DecodeString(new ByteBuffer(new ArraySegment <byte>(str8Utf8ValueBin)));

            Assert.True(str8Utf8 == strValue, "UTF8 string8 string value is not equal.");

            // string 32 UTF8
            string str32Utf8 = AmqpCodec.DecodeString(new ByteBuffer(new ArraySegment <byte>(str32Utf8ValueBin)));

            Assert.True(str32Utf8 == strValue, "UTF8 string32 string value is not equal.");
        }
Esempio n. 18
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                base.Handle = AmqpCodec.DecodeUInt(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.DeliveryId = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.DeliveryTag = AmqpCodec.DecodeBinary(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.MessageFormat = AmqpCodec.DecodeUInt(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.Settled = AmqpCodec.DecodeBoolean(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.More = AmqpCodec.DecodeBoolean(buffer);
            }
            int num6 = count;

            count = num6 - 1;
            if (num6 > 0)
            {
                this.RcvSettleMode = AmqpCodec.DecodeUByte(buffer);
            }
            int num7 = count;

            count = num7 - 1;
            if (num7 > 0)
            {
                this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer);
            }
            int num8 = count;

            count = num8 - 1;
            if (num8 > 0)
            {
                this.Resume = AmqpCodec.DecodeBoolean(buffer);
            }
            int num9 = count;

            count = num9 - 1;
            if (num9 > 0)
            {
                this.Aborted = AmqpCodec.DecodeBoolean(buffer);
            }
            int num10 = count;

            count = num10 - 1;
            if (num10 > 0)
            {
                this.Batchable = AmqpCodec.DecodeBoolean(buffer);
            }
        }
Esempio n. 19
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.Address = Microsoft.ServiceBus.Messaging.Amqp.Framing.Address.Decode(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.Durable = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.ExpiryPolicy = AmqpCodec.DecodeSymbol(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.Timeout = AmqpCodec.DecodeUInt(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.Dynamic = AmqpCodec.DecodeBoolean(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.DynamicNodeProperties = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.Fields>(buffer);
            }
            int num6 = count;

            count = num6 - 1;
            if (num6 > 0)
            {
                this.DistributionMode = AmqpCodec.DecodeSymbol(buffer);
            }
            int num7 = count;

            count = num7 - 1;
            if (num7 > 0)
            {
                this.FilterSet = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.FilterSet>(buffer);
            }
            int num8 = count;

            count = num8 - 1;
            if (num8 > 0)
            {
                this.DefaultOutcome = (Outcome)AmqpCodec.DecodeAmqpDescribed(buffer);
            }
            int num9 = count;

            count = num9 - 1;
            if (num9 > 0)
            {
                this.Outcomes = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
            int num10 = count;

            count = num10 - 1;
            if (num10 > 0)
            {
                this.Capabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
        }
Esempio n. 20
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.NextIncomingId = AmqpCodec.DecodeUInt(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                this.IncomingWindow = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.NextOutgoingId = AmqpCodec.DecodeUInt(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.OutgoingWindow = AmqpCodec.DecodeUInt(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                base.Handle = AmqpCodec.DecodeUInt(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.DeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }
            int num6 = count;

            count = num6 - 1;
            if (num6 > 0)
            {
                this.LinkCredit = AmqpCodec.DecodeUInt(buffer);
            }
            int num7 = count;

            count = num7 - 1;
            if (num7 > 0)
            {
                this.Available = AmqpCodec.DecodeUInt(buffer);
            }
            int num8 = count;

            count = num8 - 1;
            if (num8 > 0)
            {
                this.Drain = AmqpCodec.DecodeBoolean(buffer);
            }
            int num9 = count;

            count = num9 - 1;
            if (num9 > 0)
            {
                this.Echo = AmqpCodec.DecodeBoolean(buffer);
            }
            int num10 = count;

            count = num10 - 1;
            if (num10 > 0)
            {
                this.Properties = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.Fields>(buffer);
            }
        }
Esempio n. 21
0
        protected override void OnDecode(ByteBuffer buffer, int count)
        {
            int num = count;

            count = num - 1;
            if (num > 0)
            {
                this.LinkName = AmqpCodec.DecodeString(buffer);
            }
            int num1 = count;

            count = num1 - 1;
            if (num1 > 0)
            {
                base.Handle = AmqpCodec.DecodeUInt(buffer);
            }
            int num2 = count;

            count = num2 - 1;
            if (num2 > 0)
            {
                this.Role = AmqpCodec.DecodeBoolean(buffer);
            }
            int num3 = count;

            count = num3 - 1;
            if (num3 > 0)
            {
                this.SndSettleMode = AmqpCodec.DecodeUByte(buffer);
            }
            int num4 = count;

            count = num4 - 1;
            if (num4 > 0)
            {
                this.RcvSettleMode = AmqpCodec.DecodeUByte(buffer);
            }
            int num5 = count;

            count = num5 - 1;
            if (num5 > 0)
            {
                this.Source = AmqpCodec.DecodeObject(buffer);
            }
            int num6 = count;

            count = num6 - 1;
            if (num6 > 0)
            {
                this.Target = AmqpCodec.DecodeObject(buffer);
            }
            int num7 = count;

            count = num7 - 1;
            if (num7 > 0)
            {
                this.Unsettled = AmqpCodec.DecodeMap(buffer);
            }
            int num8 = count;

            count = num8 - 1;
            if (num8 > 0)
            {
                this.IncompleteUnsettled = AmqpCodec.DecodeBoolean(buffer);
            }
            int num9 = count;

            count = num9 - 1;
            if (num9 > 0)
            {
                this.InitialDeliveryCount = AmqpCodec.DecodeUInt(buffer);
            }
            int num10 = count;

            count = num10 - 1;
            if (num10 > 0)
            {
                this.MaxMessageSize = AmqpCodec.DecodeULong(buffer);
            }
            int num11 = count;

            count = num11 - 1;
            if (num11 > 0)
            {
                this.OfferedCapabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
            int num12 = count;

            count = num12 - 1;
            if (num12 > 0)
            {
                this.DesiredCapabilities = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
            }
            int num13 = count;

            count = num13 - 1;
            if (num13 > 0)
            {
                this.Properties = AmqpCodec.DecodeMap <Microsoft.ServiceBus.Messaging.Amqp.Framing.Fields>(buffer);
            }
        }