Example #1
0
        public void Execute()
        {
            Object source;

            if (TestObject.Find(Source) != null)
            {
                source = TestObject.Find(Source);
            }
            else if (KodiObject.Find(Source) != null)
            {
                source = KodiObject.Find(Source);
            }
            else if (WeatherObject.Find(Source) != null)
            {
                source = WeatherObject.Find(Source);
            }
            else if (GenericInfoObject.Find(Source) != null)
            {
                source = GenericInfoObject.Find(Source);
            }
            else
            {
                Console.WriteLine("Source not found"); return;
            }

            if (Evaluate())
            {
                source.GetType().GetMethod("A" + Action).Invoke(source, new string[] { Parameter });
            }
        }
Example #2
0
        public bool Evaluate()
        {
            Object source;

            if (TestObject.Find(Source) != null)
            {
                source = TestObject.Find(Source);
            }
            else if (KodiObject.Find(Source) != null)
            {
                source = KodiObject.Find(Source);
            }
            else if (WeatherObject.Find(Source) != null)
            {
                source = WeatherObject.Find(Source);
            }
            else if (GenericInfoObject.Find(Source) != null)
            {
                source = GenericInfoObject.Find(Source);
            }
            else
            {
                Console.WriteLine("Source not found"); return(false);
            }

            string      attribute  = source.GetType().GetMethod("AGet" + Attribute).Invoke(source, null).ToString();
            Comparators comparator = (Comparators)Enum.Parse(typeof(Comparators), Comparator.ToUpper());

            if (comparator.Equals(Comparators.EQUALS))
            {
                return(attribute.Equals(Threshold));
            }
            else if (comparator.Equals(Comparators.MORE))
            {
                try { return(Double.Parse(attribute) > Double.Parse(Threshold)); } catch (Exception) { Console.WriteLine("Cannot cast inputs"); return(false); }
            }
            else if (comparator.Equals(Comparators.LESS))
            {
                try { return(Double.Parse(attribute) < Double.Parse(Threshold)); } catch (Exception) { Console.WriteLine("Cannot cast inputs"); return(false); }
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 public void SetName(string sourceName, string name)
 {
     GenericInfoObject.Find(sourceName).SetName(name);
 }
Example #4
0
 public void SetInfo(string SourceName, GenericInfo.Data.GenericInfo info)
 {
     GenericInfoObject.Find(SourceName).SetInfo(info);
 }
Example #5
0
 public string GetRonsQuote(string sourceName)
 {
     return(GenericInfoObject.Find(sourceName).GetRonsQuote());
 }
Example #6
0
 public bool GetIsUp(string sourceName)
 {
     return(GenericInfoObject.Find(sourceName).Isup());
 }
Example #7
0
 public GenericInfo.Data.GenericInfo GetInfo(string sourceName)
 {
     return(GenericInfoObject.Find(sourceName).GetInfo());
 }