Example #1
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="xml">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static T Deserialize <T>(XElement xml, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.Deserialize <XElement, T>(xml, format ?? DefaultFormat, options));
 }
Example #2
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <param name="type">
 ///     Type of object to reconstruct.</param>
 /// <param name="xml">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static object Deserialize(Type type, XElement xml, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.Deserialize <XElement>(type, xml, format ?? DefaultFormat, options));
 }
Example #3
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified file.</summary>
 /// <typeparam name="T">
 ///     Type of object to read.</typeparam>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static T DeserializeFile <T>(string filename, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.DeserializeFile <XElement, T>(filename, format ?? DefaultFormat, options));
 }
Example #4
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified file.</summary>
 /// <param name="type">
 ///     Type of object to read.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static object DeserializeFile(Type type, string filename, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.DeserializeFile <XElement>(type, filename, format ?? DefaultFormat, options));
 }
Example #5
0
 /// <summary>
 ///     Stores the specified object in a file with the given path and filename.</summary>
 /// <param name="saveType">
 ///     Type of the object to store.</param>
 /// <param name="saveObject">
 ///     Object to store in a file.</param>
 /// <param name="filename">
 ///     Path and filename of the file to be created. If the file already exists, it is overwritten.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void SerializeToFile(Type saveType, object saveObject, string filename, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.SerializeToFile(saveType, saveObject, filename, format ?? DefaultFormat, options);
 }
Example #6
0
 /// <summary>
 ///     Converts the specified object into a serialized form.</summary>
 /// <param name="saveType">
 ///     Type of object to convert.</param>
 /// <param name="saveObject">
 ///     Object to be serialized.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     The serialized form generated from the object.</returns>
 public static XElement Serialize(Type saveType, object saveObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.Serialize(saveType, saveObject, format ?? DefaultFormat, options));
 }
Example #7
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form by applying the values to an
 ///     existing instance of the type.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="xml">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void DeserializeIntoObject <T>(XElement xml, T intoObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.DeserializeIntoObject <XElement, T>(xml, intoObject, format ?? DefaultFormat, options);
 }
Example #8
0
 /// <summary>
 ///     Reconstructs an object from the specified file by applying the values to an existing instance of the desired
 ///     type. The type of object is inferred from the object passed in.</summary>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object. Also determines the type of object
 ///     expected.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void DeserializeFileIntoObject(string filename, object intoObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.DeserializeFileIntoObject <XElement>(filename, intoObject, format ?? DefaultFormat, options);
 }
Example #9
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static T Deserialize <T>(JsonValue json, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Deserialize <JsonValue, T>(json, format ?? DefaultFormat, options));
 }
Example #10
0
 /// <summary>
 ///     Converts the specified object into a serialized form.</summary>
 /// <typeparam name="T">
 ///     Type of object to convert.</typeparam>
 /// <param name="saveObject">
 ///     Object to be serialized.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     The serialized form generated from the object.</returns>
 public static JsonValue Serialize <T>(T saveObject, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Serialize(saveObject, format ?? DefaultFormat, options));
 }
Example #11
0
 /// <summary>
 ///     Stores the specified object in a file with the given path and filename.</summary>
 /// <typeparam name="T">
 ///     Type of the object to store.</typeparam>
 /// <param name="saveObject">
 ///     Object to store in a file.</param>
 /// <param name="filename">
 ///     Path and filename of the file to be created. If the file already exists, it is overwritten.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 public static void SerializeToFile <T>(T saveObject, string filename, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     Classify.SerializeToFile(saveObject, filename, format ?? DefaultFormat, options);
 }
Example #12
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form by applying the values to an
 ///     existing instance of the type.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 public static void DeserializeIntoObject <T>(JsonValue json, T intoObject, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     Classify.DeserializeIntoObject(json, intoObject, format ?? DefaultFormat, options);
 }
Example #13
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <param name="type">
 ///     Type of object to reconstruct.</param>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static object Deserialize(Type type, JsonValue json, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Deserialize(type, json, format ?? DefaultFormat, options));
 }