using System; using DPumpHydr.WinFrmUI.WenSkin.Json.Schema; namespace DPumpHydr.WinFrmUI.WenSkin.Json { /// /// Converts an object to and from JSON. /// public abstract class JsonConverter { /// /// Gets a value indicating whether this can read JSON. /// /// true if this can read JSON; otherwise, false. public virtual bool CanRead => true; /// /// Gets a value indicating whether this can write JSON. /// /// true if this can write JSON; otherwise, false. public virtual bool CanWrite => true; /// /// Writes the JSON representation of the object. /// /// The to write to. /// The value. /// The calling serializer. public abstract void WriteJson(JsonWriter writer, object value, JsonSerializer serializer); /// /// Reads the JSON representation of the object. /// /// The to read from. /// Type of the object. /// The existing value of object being read. /// The calling serializer. /// The object value. public abstract object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer); /// /// Determines whether this instance can convert the specified object type. /// /// Type of the object. /// /// true if this instance can convert the specified object type; otherwise, false. /// public abstract bool CanConvert(Type objectType); /// /// /// Gets the of the JSON produced by the JsonConverter. /// /// /// JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details. /// /// /// The of the JSON produced by the JsonConverter. [Obsolete("JSON Schema validation has been moved to its own package. It is strongly recommended that you do not override GetSchema() in your own converter. It is not used by Json.NET and will be removed at some point in the future. Converter's that override GetSchema() will stop working when it is removed.")] public virtual JsonSchema GetSchema() { return null; } } }