From a8eadb933c2c1214176539a34d9cd9ba2c6c4775 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Mon, 25 May 2026 17:42:36 -0500 Subject: [PATCH 1/2] Parse log file line-by-line with StreamReader --- RLBotCS/ManagerTools/WinReadLog.cs | 42 +++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/RLBotCS/ManagerTools/WinReadLog.cs b/RLBotCS/ManagerTools/WinReadLog.cs index df78343..a78d4a3 100644 --- a/RLBotCS/ManagerTools/WinReadLog.cs +++ b/RLBotCS/ManagerTools/WinReadLog.cs @@ -45,25 +45,37 @@ public WinReadLog() if (!File.Exists(LogPath)) return null; - string logContent = File.ReadAllText(LogPath); + string? auth = null; + string? path = null; - int authPrefixIndex = logContent.IndexOf(AUTH_LINE_PREFIX, StringComparison.Ordinal); - int pathPrefixIndex = logContent.IndexOf(PATH_LINE_PREFIX, StringComparison.Ordinal); - if (authPrefixIndex == -1 || pathPrefixIndex == -1) - return null; - - int authStart = authPrefixIndex + AUTH_LINE_PREFIX.Length; - int pathStart = pathPrefixIndex + PATH_LINE_PREFIX.Length; + using var reader = new StreamReader( + LogPath, + Encoding.UTF8, + detectEncodingFromByteOrderMarks: true + ); - int authEnd = logContent.IndexOf('\n', authStart); - int pathEnd = logContent.IndexOf('\n', pathStart); - if (authEnd == -1 || pathEnd == -1) - return null; + string? line; + while ((line = reader.ReadLine()) != null) + { + if (auth == null && line.StartsWith(AUTH_LINE_PREFIX, StringComparison.Ordinal)) + { + auth = line[AUTH_LINE_PREFIX.Length..].TrimEnd('\r', '\n'); + } + else if ( + path == null + && line.StartsWith(PATH_LINE_PREFIX, StringComparison.Ordinal) + ) + { + path = line[PATH_LINE_PREFIX.Length..].TrimEnd('\r', '\n'); + } - string auth = logContent[authStart..authEnd].TrimEnd('\r', '\n'); - string path = logContent[pathStart..pathEnd].TrimEnd('\r', '\n'); + if (auth != null && path != null) + { + return (Path.Combine(path, BINARY_NAME), auth); + } + } - return (Path.Combine(path, BINARY_NAME), auth); + return null; } } #endif From 640d5874398827a96a5968b0eeb765dedd60b96f Mon Sep 17 00:00:00 2001 From: VirxEC Date: Mon, 25 May 2026 17:44:36 -0500 Subject: [PATCH 2/2] Bump version --- RLBotCS/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RLBotCS/Main.cs b/RLBotCS/Main.cs index 4dfbf33..18316c1 100644 --- a/RLBotCS/Main.cs +++ b/RLBotCS/Main.cs @@ -10,7 +10,7 @@ if (args.Length > 0 && args[0] == "--version") { Console.WriteLine( - "RLBotServer v5.0.0-rc.7\n" + "RLBotServer v5.0.0-rc.8\n" + $"Bridge {BridgeVersion.Version}\n" + "@ https://www.rlbot.org & https://github.com/RLBot/core" );