public void Load(XmlElement xmlElem) { XmlNodeList nodes = xmlElem.GetElementsByTagName("graphic"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; if (node is XmlElement) { XmlElement elem = (XmlElement)node; StrategyGraphic graphic = new StrategyGraphic(); graphic.Load(elem); this.AddGraphic(graphic); } } }
public void TestStrategyGraphicSaveLoad() { StrategyGraphic graphic = GetGraphic(); Console.WriteLine(XmlUtils.ToString(graphic)); XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("root"); doc.AppendChild(root); graphic.Save(root); StrategyGraphic graphic2 = new StrategyGraphic(); graphic2.Load(root); Console.WriteLine(XmlUtils.ToString(graphic2)); Assert.AreEqual(XmlUtils.ToString(graphic), XmlUtils.ToString(graphic2)); }
public void Load(XmlElement xmlElem) { this.startBarPos = int.Parse(xmlElem.GetAttribute("startBarPos")); strategyGraphic = new StrategyGraphic(); strategyGraphic.Load(xmlElem); }