/// <summary> /// Helper method for deserializing a crossword saved to an XML file. /// </summary> /// <param name="file"></param> /// <returns></returns> public static Crossword LoadCrosswordFromXml(XmlDocument file) { Crossword loadedObject = null; XmlNode root = file.DocumentElement; string type = root.Attributes["type"].Value; loadedObject = UniversalFactory <string, Crossword> .SAP.CreateObject(type); loadedObject.DeserializeFromNode(root); return(loadedObject); }
private static BaseCrosswordElement RecreateElementFromXmlNode(XmlNode element, Crossword loadedObject) { string type = element.Attributes["type"].Value; int column = int.Parse(element.Attributes["column"].Value); int row = int.Parse(element.Attributes["row"].Value); BaseCrosswordElement bce = ElementsFactory.SAP.CreateObject(type, loadedObject, column, row); bce.DeserializeFromNode(element); loadedObject.SubstituteCrosswordElement(bce, column, row); return(bce); }