Example #1
0
 static void Main(string[] args)
 {
     try
     {
         Ed2000.Fetch();
         Mp4Ba.Fetch();
         Zimuzu.Fetch();
         Ed2Kers.Fetch();
         Verycd.Fetch();
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
     finally
     {
         Process.GetCurrentProcess().Kill();
     }
 }
Example #2
0
 private void CrawlerServiceProcess()
 {
     while (true)
     {
         try
         {
             if (6 < DateTime.Now.Hour && DateTime.Now.Hour < 20)
             {
                 MessageLog("The program won't executed between 6 and 20");
                 Thread.Sleep(1 * 60 * 60 * 1000);
                 continue;
             }
             if (_runTime.Date == DateTime.Now.Date)
             {
                 MessageLog("The program has been executed today");
                 Thread.Sleep(1 * 60 * 60 * 1000);
                 continue;
             }
             if ((DateTime.Now - _runTime).Hours < 20)
             {
                 MessageLog("The program has been executed in recent 20 hours");
                 Thread.Sleep(1 * 60 * 60 * 1000);
                 continue;
             }
             Ed2000.Fetch();
             Mp4Ba.Fetch();
             Zimuzu.Fetch();
             Ed2Kers.Fetch();
             Verycd.Fetch();
             _runTime = DateTime.Now;
         }
         catch (ThreadAbortException threadAbortException)
         {
             Logger.Error(threadAbortException);
             break;
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
             Thread.Sleep(10 * 60 * 1000);
         }
     }
 }