C# Class NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher

Wraps a runspace and protects the invoke method from being called on multiple threads through blocking.
Calls to Invoke on this object will block if the runspace is already busy. Calls to InvokeAsync will also block until the runspace is free. However, it will not block while the pipeline is actually running.
Inheritance: IDisposable
Mostrar archivo Open project: xero-github/Nuget Class Usage Examples

Public Methods

Method Description
ChangePSDirectory ( string directory ) : void
Dispose ( ) : void
ExecuteScript ( string installPath, string scriptPath, IPackage package ) : void
ExtractErrorFromErrorRecord ( ErrorRecord record ) : string
GetEffectiveExecutionPolicy ( ) : ExecutionPolicy
GetExecutionPolicy ( ExecutionPolicyScope scope ) : ExecutionPolicy
ImportModule ( string modulePath ) : void
Invoke ( string command, object inputs, bool outputResults ) : Collection
InvokeCommands ( System.Management.Automation.PSCommand profileCommands ) : void
MakeDefault ( ) : void
RunspaceDispatcher ( System.Management.Automation.Runspaces.Runspace runspace ) : System
SetExecutionPolicy ( ExecutionPolicy policy, ExecutionPolicyScope scope ) : void

Private Methods

Method Description
CreatePipeline ( string command, bool outputResults ) : System.Management.Automation.Runspaces.Pipeline
GetExecutionPolicy ( string command ) : ExecutionPolicy
InvokeAsync ( string command, object inputs, bool outputResults, EventHandler pipelineStateChanged ) : System.Management.Automation.Runspaces.Pipeline
InvokeCore ( System.Management.Automation.Runspaces.Pipeline pipeline, IEnumerable inputs ) : Collection
InvokeCoreAsync ( System.Management.Automation.Runspaces.Pipeline pipeline, IEnumerable inputs ) : void

Method Details

ChangePSDirectory() public method

public ChangePSDirectory ( string directory ) : void
directory string
return void

Dispose() public method

public Dispose ( ) : void
return void

ExecuteScript() public method

public ExecuteScript ( string installPath, string scriptPath, IPackage package ) : void
installPath string
scriptPath string
package IPackage
return void

ExtractErrorFromErrorRecord() public method

public ExtractErrorFromErrorRecord ( ErrorRecord record ) : string
record System.Management.Automation.ErrorRecord
return string

GetEffectiveExecutionPolicy() public method

public GetEffectiveExecutionPolicy ( ) : ExecutionPolicy
return ExecutionPolicy

GetExecutionPolicy() public method

public GetExecutionPolicy ( ExecutionPolicyScope scope ) : ExecutionPolicy
scope ExecutionPolicyScope
return ExecutionPolicy

ImportModule() public method

public ImportModule ( string modulePath ) : void
modulePath string
return void

Invoke() public method

public Invoke ( string command, object inputs, bool outputResults ) : Collection
command string
inputs object
outputResults bool
return Collection

InvokeCommands() public method

public InvokeCommands ( System.Management.Automation.PSCommand profileCommands ) : void
profileCommands System.Management.Automation.PSCommand
return void

MakeDefault() public method

public MakeDefault ( ) : void
return void

RunspaceDispatcher() public method

public RunspaceDispatcher ( System.Management.Automation.Runspaces.Runspace runspace ) : System
runspace System.Management.Automation.Runspaces.Runspace
return System

SetExecutionPolicy() public method

public SetExecutionPolicy ( ExecutionPolicy policy, ExecutionPolicyScope scope ) : void
policy ExecutionPolicy
scope ExecutionPolicyScope
return void