diff --git a/Entities/LogFileWatcher.cs b/Entities/LogFileWatcher.cs index 18df4480b..4866065ab 100644 --- a/Entities/LogFileWatcher.cs +++ b/Entities/LogFileWatcher.cs @@ -586,7 +586,7 @@ private void SetCountryCodeByIp(string ip) { } private void UpdateServerConnectionLog(string session, string show) { - if (!this.StatsForm.ExistsServerConnectionLog(session, show)) { + if (!this.StatsForm.ExistsServerConnectionLog(session)) { this.StatsForm.InsertServerConnectionLog(session, show, Stats.LastServerIp, Stats.ConnectedToServerDate, true, true); this.serverPingWatcher.Start(); this.SetCountryCodeByIp(Stats.LastServerIp); @@ -594,7 +594,7 @@ private void UpdateServerConnectionLog(string session, string show) { this.OnServerConnectionNotification?.Invoke(); } } else { - ServerConnectionLog serverConnectionLog = this.StatsForm.SelectServerConnectionLog(session, show); + ServerConnectionLog serverConnectionLog = this.StatsForm.SelectServerConnectionLog(session); if (!serverConnectionLog.IsNotify) { if (!Stats.IsClientHasBeenClosed && this.StatsForm.CurrentSettings.NotifyServerConnected && !string.IsNullOrEmpty(Stats.LastCountryAlpha2Code)) { this.OnServerConnectionNotification?.Invoke(); @@ -638,7 +638,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { int index; if ((!string.Equals(this.threadLocalVariable.Value.selectedShowId, "casual_show") && line.Line.IndexOf("[StateDisconnectingFromServer] Shutting down game and resetting scene to reconnect", StringComparison.OrdinalIgnoreCase) != -1) || line.Line.IndexOf("[GameStateMachine] Replacing FGClient.StateDisconnectingFromServer with FGClient.StateMainMenu", StringComparison.OrdinalIgnoreCase) != -1) { - this.StatsForm.UpdateServerConnectionLog(this.threadLocalVariable.Value.currentSessionId, this.threadLocalVariable.Value.selectedShowId, false); + this.StatsForm.UpdateServerConnectionLog(this.threadLocalVariable.Value.currentSessionId, false); Stats.InShow = false; Stats.QueuedPlayers = 0; Stats.IsQueued = false; @@ -921,7 +921,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { round[i].IsFinal = false; } } - this.StatsForm.UpdateServerConnectionLog(logRound.Info.SessionId, logRound.Info.ShowNameId, false); + this.StatsForm.UpdateServerConnectionLog(logRound.Info.SessionId, false); logRound.Info = null; Stats.InShow = false; Stats.EndedShow = true; @@ -1040,7 +1040,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { logRound.GetCurrentPlayerID = false; logRound.FindingPosition = false; } - this.StatsForm.UpdateServerConnectionLog(logRound.Info.SessionId, logRound.Info.ShowNameId, false); + this.StatsForm.UpdateServerConnectionLog(logRound.Info.SessionId, false); logRound.Info = null; return true; } diff --git a/Views/Stats.cs b/Views/Stats.cs index a7ccf2957..2b08724b7 100644 --- a/Views/Stats.cs +++ b/Views/Stats.cs @@ -4274,23 +4274,23 @@ private void ClearWeeklyCrownLog(int days) { } } - public bool ExistsServerConnectionLog(string sessionId, string showId) { - if (string.IsNullOrEmpty(sessionId) || string.IsNullOrEmpty(showId)) return false; + public bool ExistsServerConnectionLog(string sessionId) { + if (string.IsNullOrEmpty(sessionId)) return false; // BsonExpression condition = Query.And( // Query.EQ("_id", sessionId), // Query.EQ("ShowId", showId) // ); // return this.ServerConnectionLog.Exists(condition); - return this.ServerConnectionLogCache.Exists(l => string.Equals(l.SessionId, sessionId) && string.Equals(l.ShowId, showId)); + return this.ServerConnectionLogCache.Exists(l => string.Equals(l.SessionId, sessionId)); } - public ServerConnectionLog SelectServerConnectionLog(string sessionId, string showId) { + public ServerConnectionLog SelectServerConnectionLog(string sessionId) { // BsonExpression condition = Query.And( // Query.EQ("_id", sessionId), // Query.EQ("ShowId", showId) // ); // return this.ServerConnectionLog.FindOne(condition); - return this.ServerConnectionLogCache.Find(l => string.Equals(l.SessionId, sessionId) && string.Equals(l.ShowId, showId)); + return this.ServerConnectionLogCache.Find(l => string.Equals(l.SessionId, sessionId)); } public void InsertServerConnectionLog(string sessionId, string showId, string serverIp, DateTime connectionDate, bool isNotify, bool isPlaying) { @@ -4306,9 +4306,9 @@ public void InsertServerConnectionLog(string sessionId, string showId, string se } } - public void UpdateServerConnectionLog(string sessionId, string showId, bool isPlaying) { + public void UpdateServerConnectionLog(string sessionId, bool isPlaying) { lock (this.StatsDB) { - ServerConnectionLog log = this.SelectServerConnectionLog(sessionId, showId); + ServerConnectionLog log = this.SelectServerConnectionLog(sessionId); if (log != null) { log.IsPlaying = isPlaying; this.StatsDB.BeginTrans();