diff --git a/sampleApp/SampleApplication.csproj b/sampleApp/SampleApplication.csproj
index a11f4422..e8b2d631 100644
--- a/sampleApp/SampleApplication.csproj
+++ b/sampleApp/SampleApplication.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/AET.SteamAbstraction/AET.SteamAbstraction.csproj b/src/AET.SteamAbstraction/AET.SteamAbstraction.csproj
index 8386272e..35deee25 100644
--- a/src/AET.SteamAbstraction/AET.SteamAbstraction.csproj
+++ b/src/AET.SteamAbstraction/AET.SteamAbstraction.csproj
@@ -25,12 +25,12 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/AET.SteamAbstraction/SteamAbstractionLayer.cs b/src/AET.SteamAbstraction/SteamAbstractionLayer.cs
index c41b40c8..c0e249d6 100644
--- a/src/AET.SteamAbstraction/SteamAbstractionLayer.cs
+++ b/src/AET.SteamAbstraction/SteamAbstractionLayer.cs
@@ -19,7 +19,7 @@ public static void InitializeServices(IServiceCollection serviceCollection)
{
serviceCollection.AddSingleton(sp => new SteamWrapperFactory(sp));
serviceCollection.AddSingleton(sp => new SteamRegistryFactory(sp));
- serviceCollection.AddSingleton(sp => new ProcessHelper());
+ serviceCollection.AddSingleton(new ProcessHelper());
serviceCollection.AddSingleton(sp => new SteamLibraryFinder(sp));
}
}
\ No newline at end of file
diff --git a/src/AET.SteamAbstraction/SteamWrapper.cs b/src/AET.SteamAbstraction/SteamWrapper.cs
index 765aa3c8..b04da866 100644
--- a/src/AET.SteamAbstraction/SteamWrapper.cs
+++ b/src/AET.SteamAbstraction/SteamWrapper.cs
@@ -51,7 +51,7 @@ public bool? UserWantsOfflineMode
try
{
var config = SteamVdfReader.ReadLoginUsers(FileSystem.FileInfo.New(configFile));
- return config.Users.Any(user => user.MostRecent && user.UserWantsOffline);
+ return config.Users.Any(user => user is { MostRecent: true, UserWantsOffline: true });
}
catch (SteamException)
{
diff --git a/src/AET.SteamAbstraction/Vdf/Linq/VConditional.cs b/src/AET.SteamAbstraction/Vdf/Linq/VConditional.cs
index d7e5ced9..4a2c1f60 100644
--- a/src/AET.SteamAbstraction/Vdf/Linq/VConditional.cs
+++ b/src/AET.SteamAbstraction/Vdf/Linq/VConditional.cs
@@ -8,7 +8,7 @@ namespace AET.SteamAbstraction.Vdf.Linq;
internal class VConditional : VToken
{
- private readonly List _tokens = new();
+ private readonly List _tokens = [];
public override VTokenType Type => VTokenType.Conditional;
diff --git a/src/AET.SteamAbstraction/Vdf/Linq/VObject.cs b/src/AET.SteamAbstraction/Vdf/Linq/VObject.cs
index 17b707c7..57621c62 100644
--- a/src/AET.SteamAbstraction/Vdf/Linq/VObject.cs
+++ b/src/AET.SteamAbstraction/Vdf/Linq/VObject.cs
@@ -75,7 +75,7 @@ public VToken? this[string key]
public VObject()
{
- _children = new List();
+ _children = [];
}
public VObject(VObject other)
diff --git a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArgumentNames.cs b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArgumentNames.cs
index 47ce6b07..fd7f9800 100644
--- a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArgumentNames.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArgumentNames.cs
@@ -9,6 +9,7 @@ namespace PG.StarWarsGame.Infrastructure.Clients.Arguments;
///
public static class GameArgumentNames
{
+ // ReSharper disable InconsistentNaming
internal const string ModListArg = "MODLIST";
internal const string WindowedArg = "WINDOWED";
internal const string MCEArg = "MCE";
@@ -68,6 +69,7 @@ public static class GameArgumentNames
internal const string ConsoleCommandFileArg = "CONSOLECOMMANDFILE";
internal const string ConnectPortArg = "CONNECTPORT";
internal const string ConnectIPArg = "CONNECTIP";
+ // ReSharper enable InconsistentNaming
internal static readonly IReadOnlyCollection SupportedFlagArgumentNames =
new ReadOnlyCollection(
diff --git a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/AILogStyle.cs b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/AILogStyle.cs
index bf6b8d3e..7a89017f 100644
--- a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/AILogStyle.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/AILogStyle.cs
@@ -2,6 +2,7 @@
namespace PG.StarWarsGame.Infrastructure.Clients.Arguments.GameArguments;
+// ReSharper disable once InconsistentNaming
///
/// Level of detail of LUA logging.
///
diff --git a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/GameArguments.cs b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/GameArguments.cs
index c4cd9b1f..2f21b4d5 100644
--- a/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/GameArguments.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Clients/Arguments/GameArguments/GameArguments.cs
@@ -5,6 +5,8 @@
namespace PG.StarWarsGame.Infrastructure.Clients.Arguments.GameArguments;
+// ReSharper disable InconsistentNaming
+
#region Flags Normal
///
@@ -304,7 +306,7 @@ internal override string ValueToCommandLine()
/// File location where LUA logging shall be stored to.
///
///
-/// The directory of the file must already exists.
+/// The directory of the file must already exist.
///
public sealed class AILogFileArgument(IFileInfo value, IDirectoryInfo gameDir) : NamedArgument(GameArgumentNames.AILogFileArg, value, true)
{
diff --git a/src/PG.StarWarsGame.Infrastructure/Clients/Utilities/GameExecutableFileUtilities.cs b/src/PG.StarWarsGame.Infrastructure/Clients/Utilities/GameExecutableFileUtilities.cs
index f6f7e1a8..442b0446 100644
--- a/src/PG.StarWarsGame.Infrastructure/Clients/Utilities/GameExecutableFileUtilities.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Clients/Utilities/GameExecutableFileUtilities.cs
@@ -6,32 +6,43 @@
namespace PG.StarWarsGame.Infrastructure.Clients.Utilities;
-internal class GameExecutableFileUtilities
+///
+/// Provides utility methods for locating game executable files for different game platforms and build types.
+///
+public static class GameExecutableFileUtilities
{
private const string SteamFileNameBase = "StarWars";
private const string SteamReleaseSuffix = "G";
private const string SteamDebugSuffix = "I";
+ ///
+ /// Gets the executable file for the specified game and build type or if not found.
+ ///
+ /// The game for which to locate the executable file.
+ /// The build type of the game executable to locate.
+ /// An representing the executable file if found; otherwise, .
+ /// is .
public static IFileInfo? GetExecutableForGame(IGame game, GameBuildType buildType)
{
- var exeFileName = GetExecutableFileName(game, buildType);
+ if (game == null)
+ throw new ArgumentNullException(nameof(game));
- if (string.IsNullOrEmpty(exeFileName))
+ // Only SteamGold supports debug builds
+ if (buildType == GameBuildType.Debug && game.Platform != GamePlatform.SteamGold)
return null;
+ var exeFileName = GetExecutableFileName(game, buildType);
+
return game.Directory
- .EnumerateFiles(exeFileName!, SearchOption.TopDirectoryOnly)
+ .EnumerateFiles(exeFileName, SearchOption.TopDirectoryOnly)
.FirstOrDefault();
}
- private static string? GetExecutableFileName(IGame game, GameBuildType buildType)
+ private static string GetExecutableFileName(IGame game, GameBuildType buildType)
{
if (game.Platform == GamePlatform.SteamGold)
return GetSteamFileName(buildType);
- if (buildType is GameBuildType.Debug)
- return null;
-
return game.Type switch
{
GameType.Eaw => PetroglyphStarWarsGameConstants.EmpireAtWarExeFileName,
diff --git a/src/PG.StarWarsGame.Infrastructure/Games/PetroglyphStarWarsGame.cs b/src/PG.StarWarsGame.Infrastructure/Games/PetroglyphStarWarsGame.cs
index 638816a3..e7738872 100644
--- a/src/PG.StarWarsGame.Infrastructure/Games/PetroglyphStarWarsGame.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Games/PetroglyphStarWarsGame.cs
@@ -13,8 +13,7 @@ namespace PG.StarWarsGame.Infrastructure.Games;
public class PetroglyphStarWarsGame : PlayableModContainer, IGame
{
private readonly string _normalizedPath;
- private IDirectoryInfo? _modLocation;
-
+
///
/// Gets the file system of this game.
///
@@ -40,13 +39,13 @@ public IDirectoryInfo ModsLocation
{
get
{
- if (_modLocation is null)
+ if (field is null)
{
var fs = Directory.FileSystem;
var modsPath = fs.Path.Combine(Directory.FullName, "Mods");
- _modLocation = fs.DirectoryInfo.New(modsPath);
+ field = fs.DirectoryInfo.New(modsPath);
}
- return _modLocation;
+ return field;
}
}
diff --git a/src/PG.StarWarsGame.Infrastructure/Games/Registry/GameRegistry.cs b/src/PG.StarWarsGame.Infrastructure/Games/Registry/GameRegistry.cs
index 9a86db83..458106be 100644
--- a/src/PG.StarWarsGame.Infrastructure/Games/Registry/GameRegistry.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Games/Registry/GameRegistry.cs
@@ -7,6 +7,7 @@ namespace PG.StarWarsGame.Infrastructure.Games.Registry;
internal sealed class GameRegistry : IGameRegistry
{
+ // ReSharper disable InconsistentNaming
internal const string VersionKey = "1.0";
internal const string CDKeyProperty = "CD Key";
internal const string EawGoldProperty = "EAWGold";
@@ -15,6 +16,7 @@ internal sealed class GameRegistry : IGameRegistry
internal const string InstallPathProperty = "InstallPath";
internal const string LauncherProperty = "Launcher";
internal const string RevisionProperty = "Revision";
+ // ReSharper enable InconsistentNaming
private static readonly Version VersionInstance = new(1, 0);
diff --git a/src/PG.StarWarsGame.Infrastructure/IModContainer.cs b/src/PG.StarWarsGame.Infrastructure/IModContainer.cs
index 5ba51d5f..4f05eb7c 100644
--- a/src/PG.StarWarsGame.Infrastructure/IModContainer.cs
+++ b/src/PG.StarWarsGame.Infrastructure/IModContainer.cs
@@ -6,7 +6,8 @@
namespace PG.StarWarsGame.Infrastructure;
///
-/// This instance can be parent for one or many mods.
+/// Defines a container for managing a collection of mods, providing methods to add, remove, and search for mods, as
+/// well as an event for tracking modifications to the mod collection.
///
public interface IModContainer : IEnumerable
{
diff --git a/src/PG.StarWarsGame.Infrastructure/Mods/ModBase.cs b/src/PG.StarWarsGame.Infrastructure/Mods/ModBase.cs
index 4baf1174..8333abbc 100644
--- a/src/PG.StarWarsGame.Infrastructure/Mods/ModBase.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Mods/ModBase.cs
@@ -21,8 +21,6 @@ public abstract class ModBase : PlayableModContainer, IMod
///
public event EventHandler? DependenciesResolved;
- private SemVersion? _modVersion;
-
///
public string Identifier { get; }
@@ -48,7 +46,7 @@ public abstract class ModBase : PlayableModContainer, IMod
public IModinfo? ModInfo { get; protected init; }
///
- public SemVersion? Version => _modVersion ??= InitializeVersion();
+ public SemVersion? Version => field ??= InitializeVersion();
///
/// Gets the mod's dependency list from the modinfo data or an empty list if no modinfo data is specified.
diff --git a/src/PG.StarWarsGame.Infrastructure/PG.StarWarsGame.Infrastructure.csproj b/src/PG.StarWarsGame.Infrastructure/PG.StarWarsGame.Infrastructure.csproj
index 491971db..08e22e06 100644
--- a/src/PG.StarWarsGame.Infrastructure/PG.StarWarsGame.Infrastructure.csproj
+++ b/src/PG.StarWarsGame.Infrastructure/PG.StarWarsGame.Infrastructure.csproj
@@ -22,7 +22,7 @@
true
-
+
@@ -36,9 +36,9 @@
-
-
+
+
-
+
\ No newline at end of file
diff --git a/src/PG.StarWarsGame.Infrastructure/PlayableObject.cs b/src/PG.StarWarsGame.Infrastructure/PlayableObject.cs
index c6a73f1a..5ddc3145 100644
--- a/src/PG.StarWarsGame.Infrastructure/PlayableObject.cs
+++ b/src/PG.StarWarsGame.Infrastructure/PlayableObject.cs
@@ -15,9 +15,6 @@ namespace PG.StarWarsGame.Infrastructure;
///
public abstract class PlayableObject(IServiceProvider serviceProvider) : IPlayableObject
{
- private IReadOnlyCollection? _installedLanguages;
- private string? _iconFile;
-
private bool _languageSearched;
private bool _iconSearched;
@@ -38,12 +35,12 @@ public IReadOnlyCollection InstalledLanguages
get
{
if (_languageSearched)
- return _installedLanguages!;
- _installedLanguages = ResolveInstalledLanguages();
- if (_installedLanguages is null)
+ return field!;
+ field = ResolveInstalledLanguages();
+ if (field is null)
throw new PetroglyphException("Resolved languages must not be null.");
_languageSearched = true;
- return _installedLanguages;
+ return field;
}
}
@@ -53,10 +50,10 @@ public string? IconFile
get
{
if (_iconSearched)
- return _iconFile;
- _iconFile = ResolveIconFile();
+ return field;
+ field = ResolveIconFile();
_iconSearched = true;
- return _iconFile;
+ return field;
}
}
diff --git a/src/PG.StarWarsGame.Infrastructure/Services/ModFactory.cs b/src/PG.StarWarsGame.Infrastructure/Services/ModFactory.cs
index 56badd1d..15c7d23c 100644
--- a/src/PG.StarWarsGame.Infrastructure/Services/ModFactory.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Services/ModFactory.cs
@@ -70,8 +70,8 @@ public IVirtualMod CreateVirtualMod(IGame game, IModinfo virtualModInfo)
private string GetModName(DetectedModReference detectedMod, CultureInfo culture)
{
var name = _nameResolver.ResolveName(detectedMod, culture);
- if (string.IsNullOrEmpty(name))
- throw new ModException(detectedMod.ModReference, "Unable to create a mod with an empty name.");
- return name!;
+ return string.IsNullOrEmpty(name)
+ ? throw new ModException(detectedMod.ModReference, "Unable to create a mod with an empty name.")
+ : name;
}
}
\ No newline at end of file
diff --git a/src/PG.StarWarsGame.Infrastructure/Utilities/CompilerServices/CallerArgumentExpressionAttribute.cs b/src/PG.StarWarsGame.Infrastructure/Utilities/CompilerServices/CallerArgumentExpressionAttribute.cs
index 5d1c7868..093da83f 100644
--- a/src/PG.StarWarsGame.Infrastructure/Utilities/CompilerServices/CallerArgumentExpressionAttribute.cs
+++ b/src/PG.StarWarsGame.Infrastructure/Utilities/CompilerServices/CallerArgumentExpressionAttribute.cs
@@ -1,5 +1,7 @@
#if !NET
+#pragma warning disable IDE0130
namespace System.Runtime.CompilerServices;
+#pragma warning restore IDE0130
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class CallerArgumentExpressionAttribute(string parameterName) : Attribute
diff --git a/test/AET.SteamAbstraction.Test/AET.SteamAbstraction.Test.csproj b/test/AET.SteamAbstraction.Test/AET.SteamAbstraction.Test.csproj
index 4525e445..d3d787e4 100644
--- a/test/AET.SteamAbstraction.Test/AET.SteamAbstraction.Test.csproj
+++ b/test/AET.SteamAbstraction.Test/AET.SteamAbstraction.Test.csproj
@@ -16,7 +16,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/test/AET.SteamAbstraction.Test/SteamWrapperTestBase.cs b/test/AET.SteamAbstraction.Test/SteamWrapperTestBase.cs
index ff4a2646..68140391 100644
--- a/test/AET.SteamAbstraction.Test/SteamWrapperTestBase.cs
+++ b/test/AET.SteamAbstraction.Test/SteamWrapperTestBase.cs
@@ -6,7 +6,7 @@
using System.Threading.Tasks;
using AET.SteamAbstraction.Library;
using AET.SteamAbstraction.Registry;
-using AET.SteamAbstraction.Test.TestUtilities;
+using AET.SteamAbstraction.Testing;
using AET.SteamAbstraction.Testing.Installation;
using AET.SteamAbstraction.Utilities;
using AnakinRaW.CommonUtilities;
diff --git a/test/AET.SteamAbstraction.Testing/AET.SteamAbstraction.Testing.csproj b/test/AET.SteamAbstraction.Testing/AET.SteamAbstraction.Testing.csproj
index 893861a4..90660bc1 100644
--- a/test/AET.SteamAbstraction.Testing/AET.SteamAbstraction.Testing.csproj
+++ b/test/AET.SteamAbstraction.Testing/AET.SteamAbstraction.Testing.csproj
@@ -33,7 +33,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
diff --git a/test/AET.SteamAbstraction.Testing/TestProcessHelper.cs b/test/AET.SteamAbstraction.Testing/TestProcessHelper.cs
index 2113f221..7773e9cf 100644
--- a/test/AET.SteamAbstraction.Testing/TestProcessHelper.cs
+++ b/test/AET.SteamAbstraction.Testing/TestProcessHelper.cs
@@ -9,7 +9,7 @@
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace AET.SteamAbstraction.Test.TestUtilities;
+namespace AET.SteamAbstraction.Testing;
public class TestProcessHelper(IServiceProvider sp) : IProcessHelper
{
@@ -32,7 +32,7 @@ public bool IsProcessRunning(int pid)
return pid == _pid;
}
- public Process? StartProcess(ProcessStartInfo startInfo)
+ public Process StartProcess(ProcessStartInfo startInfo)
{
var registry = _registryFactory.CreateRegistry();
var expectedFileName = registry.ExecutableFile?.FullName;
diff --git a/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test.csproj b/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test.csproj
index 96b4e4eb..9a243dfd 100644
--- a/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test.csproj
+++ b/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test.csproj
@@ -17,7 +17,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/SteamPetroglyphStarWarsGameClientTest.cs b/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/SteamPetroglyphStarWarsGameClientTest.cs
index fb39ea61..db607eb8 100644
--- a/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/SteamPetroglyphStarWarsGameClientTest.cs
+++ b/test/PG.StarWarsGame.Infrastructure.Clients.Steam.Test/SteamPetroglyphStarWarsGameClientTest.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using AET.SteamAbstraction;
using AET.SteamAbstraction.Registry;
-using AET.SteamAbstraction.Test.TestUtilities;
+using AET.SteamAbstraction.Testing;
using AET.SteamAbstraction.Testing.Installation;
using AET.SteamAbstraction.Utilities;
using AnakinRaW.CommonUtilities.Registry;
diff --git a/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/ArgumentCollectionTest.cs b/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/ArgumentCollectionTest.cs
index 3ff2030c..d4f651d3 100644
--- a/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/ArgumentCollectionTest.cs
+++ b/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/ArgumentCollectionTest.cs
@@ -29,7 +29,7 @@ public void TestImmutable()
var e = ((IEnumerable)argList).GetEnumerator();
Assert.True(e.MoveNext());
- var o = (GameArgument)e.Current;
+ var o = (GameArgument)e.Current!;
Assert.Equal(new WindowedArgument(), a);
diff --git a/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/GameArgumentTestBase.cs b/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/GameArgumentTestBase.cs
index 017fa590..25458c52 100644
--- a/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/GameArgumentTestBase.cs
+++ b/test/PG.StarWarsGame.Infrastructure.Test/Clients/Arguments/GameArgumentTestBase.cs
@@ -159,7 +159,7 @@ public static IEnumerable