protected PSSession(IDebugger debugger, PSHost host, IMethodCallDispatch methodCallDispatcher) { _methodCallDispatcher = methodCallDispatcher; var initialSessionState = InitialSessionState.CreateDefault(); initialSessionState.Variables.Add(new SessionStateVariableEntry("Debugger", debugger, "Interface to the Windows debuggers", ScopedItemOptions.Constant)); initialSessionState.Variables.Add(new SessionStateVariableEntry("ShellID", "PSExt", "", ScopedItemOptions.Constant)); // Add the executing assembly as a PowerShell module since we have cmdlets here we want to execute. // This should be refactored into separate assemblies, since we could use the debugger parts outside // of an extension var location = Assembly.GetExecutingAssembly().Location; initialSessionState.ImportPSModule(new[] { location }); // Extend types for easier display var psextDir = Path.GetDirectoryName(location); var typeFile = Path.Combine(psextDir, "PSExt.Types.ps1xml"); initialSessionState.Types.Add(new SessionStateTypeEntry(typeFile)); // Pretty formatting of debugger output var formatFile = Path.Combine(psextDir, "PSExt.Format.ps1xml"); initialSessionState.Formats.Add(new SessionStateFormatEntry(formatFile)); _host = host; _runspace = RunspaceFactory.CreateRunspace(_host, initialSessionState); }
public ConsolePSSession(IDebugger debugger, ConsoleHost host, IMethodCallDispatch methodCallDispatcher) : base(debugger, host, methodCallDispatcher) { host.Program = this; _consoleHost = host; _consoleReadLine = new ConsoleReadLine(); }
public DbgEnginePSSession(IDebugger debugger, PSHost host, IMethodCallDispatch methodCallDispatcher) : base(debugger, host, methodCallDispatcher) { }