Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions GamesDat/Telemetry/Sources/WarThunder/WarThunderSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public static class WarThunderSources
/// <returns>A configured StateSource instance.</returns>
public static StateSource CreateStateSource(string? baseUrl = null, int hz = 60)
{
if (hz <= 0)
throw new ArgumentOutOfRangeException(nameof(hz), hz, "Polling frequency must be greater than 0");

var pollInterval = TimeSpan.FromMilliseconds(1000.0 / hz);
return new StateSource(baseUrl ?? DefaultBaseUrl, pollInterval);
}
Expand All @@ -39,6 +42,9 @@ public static StateSource CreateStateSource(HttpPollingSourceOptions options)
/// <returns>A configured IndicatorsSource instance.</returns>
public static IndicatorsSource CreateIndicatorsSource(string? baseUrl = null, int hz = 10)
{
if (hz <= 0)
throw new ArgumentOutOfRangeException(nameof(hz), hz, "Polling frequency must be greater than 0");

var pollInterval = TimeSpan.FromMilliseconds(1000.0 / hz);
return new IndicatorsSource(baseUrl ?? DefaultBaseUrl, pollInterval);
}
Expand Down