/*! loads a historic event */ private static void LoadHistoricEvent(string filename) { XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlElement root = doc.DocumentElement; string name = root.Attributes["name"].Value; string text = root.Attributes["text"].Value; DateTime eventDate = Convert.ToDateTime(root.Attributes["date"].Value, new CultureInfo("en-US", false)); HistoricEvent historicEvent = new HistoricEvent(name, text, eventDate); XmlNodeList influencesList = root.SelectNodes("influences/influence"); foreach (XmlElement influenceElement in influencesList) { HistoricEventInfluence.InfluenceType type = (HistoricEventInfluence.InfluenceType)Enum.Parse(typeof(HistoricEventInfluence.InfluenceType), influenceElement.Attributes["type"].Value); double value = Convert.ToDouble(influenceElement.Attributes["value"].Value, CultureInfo.GetCultureInfo("en-US").NumberFormat); DateTime endDate = Convert.ToDateTime(influenceElement.Attributes["enddate"].Value, new CultureInfo("en-US", false)); historicEvent.addInfluence(new HistoricEventInfluence(type, value, endDate)); } HistoricEvents.AddHistoricEvent(historicEvent); }
//adds an event to the list public static void AddHistoricEvent(HistoricEvent e) { events.Add(e); }