Run key change script in InstallController

pull/33/head
Pat Hartl 2023-11-16 00:40:27 -06:00
parent eb05364542
commit 16dc60b90a
1 changed files with 19 additions and 0 deletions

View File

@ -119,6 +119,7 @@ namespace LANCommander.PlaynitePlugin
RunInstallScript(installDirectory); RunInstallScript(installDirectory);
RunNameChangeScript(installDirectory); RunNameChangeScript(installDirectory);
RunKeyChangeScript(installDirectory);
InvokeOnInstalled(new GameInstalledEventArgs(installInfo)); InvokeOnInstalled(new GameInstalledEventArgs(installInfo));
} }
@ -166,5 +167,23 @@ namespace LANCommander.PlaynitePlugin
return script.Execute(); return script.Execute();
} }
private int RunKeyChangeScript(string installDirectory)
{
var manifest = ManifestHelper.Read(installDirectory);
var script = new PowerShellScript();
var key = Plugin.LANCommanderClient.GetAllocatedKey(manifest.Id);
script.AddVariable("InstallDirectory", installDirectory);
script.AddVariable("GameManifest", manifest);
script.AddVariable("DefaultInstallDirectory", Plugin.Settings.InstallDirectory);
script.AddVariable("ServerAddress", Plugin.Settings.ServerAddress);
script.AddVariable("AllocatedKey", key);
script.UseFile(ScriptHelper.GetScriptFilePath(installDirectory, SDK.Enums.ScriptType.KeyChange));
return script.Execute();
}
} }
} }