コード例 #1
0
ファイル: SomeUnion.cs プロジェクト: ste93/yarp
        public static async Task <SomeUnion> ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                SomeUnion 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.Map)
                        {
                            Dictionary <global::ThriftTest.Numberz, long> temp;
                            {
                                TMap _map59 = await iprot.ReadMapBeginAsync(cancellationToken);

                                temp = new Dictionary <global::ThriftTest.Numberz, long>(_map59.Count);
                                for (int _i60 = 0; _i60 < _map59.Count; ++_i60)
                                {
                                    global::ThriftTest.Numberz _key61;
                                    long _val62;
                                    _key61 = (global::ThriftTest.Numberz) await iprot.ReadI32Async(cancellationToken);

                                    _val62 = await iprot.ReadI64Async(cancellationToken);

                                    temp[_key61] = _val62;
                                }
                                await iprot.ReadMapEndAsync(cancellationToken);
                            }
                            retval = new map_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            string temp;
                            temp = await iprot.ReadStringAsync(cancellationToken);

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

                            retval = new ___undefined();
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            int temp;
                            temp = await iprot.ReadI32Async(cancellationToken);

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

                            retval = new ___undefined();
                        }
                        break;

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

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

                            retval = new ___undefined();
                        }
                        break;

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

                            retval = new insanity_thing(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();
            }
        }
コード例 #2
0
ファイル: SomeUnion.cs プロジェクト: ste93/yarp
 public xtruct_thing(global::ThriftTest.Xtruct3 data) : base(4)
 {
     this._data = data;
 }