Beispiel #1
0
        public async global::System.Threading.Tasks.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.I32)
                        {
                            ErrorCode = await iprot.ReadI32Async(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            Struct_thing = new global::ThriftTest.Xtruct();
                            await Struct_thing.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();
            }
        }
Beispiel #2
0
        public async global::System.Threading.Tasks.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.Map)
                        {
                            {
                                TMap _map11 = await iprot.ReadMapBeginAsync(cancellationToken);

                                UserMap = new Dictionary <global::ThriftTest.Numberz, long>(_map11.Count);
                                for (int _i12 = 0; _i12 < _map11.Count; ++_i12)
                                {
                                    global::ThriftTest.Numberz _key13;
                                    long _val14;
                                    _key13 = (global::ThriftTest.Numberz) await iprot.ReadI32Async(cancellationToken);

                                    _val14 = await iprot.ReadI64Async(cancellationToken);

                                    UserMap[_key13] = _val14;
                                }
                                await iprot.ReadMapEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                TList _list15 = await iprot.ReadListBeginAsync(cancellationToken);

                                Xtructs = new List <global::ThriftTest.Xtruct>(_list15.Count);
                                for (int _i16 = 0; _i16 < _list15.Count; ++_i16)
                                {
                                    global::ThriftTest.Xtruct _elem17;
                                    _elem17 = new global::ThriftTest.Xtruct();
                                    await _elem17.ReadAsync(iprot, cancellationToken);

                                    Xtructs.Add(_elem17);
                                }
                                await iprot.ReadListEndAsync(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();
            }
        }