示例#1
0
 public static void ImagesWorkerInit(TimeSpan ImageSamplePeriodInMinutes)
 {
     while (true)
     {
         while (!EsportsLiveScore.HaveGatheredLinks)
         {
         }
         EsportsLiveScore.WriteTeamIconsToDisk();
         Console.WriteLine($"Finished Saving Team Logos at {DateTime.Now.ToShortTimeString()}. Sampling images again in {ImageSamplePeriodInMinutes.Hours} hours {ImageSamplePeriodInMinutes.Minutes} minutes");
         Thread.Sleep(ImageSamplePeriodInMinutes);
     }
 }
        public void XEsportsLiveScoreResultEvents()
        {
            EsportsLiveScore.GetNewLinks();
            var results = EsportsLiveScore.GetResultEvents();

            foreach (var res in results)
            {
                Assert.False(res.GameDate == null ||
                             res.GameDate > DateTime.Now.AddHours(6)
                             , $"{res.LeagueName} - {res.HomeTeam} vs {res.AwayTeam}. The specific failed event date: {res.GameDate}");
            }
        }
 public static void ResultsWorkerInit(TimeSpan ResultsSamplePeriod)
 {
     while (true)
     {
         TrackerDBContext dbContext = new TrackerDBContext();
         EsportsLiveScore.GetNewLinks();
         var results         = EsportsLiveScore.GetResultEvents();
         var filteredResults = Utilities.FilterAlreadySentEvents(dbContext, results);
         dbContext.Results.AddRange(filteredResults);
         Utilities.RemoveUnwatedEventsFromDb(ref dbContext);
         dbContext.SaveChanges();
         Console.WriteLine($"Finished Getting Results at {DateTime.Now.ToShortTimeString()}. New Results Added to db: {filteredResults.Count}. Sampling Results again in {ResultsSamplePeriod.Hours} hours and {ResultsSamplePeriod.Minutes} minutes");
         Thread.Sleep(ResultsSamplePeriod);
     }
 }
示例#4
0
 public static void PreliveWorkerInit(TimeSpan PreliveSamplePeriod)
 {
     while (true)
     {
         while (EsportsLiveScore.LinksForLeagues == null || EsportsLiveScore.LinksForLeagues.Count == 0)
         {
             Thread.Sleep(30000);
         }
         TrackerDBContext dbContext = new TrackerDBContext();
         var preliveEvents          = EsportsLiveScore.GetPreliveEvents();
         var filteredEvents         = Utilities.FilterAlreadySentEvents(dbContext, preliveEvents);
         dbContext.Prelive.AddRange(filteredEvents);
         dbContext.SaveChanges();
         Console.WriteLine($"Finished Getting Prelive Events at {DateTime.Now.ToShortTimeString()}." +
                           $" {filteredEvents.Count} events added to Db. " +
                           $"Sampling Prelive again in {PreliveSamplePeriod.Hours} hours and {PreliveSamplePeriod.Minutes} minutes");
         Thread.Sleep(PreliveSamplePeriod);
     }
 }