Exemplo 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);
     }
 }
Exemplo 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;
        }
Exemplo 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();
        }
Exemplo 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;
            //}
        }
Exemplo n.º 5
0
 public static TimeSpan CheckTotalStreamTime(Statistic statistic)
 {
     return statistic.TotalStreamTime;
 }