From 49fab71c147570c8ace5eeb2072b36141b986858 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sun, 3 Sep 2023 15:55:04 -0500 Subject: [PATCH] Add Playnite URI support --- .../LANCommanderLibraryPlugin.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs index 0c410c6..db7ac65 100644 --- a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs +++ b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs @@ -49,6 +49,34 @@ namespace LANCommander.PlaynitePlugin PowerShellRuntime = new PowerShellRuntime(); GameSaveService = new GameSaveService(LANCommander, PlayniteApi, PowerShellRuntime); + + api.UriHandler.RegisterSource("lancommander", args => + { + if (args.Arguments.Length == 0) + return; + + Guid gameId; + + switch (args.Arguments[0].ToLower()) + { + case "install": + if (args.Arguments.Length == 1) + break; + + if (Guid.TryParse(args.Arguments[1], out gameId)) + PlayniteApi.InstallGame(gameId); + break; + + case "run": + if (args.Arguments.Length == 1) + break; + + if (Guid.TryParse(args.Arguments[1], out gameId)) + PlayniteApi.StartGame(gameId); + break; + } + + }); } public override void OnApplicationStarted(OnApplicationStartedEventArgs args)