Skip to content

Commit

Permalink
Merge pull request #71 from the-hideout/read-past-logs-fix
Browse files Browse the repository at this point in the history
Fix for read past logs while EFT is running
  • Loading branch information
Razzmatazzz authored May 13, 2024
2 parents e132f4e + 8670117 commit fa53338
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions TarkovMonitor/GameWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ public void ProcessLogs(string folderPath)
}

// Read the file into memory using UTF-8 encoding
var fileContents = File.ReadAllText(logFile, Encoding.UTF8);
using var fileStream = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using var textReader = new StreamReader(fileStream, Encoding.UTF8);
var fileContents = textReader.ReadToEnd();

GameWatcher_NewLogData(this, new NewLogDataEventArgs { Type = logType, Data = fileContents });
}
Expand All @@ -514,7 +516,9 @@ public void ProcessLogs(string folderPath)
{
return null;
}
var applicationLog = File.ReadAllText(appLogPath);
using var fileStream = new FileStream(appLogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using var textReader = new StreamReader(fileStream, Encoding.UTF8);
var applicationLog = textReader.ReadToEnd();
var match = Regex.Match(applicationLog, @"(?<date>^\d{4}-\d{2}-\d{2}) (?<time>\d{2}:\d{2}:\d{2}\.\d{3} [+-]\d{2}:\d{2})\|(?<version>\d+\.\d+\.\d+\.\d+)\.\d+\|(?<logLevel>[^|]+)\|(?<logType>[^|]+)\|SelectProfile ProfileId:(?<profileId>[a-f0-9]+) AccountId:(?<accountId>\d+)", RegexOptions.Multiline);
if (!match.Success)
{
Expand Down
2 changes: 1 addition & 1 deletion TarkovMonitor/TarkovMonitor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Resources\TarkovDev.ico</ApplicationIcon>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<AssemblyVersion>1.4.2.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit fa53338

Please sign in to comment.