예제 #1
0
파일: Util.cs 프로젝트: wach78/Turbofest
        /// <summary>
        /// Load effect xml and get stuff oriented as they should
        /// </summary>
        /// <returns></returns>
        public static List<EventData> Loadeffectdata()
        {
            List<EventData> objlist = new List<EventData>();

            XDocument xDoc = XDocument.Load(Util.CurrentExecutionPath + "/XMLFiles/Effects/randomeffects" + Util.SpringOrFall + ".xml");

            var effects = xDoc.Descendants("effect");

            foreach (var effect in effects)
            {
                EventData ev = new EventData(effect.Element("Name").Value);

                var months = effect.Descendants("Month");

                foreach (var m in months)
                {
                    ev.setData(m.Element("Name").Value, Int16.Parse(m.Element("Runs").Value), bool.Parse(m.Element("RunAllowed").Value), bool.Parse(m.Element("Veto").Value), Int16.Parse(m.Element("Prio").Value));
                }

                objlist.Add(ev);
            }

            return objlist;
        }