GameFinder.StoreHandlers.GOG
4.2.3
See the version list below for details.
dotnet add package GameFinder.StoreHandlers.GOG --version 4.2.3
NuGet\Install-Package GameFinder.StoreHandlers.GOG -Version 4.2.3
<PackageReference Include="GameFinder.StoreHandlers.GOG" Version="4.2.3" />
paket add GameFinder.StoreHandlers.GOG --version 4.2.3
#r "nuget: GameFinder.StoreHandlers.GOG, 4.2.3"
// Install GameFinder.StoreHandlers.GOG as a Cake Addin #addin nuget:?package=GameFinder.StoreHandlers.GOG&version=4.2.3 // Install GameFinder.StoreHandlers.GOG as a Cake Tool #tool nuget:?package=GameFinder.StoreHandlers.GOG&version=4.2.3
GameFinder
.NET library for finding games. The following launchers are supported:
The following launchers are not yet supported or support has been dropped:
If you are interested in understanding how GameFinder finds these games, check the wiki for more information.
Additionally, the following Linux tools are supported:
Example
The example project uses every available store handler and can be used as a reference. You can go to the GitHub Actions Page and click on one of the latest CI workflow runs to download a build of this project.
Usage
All store handlers inherit from AHandler<TGame, TId>
and implement FindAllGames()
which returns IEnumerable<OneOf<TGame, ErrorMessage>>
. The OneOf
struct is a F# style union and is guaranteed to only contain one of the following: a TGame
or an ErrorMessage
. I recommended checking out the OneOf library, if you want to learn more.
Some important things to remember:
- All store handler methods are pure, meaning they do not change the internal state of the store handler because they don't have any. This also means that the results are not cached and you shouldn't call the same method multiple times. It's up to the library consumer to cache the results somewhere.
- Ids are store dependent. Each store handler has their own type of id and figuring out the right id for your game might require some testing. You can find useful resources in this README for some store handlers.
Basic Usage
var results = handler.FindAllGames();
foreach (var result in results)
{
// using the switch method
result.Switch(game =>
{
Console.WriteLine($"Found {game}");
}, error =>
{
Console.WriteLine(error);
});
// using the provided extension functions
if (result.TryGetGame(out var game))
{
Console.WriteLine($"Found {game}");
} else
{
Console.WriteLine(result.AsError());
}
}
Finding a single game
If you're working on an application that only needs to find 1 game, then you can use the FindOneGameById
method instead. IMPORTANT NOTE: the results are not cached. If you call this method multiple, the store handler will do the same thing multiple times, which is search for every game installed. Do not call this method if you need to find multiple games.
var game = handler.FindOneGameById(someId, out var errors);
// I highly recommend logging errors regardless of whether or not the game was found.
foreach (var error in errors)
{
Console.WriteLine(error);
}
if (game is null)
{
Console.WriteLine("Unable to find game");
} else
{
Console.WriteLine($"Found {game}");
}
Finding multiple games
If you need to find multiple games at once, you can use the FindAllGamesById
method instead. This returns an IReadOnlyDictionary<TId, TGame>
which you can use to lookup games by id. IMPORTANT NOTE: the results are not cached. You have to do that yourself.
var games = handler.FindAllGamesById(out var errors);
// I highly recommend always logging errors.
foreach (var error in errors)
{
Console.WriteLine(error);
}
if (games.TryGetValue(someId, out var game))
{
Console.WriteLine($"Found {game}");
} else
{
Console.WriteLine($"Unable to find game with the id {someId}");
}
Supported Launchers
Steam
Steam is supported natively on Windows and Linux. Use SteamDB to find the ID of a game.
Usage (cross-platform):
var handler = new SteamHandler(FileSystem.Shared, OperatingSystem.IsWindows() ? WindowsRegistry.Shared : null);
GOG Galaxy
GOG Galaxy is supported natively on Windows, and with Wine on Linux. Use the GOG Database to find the ID of a game.
Usage (native on Windows):
var handler = new GOGHandler(WindowsRegistry.Shared, FileSystem.Shared);
Usage (Wine on Linux):
See Wine for more information.
// requires a valid prefix
var wineFileSystem = winePrefix.CreateOverlayFileSystem(FileSystem.Shared);
var wineRegistry = winePrefix.CreateRegistry(FileSystem.Shared);
var handler = new GOGHandler(wineRegistry, wineFileSystem);
Epic Games Store
The Epic Games Store is supported natively on Windows, and with Wine on Linux. Use the Epic Games Store Database to find the ID of a game (WIP).
Usage (native on Windows):
var handler = new EGSHandler(WindowsRegistry.Shared, FileSystem.Shared);
Usage (Wine on Linux):
See Wine for more information.
// requires a valid prefix
var wineFileSystem = winePrefix.CreateOverlayFileSystem(FileSystem.Shared);
var wineRegistry = winePrefix.CreateRegistry(FileSystem.Shared);
var handler = new EGSHandler(wineRegistry, wineFileSystem);
Origin
Origin is supported natively on Windows, and with Wine on Linux. Note: EA is deprecating Origin and will replace it with EA Desktop.
Usage (native on Windows):
var handler = new OriginHandler(FileSystem.Shared);
Usage (Wine on Linux):
See Wine for more information.
// requires a valid prefix
var wineFileSystem = winePrefix.CreateOverlayFileSystem(FileSystem.Shared);
var handler = new OriginHandler(wineFileSystem);
EA Desktop
EA Desktop is the replacement for Origin: See EA is deprecating Origin. This is by far, the most complicated Store Handler. You should read the wiki entry. My implementation decrypts the encrypted file, created by EA Desktop. You should be aware that the key used to encrypt the file is derived from hardware information. If the user changes their hardware, the decryption process might fail because they key has changed.
EA Desktop is only supported on Windows.
Usage:
var handler = new EADesktopHandler(FileSystem.Shared, new HardwareInfoProvider());
Xbox Game Pass
This package used to be deprecated, but I've re-added support in GameFinder 3.0.0. Xbox Game Pass used to install games inside a SYSTEM
protected folder, making modding not feasible for the average user. You can read more about this here.
Xbox Game Pass is only supported on Windows.
Usage:
var handler = new XboxHandler(FileSystem.Shared);
Bethesda.net
As of May 11, 2022, the Bethesda.net launcher is no longer in use. The package GameFinder.StoreHandlers.BethNet has been deprecated and marked as legacy.
Wine
Wine is a compatibility layer capable of running Windows applications on Linux. Wine uses prefixes to create and store virtual C:
drives. A user can install and run Windows program inside these prefixes, and applications running inside the prefixes likely won't even notice they are not actually running on Windows.
Since GameFinder is all about finding games, it also has to be able to find games inside Wine prefixes to provide good Linux support. The package NexusMods.Paths
from NexusMods.App provides a file system abstraction IFileSystem
which enables path re-mappings:
AWinePrefix prefix = //...
// creates a new IFileSystem, with path mappings into the wine prefix
IFileSystem wineFileSystem = prefix.CreateOverlayFileSystem(FileSystem.Shared);
// this wineFileSystem can be used instead of FileSystem.Shared:
var handler = new OriginHandler(wineFileSystem);
// you can also create a new IRegistry:
IRegistry wineRegistry = prefix.CreateRegistry(FileSystem.Shared);
// and use both:
var handler = new EGSHandler(wineRegistry, wineFileSystem);
Default Prefix Manager
GameFinder.Wine
implements a IWinePrefixManager
for finding Wine prefixes.
Usage:
var prefixManager = new DefaultWinePrefixManager(FileSystem.Shared);
foreach (var result in prefixManager.FindPrefixes())
{
result.Switch(prefix =>
{
Console.WriteLine($"Found wine prefix at {prefix.ConfigurationDirectory}");
}, error =>
{
Console.WriteLine(error.Value);
});
}
Bottles
GameFinder.Wine
implements a IWinePrefixManager
for finding Wine prefixes managed by Bottles.
Usage:
var prefixManager = new BottlesWinePrefixManager(FileSystem.Shared);
foreach (var result in prefixManager.FindPrefixes())
{
result.Switch(prefix =>
{
Console.WriteLine($"Found wine prefix at {prefix.ConfigurationDirectory}");
}, error =>
{
Console.WriteLine(error.Value);
});
}
Proton
Valve's Proton is a compatibility tool for Steam and is mostly based on Wine. The Wine prefixes managed by Proton are in the compatdata
directory of the steam library where the game itself is installed. Since the path is relative to the game itself and requires the app id, I've decided to put this functionality in GameFinder.StoreHandlers.Steam
:
SteamGame? steamGame = steamHandler.FindOneGameById(1237970, out var errors);
if (steamGame is null) return;
ProtonWinePrefix protonPrefix = steamGame.GetProtonPrefix();
var protonPrefixDirectory = protonPrefix.ProtonDirectory;
if (protonDirectory != default && fileSystem.DirectoryExists(protonDirectory))
{
Console.WriteLine($"Proton prefix is at {protonDirectory}");
}
Trimming
Self-contained deployments and executables can be trimmed starting with .NET 6. This feature is only available to applications that are published self-contained.
Trimmable:
GameFinder.Common
GameFinder.RegistryUtils
GameFinder.Wine
GameFinder.StoreHandlers.Steam
GameFinder.StoreHandlers.GOG
GameFinder.StoreHandlers.EGS
GameFinder.StoreHandlers.Origin
NOT Trimmable:
GameFinder.StoreHandlers.EADesktop
: This package referencesSystem.Management
, which is not trimmable due to COM interop issues. See dotnet/runtime#78038, dotnet/runtime#75176 and dotnet/runtime#61960 for more details.
I recommend looking at the project file of the example project, if you run into warnings or errors with trimming.
Contributing
See CONTRIBUTING for more information.
License
See LICENSE for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- GameFinder.Common (>= 4.2.3)
- GameFinder.RegistryUtils (>= 4.2.3)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on GameFinder.StoreHandlers.GOG:
Package | Downloads |
---|---|
Mutagen.Bethesda.Core
A C# library for manipulating, creating, and analyzing Bethesda mods. Contains only the core components without the generated records. |
|
GameFinder
Package Description |
|
Mutagen.Bethesda.Core.Windows
A C# library for Mutagen features that only work on windows |
|
PGCG.commonItems
Package Description |
|
Wabbajack.Downloaders.GameFile
Package Description |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on GameFinder.StoreHandlers.GOG:
Repository | Stars |
---|---|
wabbajack-tools/wabbajack
An automated Modlist installer for various games.
|
|
Mutagen-Modding/Mutagen
A .NET library for analyzing, creating, and manipulating Bethesda mods
|
Version | Downloads | Last updated |
---|---|---|
4.3.3 | 4,846 | 10/31/2024 |
4.3.2 | 3,015 | 10/7/2024 |
4.3.1 | 881 | 10/1/2024 |
4.3.0 | 351 | 9/28/2024 |
4.2.4 | 30,230 | 7/4/2024 |
4.2.3 | 887 | 6/25/2024 |
4.2.2 | 5,018 | 6/6/2024 |
4.2.1 | 148 | 6/5/2024 |
4.2.0 | 13,294 | 1/28/2024 |
4.1.0 | 3,704 | 1/8/2024 |
4.0.0 | 7,523 | 9/3/2023 |
3.2.2 | 2,169 | 8/11/2023 |
3.2.1 | 1,398 | 7/25/2023 |
3.2.0 | 263 | 7/25/2023 |
3.1.0 | 2,310 | 5/23/2023 |
3.0.2 | 654 | 5/10/2023 |
3.0.1 | 224 | 5/10/2023 |
3.0.0 | 289 | 5/9/2023 |
2.6.0 | 1,761 | 3/7/2023 |
2.5.0 | 2,858 | 1/17/2023 |
2.4.0 | 119,845 | 1/13/2023 |
2.3.0 | 545 | 12/16/2022 |
2.2.2 | 6,492 | 11/11/2022 |
2.2.1 | 27,650 | 10/21/2022 |
2.2.0 | 486 | 10/21/2022 |
2.1.0 | 387 | 10/21/2022 |
2.0.1 | 405 | 10/19/2022 |
2.0.0 | 567 | 10/15/2022 |
1.8.0 | 6,046 | 6/27/2022 |
1.7.3 | 79,520 | 5/14/2022 |
1.7.2 | 57,804 | 11/10/2021 |
1.7.1 | 23,452 | 8/19/2021 |
1.7.0 | 30,452 | 8/9/2021 |
1.6.4 | 414 | 8/3/2021 |
1.6.3 | 1,325 | 7/30/2021 |
1.6.2 | 394 | 7/17/2021 |
1.6.1 | 829 | 7/10/2021 |
1.6.0 | 441 | 7/10/2021 |
1.5.3 | 24,606 | 6/13/2021 |
1.5.2 | 328 | 6/9/2021 |
1.5.1 | 343 | 6/6/2021 |
1.5.0 | 15,745 | 5/29/2021 |
1.4.1 | 35,459 | 3/26/2021 |
1.4.0 | 347 | 3/26/2021 |
1.3.1 | 336 | 3/14/2021 |
1.3.0 | 350 | 3/13/2021 |
1.2.0 | 408 | 3/13/2021 |