public static void Init() { _materiatory = new Materia[MATERIATORY_SIZE]; XmlDocument savegame = Globals.SaveGame; foreach (XmlNode node in savegame.SelectSingleNode("//materiatory").ChildNodes) { if (node.NodeType == XmlNodeType.Comment) { continue; } XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(node.OuterXml))); XmlNode orbNode = xml.DocumentElement; string id = orbNode.Attributes["id"].Value; MateriaType type = (MateriaType)Enum.Parse(typeof(MateriaType), orbNode.Attributes["type"].Value); int ap = Int32.Parse(orbNode.Attributes["ap"].Value); int slot = Int32.Parse(orbNode.Attributes["slot"].Value); _materiatory[slot] = Materia.Create(id, ap, type); } }