Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qutrits committed May 8, 2024
1 parent d4ce440 commit e8bfe4a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Entities/LogFileWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class LogRound {
public class ThreadLocalData {
public string selectedShowId;
public bool useShareCode;
public string sessionId;
public string currentSessionId;

public bool toggleCountryInfoApi;
public bool toggleFgdbCreativeApi;
Expand Down Expand Up @@ -641,8 +641,8 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
}
}
}
} else if (line.Line.IndexOf("[StateDisconnectingFromServer] Shutting down game and resetting scene to reconnect", StringComparison.OrdinalIgnoreCase) != -1) {
this.StatsForm.UpdateServerConnectionLog(this.threadLocalVariable.Value.sessionId, this.threadLocalVariable.Value.selectedShowId, false);
} else if (!string.Equals(this.threadLocalVariable.Value.selectedShowId, "casual_show") && line.Line.IndexOf("[StateDisconnectingFromServer] Shutting down game and resetting scene to reconnect", StringComparison.OrdinalIgnoreCase) != -1) {
this.StatsForm.UpdateServerConnectionLog(this.threadLocalVariable.Value.currentSessionId, this.threadLocalVariable.Value.selectedShowId, false);
Stats.InShow = false;
Stats.QueuedPlayers = 0;
Stats.IsQueued = false;
Expand All @@ -657,8 +657,7 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
this.ClearUserCreativeLevelInfo();
} else if (line.Line.IndexOf("[StateMatchmaking] Begin", StringComparison.OrdinalIgnoreCase) != -1
|| line.Line.IndexOf("[GameStateMachine] Replacing FGClient.StatePrivateLobby with FGClient.StateConnectToGame", StringComparison.OrdinalIgnoreCase) != -1
|| line.Line.IndexOf("[GameStateMachine] Replacing FGClient.StatePrivateLobbyMinimal with FGClient.StateConnectToGame", StringComparison.OrdinalIgnoreCase) != -1
) {
|| line.Line.IndexOf("[GameStateMachine] Replacing FGClient.StatePrivateLobbyMinimal with FGClient.StateConnectToGame", StringComparison.OrdinalIgnoreCase) != -1) {
if (line.Date > Stats.LastGameStart) {
Stats.LastGameStart = line.Date;
if (logRound.Info != null) {
Expand All @@ -682,8 +681,9 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
if (!Stats.IsConnectedToServer) {
Stats.IsConnectedToServer = true;
Stats.ConnectedToServerDate = line.Date;
int ipIndex = line.Line.IndexOf("IP:", StringComparison.OrdinalIgnoreCase);
Stats.LastServerIp = line.Line.Substring(ipIndex + 3);
int ipIndex = line.Line.IndexOf("IP:", StringComparison.OrdinalIgnoreCase) + 3;
Stats.LastServerIp = line.Line.Substring(ipIndex);

}
} else if ((index = line.Line.IndexOf("[HandleSuccessfulLogin] Selected show is ", StringComparison.OrdinalIgnoreCase)) != -1) {
int index2 = line.Line.IndexOf(" IsUltimatePartyEpisode:");
Expand All @@ -697,9 +697,9 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
this.threadLocalVariable.Value.useShareCode = false;
}
} else if ((index = line.Line.IndexOf("[HandleSuccessfulLogin] Session: ", StringComparison.OrdinalIgnoreCase)) != -1) {
this.threadLocalVariable.Value.sessionId = line.Line.Substring(index + 33);
this.threadLocalVariable.Value.currentSessionId = line.Line.Substring(index + 33);
if ((DateTime.UtcNow - Stats.ConnectedToServerDate).TotalMinutes <= 40) {
this.UpdateServerConnectionLog(this.threadLocalVariable.Value.sessionId, this.threadLocalVariable.Value.selectedShowId);
this.UpdateServerConnectionLog(this.threadLocalVariable.Value.currentSessionId, this.threadLocalVariable.Value.selectedShowId);
}
} else if ((index = line.Line.IndexOf("[StateGameLoading] Created UGC round: ", StringComparison.OrdinalIgnoreCase)) != -1) {
if (string.Equals(this.threadLocalVariable.Value.selectedShowId, "casual_show")) {
Expand All @@ -723,7 +723,7 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
}

logRound.Info = new RoundInfo {
ShowNameId = this.threadLocalVariable.Value.selectedShowId, SessionId = this.threadLocalVariable.Value.sessionId, UseShareCode = this.threadLocalVariable.Value.useShareCode,
ShowNameId = this.threadLocalVariable.Value.selectedShowId, SessionId = this.threadLocalVariable.Value.currentSessionId, UseShareCode = this.threadLocalVariable.Value.useShareCode,
OnlineServiceType = (int)Stats.OnlineServiceType, OnlineServiceId = Stats.OnlineServiceId, OnlineServiceNickname = Stats.OnlineServiceNickname
};

Expand Down Expand Up @@ -841,6 +841,7 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
|| line.Line.IndexOf("[GameStateMachine] Replacing FGClient.StateReloadingToMainMenu with FGClient.StateMainMenu", StringComparison.OrdinalIgnoreCase) != -1
|| line.Line.IndexOf("[StateMainMenu] Loading scene MainMenu", StringComparison.OrdinalIgnoreCase) != -1
|| line.Line.IndexOf("[EOSPartyPlatformService.Base] Reset, reason: Shutdown", StringComparison.OrdinalIgnoreCase) != -1
|| (string.Equals(this.threadLocalVariable.Value.selectedShowId, "casual_show") && line.Line.IndexOf("[MatchmakeWhileInGameHandler] Begin matchmaking...", StringComparison.OrdinalIgnoreCase) != -1)
|| Stats.IsClientHasBeenClosed) {
if (Stats.IsClientHasBeenClosed) {
Stats.QueuedPlayers = 0;
Expand All @@ -857,6 +858,8 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
return false;
}

Stats.QueuedPlayers = 0;
Stats.IsQueued = false;
Stats.IsConnectedToServer = false;
this.ClearUserCreativeLevelInfo();
Stats.LastServerPing = 0;
Expand Down

0 comments on commit e8bfe4a

Please sign in to comment.