Open EzioTheDeadPoet opened 1 year ago
Since I don't know if this has still any relevance I moved it form the wiki into an issue that can be closed.
This is so that I can also add the wiki to the main repository, mainly because it is easier to find for most people if the wiki is located there.
You can ditch netX.0-windows
by using the [SupportedOSPlatform]("windows")
attribute on classes/methods that are OS specific or RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
in functions to provide different behaviors.
This is what I've done with GameFinder and now every GameFinder package targets net6.0
/net7.0
. Instead of directly accessing the Windows registry I created an interface IRegistry
and guarded the Windows specific implementation behind an [SupportedOSPlatform("windows")]
: https://github.com/erri120/GameFinder/blob/2c39db4ca3c1eca255774f53db2dd9b75ffa95f6/GameFinder.RegistryUtils/WindowsRegistry.cs
This also made testing easier since I can now create an In-Memory registry without any issues.
I used RuntimeInformation.IsOSPlatform
for the Steam package since Steam official supports Linux:
https://github.com/erri120/GameFinder/blob/2c39db4ca3c1eca255774f53db2dd9b75ffa95f6/GameFinder.StoreHandlers.Steam/SteamHandler.cs#L171-L189
More infos here: https://learn.microsoft.com/en-us/dotnet/standard/analyzers/platform-compat-analyzer
Wabbajack has a code problem, mainly that most of the libraries require
net5.0-windows
instead ofnet5.0
. In addition, most of our libraries are Windows specific to a very low level. This is a general plan/braindump of how to restructure the app to be more cross platform.Wabbajack.Paths
AlphaFS
?\
or/
?Wabbajack.Hashing
Wabbajack.Paths
for all IOWabbajack.Serialization.Json
.dlls
that are not loadedJsonName
.Wabbajack.DTOs
Compression.BSA
toWabbajack.Compression.BSA
Wabbajack.Common.CSP
- we don't need it