Run uninstall script. Run scripts safely without throwing exceptions
This commit is contained in:
parent
d39c75d0ab
commit
b689abb8bc
2 changed files with 13 additions and 2 deletions
|
@ -32,7 +32,6 @@ namespace LANCommander.PlaynitePlugin
|
||||||
|
|
||||||
public override void Install(InstallActionArgs args)
|
public override void Install(InstallActionArgs args)
|
||||||
{
|
{
|
||||||
var tempPath = System.IO.Path.GetTempFileName();
|
|
||||||
var gameId = Guid.Parse(Game.GameId);
|
var gameId = Guid.Parse(Game.GameId);
|
||||||
|
|
||||||
var game = Plugin.LANCommander.GetGame(gameId);
|
var game = Plugin.LANCommander.GetGame(gameId);
|
||||||
|
@ -50,7 +49,11 @@ namespace LANCommander.PlaynitePlugin
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(installDirectory, "_manifest.yml"), GetManifest(gameId));
|
File.WriteAllText(Path.Combine(installDirectory, "_manifest.yml"), GetManifest(gameId));
|
||||||
|
|
||||||
PowerShellRuntime.RunInstallScript(PlayniteGame);
|
try
|
||||||
|
{
|
||||||
|
PowerShellRuntime.RunInstallScript(PlayniteGame);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
InvokeOnInstalled(new GameInstalledEventArgs(installInfo));
|
InvokeOnInstalled(new GameInstalledEventArgs(installInfo));
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,23 @@ namespace LANCommander.PlaynitePlugin
|
||||||
public class LANCommanderUninstallController : UninstallController
|
public class LANCommanderUninstallController : UninstallController
|
||||||
{
|
{
|
||||||
private LANCommanderLibraryPlugin Plugin;
|
private LANCommanderLibraryPlugin Plugin;
|
||||||
|
private PowerShellRuntime PowerShellRuntime;
|
||||||
|
|
||||||
public LANCommanderUninstallController(LANCommanderLibraryPlugin plugin, Game game) : base(game)
|
public LANCommanderUninstallController(LANCommanderLibraryPlugin plugin, Game game) : base(game)
|
||||||
{
|
{
|
||||||
Name = "Uninstall LANCommander Game";
|
Name = "Uninstall LANCommander Game";
|
||||||
Plugin = plugin;
|
Plugin = plugin;
|
||||||
|
PowerShellRuntime = new PowerShellRuntime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Uninstall(UninstallActionArgs args)
|
public override void Uninstall(UninstallActionArgs args)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PowerShellRuntime.RunUninstallScript(Game);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(Game.InstallDirectory) && Directory.Exists(Game.InstallDirectory))
|
if (!String.IsNullOrWhiteSpace(Game.InstallDirectory) && Directory.Exists(Game.InstallDirectory))
|
||||||
Directory.Delete(Game.InstallDirectory, true);
|
Directory.Delete(Game.InstallDirectory, true);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue