/// <summary> /// Must be called after all Items have been deserialized. /// Restores the Item references in CustomProperties of type Item. /// </summary> public void RestoreItemAssociations(root root) { foreach (CustomProperty cp in Values) { if (cp.type == typeof(Component)) { cp.value = root.getItemByName((string)cp.value); } } }
public static root FromFile(string filename) { FileStream stream = File.Open(filename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(root)); root root = (root)serializer.Deserialize(stream); stream.Close(); return(root); }
public static root FromFile(string filename, ContentManager cm) { FileStream stream = File.Open(filename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(root)); root root = (root)serializer.Deserialize(stream); stream.Close(); foreach (Archetype arch in root.Archetypes) { foreach (Component comp in arch.Components) { //comp.load(cm); } } return(root); }