Example #1
0
 public Wiki(LyricSearch lyricSearch)
 {
     this.lyricSearch = lyricSearch;
     lyricWiki        = new LyricWiki();
 }
        public void Run()
        {
            bool lrcFinderThreadIsRunning  = false;
            bool lyricWikiThreadIsRunning  = false;
            bool actionextIsRunning        = false;
            bool lyricsPluginSiteIsRunning = false;
            bool lyrDBIsRunning            = false;
            bool lyrics007IsRunning        = false;
            bool lyricsOnDemandIsRunning   = false;
            bool hotLyricsIsRunning        = false;

            while (m_SearchHasEnded == false)
            {
                if (System.Array.IndexOf <string>(LyricsSites, "LrcFinder") != -1 && lrcFinderThreadIsRunning == false)
                {
                    lrcFinderThreadIsRunning = true;
                    Thread      lrcFinderThread;
                    ThreadStart job = delegate { SearchLrcFinder(m_artist, m_title); };
                    lrcFinderThread = new Thread(job);
                    lrcFinderThread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "LyricsOnDemand") != -1 && lyricsOnDemandIsRunning == false)
                {
                    lyricsOnDemandIsRunning = true;
                    Thread      lyricsOnDemandThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.LyricsOnDemand lyricsOnDemand = new LyricSites.LyricsOnDemand(m_artist,
                                                                                                 m_title,
                                                                                                 m_EventStop_SiteSearches,
                                                                                                 TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(lyricsOnDemand.Lyric, "LyricsOnDemand");
                        }
                        else
                        {
                            ValidateSearchOutput(lyricsOnDemand.Lyric, "LyricsOnDemand");
                        }
                    };
                    lyricsOnDemandThread = new Thread(job);
                    lyricsOnDemandThread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "LyricWiki") != -1 && lyricWikiThreadIsRunning == false)
                {
                    lyricWikiThreadIsRunning = true;
                    Thread      lyricWikiThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.LyricWiki lyricWiki = new LyricSites.LyricWiki(m_artist, m_title,
                                                                                  m_EventStop_SiteSearches,
                                                                                  TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(lyricWiki.Lyric, "LyricWiki");
                        }
                        else
                        {
                            ValidateSearchOutput(lyricWiki.Lyric, "LyricWiki");
                        }
                    };
                    lyricWikiThread = new Thread(job);
                    lyricWikiThread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "Lyrics007") != -1 && lyrics007IsRunning == false)
                {
                    lyrics007IsRunning = true;
                    Thread      lyrics007Thread;
                    ThreadStart job = delegate
                    {
                        LyricSites.Lyrics007 lyrics007 = new LyricSites.Lyrics007(m_artist, m_title,
                                                                                  m_EventStop_SiteSearches,
                                                                                  TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(lyrics007.Lyric, "Lyrics007");
                        }
                        else
                        {
                            ValidateSearchOutput(lyrics007.Lyric, "Lyrics007");
                        }
                    };
                    lyrics007Thread = new Thread(job);
                    lyrics007Thread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "LyricsPluginSite") != -1 && lyricsPluginSiteIsRunning == false)
                {
                    lyricsPluginSiteIsRunning = true;
                    Thread      lyricPluginSiteThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.LyricsPluginSite lyricPluginSite = new LyricSites.LyricsPluginSite(m_artist,
                                                                                                      m_title,
                                                                                                      m_EventStop_SiteSearches,
                                                                                                      TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(lyricPluginSite.Lyric, "LyricsPluginSite");
                        }
                        else
                        {
                            ValidateSearchOutput(lyricPluginSite.Lyric, "LyricsPluginSite");
                        }
                    };
                    lyricPluginSiteThread = new Thread(job);
                    lyricPluginSiteThread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "Actionext") != -1 && actionextIsRunning == false)
                {
                    actionextIsRunning = true;
                    Thread      actionextThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.Actionext actionext = new LyricSites.Actionext(m_artist, m_title,
                                                                                  m_EventStop_SiteSearches,
                                                                                  TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(actionext.Lyric, "Actionext");
                        }
                        else
                        {
                            ValidateSearchOutput(actionext.Lyric, "Actionext");
                        }
                    };
                    actionextThread = new Thread(job);
                    actionextThread.Start();
                }

                if (System.Array.IndexOf <string>(LyricsSites, "LyrDB") != -1 && lyrDBIsRunning == false)
                {
                    lyrDBIsRunning = true;
                    Thread      lyrDBThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.LyrDB lyrDB = new LyricSites.LyrDB(m_artist, m_title,
                                                                      m_EventStop_SiteSearches,
                                                                      TIME_LIMIT_FOR_SITE);
                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(lyrDB.Lyric, "LyrDB");
                        }
                        else
                        {
                            ValidateSearchOutput(lyrDB.Lyric, "LyrDB");
                        }
                    };
                    lyrDBThread = new Thread(job);
                    lyrDBThread.Start();
                }


                if (System.Array.IndexOf <string>(LyricsSites, "HotLyrics") != -1 && hotLyricsIsRunning == false)
                {
                    hotLyricsIsRunning = true;
                    Thread      hotLyricsThread;
                    ThreadStart job = delegate
                    {
                        LyricSites.HotLyrics hotLyrics = new LyricSites.HotLyrics(m_artist, m_title,
                                                                                  m_EventStop_SiteSearches,
                                                                                  TIME_LIMIT_FOR_SITE);

                        if (m_allowAllToComplete)
                        {
                            ValidateSearchOutputForAllowAllToComplete(hotLyrics.Lyric, "HotLyrics");
                        }
                        else
                        {
                            ValidateSearchOutput(hotLyrics.Lyric, "HotLyrics");
                        }
                    };
                    hotLyricsThread = new Thread(job);
                    hotLyricsThread.Start();
                }

                Thread.Sleep(300);
            }

            Thread.CurrentThread.Abort();
        }
        public void Run()
        {
            bool lrcFinderThreadIsRunning = false;
              bool lyricWikiThreadIsRunning = false;
              bool actionextIsRunning = false;
              bool lyricsPluginSiteIsRunning = false;
              bool lyrDBIsRunning = false;
              bool lyrics007IsRunning = false;
              bool lyricsOnDemandIsRunning = false;
              bool hotLyricsIsRunning = false;

              while (m_SearchHasEnded == false)
              {
            if (System.Array.IndexOf<string>(LyricsSites, "LrcFinder") != -1 && lrcFinderThreadIsRunning == false)
            {
              lrcFinderThreadIsRunning = true;
              Thread lrcFinderThread;
              ThreadStart job = delegate { SearchLrcFinder(m_artist, m_title); };
              lrcFinderThread = new Thread(job);
              lrcFinderThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "LyricsOnDemand") != -1 && lyricsOnDemandIsRunning == false)
            {
              lyricsOnDemandIsRunning = true;
              Thread lyricsOnDemandThread;
              ThreadStart job = delegate
                              {
                                LyricSites.LyricsOnDemand lyricsOnDemand = new LyricSites.LyricsOnDemand(m_artist,
                                                                                                         m_title,
                                                                                                         m_EventStop_SiteSearches,
                                                                                                         TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(lyricsOnDemand.Lyric, "LyricsOnDemand");
                                }
                                else
                                {
                                  ValidateSearchOutput(lyricsOnDemand.Lyric, "LyricsOnDemand");
                                }
                              };
              lyricsOnDemandThread = new Thread(job);
              lyricsOnDemandThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "LyricWiki") != -1 && lyricWikiThreadIsRunning == false)
            {
              lyricWikiThreadIsRunning = true;
              Thread lyricWikiThread;
              ThreadStart job = delegate
                              {
                                LyricSites.LyricWiki lyricWiki = new LyricSites.LyricWiki(m_artist, m_title,
                                                                                          m_EventStop_SiteSearches,
                                                                                          TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(lyricWiki.Lyric, "LyricWiki");
                                }
                                else
                                {
                                  ValidateSearchOutput(lyricWiki.Lyric, "LyricWiki");
                                }
                              };
              lyricWikiThread = new Thread(job);
              lyricWikiThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "Lyrics007") != -1 && lyrics007IsRunning == false)
            {
              lyrics007IsRunning = true;
              Thread lyrics007Thread;
              ThreadStart job = delegate
                              {
                                LyricSites.Lyrics007 lyrics007 = new LyricSites.Lyrics007(m_artist, m_title,
                                                                                          m_EventStop_SiteSearches,
                                                                                          TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(lyrics007.Lyric, "Lyrics007");
                                }
                                else
                                {
                                  ValidateSearchOutput(lyrics007.Lyric, "Lyrics007");
                                }
                              };
              lyrics007Thread = new Thread(job);
              lyrics007Thread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "LyricsPluginSite") != -1 && lyricsPluginSiteIsRunning == false)
            {
              lyricsPluginSiteIsRunning = true;
              Thread lyricPluginSiteThread;
              ThreadStart job = delegate
                              {
                                LyricSites.LyricsPluginSite lyricPluginSite = new LyricSites.LyricsPluginSite(m_artist,
                                                                                                              m_title,
                                                                                                              m_EventStop_SiteSearches,
                                                                                                              TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(lyricPluginSite.Lyric, "LyricsPluginSite");
                                }
                                else
                                {
                                  ValidateSearchOutput(lyricPluginSite.Lyric, "LyricsPluginSite");
                                }
                              };
              lyricPluginSiteThread = new Thread(job);
              lyricPluginSiteThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "Actionext") != -1 && actionextIsRunning == false)
            {
              actionextIsRunning = true;
              Thread actionextThread;
              ThreadStart job = delegate
                              {
                                LyricSites.Actionext actionext = new LyricSites.Actionext(m_artist, m_title,
                                                                                          m_EventStop_SiteSearches,
                                                                                          TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(actionext.Lyric, "Actionext");
                                }
                                else
                                {
                                  ValidateSearchOutput(actionext.Lyric, "Actionext");
                                }
                              };
              actionextThread = new Thread(job);
              actionextThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "LyrDB") != -1 && lyrDBIsRunning == false)
            {
              lyrDBIsRunning = true;
              Thread lyrDBThread;
              ThreadStart job = delegate
                              {
                                LyricSites.LyrDB lyrDB = new LyricSites.LyrDB(m_artist, m_title,
                                                                              m_EventStop_SiteSearches,
                                                                              TIME_LIMIT_FOR_SITE);
                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(lyrDB.Lyric, "LyrDB");
                                }
                                else
                                {
                                  ValidateSearchOutput(lyrDB.Lyric, "LyrDB");
                                }
                              };
              lyrDBThread = new Thread(job);
              lyrDBThread.Start();
            }

            if (System.Array.IndexOf<string>(LyricsSites, "HotLyrics") != -1 && hotLyricsIsRunning == false)
            {
              hotLyricsIsRunning = true;
              Thread hotLyricsThread;
              ThreadStart job = delegate
                              {
                                LyricSites.HotLyrics hotLyrics = new LyricSites.HotLyrics(m_artist, m_title,
                                                                                          m_EventStop_SiteSearches,
                                                                                          TIME_LIMIT_FOR_SITE);

                                if (m_allowAllToComplete)
                                {
                                  ValidateSearchOutputForAllowAllToComplete(hotLyrics.Lyric, "HotLyrics");
                                }
                                else
                                {
                                  ValidateSearchOutput(hotLyrics.Lyric, "HotLyrics");
                                }
                              };
              hotLyricsThread = new Thread(job);
              hotLyricsThread.Start();
            }

            Thread.Sleep(300);
              }

              Thread.CurrentThread.Abort();
        }