/// <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.Challenge = AmqpCodec.DecodeBinary(buffer); } }
public ArraySegment <byte> Bytes_Decode_MAA() { EncodedBytes1MBBuffer.Seek(0); var result = AmqpCodec.DecodeBinary(EncodedBytes1MBBuffer); return(result); }
protected override void OnDecode(ByteBuffer buffer, int count) { SaslCode?nullable; int num = count; count = num - 1; if (num > 0) { byte?nullable1 = AmqpCodec.DecodeUByte(buffer); if (nullable1.HasValue) { nullable = new SaslCode?((SaslCode)nullable1.GetValueOrDefault()); } else { nullable = null; } this.OutcomeCode = nullable; } int num1 = count; count = num1 - 1; if (num1 > 0) { this.AdditionalData = AmqpCodec.DecodeBinary(buffer); } }
internal override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.TxnId = AmqpCodec.DecodeBinary(buffer); } }
/// <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); } }
protected override void OnDecode(ByteBuffer buffer, int count) { int num = count; count = num - 1; if (num > 0) { this.TxnId = AmqpCodec.DecodeBinary(buffer); } }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.TxnId = AmqpCodec.DecodeBinary(buffer); } if (count-- > 0) { this.Fail = AmqpCodec.DecodeBoolean(buffer); } }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.TxnId = AmqpCodec.DecodeBinary(buffer); } if (count-- > 0) { this.Outcome = (Outcome)AmqpCodec.DecodeAmqpDescribed(buffer); } }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.OutcomeCode = (SaslCode?)AmqpCodec.DecodeUByte(buffer); } if (count-- > 0) { this.AdditionalData = AmqpCodec.DecodeBinary(buffer); } }
/// <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.Mechanism = AmqpCodec.DecodeSymbol(buffer); } if (count-- > 0) { this.InitialResponse = AmqpCodec.DecodeBinary(buffer); } if (count-- > 0) { this.HostName = AmqpCodec.DecodeString(buffer); } }
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.Outcome = (Microsoft.ServiceBus.Messaging.Amqp.Framing.Outcome)AmqpCodec.DecodeAmqpDescribed(buffer); } }
public void ReadReference() { { var buffer = new ByteBuffer(_encodedBytes_1MB, 0, _encodedBytes_1MB.Length); buffer.Seek(0); var result = AmqpCodec.DecodeBinary(buffer); var decoded = result.AsMemory(); decoded.Span.SequenceEqual(_randomBytes1_MB); } { var buffer = new ByteBuffer(_encodedInt32_1M, 0, _encodedInt32_1M.Length); buffer.Seek(0); var result = AmqpCodec.DecodeArray <Int32>(buffer); var decoded = result.AsMemory(); decoded.Span.SequenceEqual(_randomInt32_1M); } }
protected override void OnDecode(ByteBuffer buffer, int count) { int num = count; count = num - 1; if (num > 0) { this.Mechanism = AmqpCodec.DecodeSymbol(buffer); } int num1 = count; count = num1 - 1; if (num1 > 0) { this.InitialResponse = AmqpCodec.DecodeBinary(buffer); } int num2 = count; count = num2 - 1; if (num2 > 0) { this.HostName = AmqpCodec.DecodeString(buffer); } }
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."); }
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); } }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.MessageId = MessageId.Decode(buffer); } if (count-- > 0) { this.UserId = AmqpCodec.DecodeBinary(buffer); } if (count-- > 0) { this.To = Address.Decode(buffer); } if (count-- > 0) { this.Subject = AmqpCodec.DecodeString(buffer); } if (count-- > 0) { this.ReplyTo = Address.Decode(buffer); } if (count-- > 0) { this.CorrelationId = MessageId.Decode(buffer); } if (count-- > 0) { this.ContentType = AmqpCodec.DecodeSymbol(buffer); } if (count-- > 0) { this.ContentEncoding = AmqpCodec.DecodeSymbol(buffer); } if (count-- > 0) { this.AbsoluteExpiryTime = AmqpCodec.DecodeTimeStamp(buffer); } if (count-- > 0) { this.CreationTime = AmqpCodec.DecodeTimeStamp(buffer); } if (count-- > 0) { this.GroupId = AmqpCodec.DecodeString(buffer); } if (count-- > 0) { this.GroupSequence = AmqpCodec.DecodeUInt(buffer); } if (count-- > 0) { this.ReplyToGroupId = AmqpCodec.DecodeString(buffer); } }
protected override void OnDecode(ByteBuffer buffer, int count) { int num = count; count = num - 1; if (num > 0) { this.MessageId = Microsoft.ServiceBus.Messaging.Amqp.Framing.MessageId.Decode(buffer); } int num1 = count; count = num1 - 1; if (num1 > 0) { this.UserId = AmqpCodec.DecodeBinary(buffer); } int num2 = count; count = num2 - 1; if (num2 > 0) { this.To = Address.Decode(buffer); } int num3 = count; count = num3 - 1; if (num3 > 0) { this.Subject = AmqpCodec.DecodeString(buffer); } int num4 = count; count = num4 - 1; if (num4 > 0) { this.ReplyTo = Address.Decode(buffer); } int num5 = count; count = num5 - 1; if (num5 > 0) { this.CorrelationId = Microsoft.ServiceBus.Messaging.Amqp.Framing.MessageId.Decode(buffer); } int num6 = count; count = num6 - 1; if (num6 > 0) { this.ContentType = AmqpCodec.DecodeSymbol(buffer); } int num7 = count; count = num7 - 1; if (num7 > 0) { this.ContentEncoding = AmqpCodec.DecodeSymbol(buffer); } int num8 = count; count = num8 - 1; if (num8 > 0) { this.AbsoluteExpiryTime = AmqpCodec.DecodeTimeStamp(buffer); } int num9 = count; count = num9 - 1; if (num9 > 0) { this.CreationTime = AmqpCodec.DecodeTimeStamp(buffer); } int num10 = count; count = num10 - 1; if (num10 > 0) { this.GroupId = AmqpCodec.DecodeString(buffer); } int num11 = count; count = num11 - 1; if (num11 > 0) { this.GroupSequence = AmqpCodec.DecodeUInt(buffer); } int num12 = count; count = num12 - 1; if (num12 > 0) { this.ReplyToGroupId = AmqpCodec.DecodeString(buffer); } }