Exemplo n.º 1
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;
        }
Exemplo n.º 2
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;
        }