From 886c6b4ddfc4a80781d55620cfd7320bee6b85ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 13:53:43 +0000 Subject: [PATCH 1/5] Initial plan From b926824a48d1c685b8f2957fb85c7ead9ac03f72 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:01:40 +0000 Subject: [PATCH 2/5] Fix EnsurePath to return new instances and update foreach to Select Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com> --- .../Formula1/F12022RaceReplaySource.cs | 10 ++++++-- .../Formula1/F12023RaceReplaySource.cs | 10 ++++++-- .../Formula1/F12024RaceReplaySource.cs | 10 ++++++-- .../Formula1/F12025RaceReplaySource.cs | 10 ++++++-- .../Sources/Formula1/F1RaceReplaySource.cs | 24 ++++++++++--------- .../Formula1/F1RaceReplaySourceBase.cs | 2 +- 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/GamesDat/Telemetry/Sources/Formula1/F12022RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F12022RaceReplaySource.cs index 8be9015..652116a 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F12022RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F12022RaceReplaySource.cs @@ -7,7 +7,7 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public class F12022RaceReplaySource : F1RaceReplaySourceBase { public F12022RaceReplaySource(FileWatcherOptions options) - : base(ApplyDefaults(EnsurePath(options))) + : base(ApplyDefaults(options)) { } @@ -25,7 +25,13 @@ private static FileWatcherOptions EnsurePath(FileWatcherOptions options) { if (string.IsNullOrEmpty(options.Path)) { - options.Path = GetDefaultReplayPath(); + return new FileWatcherOptions + { + Path = GetDefaultReplayPath(), + Patterns = options.Patterns, + IncludeSubdirectories = options.IncludeSubdirectories, + DebounceDelay = options.DebounceDelay + }; } return options; } diff --git a/GamesDat/Telemetry/Sources/Formula1/F12023RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F12023RaceReplaySource.cs index fc1bf97..d46325e 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F12023RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F12023RaceReplaySource.cs @@ -7,7 +7,7 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public class F12023RaceReplaySource : F1RaceReplaySourceBase { public F12023RaceReplaySource(FileWatcherOptions options) - : base(ApplyDefaults(EnsurePath(options))) + : base(ApplyDefaults(options)) { } @@ -25,7 +25,13 @@ private static FileWatcherOptions EnsurePath(FileWatcherOptions options) { if (string.IsNullOrEmpty(options.Path)) { - options.Path = GetDefaultReplayPath(); + return new FileWatcherOptions + { + Path = GetDefaultReplayPath(), + Patterns = options.Patterns, + IncludeSubdirectories = options.IncludeSubdirectories, + DebounceDelay = options.DebounceDelay + }; } return options; } diff --git a/GamesDat/Telemetry/Sources/Formula1/F12024RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F12024RaceReplaySource.cs index 4e8b4e9..a685f40 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F12024RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F12024RaceReplaySource.cs @@ -7,7 +7,7 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public class F12024RaceReplaySource : F1RaceReplaySourceBase { public F12024RaceReplaySource(FileWatcherOptions options) - : base(ApplyDefaults(EnsurePath(options))) + : base(ApplyDefaults(options)) { } @@ -25,7 +25,13 @@ private static FileWatcherOptions EnsurePath(FileWatcherOptions options) { if (string.IsNullOrEmpty(options.Path)) { - options.Path = GetDefaultReplayPath(); + return new FileWatcherOptions + { + Path = GetDefaultReplayPath(), + Patterns = options.Patterns, + IncludeSubdirectories = options.IncludeSubdirectories, + DebounceDelay = options.DebounceDelay + }; } return options; } diff --git a/GamesDat/Telemetry/Sources/Formula1/F12025RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F12025RaceReplaySource.cs index fa8014d..905e589 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F12025RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F12025RaceReplaySource.cs @@ -7,7 +7,7 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public class F12025RaceReplaySource : F1RaceReplaySourceBase { public F12025RaceReplaySource(FileWatcherOptions options) - : base(ApplyDefaults(EnsurePath(options))) + : base(ApplyDefaults(options)) { } @@ -25,7 +25,13 @@ private static FileWatcherOptions EnsurePath(FileWatcherOptions options) { if (string.IsNullOrEmpty(options.Path)) { - options.Path = GetDefaultReplayPath(); + return new FileWatcherOptions + { + Path = GetDefaultReplayPath(), + Patterns = options.Patterns, + IncludeSubdirectories = options.IncludeSubdirectories, + DebounceDelay = options.DebounceDelay + }; } return options; } diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs index 60bdf68..27bca52 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; namespace GamesDat.Core.Telemetry.Sources.Formula1 { @@ -12,7 +13,7 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public class F1RaceReplaySource : F1RaceReplaySourceBase { public F1RaceReplaySource(FileWatcherOptions options) - : base(ApplyDefaults(EnsurePath(options))) + : base(ApplyDefaults(options)) { } @@ -23,7 +24,13 @@ private static FileWatcherOptions EnsurePath(FileWatcherOptions options) { if (string.IsNullOrEmpty(options.Path)) { - options.Path = F12025RaceReplaySource.GetDefaultReplayPath(); + return new FileWatcherOptions + { + Path = F12025RaceReplaySource.GetDefaultReplayPath(), + Patterns = options.Patterns, + IncludeSubdirectories = options.IncludeSubdirectories, + DebounceDelay = options.DebounceDelay + }; } return options; } @@ -60,17 +67,12 @@ public F1RaceReplaySource(string? customPath = null, bool autoDetectLatestInstal public static string GetLatestInstalledReplayPath() { var years = new[] { "25", "24", "23", "22" }; - foreach (var year in years) - { - var path = GetReplayPathForYear(year); - if (Directory.Exists(path)) - { - return path; - } - } + var path = years + .Select(GetReplayPathForYear) + .FirstOrDefault(Directory.Exists); // Default to F1 25 even if it doesn't exist - return GetReplayPathForYear("25"); + return path ?? GetReplayPathForYear("25"); } private static string ResolveReplayPath(string? customPath, bool autoDetectLatestInstalled) diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs index e73c7dc..803f262 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs @@ -54,7 +54,7 @@ protected static FileWatcherOptions ApplyDefaults(FileWatcherOptions options) ? new[] { "*.frr" } : options.Patterns, IncludeSubdirectories = options.IncludeSubdirectories, - DebounceDelay = options.DebounceDelay == default + DebounceDelay = options.DebounceDelay == default || options.DebounceDelay == TimeSpan.FromSeconds(1) ? TimeSpan.FromSeconds(2) : options.DebounceDelay }; From 2f29e8dd6d587e9ea81a562611d02c1bba23072b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:02:39 +0000 Subject: [PATCH 3/5] Extract debounce delay constants for better maintainability Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com> --- .../Sources/Formula1/F1RaceReplaySourceBase.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs index 803f262..1198f2a 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs @@ -8,6 +8,16 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 /// public abstract class F1RaceReplaySourceBase : FileWatcherSourceBase { + /// + /// The default debounce delay used by FileWatcherOptions (1 second) + /// + private static readonly TimeSpan LibraryDefaultDebounceDelay = TimeSpan.FromSeconds(1); + + /// + /// The F1-specific debounce delay (2 seconds) + /// + private static readonly TimeSpan F1DebounceDelay = TimeSpan.FromSeconds(2); + protected F1RaceReplaySourceBase(FileWatcherOptions options) : base(options) { } @@ -33,7 +43,7 @@ protected static FileWatcherOptions CreateDefaultOptions(string path) Path = path, Patterns = new[] { "*.frr" }, IncludeSubdirectories = false, - DebounceDelay = TimeSpan.FromSeconds(2) + DebounceDelay = F1DebounceDelay }; } @@ -54,8 +64,8 @@ protected static FileWatcherOptions ApplyDefaults(FileWatcherOptions options) ? new[] { "*.frr" } : options.Patterns, IncludeSubdirectories = options.IncludeSubdirectories, - DebounceDelay = options.DebounceDelay == default || options.DebounceDelay == TimeSpan.FromSeconds(1) - ? TimeSpan.FromSeconds(2) + DebounceDelay = options.DebounceDelay == default || options.DebounceDelay == LibraryDefaultDebounceDelay + ? F1DebounceDelay : options.DebounceDelay }; } From 2537737ccb377c3afb75ef064ae3f6e10745f104 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:03:33 +0000 Subject: [PATCH 4/5] Add clarifying comments and improve variable naming Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com> --- GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs | 4 ++-- GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs index 27bca52..97ffaec 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySource.cs @@ -67,12 +67,12 @@ public F1RaceReplaySource(string? customPath = null, bool autoDetectLatestInstal public static string GetLatestInstalledReplayPath() { var years = new[] { "25", "24", "23", "22" }; - var path = years + var existingPath = years .Select(GetReplayPathForYear) .FirstOrDefault(Directory.Exists); // Default to F1 25 even if it doesn't exist - return path ?? GetReplayPathForYear("25"); + return existingPath ?? GetReplayPathForYear("25"); } private static string ResolveReplayPath(string? customPath, bool autoDetectLatestInstalled) diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs index 1198f2a..a721c07 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs @@ -64,6 +64,8 @@ protected static FileWatcherOptions ApplyDefaults(FileWatcherOptions options) ? new[] { "*.frr" } : options.Patterns, IncludeSubdirectories = options.IncludeSubdirectories, + // Check for both default (00:00:00, used when constructed via string path) + // and LibraryDefaultDebounceDelay (1s, used when constructed via options without explicit delay) DebounceDelay = options.DebounceDelay == default || options.DebounceDelay == LibraryDefaultDebounceDelay ? F1DebounceDelay : options.DebounceDelay From 3fa9b5322d4a270dcc0a389b8cb6750088340c9c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:04:11 +0000 Subject: [PATCH 5/5] Document library default coupling in constant Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com> --- GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs index a721c07..f459d5f 100644 --- a/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs +++ b/GamesDat/Telemetry/Sources/Formula1/F1RaceReplaySourceBase.cs @@ -9,7 +9,9 @@ namespace GamesDat.Core.Telemetry.Sources.Formula1 public abstract class F1RaceReplaySourceBase : FileWatcherSourceBase { /// - /// The default debounce delay used by FileWatcherOptions (1 second) + /// The default debounce delay used by FileWatcherOptions (1 second). + /// Note: This mirrors the default in FileWatcherOptions.DebounceDelay. + /// If that default changes, this constant should be updated to match. /// private static readonly TimeSpan LibraryDefaultDebounceDelay = TimeSpan.FromSeconds(1);