Example #1
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            Id = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            CategoryId = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            SortingPriority = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.List)
                        {
                            {
                                Children = new List <CategoryNode>();
                                TList _list0 = iprot.ReadListBegin();
                                for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                                {
                                    CategoryNode _elem2;
                                    _elem2 = new CategoryNode();
                                    _elem2.Read(iprot);
                                    Children.Add(_elem2);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Example #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            CateNode = new CategoryNode();
                            CateNode.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Map)
                        {
                            {
                                SettingCategories = new Dictionary <string, Ruyi.SDK.CommonType.SettingCategory>();
                                TMap _map8 = iprot.ReadMapBegin();
                                for (int _i9 = 0; _i9 < _map8.Count; ++_i9)
                                {
                                    string _key10;
                                    Ruyi.SDK.CommonType.SettingCategory _val11;
                                    _key10 = iprot.ReadString();
                                    _val11 = new Ruyi.SDK.CommonType.SettingCategory();
                                    _val11.Read(iprot);
                                    SettingCategories[_key10] = _val11;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Map)
                        {
                            {
                                SettingItems = new Dictionary <string, Ruyi.SDK.CommonType.SettingItem>();
                                TMap _map12 = iprot.ReadMapBegin();
                                for (int _i13 = 0; _i13 < _map12.Count; ++_i13)
                                {
                                    string _key14;
                                    Ruyi.SDK.CommonType.SettingItem _val15;
                                    _key14 = iprot.ReadString();
                                    _val15 = new Ruyi.SDK.CommonType.SettingItem();
                                    _val15.Read(iprot);
                                    SettingItems[_key14] = _val15;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Example #3
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)
                        {
                            CateNode = new CategoryNode();
                            await CateNode.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Map)
                        {
                            {
                                SettingCategories = new Dictionary <string, Ruyi.SDK.CommonType.SettingCategory>();
                                TMap _map8 = await iprot.ReadMapBeginAsync(cancellationToken);

                                for (int _i9 = 0; _i9 < _map8.Count; ++_i9)
                                {
                                    string _key10;
                                    Ruyi.SDK.CommonType.SettingCategory _val11;
                                    _key10 = await iprot.ReadStringAsync(cancellationToken);

                                    _val11 = new Ruyi.SDK.CommonType.SettingCategory();
                                    await _val11.ReadAsync(iprot, cancellationToken);

                                    SettingCategories[_key10] = _val11;
                                }
                                await iprot.ReadMapEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Map)
                        {
                            {
                                SettingItems = new Dictionary <string, Ruyi.SDK.CommonType.SettingItem>();
                                TMap _map12 = await iprot.ReadMapBeginAsync(cancellationToken);

                                for (int _i13 = 0; _i13 < _map12.Count; ++_i13)
                                {
                                    string _key14;
                                    Ruyi.SDK.CommonType.SettingItem _val15;
                                    _key14 = await iprot.ReadStringAsync(cancellationToken);

                                    _val15 = new Ruyi.SDK.CommonType.SettingItem();
                                    await _val15.ReadAsync(iprot, cancellationToken);

                                    SettingItems[_key14] = _val15;
                                }
                                await iprot.ReadMapEndAsync(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();
            }
        }
Example #4
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.String)
                        {
                            Id = await iprot.ReadStringAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            CategoryId = await iprot.ReadStringAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            SortingPriority = await iprot.ReadI32Async(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.List)
                        {
                            {
                                Children = new List <CategoryNode>();
                                TList _list0 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                                {
                                    CategoryNode _elem2;
                                    _elem2 = new CategoryNode();
                                    await _elem2.ReadAsync(iprot, cancellationToken);

                                    Children.Add(_elem2);
                                }
                                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();
            }
        }