示例#1
0
        public static T[] Decode <T>(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);
            return(ArrayEncoding.Decode <T>(buffer, size, count, formatCode));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }