Esempio n. 1
0
 /// <summary>
 /// Adds all recent games of all summoners into
 /// the database to be tracked. This is called
 /// by t_tick or when the user clicks to
 /// refresh the games.
 /// </summary>
 public void addGames()
 {
     foreach (string s in lstUsers.Items)
     {
         Summoner    _s = db.getSummonerInfo(s);
         RecentGames _r = league.getRecentGames(_s.id);
         db.addGameInfo(_r, _s);
     }
     if (trayIcon.Visible)
     {
         trayIcon.BalloonTipText = "Updating Games!";
         trayIcon.ShowBalloonTip(5000);
     }
 }
 /// <summary>
 /// Adds all of the games from a summoners RecentGames to the database.
 ///
 /// </summary>
 /// <param name="_r"></param>
 /// <param name="s"></param>
 public void addGameInfo(RecentGames _r, Summoner s)
 {
     using (SQLiteConnection con = new SQLiteConnection(dbString))
     {
         con.Open();
         try
         {
             foreach (Game g in _r.games)
             {
                 using (SQLiteCommand command = new SQLiteCommand("INSERT INTO Games VALUES(@ID, @gameType, @spell1, @spell2, @gameMode, @mapID, @level, @subType, @championID, @stats, @fellowPlayers, @summonerID, @uniqueKey)", con))
                 {
                     command.Parameters.Add(new SQLiteParameter("ID", g.gameId));
                     command.Parameters.Add(new SQLiteParameter("gameType", g.gameType));
                     command.Parameters.Add(new SQLiteParameter("spell1", g.spell1));
                     command.Parameters.Add(new SQLiteParameter("spell2", g.spell2));
                     command.Parameters.Add(new SQLiteParameter("gameMode", g.gameMode));
                     command.Parameters.Add(new SQLiteParameter("mapID", g.mapId));
                     command.Parameters.Add(new SQLiteParameter("level", g.level));
                     command.Parameters.Add(new SQLiteParameter("subType", g.subType));
                     command.Parameters.Add(new SQLiteParameter("championID", g.championId));
                     command.Parameters.Add(new SQLiteParameter("stats", g.statsToJSON()));
                     try
                     {
                         command.Parameters.Add(new SQLiteParameter("fellowPlayers", g.fellowPlayersToJSON()));
                     }
                     catch { }
                     command.Parameters.Add(new SQLiteParameter("summonerID", s.id));
                     command.Parameters.Add(new SQLiteParameter("uniqueKey", g.gameId + " " + s.id));
                     command.ExecuteNonQuery();
                 }
             }
         }
         catch
         { }
     }
 }