Esempio n. 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 });
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 3
0
 public void SetUrl(string sourceName, string url)
 {
     KodiObject.Find(sourceName).SetUrl(url);
 }
Esempio n. 4
0
 public void AChangeVolume(string sourceName, int volume)
 {
     KodiObject.Find(sourceName).ChangeVolume(volume);
 }
Esempio n. 5
0
 public void PlayPlaylist(string sourceName, string playlistId)
 {
     KodiObject.Find(sourceName).PlayPlaylist(playlistId);
 }
Esempio n. 6
0
 public void PlayPicture(string sourceName, string pictureId)
 {
     KodiObject.Find(sourceName).PlayPicture(pictureId);
 }
Esempio n. 7
0
 public IDictionary <string, string> GetPlaylists(string sourceName)
 {
     return(KodiObject.Find(sourceName).GetPlaylists());
 }
Esempio n. 8
0
 public void PlayPause(string sourceName)
 {
     KodiObject.Find(sourceName).PlayPause();
 }
Esempio n. 9
0
 public void PlayMovie(string sourceName, int movieId)
 {
     KodiObject.Find(sourceName).PlayMovie(movieId);
 }
Esempio n. 10
0
 public IDictionary <int, string> GetMovies(string sourceName)
 {
     return(KodiObject.Find(sourceName).GetMovies());
 }
Esempio n. 11
0
 public void PlaySong(string sourceName, int songId)
 {
     KodiObject.Find(sourceName).PlaySong(songId);
 }
Esempio n. 12
0
 public void SetName(string sourceName, string name)
 {
     KodiObject.Find(sourceName).SetName(name);
 }
Esempio n. 13
0
 public string GetName(string sourceName)
 {
     return(KodiObject.Find(sourceName).GetName());
 }