Skip to content

Commit

Permalink
Update NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
poveden committed Mar 22, 2024
1 parent bb28c11 commit 86a863b
Show file tree
Hide file tree
Showing 26 changed files with 163 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.1.24",
"version": "5.2.4",
"commands": [
"reportgenerator"
]
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ csharp_style_implicit_object_creation_when_type_is_apparent = false
# Test code
[test/**/*.cs]

# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = none

# IDE0008: Use explicit type
csharp_style_var_elsewhere = true:warning

Expand Down
4 changes: 2 additions & 2 deletions Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.7.0.75501">
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.22.0.87781">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/EliteChroma.Core/Chroma/ColorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public static ChromaColor Transform(this ChromaColor color, double multiply, dou
double g = color.G / 255.0;
double b = color.B / 255.0;

if (multiply != 1.0)
if (multiply is < 1.0 or > 1.0)
{
r *= multiply;
g *= multiply;
b *= multiply;
}

if (gamma != 1.0)
if (gamma is < 1.0 or > 1.0)
{
r = Math.Pow(r, gamma);
g = Math.Pow(g, gamma);
Expand Down
4 changes: 3 additions & 1 deletion src/EliteFiles/Bindings/BindingPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public static IReadOnlyDictionary<BindingCategory, string> FindActivePresetFiles
using var sr = new StreamReader(fs);

string? bindsName;
for (int i = 0; (bindsName = sr.ReadLine()) != null; i++)
int i = 0;
while ((bindsName = sr.ReadLine()) != null)
{
string? bindsFile =
TryGetBindingsFilePath(gameOptionsFolder.Bindings, bindsName)
Expand All @@ -175,6 +176,7 @@ public static IReadOnlyDictionary<BindingCategory, string> FindActivePresetFiles
}

bindsFiles.Add((BindingCategory)i, bindsFile);
i++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/EliteFiles/EliteFiles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
</ItemGroup>

Expand Down
23 changes: 12 additions & 11 deletions test/Common/TestUtils/MetaTestsCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ public static void AssertSenderParameterIsNullable(MethodInfo eventHandler)
Assert.Equal(NullabilityState.Nullable, ni.WriteState);
}

public static IEnumerable<object[]> GetAllEventHandlers(Assembly assembly)
public static TheoryData<MethodInfo> GetAllEventHandlers(Assembly assembly)
{
return (from t in assembly.GetTypes()
where !t.FullName!.StartsWith("Coverlet.", StringComparison.Ordinal) // Reference: https://github.com/coverlet-coverage/coverlet/issues/1191
from mi in t.GetMethods(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)
let ps = mi.GetParameters()
where mi.ReturnType == typeof(void)
&& ps.Length == 2
&& ps[0].ParameterType == typeof(object)
&& (ps[1].ParameterType.IsAssignableTo(typeof(EventArgs)) || ps[0].Name == "sender")
select new object[] { mi }).ToList();
return new TheoryData<MethodInfo>(
from t in assembly.GetTypes()
where !t.FullName!.StartsWith("Coverlet.", StringComparison.Ordinal) // Reference: https://github.com/coverlet-coverage/coverlet/issues/1191
from mi in t.GetMethods(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)
let ps = mi.GetParameters()
where mi.ReturnType == typeof(void)
&& ps.Length == 2
&& ps[0].ParameterType == typeof(object)
&& (ps[1].ParameterType.IsAssignableTo(typeof(EventArgs)) || ps[0].Name == "sender")
select mi);
}
}
}
4 changes: 2 additions & 2 deletions test/EliteChroma.Core.Tests/ChromaControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void DoesNotThrowWhenDisposingTwice()
}

[Fact]
public void RenderEffectIsNotReentrant()
public async Task RenderEffectIsNotReentrant()
{
using var cc = new ChromaController(_gameRootFolder, _gameOptionsFolder, _journalFolder)
{
Expand Down Expand Up @@ -210,7 +210,7 @@ async Task RenderEffect()
mre.Set();
}

Task.WaitAll(
await Task.WhenAll(
Task.Run(RenderEffect),
Task.Run(RenderEffect));

Expand Down
2 changes: 1 addition & 1 deletion test/EliteChroma.Core.Tests/ChromaFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public async Task WaitsForChromaSdkDeviceAccessEvent()

var tChroma = cf.CreateAsync();

using var chroma = await tChroma.ConfigureAwait(false);
using var chroma = await tChroma;
Assert.NotNull(chroma);
}

Expand Down
12 changes: 6 additions & 6 deletions test/EliteChroma.Core.Tests/EliteChroma.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeCoverage" Version="17.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.CodeCoverage" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions test/EliteChroma.Core.Tests/GameProcessWatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void WatchesForGameProcessChanges()
}

