Add Playnite URI support

dhcp-server
Pat Hartl 2023-09-03 15:55:04 -05:00
parent 1067e9ff93
commit 49fab71c14
1 changed files with 28 additions and 0 deletions

View File

@ -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)