Skip to content

Commit

Permalink
Manager: Increase delay for likely temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed Sep 15, 2024
1 parent 6f92c1e commit f5d0a33
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ArcdpsLogManager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This is the full changelog of the arcdps Log Manager.

## Log Manager v1.12.1 (unreleased)

#### Fixes
- Increased delay for detecting files without an extension, should hopefully fix issue with ghost logs appearing.

## Log Manager v1.12

#### New features
Expand Down
6 changes: 6 additions & 0 deletions ArcdpsLogManager/Logs/LogFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public bool IsLikelyEvtcLog(string filename)
return false;
}

/// <summary>
/// Arcdps creates a file and then adds into an archive. The file is then deleted. Checks if this is possibly one of these files.
/// It is not guaranteed, however, and this may return true for files that will not be removed.
/// </summary>
public bool IsLikelyTemporary(string filename) => !filename.Contains('.');

public IEnumerable<LogData> GetTesting()
{
var player1 = new LogPlayer("Testing player", ":Testing account.1234", 1, Profession.Thief, EliteSpecialization.Daredevil, "01D1DADF-751E-E411-ADEE-AC162DC0070D");
Expand Down
21 changes: 19 additions & 2 deletions ArcdpsLogManager/ManagerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ private void SetupFileSystemWatchers()
// We do not want to process logs before they are fully written,
// mid-compression and the like, so we add a delay after detecting one.
var delay = TimeSpan.FromSeconds(5);
var temporaryFileDelay = TimeSpan.FromSeconds(15);

fileSystemWatchers.Clear();
foreach (var directory in Settings.LogRootPaths)
Expand All @@ -716,7 +717,15 @@ private void SetupFileSystemWatchers()
{
Task.Run(async () =>
{
await Task.Delay(delay);
if (LogFinder.IsLikelyTemporary(args.FullPath))
{
await Task.Delay(temporaryFileDelay);
}
else
{
await Task.Delay(delay);
}
if (File.Exists(args.FullPath) && LogFinder.IsLikelyEvtcLog(args.FullPath))
{
Application.Instance.AsyncInvoke(() => AddNewLog(args.FullPath));
Expand All @@ -727,7 +736,15 @@ private void SetupFileSystemWatchers()
{
Task.Run(async () =>
{
await Task.Delay(delay);
if (LogFinder.IsLikelyTemporary(args.FullPath))
{
await Task.Delay(temporaryFileDelay);
}
else
{
await Task.Delay(delay);
}
if (File.Exists(args.FullPath) && LogFinder.IsLikelyEvtcLog(args.FullPath))
{
Application.Instance.AsyncInvoke(() => AddNewLog(args.FullPath));
Expand Down

0 comments on commit f5d0a33

Please sign in to comment.