Progress on debug console

This commit is contained in:
Pat Hartl 2024-08-14 13:24:50 -05:00
parent 7bc37478aa
commit 9038e02bfb
6 changed files with 194 additions and 0 deletions

View file

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Reflection;
using System.Runtime.InteropServices;
@ -30,6 +31,10 @@ namespace LANCommander.SDK.PowerShell
private InitialSessionState InitialSessionState { get; set; }
private TaskCompletionSource<string> Input { get; set; }
public Func<System.Management.Automation.PowerShell, Task> OnDebug;
public PowerShellScript(ScriptType type)
{
Type = type;
@ -179,6 +184,9 @@ namespace LANCommander.SDK.PowerShell
ps.AddScript(scriptBuilder.ToString());
var results = await ps.InvokeAsync();
if (Debug)
await OnDebug?.Invoke(ps);
}
}