public bool readXmlNode(XmlElement elem) { changes = new List <GPLocationChange>(); bool succ = false; foreach (XmlElement e1 in elem.ChildNodes) { if (e1.Name.Equals("Change")) { GPLocationChange chng = new GPLocationChange(); chng.loadFromXmlNode(e1); changes.Add(chng); } else if (e1.Name.Equals("DefaultLocation")) { defaultLocation = new GPLocation(); defaultLocation.loadFromXmlNode(e1); succ = true; if (e1.HasAttribute("type")) { int i = TYPE_SELECTED; if (int.TryParse(e1.GetAttribute("type"), out i)) { this.setType(i); } } } } return(succ); }
public void loadFromXmlNode(XmlElement elem) { foreach (XmlElement e1 in elem.ChildNodes) { if (e1.Name.Equals("LocationA")) { LocationA = new GPLocation(); LocationA.loadFromXmlNode(e1); } else if (e1.Name.Equals("LocationB")) { LocationB = new GPLocation(); LocationB.loadFromXmlNode(e1); } else if (e1.Name.Equals("Time")) { bool b; double d; if (e1.HasAttribute("TzStart")) { b = true; bool.TryParse(e1.GetAttribute("TzStart"), out b); TimezoneStart = b; } if (e1.HasAttribute("JuStart")) { double.TryParse(e1.GetAttribute("JuStart"), out d); julianStart = d; } if (e1.HasAttribute("JuEnd")) { double.TryParse(e1.GetAttribute("JuEnd"), out d); julianEnd = d; } } } }