コード例 #1
0
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        ObjPtr = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        X = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I16)
                    {
                        Y = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #2
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.I16)
                    {
                        this.year         = iprot.ReadI16();
                        this.__isset.year = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Byte)
                    {
                        this.month         = iprot.ReadByte();
                        this.__isset.month = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Byte)
                    {
                        this.day         = iprot.ReadByte();
                        this.__isset.day = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #3
0
        public void Read(TProtocol iprot)
        {
            bool   isset_unscaled = false;
            bool   isset_scale    = 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)
                    {
                        Unscaled       = iprot.ReadBinary();
                        isset_unscaled = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I16)
                    {
                        Scale       = iprot.ReadI16();
                        isset_scale = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_unscaled)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_scale)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
コード例 #4
0
ファイル: RecList.cs プロジェクト: xgray/dotnet
        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)
                        {
                            Nextitem = new RecList();
                            Nextitem.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I16)
                        {
                            Item = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #5
0
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        this.type         = (PropertyType)iprot.ReadI32();
                        this.__isset.type = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        this.type_length         = iprot.ReadI16();
                        this.__isset.type_length = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #6
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_commission = 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.I16)
                        {
                            Commission       = iprot.ReadI16();
                            isset_commission = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_commission)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Commission not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #7
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Bool)
                    {
                        Retval = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        O_value = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #8
0
        public void Read(TProtocol iprot)
        {
            bool   isset_values = false;
            bool   isset_nulls  = 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.List)
                    {
                        {
                            Values = new List <short>();
                            TList _list35 = iprot.ReadListBegin();
                            for (int _i36 = 0; _i36 < _list35.Count; ++_i36)
                            {
                                short _elem37 = 0;
                                _elem37 = iprot.ReadI16();
                                Values.Add(_elem37);
                            }
                            iprot.ReadListEnd();
                        }
                        isset_values = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.String)
                    {
                        Nulls       = iprot.ReadBinary();
                        isset_nulls = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_values)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_nulls)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
