Пример #1
0
		public static IDictionary<String, ITrigger> LoadTriggers()
		{
			XmlDocument accountDoc = new XmlDocument();
			accountDoc.Load("accounts.xml");
			
			IDictionary<String, ITrigger> triggers = new Dictionary<String, ITrigger>();
			foreach(XmlElement triggerElement in accountDoc.DocumentElement.SelectNodes("trigger"))
			{
				String name = XmlHelper.ReadString(triggerElement, "name");
				
				TriggerCollector collector = new TriggerCollector(name);
				
				foreach(XmlElement realTrigger in triggerElement.ChildNodes)
				{
					if(realTrigger.Name.Equals("day"))
						collector.AddTrigger(new DayTrigger(realTrigger.InnerText, name));
					else if(realTrigger.Name.Equals("ringDelay"))
						collector.AddTrigger(new RingDelay(realTrigger.InnerText, name));
				}
				
				triggers.Add(name, collector);				
			}
			
			return triggers;
			
		}
Пример #2
0
        public static IDictionary <String, ITrigger> LoadTriggers()
        {
            XmlDocument accountDoc = new XmlDocument();

            accountDoc.Load("accounts.xml");

            IDictionary <String, ITrigger> triggers = new Dictionary <String, ITrigger>();

            foreach (XmlElement triggerElement in accountDoc.DocumentElement.SelectNodes("trigger"))
            {
                String name = XmlHelper.ReadString(triggerElement, "name");

                TriggerCollector collector = new TriggerCollector(name);

                foreach (XmlElement realTrigger in triggerElement.ChildNodes)
                {
                    if (realTrigger.Name.Equals("day"))
                    {
                        collector.AddTrigger(new DayTrigger(realTrigger.InnerText, name));
                    }
                    else if (realTrigger.Name.Equals("ringDelay"))
                    {
                        collector.AddTrigger(new RingDelay(realTrigger.InnerText, name));
                    }
                }

                triggers.Add(name, collector);
            }

            return(triggers);
        }