[Fact]
public void OnChangedIsNotReentrant()
public async Task OnChangedIsNotReentrant()
{
var nm = new NativeMethodsMock()
{
Expand Down Expand Up @@ -81,7 +81,7 @@ void TimerElapsed(int pid)
mre.Set();
}

Task.WaitAll(
await Task.WhenAll(
Task.Run(() => TimerElapsed(1000)),
Task.Run(() => TimerElapsed(2000)));

Expand Down
6 changes: 3 additions & 3 deletions test/EliteChroma.Core.Tests/GameStateWatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public void WatcherDoesNotThrowWhenDisposingTwice()
}

[Fact]
public void OnChangedIsNotReentrant()
public async Task OnChangedIsNotReentrant()
{
using var watcher = new GameStateWatcher(_gameRootFolder, _gameOptionsFolder, _journalFolder)
{
RaisePreStartupEvents = false,
};

var evs = new EventCollector<ChangeType>(h => watcher.Changed += h, h => watcher.Changed -= h, nameof(OnChangedIsNotReentrant));
evs.Wait(watcher.Start, 5000);
await evs.WaitAsync(watcher.Start, 5000);

int nOnChangedCalls = 0;
using var mre = new ManualResetEventSlim();
Expand All @@ -111,7 +111,7 @@ void OnChanged()
mre.Set();
}

Task.WaitAll(
await Task.WhenAll(
Task.Run(OnChanged),
Task.Run(OnChanged));

Expand Down
8 changes: 4 additions & 4 deletions test/EliteChroma.Core.Tests/KeyMappingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void AllDefinedDirectKeyMappingsToChromaKeysAreUnique()
[InlineData("Key_INVALID_KEY_NAME", "en-US", false, (VirtualKey)0)]
[InlineData("Key_Escape", null, true, VirtualKey.VK_ESCAPE)]
[InlineData("Key_Slash", null, true, VirtualKey.VK_OEM_2)]
public void TryGetVirtualKeyReturnsExpectedValues(string keyName, string keyboardLayout, bool expectedOk, Enum expectedKey)
public void TryGetVirtualKeyReturnsExpectedValues(string keyName, string? keyboardLayout, bool expectedOk, Enum expectedKey)
{
bool ok = Elite.Internal.KeyMappings.TryGetKey(keyName, keyboardLayout, false, out var virtualKey, NativeMethodsKeyboardMock.Instance);

Expand All @@ -81,7 +81,7 @@ public void TryGetVirtualKeyReturnsExpectedValues(string keyName, string keyboar
[InlineData("Key_INVALID_KEY_NAME", "en-US", false, (KeyboardKey)0)]
[InlineData("Key_Escape", null, true, KeyboardKey.Esc)]
[InlineData("Key_Slash", null, true, KeyboardKey.Oem11)]
public void TryGetChromaKeyReturnsExpectedValues(string keyName, string keyboardLayout, bool expectedOk, KeyboardKey expectedKey)
public void TryGetChromaKeyReturnsExpectedValues(string keyName, string? keyboardLayout, bool expectedOk, KeyboardKey expectedKey)
{
bool ok = Core.Internal.KeyMappings.TryGetKey(keyName, keyboardLayout, false, out var chromaKey, NativeMethodsKeyboardMock.Instance);

Expand All @@ -92,7 +92,7 @@ public void TryGetChromaKeyReturnsExpectedValues(string keyName, string keyboard
[Theory]
[InlineData("Key_Grave", "es-ES", true, VirtualKey.VK_OEM_5)]
[InlineData("Key_Slash", null, true, VirtualKey.VK_OEM_2)]
public void TryGetVirtualKeyReturnsEnUSOverrides(string keyName, string keyboardLayout, bool expectedOk, Enum expectedKey)
public void TryGetVirtualKeyReturnsEnUSOverrides(string keyName, string? keyboardLayout, bool expectedOk, Enum expectedKey)
{
bool ok = Elite.Internal.KeyMappings.TryGetKey(keyName, keyboardLayout, true, out var virtualKey, NativeMethodsKeyboardMock.Instance);

Expand All @@ -103,7 +103,7 @@ public void TryGetVirtualKeyReturnsEnUSOverrides(string keyName, string keyboard
[Theory]
[InlineData("Key_Grave", "es-ES", true, KeyboardKey.Oem1)]
[InlineData("Key_Slash", null, true, KeyboardKey.Oem11)]
public void TryGetChromaKeyReturnsEnUSOverrides(string keyName, string keyboardLayout, bool expectedOk, KeyboardKey expectedKey)
public void TryGetChromaKeyReturnsEnUSOverrides(string keyName, string? keyboardLayout, bool expectedOk, KeyboardKey expectedKey)
{
bool ok = Core.Internal.KeyMappings.TryGetKey(keyName, keyboardLayout, true, out var chromaKey, NativeMethodsKeyboardMock.Instance);

Expand Down
2 changes: 1 addition & 1 deletion test/EliteChroma.Core.Tests/MetaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void EventHandlersDeclareSenderParameterAsNullable(MethodInfo eventHandle
}

[SuppressMessage("OrderingRules", "SA1204:Static elements should appear before instance elements", Justification = "Theory data")]
public static IEnumerable<object[]> GetAllEventHandlers()
public static TheoryData<MethodInfo> GetAllEventHandlers()
{
return MetaTestsCommon.GetAllEventHandlers(typeof(ChromaController).Assembly);
}
Expand Down
Loading

0 comments on commit 86a863b

Please sign in to comment.