Commit graph

40 commits

Author SHA1 Message Date
Pat Hartl
68b112d6ce Implement RunWrapper script execution for redistributables
RunWrapper scripts were defined as a script type but never executed. This adds full execution support during game launch, with proper game running state tracking and cancellation/stop support including child process cleanup.
2026-05-26 20:11:53 -05:00
Pat Hartl
a256ea6406 Log script errors, avoid silent failures in package scripts 2026-05-10 12:14:32 -05:00
Pat Hartl
1c2b068001 Fix regex for checking if script requires admin 2026-03-13 01:33:18 -05:00
Pat Hartl
da0d1d6d7a Replace custom admin directive with PowerShell standard directive 2026-03-10 18:15:35 -05:00
Pat Hartl
303f8720f4 ILogger implementation to log to PowerShell 2026-01-28 02:13:19 -06:00
Pat Hartl
87f7e2160c Remove DI from cmdlets, fix SteamCMD login, fix SteamCMD settings 2026-01-28 01:59:27 -06:00
Pat Hartl
c5506b440f Move Steam integrations to separate assembly, add cmdlets for various Steam actions 2026-01-24 16:37:07 -06:00
Aaron Powell
22113f9ef2 Removing Serilig from the sdk 2025-12-11 16:18:33 +11:00
Pat Hartl
ce183c8eb9 Implement debugger for packaging scripts 2025-12-10 21:46:46 -06:00
Pat Hartl
17fa802c19 Implementation of script debugger component with RPC via SignalR 2025-12-10 20:55:38 -06:00
Pat Hartl
a281ef473e Fix script debugging in launcher, fix cmdlet registration 2025-11-26 22:38:04 -06:00
Pat Hartl
e6c12b4809 Refactor script debugging
Instead of providing delegates to a ScriptClient singleton, script execution now relies on dependency injection for debugging. This can be handled by registering an implementation of IScriptDebugger. Multiple script debuggers are supported. These changes required the creation of a PowerShellScriptFactory to handle DI of the service provider to the script.

In the case of LANCommander, "debugging" scripts really just gives an opportunity for the application to break after a script's execution and provide a poor-man's pty. This could be expanded upon in the future to hook directly into PowerShell's debugging functionality, but would require a substantial refactor to script execution.
2025-11-26 01:09:52 -06:00
Pat Hartl
d8af75df26 Load all cmdlets defined in code 2025-11-25 23:58:43 -06:00
Pat Hartl
4968481460 Standardize YAML serializers 2025-10-06 19:23:49 -05:00
Pat Hartl
a648852292 Implement SDK using dependency injection
- API requests are now made through the ApiRequestBuilder with DI supplied via the ApiRequestFactory singleton
- Reliance on RestSharp and WebClient has been removed in favor of HttpClient
- Auth token is now being tracked by the ITokenProvider
- Network information (MAC address, broadcast addresses, IP address) is now supplied with the INetworkInformationProvider singleton
- Connection state is now being maintained by the ConnectionService, with a reliance on RPC (SignalR websocket) reporting actual connection state without relying on pings
- All download streams are now provided as a TrackableStream
- Singleton Client class has been removed. All usage of the SDK should happen via Dependency Injection

