示例#1
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                await iprot.ReadStructBeginAsync(cancellationToken);

                while (true)
                {
                    field = await iprot.ReadFieldBeginAsync(cancellationToken);

                    if (field.Type == TType.Stop)
                    {
                        break;
                    }

                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            Play = new PlayMsg();
                            await Play.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            Pause = new PauseMsg();
                            await Pause.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Stop = new StopMsg();
                            await Stop.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            AddPath = new AddPathMsg();
                            await AddPath.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            RemovePath = new RemovePathMsg();
                            await RemovePath.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            Query = new QueryMsg();
                            await Query.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
示例#2
0
        public static async Task <RequestMsg> ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                RequestMsg retval;
                await iprot.ReadStructBeginAsync(cancellationToken);

                TField field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    retval = new ___undefined();
                }
                else
                {
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            PlayMsg temp;
                            temp = new PlayMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Play(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            PauseMsg temp;
                            temp = new PauseMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Pause(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            StopMsg temp;
                            temp = new StopMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Stop(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            AddPathMsg temp;
                            temp = new AddPathMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new AddPath(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            RemovePathMsg temp;
                            temp = new RemovePathMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new RemovePath(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            QueryMsg temp;
                            temp = new QueryMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Query(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        retval = new ___undefined();
                        break;
                    }
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    if ((await iprot.ReadFieldBeginAsync(cancellationToken)).Type != TType.Stop)
                    {
                        throw new TProtocolException(TProtocolException.INVALID_DATA);
                    }
                }
                await iprot.ReadStructEndAsync(cancellationToken);

                return(retval);
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }