Pass in default install directory to managers

pull/32/head
Pat Hartl 2023-11-10 21:36:35 -06:00
parent 20de9d6cae
commit b77e7f6e53
3 changed files with 7 additions and 5 deletions

View File

@ -37,7 +37,7 @@ namespace LANCommander.PlaynitePlugin
var result = Plugin.PlayniteApi.Dialogs.ActivateGlobalProgress(progress => var result = Plugin.PlayniteApi.Dialogs.ActivateGlobalProgress(progress =>
{ {
var gameManager = new GameManager(Plugin.LANCommanderClient); var gameManager = new GameManager(Plugin.LANCommanderClient, Plugin.Settings.InstallDirectory);
gameManager.OnArchiveExtractionProgress += (long pos, long len) => gameManager.OnArchiveExtractionProgress += (long pos, long len) =>
{ {

View File

@ -23,7 +23,7 @@ namespace LANCommander.PlaynitePlugin
{ {
try try
{ {
var gameManager = new LANCommander.SDK.GameManager(Plugin.LANCommanderClient); var gameManager = new LANCommander.SDK.GameManager(Plugin.LANCommanderClient, Plugin.Settings.InstallDirectory);
gameManager.Uninstall(Game.InstallDirectory); gameManager.Uninstall(Game.InstallDirectory);
} }

View File

@ -25,14 +25,16 @@ namespace LANCommander.SDK
public delegate void OnArchiveExtractionProgressHandler(long position, long length); public delegate void OnArchiveExtractionProgressHandler(long position, long length);
public event OnArchiveExtractionProgressHandler OnArchiveExtractionProgress; public event OnArchiveExtractionProgressHandler OnArchiveExtractionProgress;
public GameManager(Client client) public GameManager(Client client, string defaultInstallDirectory)
{ {
Client = client; Client = client;
DefaultInstallDirectory = defaultInstallDirectory;
} }
public GameManager(Client client, ILogger logger) public GameManager(Client client, string defaultInstallDirectory, ILogger logger)
{ {
Client = client; Client = client;
DefaultInstallDirectory = DefaultInstallDirectory;
Logger = logger; Logger = logger;
} }
@ -53,7 +55,7 @@ namespace LANCommander.SDK
{ {
Logger?.LogTrace("Attempting to download and extract game"); Logger?.LogTrace("Attempting to download and extract game");
return DownloadAndExtract(game); return DownloadAndExtract(game, DefaultInstallDirectory);
}); });
if (!result.Success && !result.Canceled) if (!result.Success && !result.Canceled)