Пример #1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            if (reader.Value == null)
            {
                return(null);
            }

            if (reader.Value is string)
            {
                return(HexTypeFactory.CreateFromHex <TValue>((string)reader.Value));
            }
            //fallback if we get rug numbers
            return(HexTypeFactory.CreateFromObject <TValue>(reader.Value));
        }
Пример #2
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                 JsonSerializer serializer)
 {
     return(HexTypeFactory.CreateFromHex <TValue>(reader.Value.ToString()));
 }