Ejemplo n.º 1
0
        /// <summary>
        ///     Deserializes JSON from the StreamReader
        /// </summary>
        /// <param name="streamReader">Stream</param>
        /// <param name="type">Types converted</param>
        /// <param name="option">Json Deserialize Option</param>
        /// <returns>Object</returns>
        public static object ToObject(StreamReader streamReader, Type type, JsonDeserializeOption option = null)
        {
            var handler = new JsonDeserializeHandler
            {
                Option = option ?? defaultDeserializeOption
            };

            return(Deserialize.DeserializeObjectJump.GetThreadSafetyJumpFunc(streamReader, type, handler));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Deserializes JSON from the StreamReader
        /// </summary>
        /// <typeparam name="T">Types converted</typeparam>
        /// <param name="streamReader">Stream</param>
        /// <param name="option">Json Deserialize Option</param>
        /// <returns>Object</returns>
        public static T ToObject <T>(StreamReader streamReader, JsonDeserializeOption option = null)
        {
            var handler = new JsonDeserializeHandler
            {
                Option = option ?? defaultDeserializeOption
            };

            return(Deserialize.ResolveProvider <T> .Convert(streamReader, handler));
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     反序列化时 - Model的Value的格式化器
 ///     When deserializing - Value formatter for Model
 /// </summary>
 /// <param name="value">从Json字符串中读取的匹配字符串,Matched strings read from Json strings</param>
 /// <param name="type">值的类型,The type of the value</param>
 /// <param name="handler">用于提供一些配置选项,Used to provide some configuration options</param>
 /// <param name="isValueFormat">决定最终是否进行值格式化,Determines whether the value is ultimately formatted</param>
 /// <returns>格式化后的结果,Formatted results</returns>
 public virtual object ReadValueFormat(string value, Type type, JsonDeserializeHandler handler, out bool isValueFormat)
 {
     isValueFormat = false;
     return(null);
 }