From 05ead6228b95d26171cc6c9802a34deeb3fd9183 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:52:14 +0000 Subject: [PATCH 1/2] Initial plan From 60ce8ba2b08410134d11a2bd9562bd10dc93cc17 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:56:48 +0000 Subject: [PATCH 2/2] Apply PR feedback: remove SkipInvalidFrames, fix condition, update DataVersion, combine if statements Co-authored-by: codegefluester <203914+codegefluester@users.noreply.github.com> --- GamesDat.Demo/Program.cs | 9 +++------ .../Sources/HttpPollingSourceBase.cs | 2 +- .../Telemetry/Sources/WarThunder/StateData.cs | 2 +- .../Sources/WarThunder/StateSource.cs | 19 ++++--------------- .../Sources/WarThunder/StateSourceOptions.cs | 13 ------------- 5 files changed, 9 insertions(+), 36 deletions(-) diff --git a/GamesDat.Demo/Program.cs b/GamesDat.Demo/Program.cs index 9940ad2..c79aa91 100644 --- a/GamesDat.Demo/Program.cs +++ b/GamesDat.Demo/Program.cs @@ -71,14 +71,11 @@ static async Task CaptureWarThunderSession() lastValidData = data.Valid; - if (data.Valid) + if (data.Valid && frameCount % 1 == 0) // Update every frame (10Hz) { // Clear and redraw dashboard every frame - if (frameCount % 1 == 0) // Update every frame (10Hz) - { - Console.SetCursorPosition(0, 4); - DrawDashboard(data); - } + Console.SetCursorPosition(0, 4); + DrawDashboard(data); } }); diff --git a/GamesDat/Telemetry/Sources/HttpPollingSourceBase.cs b/GamesDat/Telemetry/Sources/HttpPollingSourceBase.cs index fcd3beb..f7ebdb5 100644 --- a/GamesDat/Telemetry/Sources/HttpPollingSourceBase.cs +++ b/GamesDat/Telemetry/Sources/HttpPollingSourceBase.cs @@ -189,7 +189,7 @@ public override async IAsyncEnumerable ReadContinuousAsync( yield return data; await Task.Delay(_options.PollInterval, cancellationToken); } - else if (!hasData) + else { // Wait before retry (for connection errors or JSON errors) var delayTime = _consecutiveErrors > 0 ? _currentRetryDelay : _options.PollInterval; diff --git a/GamesDat/Telemetry/Sources/WarThunder/StateData.cs b/GamesDat/Telemetry/Sources/WarThunder/StateData.cs index 2ee827b..39fe42d 100644 --- a/GamesDat/Telemetry/Sources/WarThunder/StateData.cs +++ b/GamesDat/Telemetry/Sources/WarThunder/StateData.cs @@ -11,7 +11,7 @@ namespace GamesDat.Core.Telemetry.Sources.WarThunder; /// [StructLayout(LayoutKind.Sequential, Pack = 1)] [GameId("WarThunder")] -[DataVersion(1, 0, 0)] +[DataVersion(2, 0, 0)] public struct StateData { // Validity diff --git a/GamesDat/Telemetry/Sources/WarThunder/StateSource.cs b/GamesDat/Telemetry/Sources/WarThunder/StateSource.cs index e7bd36b..ee3acb3 100644 --- a/GamesDat/Telemetry/Sources/WarThunder/StateSource.cs +++ b/GamesDat/Telemetry/Sources/WarThunder/StateSource.cs @@ -12,7 +12,6 @@ namespace GamesDat.Core.Telemetry.Sources.WarThunder; public class StateSource : HttpPollingSourceBase { private readonly StateSourceOptions _stateOptions; - private DateTime _lastInvalidFrameLog = DateTime.MinValue; /// /// Initializes a new instance with StateSourceOptions. @@ -31,8 +30,7 @@ public StateSource(StateSourceOptions options) public StateSource(HttpPollingSourceOptions options) : this(new StateSourceOptions { - HttpOptions = options, - SkipInvalidFrames = true + HttpOptions = options }) { } @@ -50,29 +48,20 @@ public StateSource(string baseUrl, TimeSpan pollInterval) BaseUrl = baseUrl, EndpointPath = "/state", PollInterval = pollInterval - }, - SkipInvalidFrames = true + } }) { } /// - /// Continuously polls the HTTP endpoint and yields valid telemetry data. - /// Filters out invalid frames if SkipInvalidFrames is enabled. + /// Continuously polls the HTTP endpoint and yields telemetry data. /// public override async IAsyncEnumerable ReadContinuousAsync( [EnumeratorCancellation] CancellationToken cancellationToken) { await foreach (var data in base.ReadContinuousAsync(cancellationToken)) { - // If not filtering invalid frames, yield everything - if (!_stateOptions.SkipInvalidFrames) - { - yield return data; - continue; - } - - yield return data; + yield return data; } } } diff --git a/GamesDat/Telemetry/Sources/WarThunder/StateSourceOptions.cs b/GamesDat/Telemetry/Sources/WarThunder/StateSourceOptions.cs index 023f27d..e0355c9 100644 --- a/GamesDat/Telemetry/Sources/WarThunder/StateSourceOptions.cs +++ b/GamesDat/Telemetry/Sources/WarThunder/StateSourceOptions.cs @@ -9,17 +9,4 @@ public class StateSourceOptions /// HTTP polling options (URL, intervals, retry settings). /// public required HttpPollingSourceOptions HttpOptions { get; init; } - - /// - /// If true, frames where Valid=false will be skipped (not yielded). - /// When enabled, the source will continue polling but only yield valid frames. - /// Default is true (skip invalid frames). - /// - public bool SkipInvalidFrames { get; init; } = true; - - /// - /// Interval for logging "waiting for valid data" messages when skipping invalid frames. - /// Set to TimeSpan.Zero to disable these messages. Default is 10 seconds. - /// - public TimeSpan InvalidFrameLogInterval { get; init; } = TimeSpan.FromSeconds(10); }