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.
12 lines
No EOL
412 B
C#
12 lines
No EOL
412 B
C#
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace LANCommander.SDK.PowerShell;
|
|
|
|
public interface IScriptDebugger
|
|
{
|
|
Task StartAsync(System.Management.Automation.PowerShell ps);
|
|
Task EndAsync(System.Management.Automation.PowerShell ps);
|
|
Task BreakAsync(System.Management.Automation.PowerShell ps);
|
|
Task OutputAsync(LogLevel level, string message, params object[] args);
|
|
} |