コード例 #9
0
ファイル: TGetInfoValue.cs プロジェクト: s2shape/HiveThrift
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        StringValue = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        SmallIntValue = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

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

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

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #10
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.I32)
                        {
                            Ipv4 = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I16)
                        {
                            Port = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #11
0
		public static void Skip(TProtocol prot, TType type)
		{
			switch (type)
			{
				case TType.Bool:
					prot.ReadBool();
					break;
				case TType.Byte:
					prot.ReadByte();
					break;
				case TType.I16:
					prot.ReadI16();
					break;
				case TType.I32:
					prot.ReadI32();
					break;
				case TType.I64:
					prot.ReadI64();
					break;
				case TType.Double:
					prot.ReadDouble();
					break;
				case TType.String:
					// Don't try to decode the string, just skip it.
					prot.ReadBinary();
					break;
				case TType.Struct:
					prot.ReadStructBegin();
					while (true)
					{
						TField field = prot.ReadFieldBegin();
						if (field.Type == TType.Stop)
						{
							break;
						}
						Skip(prot, field.Type);
						prot.ReadFieldEnd();
					}
					prot.ReadStructEnd();
					break;
				case TType.Map:
					TMap map = prot.ReadMapBegin();
					for (int i = 0; i < map.Count; i++)
					{
						Skip(prot, map.KeyType);
						Skip(prot, map.ValueType);
					}
					prot.ReadMapEnd();
					break;
				case TType.Set:
					TSet set = prot.ReadSetBegin();
					for (int i = 0; i < set.Count; i++)
					{
						Skip(prot, set.ElementType);
					}
					prot.ReadSetEnd();
					break;
				case TType.List:
					TList list = prot.ReadListBegin();
					for (int i = 0; i < list.Count; i++)
					{
						Skip(prot, list.ElementType);
					}
					prot.ReadListEnd();
					break;
			}
		}
コード例 #12
0
ファイル: Resource.cs プロジェクト: trayburn/EverGTD
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        this.guid         = iprot.ReadString();
                        this.__isset.guid = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        this.data = new Data();
                        this.data.Read(iprot);
                        this.__isset.data = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.String)
                    {
                        this.mime         = iprot.ReadString();
                        this.__isset.mime = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.I16)
                    {
                        this.width         = iprot.ReadI16();
                        this.__isset.width = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.I16)
                    {
                        this.height         = iprot.ReadI16();
                        this.__isset.height = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.I16)
                    {
                        this.duration         = iprot.ReadI16();
                        this.__isset.duration = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 8:
                    if (field.Type == TType.Bool)
                    {
                        this.active         = iprot.ReadBool();
                        this.__isset.active = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 9:
                    if (field.Type == TType.Struct)
                    {
                        this.recognition = new Data();
                        this.recognition.Read(iprot);
                        this.__isset.recognition = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 11:
                    if (field.Type == TType.Struct)
                    {
                        this.attributes = new ResourceAttributes();
                        this.attributes.Read(iprot);
                        this.__isset.attributes = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 12:
                    if (field.Type == TType.I32)
                    {
                        this.updateSequenceNum         = iprot.ReadI32();
                        this.__isset.updateSequenceNum = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 13:
                    if (field.Type == TType.Struct)
                    {
                        this.alternateData = new Data();
                        this.alternateData.Read(iprot);
                        this.__isset.alternateData = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #13
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.I16)
                    {
                        Register_flag = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.Map)
                    {
                        {
                            Service2node_id = new Dictionary <string, long>();
                            TMap _map4 = iprot.ReadMapBegin();
                            for (int _i5 = 0; _i5 < _map4.Count; ++_i5)
                            {
                                string _key6;
                                long   _val7;
                                _key6 = iprot.ReadString();
                                _val7 = iprot.ReadI64();
                                Service2node_id[_key6] = _val7;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #14
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.Byte)
                        {
                            Days = iprot.ReadByte();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I16)
                        {
                            StartMinutes = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I16)
                        {
                            DurationMinutes = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #15
0
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        Path = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.Bool)
                    {
                        Isdir = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I16)
                    {
                        Block_replication = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

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

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

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

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #16
0
        private static object ReadFieldValue(this TProtocol protocol, TType thriftType, Type targetType)
        {
            switch (thriftType)
            {
            //case TType.Void:
            //    return null;
            case TType.Bool:
                return(protocol.ReadBool());

            case TType.Byte:
                return(protocol.ReadByte());

            case TType.I16:
                return(protocol.ReadI16());

            case TType.I32:
                return(protocol.ReadI32());

            case TType.I64:
                return(protocol.ReadI64());

            case TType.Double:
                return(protocol.ReadDouble());

            case TType.String:
                if (targetType == typeof(string) ||
                    targetType == typeof(Guid))
                {
                    return(protocol.ReadString());
                }
                else
                {
                    return(protocol.ReadBinary());
                }

            case TType.Struct:
                return(protocol.ReadStruct(targetType));

            case TType.List:
                var result = Activator.CreateInstance(targetType);
                var list   = result as IList;

                // 只考虑泛型list
                if (targetType.IsGenericType)
                {
                    var genericType = targetType.GetGenericArguments()[0];
                    var tlist       = protocol.ReadListBegin();
                    for (int i = 0; i < tlist.Count; i++)
                    {
                        var item = protocol.ReadFieldValue(genericType.ToThriftType(), genericType);
                        list.Add(item);
                    }
                    protocol.ReadListEnd();
                }

                return(result);

            case TType.Map:
                var resultMap = Activator.CreateInstance(targetType);
                var dic       = resultMap as IDictionary;

                // 只考虑泛型map
                if (targetType.IsGenericType)
                {
                    var genericTypes     = targetType.GetGenericArguments();
                    var genericTypeKey   = genericTypes[0];
                    var genericTypeValue = genericTypes[1];

                    var tmap = protocol.ReadMapBegin();
                    for (int i = 0; i < tmap.Count; i++)
                    {
                        var key   = protocol.ReadFieldValue(genericTypeKey.ToThriftType(), genericTypeKey);
                        var value = protocol.ReadFieldValue(genericTypeValue.ToThriftType(), genericTypeValue);
                        dic.Add(key, value);
                    }
                    protocol.ReadMapEnd();
                }

                return(resultMap);

            default:
                TProtocolUtil.Skip(protocol, thriftType);
                return(null);
            }
        }
コード例 #17
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.I16)
                    {
                        Left = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        Top = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I16)
                    {
                        Width = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I16)
                    {
                        Height = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #18
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)
                    {
                        Timestamp = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        Version = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 4:
                    if (field.Type == TType.List)
                    {
                        {
                            ExtraList = new List <TimNode>();
                            TList _list9 = iprot.ReadListBegin();
                            for (int _i10 = 0; _i10 < _list9.Count; ++_i10)
                            {
                                TimNode _elem11;
                                _elem11 = new TimNode();
                                _elem11.Read(iprot);
                                ExtraList.Add(_elem11);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

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

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
コード例 #19
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)
                    {
                        Ap_id = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I16)
                    {
                        Left_or_right = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.Double)
                    {
                        Distance = iprot.ReadDouble();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            Points = new List <string>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                string _elem2;
                                _elem2 = iprot.ReadString();
                                Points.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();
        }
    }
コード例 #20
0
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        UserId = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

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

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

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

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

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

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

                case 10:
                    if (field.Type == TType.I16)
                    {
                        StatusContactType = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #21
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)
                        {
                            DeviceId = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

                    case 4:
                        if (field.Type == TType.Byte)
                        {
                            LeftTrigger = iprot.ReadByte();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Byte)
                        {
                            RightTrigger = iprot.ReadByte();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.I16)
                        {
                            LeftThumbX = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.I16)
                        {
                            LeftThumbY = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.I16)
                        {
                            RightThumbX = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.I16)
                        {
                            RightThumbY = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #22
0
        public static void Skip(TProtocol prot, TType type)
        {
            prot.IncrementRecursionDepth();
            try
            {
                switch (type)
                {
                case TType.Bool:
                    prot.ReadBool();
                    break;

                case TType.Byte:
                    prot.ReadByte();
                    break;

                case TType.I16:
                    prot.ReadI16();
                    break;

                case TType.I32:
                    prot.ReadI32();
                    break;

                case TType.I64:
                    prot.ReadI64();
                    break;

                case TType.Double:
                    prot.ReadDouble();
                    break;

                case TType.String:
                    // Don't try to decode the string, just skip it.
                    prot.ReadBinary();
                    break;

                case TType.Struct:
                    prot.ReadStructBegin();
                    while (true)
                    {
                        var field = prot.ReadFieldBegin();
                        if (field.Type == TType.Stop)
                        {
                            break;
                        }
                        Skip(prot, field.Type);
                        prot.ReadFieldEnd();
                    }
                    prot.ReadStructEnd();
                    break;

                case TType.Map:
                    var map = prot.ReadMapBegin();
                    for (var i = 0; i < map.Count; i++)
                    {
                        Skip(prot, map.KeyType);
                        Skip(prot, map.ValueType);
                    }
                    prot.ReadMapEnd();
                    break;

                case TType.Set:
                    var set = prot.ReadSetBegin();
                    for (var i = 0; i < set.Count; i++)
                    {
                        Skip(prot, set.ElementType);
                    }
                    prot.ReadSetEnd();
                    break;

                case TType.List:
                    var list = prot.ReadListBegin();
                    for (var i = 0; i < list.Count; i++)
                    {
                        Skip(prot, list.ElementType);
                    }
                    prot.ReadListEnd();
                    break;

                default:
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "Unknown data type " + type.ToString("d"));
                }
            }
            finally
            {
                prot.DecrementRecursionDepth();
            }
        }
コード例 #23
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_threadId = 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)
                    {
                        ThreadId       = iprot.ReadString();
                        isset_threadId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        FromTid = new Tid();
                        FromTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.Struct)
                    {
                        ToTid = new Tid();
                        ToTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

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

                case 7:
                    if (field.Type == TType.I16)
                    {
                        MsgType = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 8:
                    if (field.Type == TType.Struct)
                    {
                        Offline = new TimTime();
                        Offline.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 9:
                    if (field.Type == TType.Struct)
                    {
                        LeaguerTid = new Tid();
                        LeaguerTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 10:
                    if (field.Type == TType.List)
                    {
                        {
                            ExtraList = new List <TimNode>();
                            TList _list75 = iprot.ReadListBegin();
                            for (int _i76 = 0; _i76 < _list75.Count; ++_i76)
                            {
                                TimNode _elem77;
                                _elem77 = new TimNode();
                                _elem77.Read(iprot);
                                ExtraList.Add(_elem77);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 12:
                    if (field.Type == TType.Struct)
                    {
                        Error = new TimError();
                        Error.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 13:
                    if (field.Type == TType.Map)
                    {
                        {
                            ExtraMap = new Dictionary <string, string>();
                            TMap _map78 = iprot.ReadMapBegin();
                            for (int _i79 = 0; _i79 < _map78.Count; ++_i79)
                            {
                                string _key80;
                                string _val81;
                                _key80           = iprot.ReadString();
                                _val81           = iprot.ReadString();
                                ExtraMap[_key80] = _val81;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 14:
                    if (field.Type == TType.I16)
                    {
                        Readstatus = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_threadId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
コード例 #24
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_chl     = false;
            bool   isset_version = 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)
                    {
                        Chl       = iprot.ReadI32();
                        isset_chl = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.I16)
                    {
                        Version       = iprot.ReadI16();
                        isset_version = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_chl)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_version)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
コード例 #25
0
        public static void Skip(TProtocol prot, TType type)
        {
            switch (type)
            {
            case TType.Bool:
                prot.ReadBool();
                break;

            case TType.Byte:
                prot.ReadByte();
                break;

            case TType.I16:
                prot.ReadI16();
                break;

            case TType.I32:
                prot.ReadI32();
                break;

            case TType.I64:
                prot.ReadI64();
                break;

            case TType.Double:
                prot.ReadDouble();
                break;

            case TType.String:
                // Don't try to decode the string, just skip it.
                prot.ReadBinary();
                break;

            case TType.Struct:
                prot.ReadStructBegin();
                while (true)
                {
                    TField field = prot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    Skip(prot, field.Type);
                    prot.ReadFieldEnd();
                }
                prot.ReadStructEnd();
                break;

            case TType.Map:
                TMap map = prot.ReadMapBegin();
                for (int i = 0; i < map.Count; i++)
                {
                    Skip(prot, map.KeyType);
                    Skip(prot, map.ValueType);
                }
                prot.ReadMapEnd();
                break;

            case TType.Set:
                TSet set = prot.ReadSetBegin();
                for (int i = 0; i < set.Count; i++)
                {
                    Skip(prot, set.ElementType);
                }
                prot.ReadSetEnd();
                break;

            case TType.List:
                TList list = prot.ReadListBegin();
                for (int i = 0; i < list.Count; i++)
                {
                    Skip(prot, list.ElementType);
                }
                prot.ReadListEnd();
                break;
            }
        }
コード例 #26
0
ファイル: TimSock5Bean.cs プロジェクト: iwenli210/im
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_fromTid   = false;
            bool   isset_toTid     = false;
            bool   isset_addr      = false;
            bool   isset_port      = false;
            bool   isset_transport = false;
            bool   isset_pubId     = 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.Struct)
                    {
                        FromTid = new Tid();
                        FromTid.Read(iprot);
                        isset_fromTid = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        ToTid = new Tid();
                        ToTid.Read(iprot);
                        isset_toTid = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.String)
                    {
                        Addr       = iprot.ReadString();
                        isset_addr = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        Port       = iprot.ReadI32();
                        isset_port = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.I16)
                    {
                        Transport       = iprot.ReadI16();
                        isset_transport = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.String)
                    {
                        PubId       = iprot.ReadString();
                        isset_pubId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.Map)
                    {
                        {
                            ExtraMap = new Dictionary <string, string>();
                            TMap _map117 = iprot.ReadMapBegin();
                            for (int _i118 = 0; _i118 < _map117.Count; ++_i118)
                            {
                                string _key119;
                                string _val120;
                                _key119           = iprot.ReadString();
                                _val120           = iprot.ReadString();
                                ExtraMap[_key119] = _val120;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_fromTid)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_toTid)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_addr)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_port)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_transport)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_pubId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
コード例 #27
0
        public void Read(TProtocol iprot)
        {
            bool   isset_dbName  = false;
            bool   isset_tblName = false;
            bool   isset_expr    = 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)
                    {
                        DbName       = iprot.ReadString();
                        isset_dbName = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.String)
                    {
                        Expr       = iprot.ReadBinary();
                        isset_expr = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 5:
                    if (field.Type == TType.I16)
                    {
                        MaxParts = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_dbName)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_tblName)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_expr)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
コード例 #28
0
ファイル: TestResponseModel.cs プロジェクト: Aresyl/LY.Thrift
        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.Bool)
                        {
                            IsTrue = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I16)
                        {
                            Aa = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

                    case 6:
                        if (field.Type == TType.Double)
                        {
                            Dd = iprot.ReadDouble();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                Ff = new List <string>();
                                TList _list4 = iprot.ReadListBegin();
                                for (int _i5 = 0; _i5 < _list4.Count; ++_i5)
                                {
                                    string _elem6;
                                    _elem6 = iprot.ReadString();
                                    Ff.Add(_elem6);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #29
0
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        Ipv4 = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I16)
                    {
                        Port = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 4:
                    if (field.Type == TType.String)
                    {
                        Ipv6 = iprot.ReadBinary();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #30
0
ファイル: Variant.cs プロジェクト: botstorm/CS-Monitor
        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.Bool)
                        {
                            V_bool = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Byte)
                        {
                            V_i8 = iprot.ReadByte();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I16)
                        {
                            V_i16 = iprot.ReadI16();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

                    case 6:
                        if (field.Type == TType.Double)
                        {
                            V_double = iprot.ReadDouble();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

                    case 9:
                        if (field.Type == TType.Set)
                        {
                            {
                                V_set = new THashSet <Variant>();
                                TSet _set3 = iprot.ReadSetBegin();
                                for (int _i4 = 0; _i4 < _set3.Count; ++_i4)
                                {
                                    Variant _elem5;
                                    _elem5 = new Variant();
                                    _elem5.Read(iprot);
                                    V_set.Add(_elem5);
                                }
                                iprot.ReadSetEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.Map)
                        {
                            {
                                V_map = new Dictionary <Variant, Variant>();
                                TMap _map6 = iprot.ReadMapBegin();
                                for (int _i7 = 0; _i7 < _map6.Count; ++_i7)
                                {
                                    Variant _key8;
                                    Variant _val9;
                                    _key8 = new Variant();
                                    _key8.Read(iprot);
                                    _val9 = new Variant();
                                    _val9.Read(iprot);
                                    V_map[_key8] = _val9;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #31
0
ファイル: Resource.cs プロジェクト: zhanggaoxuan/AlephNote
        public void Read(TProtocol iprot)
        {
            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)
                    {
                        Guid = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        Data = new Data();
                        Data.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 5:
                    if (field.Type == TType.I16)
                    {
                        Width = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.I16)
                    {
                        Height = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.I16)
                    {
                        Duration = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 8:
                    if (field.Type == TType.Bool)
                    {
                        Active = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 9:
                    if (field.Type == TType.Struct)
                    {
                        Recognition = new Data();
                        Recognition.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 11:
                    if (field.Type == TType.Struct)
                    {
                        Attributes = new ResourceAttributes();
                        Attributes.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 13:
                    if (field.Type == TType.Struct)
                    {
                        AlternateData = new Data();
                        AlternateData.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }