Ejemplo n.º 1
0
        public void Read(TProtocol iprot)
        {
            bool   isset_id         = false;
            bool   isset_user       = false;
            bool   isset_info       = false;
            bool   isset_createTime = false;
            bool   isset_status     = false;
            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();
                        isset_id = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        User = new com.imd.user.thrift.User();
                        User.Read(iprot);
                        isset_user = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        Info = new com.imd.doc.thrift.Info();
                        Info.Read(iprot);
                        isset_info = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I64)
                    {
                        CreateTime       = iprot.ReadI64();
                        isset_createTime = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.I64)
                    {
                        UpdateTime = iprot.ReadI64();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.Bool)
                    {
                        Status       = iprot.ReadBool();
                        isset_status = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_id)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_user)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_info)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_createTime)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_status)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Ejemplo n.º 2
0
        public void Read(TProtocol iprot)
        {
            bool   isset_status = false;
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.I32)
                    {
                        Status       = (com.imd.doc.thrift.Status)iprot.ReadI32();
                        isset_status = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            Users = new List <com.imd.user.thrift.User>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                com.imd.user.thrift.User _elem2 = new com.imd.user.thrift.User();
                                _elem2 = new com.imd.user.thrift.User();
                                _elem2.Read(iprot);
                                Users.Add(_elem2);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_status)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }