/// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            location = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            price    = joDetails.TryGetValue("price", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            radius   = joDetails.TryGetValue("radius", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            keyword  = joDetails.TryGetValue("keyword", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("coupon", out jt))
            {
                coupon = (CouponEnum)(int)jt;
            }
            else
            {
                coupon = null;
            }
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (CouponSortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            name     = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            actor    = joDetails.TryGetValue("actor", out jt) ? (string)jt : null;
            director = joDetails.TryGetValue("director", out jt) ? (string)jt : null;
            tag      = joDetails.TryGetValue("tag", out jt) ? (string)jt : null;
            country  = joDetails.TryGetValue("country", out jt) ? (string)jt : null;
            cinema   = joDetails.TryGetValue("cinema", out jt) ? (string)jt : null;
            location = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            datetime = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("coupon", out jt))
            {
                coupon = (CouponEnum)(int)jt;
            }
            else
            {
                coupon = null;
            }
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (MovieSortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            name     = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            actor    = joDetails.TryGetValue("actor", out jt) ? (string)jt : null;
            director = joDetails.TryGetValue("director", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("category", out jt))
            {
                category = (VideoCategoryEnum)Enum.Parse(typeof(VideoCategoryEnum), (string)jt);
            }
            else
            {
                category = null;
            }
            tag     = joDetails.TryGetValue("tag", out jt) ? (string)jt : null;
            country = joDetails.TryGetValue("country", out jt) ? (string)jt : null;
            season  = joDetails.TryGetValue("season", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            episode = joDetails.TryGetValue("episode", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (VideoSortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            location = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            datetime = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            location   = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            start_date = joDetails.TryGetValue("start_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_date   = joDetails.TryGetValue("end_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            name       = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            price      = joDetails.TryGetValue("price", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            radius     = joDetails.TryGetValue("radius", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("level", out jt))
            {
                level = (HotelLevelEnum)Enum.Parse(typeof(HotelLevelEnum), (string)jt);
            }
            else
            {
                level = null;
            }
            if (joDetails.TryGetValue("wifi", out jt))
            {
                wifi = (int)jt == 1;
            }
            else
            {
                wifi = null;
            }
            if (joDetails.TryGetValue("roomtype", out jt))
            {
                roomtype = (RoomTypeEnum)Enum.Parse(typeof(RoomTypeEnum), (string)jt);
            }
            else
            {
                roomtype = null;
            }
            if (joDetails.TryGetValue("coupon", out jt))
            {
                coupon = (CouponEnum)(int)jt;
            }
            else
            {
                coupon = null;
            }
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (SortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            location = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            name     = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            category = joDetails.TryGetValue("category", out jt) ? (string)jt : null;
            special  = joDetails.TryGetValue("special", out jt) ? (string)jt : null;
            price    = joDetails.TryGetValue("price", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            radius   = joDetails.TryGetValue("radius", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("coupon", out jt))
            {
                coupon = (CouponEnum)(int)jt;
            }
            else
            {
                coupon = null;
            }
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (SortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
            user_city = joDetails.TryGetValue("user_city", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("user_latitude", out jt))
            {
                user_latitude = float.Parse((string)jt);
            }
            else
            {
                user_latitude = null;
            }
            if (joDetails.TryGetValue("user_longitude", out jt))
            {
                user_longitude = float.Parse((string)jt);
            }
            else
            {
                user_longitude = null;
            }
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            location = joDetails.TryGetValue("location", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            spot     = joDetails.TryGetValue("spot", out jt) ? (string)jt : null;
            datetime = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            tag      = joDetails.TryGetValue("tag", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("category", out jt))
            {
                category = (TravelCategoryEnum)(int)jt;
            }
            else
            {
                category = null;
            }
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            name     = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            author   = joDetails.TryGetValue("author", out jt) ? (string)jt : null;
            category = joDetails.TryGetValue("category", out jt) ? (string)jt : null;
            chapter  = joDetails.TryGetValue("chapter", out jt) ? (NumberProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (NovelSortEnum)(int)jt;
            }
            else
            {
                sort = null;
            }
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            datetime   = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            tv_name    = joDetails.TryGetValue("tv_name", out jt) ? (string)jt : null;
            tv_channel = joDetails.TryGetValue("tv_channel", out jt) ? (string)jt : null;
            show_name  = joDetails.TryGetValue("show_name", out jt) ? (string)jt : null;
            category   = joDetails.TryGetValue("category", out jt) ? (string)jt : null;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            name = joDetails.TryGetValue("name", out jt) ? (string)jt : null;
            code = joDetails.TryGetValue("code", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("category", out jt))
            {
                category = (StockCategoryEnum)Enum.Parse(typeof(StockCategoryEnum), (string)jt);
            }
            else
            {
                category = null;
            }
            datetime = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            start_area = joDetails.TryGetValue("start_area", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            start_loc  = joDetails.TryGetValue("start_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_area   = joDetails.TryGetValue("end_area", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_loc    = joDetails.TryGetValue("end_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("route_type", out jt))
            {
                route_type = (RouteTypeEnum)Enum.Parse(typeof(RouteTypeEnum), (string)jt);
            }
            else
            {
                route_type = null;
            }
            if (joDetails.TryGetValue("bus_num", out jt))
            {
                bus_num = (int)jt;
            }
            else
            {
                bus_num = null;
            }
            subway_num = joDetails.TryGetValue("subway_num", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("type", out jt))
            {
                type = (RouteSortTypeEnum)(int)jt;
            }
            else
            {
                type = null;
            }
            keyword = joDetails.TryGetValue("keyword", out jt) ? (string)jt : null;
        }
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            code       = joDetails.TryGetValue("code", out jt) ? (string)jt : null;
            start_loc  = joDetails.TryGetValue("start_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_loc    = joDetails.TryGetValue("end_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            start_date = joDetails.TryGetValue("start_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_date   = joDetails.TryGetValue("end_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            if (joDetails.TryGetValue("seat", out jt))
            {
                seat = (TrainSeatEnum)Enum.Parse(typeof(TrainSeatEnum), (string)jt);
            }
            else
            {
                seat = null;
            }
            if (joDetails.TryGetValue("category", out jt))
            {
                category = (TrainCategoryEnum)Enum.Parse(typeof(TrainCategoryEnum), (string)jt);
            }
            else
            {
                category = null;
            }
            if (joDetails.TryGetValue("type", out jt))
            {
                type = (TrainTypeEnum)Enum.Parse(typeof(TrainTypeEnum), (string)jt);
            }
            else
            {
                type = null;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        /// <returns>返回通用协议对象</returns>
        internal static CommonProtocol ParseObject(JObject jo)
        {
            CommonProtocol cp = new CommonProtocol();

            cp.Parse(jo);
            switch (cp.type)
            {
            case CommonProtocolTypeEnum.DT_SINGLE:
                cp = Utility.Parse <DateTimeSingleProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.DT_ORI:
                cp = Utility.Parse <DateTimeOriProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.DT_INFER:
                cp = Utility.Parse <DateTimeInferProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.DT_INTERVAL:
                cp = Utility.Parse <DateTimeIntervalProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.DT_REPEAT:
            case CommonProtocolTypeEnum.DT_RORI:
            case CommonProtocolTypeEnum.DT_RINFER:
                cp = Utility.Parse <DateTimeRepeatProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC:
                cp = Utility.Parse <LocationProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC_COUNTRY:
                cp = Utility.Parse <LocationCountryProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC_PROVINCE:
                cp = Utility.Parse <LocationProvinceProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC_CITY:
                cp = Utility.Parse <LocationCityProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC_TOWN:
                cp = Utility.Parse <LocationTownProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.LOC_POI:
                cp = Utility.Parse <LocationPoiProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.NORMAL_POI:
                cp = Utility.Parse <LocationNormalPoiProtocol>(jo);
                break;

            case CommonProtocolTypeEnum.NUMBER:
            case CommonProtocolTypeEnum.NUM_PRICE:
            case CommonProtocolTypeEnum.NUM_PADIUS:
            case CommonProtocolTypeEnum.NUM_DISCOUNT:
            case CommonProtocolTypeEnum.NUM_SEASON:
            case CommonProtocolTypeEnum.NUM_EPI:
            case CommonProtocolTypeEnum.NUM_CHAPTER:
                cp = Utility.Parse <NumberProtocol>(jo);
                break;
            }
            return(cp);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            flight_no  = joDetails.TryGetValue("flight_no", out jt) ? (string)jt : null;
            start_loc  = joDetails.TryGetValue("start_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_loc    = joDetails.TryGetValue("end_loc", out jt) ? (LocationProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            start_date = joDetails.TryGetValue("start_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            end_date   = joDetails.TryGetValue("end_date", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            airline    = joDetails.TryGetValue("airline", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("seat", out jt))
            {
                seat = (FlightSeatEnum)Enum.Parse(typeof(FlightSeatEnum), (string)jt);
            }
            else
            {
                seat = null;
            }
            if (joDetails.TryGetValue("sort", out jt))
            {
                sort = (FlightSortEnum)Enum.Parse(typeof(FlightSortEnum), (string)jt);
            }
            else
            {
                sort = null;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 从JObject对象解析
        /// </summary>
        /// <param name="jo"></param>
        public override void Parse(JObject jo)
        {
            base.Parse(jo);
            JObject joDetails = (JObject)jo["details"];
            JToken  jt;

            datetime = joDetails.TryGetValue("datetime", out jt) ? (DateTimeSingleProtocol)CommonProtocol.ParseObject((JObject)jt) : null;
            Event    = joDetails.TryGetValue("event", out jt) ? (string)jt : null;
            if (joDetails.TryGetValue("remind_type", out jt))
            {
                remind_type = (RemindTypeEnum)(int)jt;
            }
            else
            {
                remind_type = null;
            }
        }