diff --git a/.gitattributes b/.gitattributes index e4e09ff..8df99a3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ -*.ibt filter=lfs diff=lfs merge=lfs -text +* text=auto eol=lf + +*.ibt filter=lfs diff=lfs merge=lfs -text diff --git a/Samples/DumpVariables_DumpSessionInfo/Program.cs b/Samples/DumpVariables_DumpSessionInfo/Program.cs index dda8324..6504cdd 100644 --- a/Samples/DumpVariables_DumpSessionInfo/Program.cs +++ b/Samples/DumpVariables_DumpSessionInfo/Program.cs @@ -18,6 +18,7 @@ using SVappsLAB.iRacingTelemetrySDK; namespace DumpVariables_DumpSessionInfo; + [RequiredTelemetryVars([TelemetryVar.RPM])] internal class Program { diff --git a/Samples/DumpVariables_DumpSessionInfo/Properties/launchSettings.json b/Samples/DumpVariables_DumpSessionInfo/Properties/launchSettings.json index e4aae97..be68516 100644 --- a/Samples/DumpVariables_DumpSessionInfo/Properties/launchSettings.json +++ b/Samples/DumpVariables_DumpSessionInfo/Properties/launchSettings.json @@ -1,8 +1,8 @@ -{ - "profiles": { - "DumpVariables_DumpSessionInfo": { - "commandName": "Project", - "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"" - } - } +{ + "profiles": { + "DumpVariables_DumpSessionInfo": { + "commandName": "Project", + "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"" + } + } } \ No newline at end of file diff --git a/Samples/LocationAndWarnings/Properties/launchSettings.json b/Samples/LocationAndWarnings/Properties/launchSettings.json index 5ac1da3..c3134c0 100644 --- a/Samples/LocationAndWarnings/Properties/launchSettings.json +++ b/Samples/LocationAndWarnings/Properties/launchSettings.json @@ -1,8 +1,8 @@ -{ - "profiles": { - "LocationAndWarnings": { - "commandName": "Project", - "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"\r\n" - } - } +{ + "profiles": { + "LocationAndWarnings": { + "commandName": "Project", + "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"\r\n" + } + } } \ No newline at end of file diff --git a/Samples/SpeedRPMGear/Properties/launchSettings.json b/Samples/SpeedRPMGear/Properties/launchSettings.json index 589064c..88e7f15 100644 --- a/Samples/SpeedRPMGear/Properties/launchSettings.json +++ b/Samples/SpeedRPMGear/Properties/launchSettings.json @@ -1,8 +1,8 @@ -{ - "profiles": { - "SpeedRPMGear": { - "commandName": "Project", - "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"\r\n" - } - } +{ + "profiles": { + "SpeedRPMGear": { + "commandName": "Project", + "commandLineArgs": "\"..\\..\\..\\..\\data\\formulair04_tsukuba 2kfull 2024-01-09 17-26-10.ibt\"\r\n" + } + } } \ No newline at end of file diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/Properties/launchSettings.json b/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/Properties/launchSettings.json index 875e88e..c256a9b 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/Properties/launchSettings.json +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/Properties/launchSettings.json @@ -1,8 +1,8 @@ -{ - "profiles": { - "Profile 1": { - "commandName": "DebugRoslynComponent", - "targetProject": "..\\tests\\IBT_Tests\\IBT_Tests.csproj" - } - } +{ + "profiles": { + "Profile 1": { + "commandName": "DebugRoslynComponent", + "targetProject": "..\\tests\\IBT_Tests\\IBT_Tests.csproj" + } + } } \ No newline at end of file diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/tools/README.md b/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/tools/README.md index 9c75e94..3280f15 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/tools/README.md +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK.CodeGen/tools/README.md @@ -1,21 +1,21 @@ -# Tools - -## vars - -Some python scripts to help with the generation of the `iRacingData.cs` file used during code generation. - -* findDistinctVars.py - - Reads a glob of *.csv files (from various variable dumps of live and ibt files), and outputs a single CSV file with the unique/distinct set of variables - -* csv-to-cs.py - - Reads a CSV file of variables and outputs a snippet of C# code, that can be merged with the `iRacingData.cs` file - -### usage - -```bash -python findDistinctVars.py "variableDumps/*.csv" "distinctVars.csv" -python csv-to-cs.py "distinctVars.csv" "varDictData.cs" -``` -use merge tool to manually merge `varDictData.cs` with `iRacingData.cs` +# Tools + +## vars + +Some python scripts to help with the generation of the `iRacingData.cs` file used during code generation. + +* findDistinctVars.py + + Reads a glob of *.csv files (from various variable dumps of live and ibt files), and outputs a single CSV file with the unique/distinct set of variables + +* csv-to-cs.py + + Reads a CSV file of variables and outputs a snippet of C# code, that can be merged with the `iRacingData.cs` file + +### usage + +```bash +python findDistinctVars.py "variableDumps/*.csv" "distinctVars.csv" +python csv-to-cs.py "distinctVars.csv" "varDictData.cs" +``` +use merge tool to manually merge `varDictData.cs` with `iRacingData.cs` diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK/Constants.cs b/Sdk/SVappsLAB.iRacingTelemetrySDK/Constants.cs index 9fb30d1..9930588 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK/Constants.cs +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK/Constants.cs @@ -19,4 +19,4 @@ namespace SVappsLAB.iRacingTelemetrySDK; internal static class Constants { public const string SDK_NAME = "SVappsLAB.iRacingTelemetrySDK"; -} \ No newline at end of file +} diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/DataProviderBase.cs b/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/DataProviderBase.cs index ff7cb09..d8fbe43 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/DataProviderBase.cs +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/DataProviderBase.cs @@ -122,7 +122,7 @@ public irsdk_header GetHeader() } if (_logger.IsEnabled(LogLevel.Debug)) - LogLayoutIfChanged(); + LogLayoutIfChanged(); return _header; } diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/LiveDataProvider.cs b/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/LiveDataProvider.cs index 4b1e22d..9dee829 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/LiveDataProvider.cs +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK/DataProviders/LiveDataProvider.cs @@ -60,7 +60,7 @@ public override Task WaitForDataReady(TimeSpan timeSpan, CancellationToken internal bool ProcessNewData() { // copy new data to the access buffer, - // validating data is good and no write was in progress + // validating data is good and no write was in progress if (!TryCopyLiveTelemetryDataToBuffer(out var latestTickCount)) { _logger.LogWarning("data changed while we were reading it. skipping this sample"); diff --git a/Sdk/SVappsLAB.iRacingTelemetrySDK/TelemetryDataAccessor.cs b/Sdk/SVappsLAB.iRacingTelemetrySDK/TelemetryDataAccessor.cs index e8d93b4..0672529 100644 --- a/Sdk/SVappsLAB.iRacingTelemetrySDK/TelemetryDataAccessor.cs +++ b/Sdk/SVappsLAB.iRacingTelemetrySDK/TelemetryDataAccessor.cs @@ -60,7 +60,7 @@ public T CreateTelemetryDataSample(IDataProvider dataProvider) } catch (Exception ex) { - _logger.LogWarning("Failed to set property {PropertyName} with value '{RawValue}': {Error}", + _logger.LogWarning("Failed to set property {PropertyName} with value '{RawValue}': {Error}", accessor.PropertyName, rawValue, ex.Message); } } diff --git a/Sdk/tests/SmokeTests/Base/Base.cs b/Sdk/tests/SmokeTests/Base/Base.cs index d260d57..1dc2269 100644 --- a/Sdk/tests/SmokeTests/Base/Base.cs +++ b/Sdk/tests/SmokeTests/Base/Base.cs @@ -57,7 +57,8 @@ await client.Monitor( Assert.True(telemetryData.CarIdxTrackSurface == null || telemetryData.CarIdxTrackSurface.Length >= 64); // only need one sample - if (_variableSummary is null) { + if (_variableSummary is null) + { var telemetryVars = client.GetTelemetryVariables(); var variableSummary = VariableSummary.Create(telemetryVars); _variableSummary = variableSummary; diff --git a/Sdk/tests/SmokeTests/Properties/launchSettings.json b/Sdk/tests/SmokeTests/Properties/launchSettings.json index 996f025..377256d 100644 --- a/Sdk/tests/SmokeTests/Properties/launchSettings.json +++ b/Sdk/tests/SmokeTests/Properties/launchSettings.json @@ -1,8 +1,8 @@ -{ - "profiles": { - "SmokeTests": { - "commandName": "Project", - "commandLineArgs": "--filter-class \"SmokeTests.Live\"" - } - } +{ + "profiles": { + "SmokeTests": { + "commandName": "Project", + "commandLineArgs": "--filter-class \"SmokeTests.Live\"" + } + } } \ No newline at end of file diff --git a/Sdk/tests/UnitTests/CodeGen/CodeGeneratorTests.cs b/Sdk/tests/UnitTests/CodeGen/CodeGeneratorTests.cs index 9a36046..c234147 100644 --- a/Sdk/tests/UnitTests/CodeGen/CodeGeneratorTests.cs +++ b/Sdk/tests/UnitTests/CodeGen/CodeGeneratorTests.cs @@ -62,7 +62,7 @@ public class Program { } Assert.Empty(telemetryData.GetMembers().OfType()); // the consumer program itself must compile cleanly - Assert.Empty(output.GetDiagnostics().Where(d => d.Severity == DiagnosticSeverity.Error)); + Assert.Empty(output.GetDiagnostics(TestContext.Current.CancellationToken).Where(d => d.Severity == DiagnosticSeverity.Error)); // an informational diagnostic flags the (possibly accidental) empty list var info = Assert.Single(diagnostics, d => d.Id == "EmptyVarList"); @@ -86,7 +86,7 @@ public class Program { } Assert.Contains("Speed", properties); Assert.Contains("RPM", properties); - Assert.Empty(output.GetDiagnostics().Where(d => d.Severity == DiagnosticSeverity.Error)); + Assert.Empty(output.GetDiagnostics(TestContext.Current.CancellationToken).Where(d => d.Severity == DiagnosticSeverity.Error)); Assert.DoesNotContain(diagnostics, d => d.Id == "EmptyVarList"); } }