public void AddGame(LoLRecord record) { try { String platform = new String(record.gamePlatform); if (!IsExistsGame(record.GameId, platform)) { UInt32 timeStamp = 0; try { timeStamp = (uint)(DateTime.Parse(record.GameEndTime) - DateTime.MinValue).TotalSeconds; } catch (Exception) { timeStamp = (uint)(DateTime.Now - DateTime.MinValue).TotalSeconds; } if (record.HasResult) { ExecuteSingleCommand(String.Format("INSERT INTO Games(Id, Platform,GameVersion , Length, Time, WinTeam, GameMode, GameType) values ({0}, '{1}', '{2}', {3}, {4}, {5}, '{6}', '{7}')", record.GameId, platform, record.LoLVersion, record.gameLength, timeStamp, record.gameStats.WonTeam, record.gameStats.GameMode, record.gameStats.GameType)); foreach (PlayerStats player in record.gameStats.Players) { AddPlayer(player, record.GameId, platform); } } else { ExecuteSingleCommand(String.Format("INSERT INTO Games(Id, Platform, GameVersion, Length, Time) values ({0}, '{1}','{2}', {3}, {4})", record.GameId, platform, record.LoLVersion, record.gameLength, timeStamp)); } } } catch (Exception e) { Logger.Instance.WriteLog(String.Format("Add game to public failed: {0}", e.Message)); } }
public void AddGame(LoLRecord record) { PublicDatabaseManager.Instance.AddGame(record); }