Esempio n. 1
0
 public static void CheckStatisticsForGame(Statistic statistic, Game game)
 {
     if (statistic.GamesPlayed.FirstOrDefault(g => g.GameName == game.GameName) != null)
     {
         StatisticMethods.AddGameToStatistics(statistic, game);
     }
 }
Esempio n. 2
0
        public static void AddGameToStatistics(Statistic statistic, Game game)
        {
            var moonDb = new MoonAidAzureContext();

            statistic.GamesPlayed.Add(game);

            moonDb.Entry(statistic).State = EntityState.Modified;
        }
Esempio n. 3
0
        public static void StopStreamTimer(Statistic statistic)
        {
            var moonDb = new MoonAidAzureContext();

            TimeSpan spanSinceLastCheck = statistic.LastUpdatedStreamTime - DateTime.Now;

            statistic.TotalStreamTime += spanSinceLastCheck;

            statistic.LastUpdatedStreamTime = DateTime.Now;

            moonDb.Entry<Statistic>(statistic).State = EntityState.Modified;
            moonDb.SaveChanges();
        }
Esempio n. 4
0
        public static void StartStreamTimer(Statistic statistic)
        {
            var moonDb = new MoonAidAzureContext();

            statistic.LastUpdatedStreamTime = DateTime.Now;

            moonDb.Entry<Statistic>(statistic).State = EntityState.Modified;
            moonDb.SaveChanges();

            //var gameInstance = GameInstanceMethods.GetGameInstance(channel.ChannelId, twitchGameName);

            //if (gameInstance.TimeSpanAdded == null)
            //{
            //    TimeSpan spanBetweenFromAndNow = gameInstance.PlayedFrom - DateTime.Now;

            //    gameInstance.TotalTimePlayed = spanBetweenFromAndNow;
            //    gameInstance.TimeSpanAdded = DateTime.Now;
            //}
            //else
            //{
            //    TimeSpan spanSinceLastCheck = gameInstance.TimeSpanAdded - DateTime.Now;
            //    gameInstance.TotalTimePlayed += spanSinceLastCheck;
            //}
        }
Esempio n. 5
0
 public static TimeSpan CheckTotalStreamTime(Statistic statistic)
 {
     return statistic.TotalStreamTime;
 }