コード例 #1
0
 protected RunspaceBase(PSHost host, System.Management.Automation.Runspaces.InitialSessionState initialSessionState, bool suppressClone)
 {
     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 (initialSessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("initialSessionState");
     }
     this._host = host;
     if (suppressClone)
     {
         this._initialSessionState = initialSessionState;
     }
     else
     {
         this._initialSessionState = initialSessionState.Clone();
     }
     base.ApartmentState = initialSessionState.ApartmentState;
     this.ThreadOptions  = initialSessionState.ThreadOptions;
 }
コード例 #2
0
 internal RunspaceStateEventArgs(System.Management.Automation.Runspaces.RunspaceStateInfo runspaceStateInfo)
 {
     if (runspaceStateInfo == null)
     {
         throw PSTraceSource.NewArgumentNullException("runspaceStateInfo");
     }
     this._runspaceStateInfo = runspaceStateInfo;
 }
コード例 #3
0
 internal RunspaceStateEventArgs(System.Management.Automation.Runspaces.RunspaceStateInfo runspaceStateInfo)
 {
     if (runspaceStateInfo == null)
     {
         throw PSTraceSource.NewArgumentNullException("runspaceStateInfo");
     }
     this._runspaceStateInfo = runspaceStateInfo;
 }
コード例 #4
0
 protected void SetRunspaceState(System.Management.Automation.Runspaces.RunspaceState state, Exception reason)
 {
     lock (this.SyncRoot)
     {
         if (state != this.RunspaceState)
         {
             this._runspaceStateInfo = new System.Management.Automation.Runspaces.RunspaceStateInfo(state, reason);
             System.Management.Automation.Runspaces.RunspaceAvailability currentAvailability = this._runspaceAvailability;
             base.UpdateRunspaceAvailability(this._runspaceStateInfo.State, false);
             this._runspaceEventQueue.Enqueue(new RunspaceEventQueueItem(this._runspaceStateInfo.Clone(), currentAvailability, this._runspaceAvailability));
         }
     }
 }
コード例 #5
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 ();
			}
        }
コード例 #6
0
ファイル: RunspaceBase.cs プロジェクト: nickchal/pash
 protected RunspaceBase(PSHost host, System.Management.Automation.Runspaces.InitialSessionState initialSessionState)
 {
     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 (initialSessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("initialSessionState");
     }
     this._host = host;
     this._initialSessionState = initialSessionState.Clone();
     base.ApartmentState = initialSessionState.ApartmentState;
     this.ThreadOptions = initialSessionState.ThreadOptions;
 }
コード例 #7
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();
     }
 }
コード例 #8
0
 public RunspaceEventQueueItem(System.Management.Automation.Runspaces.RunspaceStateInfo runspaceStateInfo, RunspaceAvailability currentAvailability, RunspaceAvailability newAvailability)
 {
     this.RunspaceStateInfo           = runspaceStateInfo;
     this.CurrentRunspaceAvailability = currentAvailability;
     this.NewRunspaceAvailability     = newAvailability;
 }
コード例 #9
0
ファイル: RunspaceBase.cs プロジェクト: nickchal/pash
 public RunspaceEventQueueItem(System.Management.Automation.Runspaces.RunspaceStateInfo runspaceStateInfo, RunspaceAvailability currentAvailability, RunspaceAvailability newAvailability)
 {
     this.RunspaceStateInfo = runspaceStateInfo;
     this.CurrentRunspaceAvailability = currentAvailability;
     this.NewRunspaceAvailability = newAvailability;
 }
コード例 #10
0
ファイル: RunspaceBase.cs プロジェクト: nickchal/pash
 protected void SetRunspaceState(System.Management.Automation.Runspaces.RunspaceState state, Exception reason)
 {
     lock (this.SyncRoot)
     {
         if (state != this.RunspaceState)
         {
             this._runspaceStateInfo = new System.Management.Automation.Runspaces.RunspaceStateInfo(state, reason);
             System.Management.Automation.Runspaces.RunspaceAvailability currentAvailability = this._runspaceAvailability;
             base.UpdateRunspaceAvailability(this._runspaceStateInfo.State, false);
             this._runspaceEventQueue.Enqueue(new RunspaceEventQueueItem(this._runspaceStateInfo.Clone(), currentAvailability, this._runspaceAvailability));
         }
     }
 }