コード例 #1
0
 public CmdletProcessor(string psSnapinName, out System.Management.Automation.Runspaces.PSSnapInException warning)
 {
     System.Management.Automation.Runspaces.RunspaceConfiguration runspaceConfig = System.Management.Automation.Runspaces.RunspaceConfiguration.Create();
     runspaceConfig.AddPSSnapIn(psSnapinName, out warning);
     this.runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(runspaceConfig);
     this.SetupRunspace();
 }
コード例 #2
0
ファイル: RunspaceBase.cs プロジェクト: nickchal/pash
        protected RunspaceBase (PSHost host, System.Management.Automation.Runspaces.RunspaceConfiguration runspaceConfiguration)
		{
			this._version = PSVersionInfo.PSVersion;
			this._runspaceStateInfo = new System.Management.Automation.Runspaces.RunspaceStateInfo (System.Management.Automation.Runspaces.RunspaceState.BeforeOpen);
			this._syncRoot = new object ();
			this._runspaceEventQueue = new Queue<RunspaceEventQueueItem> ();
			this.RunspaceOpening = new ManualResetEventSlim (false);
			this._runningPipelines = new ArrayList ();
			if (host == null) {
				throw PSTraceSource.NewArgumentNullException ("host");
			}
			if (runspaceConfiguration == null) {
				throw PSTraceSource.NewArgumentNullException ("runspaceConfiguration");
			}
			this._host = host;
			this._runspaceConfiguration = runspaceConfiguration;
			if (this._runspaceConfiguration.ImportSystemModules) {
				this._initialSessionState = InitialSessionState.CreateDefault (); 
				ImportSystemModules ();
			}
        }
コード例 #3
0
 protected RunspaceBase(PSHost host, System.Management.Automation.Runspaces.RunspaceConfiguration runspaceConfiguration)
 {
     this._version            = PSVersionInfo.PSVersion;
     this._runspaceStateInfo  = new System.Management.Automation.Runspaces.RunspaceStateInfo(System.Management.Automation.Runspaces.RunspaceState.BeforeOpen);
     this._syncRoot           = new object();
     this._runspaceEventQueue = new Queue <RunspaceEventQueueItem> ();
     this.RunspaceOpening     = new ManualResetEventSlim(false);
     this._runningPipelines   = new ArrayList();
     if (host == null)
     {
         throw PSTraceSource.NewArgumentNullException("host");
     }
     if (runspaceConfiguration == null)
     {
         throw PSTraceSource.NewArgumentNullException("runspaceConfiguration");
     }
     this._host = host;
     this._runspaceConfiguration = runspaceConfiguration;
     if (this._runspaceConfiguration.ImportSystemModules)
     {
         this._initialSessionState = InitialSessionState.CreateDefault();
         ImportSystemModules();
     }
 }