This is just a base, non-functional refactor of the SDK to use DI. The following changes to the rest of the codebase need to be made:
- Usage of the SDK client in the launcher needs to be replaced in favor of injecting SDK services
- PowerShell cmdlets need to be able to have services injected. Most likely a separate scope will have to be opened up per PS runtime?
- Usage of the SDK client in the server needs to be replaced in favor of injecting SDK services. This should be minimal and should actually provide benefit when it comes to executing client-like features (scripts mostly) without needing a fully configured client that maintains connection state.
- Configuration of the client needs to be implemented using ILANCommanderConfiguration
2025-09-22 00:29:51 -05:00
Pat Hartl
11da187920 Add debug handler 2025-09-09 18:39:56 -05:00
RattleSN4K3
9eca901448 Fix uploading game save registry dumping when debugging script 2025-06-28 00:44:51 +02:00
Pat Hartl
bebe4181a3 Add cmdlet for downloading player avatar
Some checks failed
Publish SDK NuGet Package / publish (push) Failing after 50s
LANCommander Release / prep (push) Has been cancelled
LANCommander Release / build_launcher_linux-x64 (push) Has been cancelled
LANCommander Release / build_launcher_osx-arm64 (push) Has been cancelled
LANCommander Release / build_launcher_osx-x64 (push) Has been cancelled
LANCommander Release / build_launcher_win-arm64 (push) Has been cancelled
LANCommander Release / build_launcher_win-x64 (push) Has been cancelled
LANCommander Release / build_server_linux-arm64 (push) Has been cancelled
LANCommander Release / build_server_linux-x64 (push) Has been cancelled
LANCommander Release / build_server_osx-arm64 (push) Has been cancelled
LANCommander Release / build_server_osx-x64 (push) Has been cancelled
LANCommander Release / build_server_win-arm64 (push) Has been cancelled
LANCommander Release / build_server_win-x64 (push) Has been cancelled
LANCommander Release / build_launcher_linux-arm64 (push) Has been cancelled
LANCommander Release / build_release (push) Has been cancelled
Implements #148
2025-01-29 23:11:52 -06:00
Pat Hartl
34c345d8e9 Add cmdlets for calculating FOV 2025-01-23 02:47:02 -06:00
Pat Hartl
0137def923 Add missing user custom field cmdlets
Fixes #163
2025-01-14 17:42:28 -06:00
Pat Hartl
61c25ac005 Avoid null reference exception at end of script exec 2024-10-09 20:22:41 -05:00
Pat Hartl
6b68592b71 Avoid null reference when trying to gather return value 2024-09-27 17:59:47 -05:00
Pat Hartl
2d00742212 Allow scripts to return data 2024-09-20 00:27:20 -05:00
Pat Hartl
1cbc3eab56 Rework PS variables, add logo, add script type/working dir, show/hide terminal when script runs 2024-08-16 18:18:02 -05:00
Pat Hartl
ac16ba813b Switched to using xterm-readline, redirect PS output to terminal 2024-08-15 21:33:17 -05:00
Pat Hartl
9038e02bfb Progress on debug console 2024-08-14 13:24:50 -05:00
Pat Hartl
5a1346b5e5 Remove reference to install/uninstall cmdlet 2024-08-08 18:08:35 -05:00
Pat Hartl
85e47f5d3a Run scripts as admin using CLI elevation 2024-08-08 18:00:41 -05:00
Pat Hartl
9e770f4965 Bundle PowerShell runtime
This does a very basic job of bundling a PowerShell runtime into the SDK. Previously, scripts had been run by spawning a separate PowerShell process and feeding the script into it. This was nothing better than a hack and meant that PowerShell had to be separately installed on the machine it's executing on. This should open up the opportunity for scripts to run on other platforms.

There's still some things that need to be figured out. Some sort of console output as well as a debugging mode would be highly beneficial for those that wish to actively develop scripts for their games.
2024-08-05 18:02:01 -05:00
Pat Hartl
424f63b207 Use correct working directory 2024-08-04 13:19:56 -05:00
Pat Hartl
a6ca4297d5 List variables when debugging PowerShell script executions 2024-07-07 20:37:39 -05:00
Pat Hartl
9ea51f6fa5 Run powershell instead of powershell.exe 2024-06-19 17:21:49 -05:00
Pat Hartl
6fec91e73e Fix PowerShell scripts, add script debug mode
PowerShell scripts now execute correctly with the client. The built in PowerShell API's serializer will always return null on .NET 8 for some reason. The serializer/deserializer was switched to YAML, mostly due to convenience of already having a package for it.

Added a new settings for enabling script debugging mode. This ensures that when a script is executed, the PowerShell terminal window is not closed. This allows power users to get the same environment that the script executes in. It also allows for some scroll back to see what potentially went wrong in their script.
2024-06-11 21:43:12 -05:00
Pat Hartl
0bf4e8cc6d Import PowerShell cmdlets module based on SDK assembly's location
Fixes #45
2023-12-13 23:38:13 -06:00
Pat Hartl
bc30cc911a Find LANCommander PowerShell module manifest using search
Probably pretty hacky. Environment.CurrentDirectory doesn't seem to be reliable in dev vs prod. In dev it correctly matches the LANCommander.PlaynitePlugin.dll's location. In prod it is the main directory of Playnite.
2023-11-17 22:35:17 -06:00
Pat Hartl
737f2bec84 Fix how arguments are passed to scripts 2023-11-17 21:39:28 -06:00
Pat Hartl
a47b77cc5c Run scripts as admin if directed via script contents 2023-11-17 21:39:01 -06:00
Pat Hartl
f19ef09ff8 Force IgnoreWow64Redirection in scripts 2023-11-17 21:38:37 -06:00
Pat Hartl
196feedded Load PowerShell module on script execution. Add cmdlet to deserialize/decode variables. 2023-11-16 14:34:00 -06:00
Pat Hartl
29dcebb70f New PowerShell runtime with the ability to use variables 2023-11-15 22:38:20 -06:00