public static ArraySegment <byte> Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode, bool copy) { int num; ArraySegment <byte> nums; if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(AmqpConstants.NullBinary); } } AmqpEncoding.ReadCount(buffer, formatCode, 160, 176, out num); if (num == 0) { return(AmqpConstants.EmptyBinary); } if (!copy) { nums = new ArraySegment <byte>(buffer.Buffer, buffer.Offset, num); } else { byte[] numArray = new byte[num]; Buffer.BlockCopy(buffer.Buffer, buffer.Offset, numArray, 0, num); nums = new ArraySegment <byte>(numArray, 0, num); } buffer.Complete(num); return(nums); }
public static byte?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } return(new byte?(AmqpBitConverter.ReadUByte(buffer))); }
public static int?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } int offset = buffer.Offset; Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] formatCodeArray = new Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] { 113, 84 }; EncodingBase.VerifyFormatCode(formatCode, offset, formatCodeArray); return(new int?((formatCode == 84 ? (int)AmqpBitConverter.ReadByte(buffer) : AmqpBitConverter.ReadInt(buffer)))); }
static int GetEncodeWidth(AmqpMap value) { return(AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count * 2, value.ValueSize)); }
public static bool?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } int offset = buffer.Offset; Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] formatCodeArray = new Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] { 86, 66, 65 }; EncodingBase.VerifyFormatCode(formatCode, offset, formatCodeArray); if (formatCode == 86) { return(new bool?(AmqpBitConverter.ReadUByte(buffer) != 0)); } return(new bool?((formatCode == 65 ? true : false))); }
public static string Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { int num; System.Text.Encoding uTF8; if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } if (formatCode != 161) { if (formatCode != 177) { throw AmqpEncoding.GetEncodingException(SRAmqp.AmqpInvalidFormatCode(formatCode, buffer.Offset)); } num = (int)AmqpBitConverter.ReadUInt(buffer); uTF8 = System.Text.Encoding.UTF8; } else { num = AmqpBitConverter.ReadUByte(buffer); uTF8 = System.Text.Encoding.UTF8; } string str = uTF8.GetString(buffer.Buffer, buffer.Offset, num); buffer.Complete(num); return(str); }
public static AmqpSymbol Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { int num; if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(new AmqpSymbol()); } } AmqpEncoding.ReadCount(buffer, formatCode, 163, 179, out num); string str = System.Text.Encoding.ASCII.GetString(buffer.Buffer, buffer.Offset, num); buffer.Complete(num); return(new AmqpSymbol(str)); }
public static DateTime?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } return(new DateTime?(TimeStampEncoding.ToDateTime(AmqpBitConverter.ReadLong(buffer)))); }
public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode) { if (formatCode == 0 && (formatCode = AmqpEncoding.ReadFormatCode(buffer)) == FormatCode.Null) { return(null); } int size = 0; int count = 0; AmqpEncoding.ReadSizeAndCount(buffer, formatCode, FormatCode.Array8, FormatCode.Array32, out size, out count); formatCode = AmqpEncoding.ReadFormatCode(buffer); Array array = null; switch (formatCode) { case FormatCode.Boolean: array = ArrayEncoding.Decode <bool>(buffer, size, count, formatCode); break; case FormatCode.UByte: array = ArrayEncoding.Decode <byte>(buffer, size, count, formatCode); break; case FormatCode.UShort: array = ArrayEncoding.Decode <ushort>(buffer, size, count, formatCode); break; case FormatCode.UInt: case FormatCode.SmallUInt: array = ArrayEncoding.Decode <uint>(buffer, size, count, formatCode); break; case FormatCode.ULong: case FormatCode.SmallULong: array = ArrayEncoding.Decode <ulong>(buffer, size, count, formatCode); break; case FormatCode.Byte: array = ArrayEncoding.Decode <sbyte>(buffer, size, count, formatCode); break; case FormatCode.Short: array = ArrayEncoding.Decode <short>(buffer, size, count, formatCode); break; case FormatCode.Int: case FormatCode.SmallInt: array = ArrayEncoding.Decode <int>(buffer, size, count, formatCode); break; case FormatCode.Long: case FormatCode.SmallLong: array = ArrayEncoding.Decode <long>(buffer, size, count, formatCode); break; case FormatCode.Float: array = ArrayEncoding.Decode <float>(buffer, size, count, formatCode); break; case FormatCode.Double: array = ArrayEncoding.Decode <double>(buffer, size, count, formatCode); break; case FormatCode.Char: array = ArrayEncoding.Decode <char>(buffer, size, count, formatCode); break; case FormatCode.TimeStamp: array = ArrayEncoding.Decode <DateTime>(buffer, size, count, formatCode); break; case FormatCode.Uuid: array = ArrayEncoding.Decode <Guid>(buffer, size, count, formatCode); break; case FormatCode.Binary32: case FormatCode.Binary8: array = ArrayEncoding.Decode <ArraySegment <byte> >(buffer, size, count, formatCode); break; case FormatCode.String32Utf8: case FormatCode.String8Utf8: array = ArrayEncoding.Decode <string>(buffer, size, count, formatCode); break; case FormatCode.Symbol32: case FormatCode.Symbol8: array = ArrayEncoding.Decode <AmqpSymbol>(buffer, size, count, formatCode); break; case FormatCode.List32: case FormatCode.List8: array = ArrayEncoding.Decode <IList>(buffer, size, count, formatCode); break; case FormatCode.Map32: case FormatCode.Map8: array = ArrayEncoding.Decode <AmqpMap>(buffer, size, count, formatCode); break; case FormatCode.Array32: case FormatCode.Array8: array = ArrayEncoding.Decode <Array>(buffer, size, count, formatCode); break; default: throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } ; return(array); }
public static decimal?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } return(new decimal?(DecimalEncoding.DecodeValue(buffer, formatCode))); }
public static int GetEncodeSize(ArraySegment <byte> value) { return(value.Array == null ? FixedWidth.NullEncoded : FixedWidth.FormatCode + AmqpEncoding.GetEncodeWidthBySize(value.Count) + value.Count); }
public override object DecodeObject(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } int num = 0; int num1 = 0; AmqpEncoding.ReadSizeAndCount(buffer, formatCode, 224, 240, out num, out num1); formatCode = AmqpEncoding.ReadFormatCode(buffer); Array arrays = null; byte num2 = formatCode; if (num2 > 152) { if (num2 > 193) { switch (num2) { case 208: { arrays = ArrayEncoding.Decode <IList>(buffer, num, num1, formatCode); return(arrays); } case 209: { break; } default: { if (num2 == 224 || num2 == 240) { arrays = ArrayEncoding.Decode <Array>(buffer, num, num1, formatCode); return(arrays); } else { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } } } } else { switch (num2) { case 160: { arrays = ArrayEncoding.Decode <ArraySegment <byte> >(buffer, num, num1, formatCode); return(arrays); } case 161: { arrays = ArrayEncoding.Decode <string>(buffer, num, num1, formatCode); return(arrays); } case 162: { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } case 163: { arrays = ArrayEncoding.Decode <AmqpSymbol>(buffer, num, num1, formatCode); return(arrays); } default: { switch (num2) { case 176: { arrays = ArrayEncoding.Decode <ArraySegment <byte> >(buffer, num, num1, formatCode); return(arrays); } case 177: { arrays = ArrayEncoding.Decode <string>(buffer, num, num1, formatCode); return(arrays); } case 178: { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } case 179: { arrays = ArrayEncoding.Decode <AmqpSymbol>(buffer, num, num1, formatCode); return(arrays); } default: { switch (num2) { case 192: { arrays = ArrayEncoding.Decode <IList>(buffer, num, num1, formatCode); return(arrays); } case 193: { break; } default: { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } } break; } } break; } } } arrays = ArrayEncoding.Decode <AmqpMap>(buffer, num, num1, formatCode); } else { if (num2 > 97) { switch (num2) { case 112: { arrays = ArrayEncoding.Decode <uint>(buffer, num, num1, formatCode); return(arrays); } case 113: { arrays = ArrayEncoding.Decode <int>(buffer, num, num1, formatCode); return(arrays); } case 114: { arrays = ArrayEncoding.Decode <float>(buffer, num, num1, formatCode); return(arrays); } case 115: { arrays = ArrayEncoding.Decode <char>(buffer, num, num1, formatCode); return(arrays); } default: { switch (num2) { case 128: { arrays = ArrayEncoding.Decode <ulong>(buffer, num, num1, formatCode); return(arrays); } case 129: { break; } case 130: { arrays = ArrayEncoding.Decode <double>(buffer, num, num1, formatCode); return(arrays); } case 131: { arrays = ArrayEncoding.Decode <DateTime>(buffer, num, num1, formatCode); return(arrays); } default: { if (num2 == 152) { arrays = ArrayEncoding.Decode <Guid>(buffer, num, num1, formatCode); return(arrays); } else { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } } } break; } } } else { switch (num2) { case 80: { arrays = ArrayEncoding.Decode <byte>(buffer, num, num1, formatCode); return(arrays); } case 81: { arrays = ArrayEncoding.Decode <sbyte>(buffer, num, num1, formatCode); return(arrays); } case 82: { arrays = ArrayEncoding.Decode <uint>(buffer, num, num1, formatCode); return(arrays); } case 83: { arrays = ArrayEncoding.Decode <ulong>(buffer, num, num1, formatCode); return(arrays); } case 84: { arrays = ArrayEncoding.Decode <int>(buffer, num, num1, formatCode); return(arrays); } case 85: { break; } case 86: { arrays = ArrayEncoding.Decode <bool>(buffer, num, num1, formatCode); return(arrays); } default: { switch (num2) { case 96: { arrays = ArrayEncoding.Decode <ushort>(buffer, num, num1, formatCode); return(arrays); } case 97: { arrays = ArrayEncoding.Decode <short>(buffer, num, num1, formatCode); return(arrays); } default: { throw new NotSupportedException(SRClient.NotSupportFrameCode(formatCode)); } } break; } } } arrays = ArrayEncoding.Decode <long>(buffer, num, num1, formatCode); } return(arrays); }
public static T[] Decode <T>(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { int num; int num1; if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } AmqpEncoding.ReadSizeAndCount(buffer, formatCode, 224, 240, out num, out num1); formatCode = AmqpEncoding.ReadFormatCode(buffer); return(ArrayEncoding.Decode <T>(buffer, num, num1, formatCode)); }
public static int GetEncodeSize(AmqpSymbol value) { return(value.Value == null ? FixedWidth.NullEncoded : FixedWidth.FormatCode + AmqpEncoding.GetEncodeWidthBySize(value.ValueSize) + value.ValueSize); }
public static char?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } string str = char.ConvertFromUtf32(AmqpBitConverter.ReadInt(buffer)); if (str.Length > 1) { throw new ArgumentOutOfRangeException(SRClient.ErroConvertingToChar); } return(new char?(str[0])); }
public static ulong?Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } int offset = buffer.Offset; Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] formatCodeArray = new Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode[] { 128, 83, 68 }; EncodingBase.VerifyFormatCode(formatCode, offset, formatCodeArray); if (formatCode == 68) { return(new ulong?((ulong)0)); } return(new ulong?((formatCode == 83 ? (ulong)AmqpBitConverter.ReadUByte(buffer) : AmqpBitConverter.ReadULong(buffer)))); }
public static IList Decode(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode) { int num; int num1; if (formatCode == 0) { Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode1 = AmqpEncoding.ReadFormatCode(buffer); formatCode = formatCode1; if (formatCode1 == 64) { return(null); } } IList objs = new List <object>(); if (formatCode == 69) { return(objs); } AmqpEncoding.ReadSizeAndCount(buffer, formatCode, 192, 208, out num, out num1); while (num1 > 0) { objs.Add(AmqpEncoding.DecodeObject(buffer)); num1--; } return(objs); }