public static void Serialize(XmlWriter xWrite, Npc contents) { XmlSerializer Writer = new XmlSerializer(contents.GetType()); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", "http://www.hybrasyl.com/XML/Creature"); Writer.Serialize(xWrite, contents, ns); }
public static Npc Deserialize(XmlReader reader, Npc contents = null) { //reader.Settings.IgnoreWhitespace = false; if (contents == null) { contents = new Npc(); } XmlSerializer XmlSerial = new XmlSerializer(contents.GetType()); if (XmlSerial.CanDeserialize(reader)) { var xContents = XmlSerial.Deserialize(reader); contents = (Npc)xContents; } return(contents); }