Example #1
0
 private ClientMethodExecutor(BaseClientTransportManager transportManager, PSHost clientHost, Guid clientRunspacePoolId, Guid clientPowerShellId, System.Management.Automation.Remoting.RemoteHostCall remoteHostCall)
 {
     this._transportManager     = transportManager;
     this._remoteHostCall       = remoteHostCall;
     this._clientHost           = clientHost;
     this._clientRunspacePoolId = clientRunspacePoolId;
     this._clientPowerShellId   = clientPowerShellId;
 }
Example #2
0
 private ClientMethodExecutor(BaseClientTransportManager transportManager, PSHost clientHost, Guid clientRunspacePoolId, Guid clientPowerShellId, System.Management.Automation.Remoting.RemoteHostCall remoteHostCall)
 {
     this._transportManager = transportManager;
     this._remoteHostCall = remoteHostCall;
     this._clientHost = clientHost;
     this._clientRunspacePoolId = clientRunspacePoolId;
     this._clientPowerShellId = clientPowerShellId;
 }
Example #3
0
        internal static void Dispatch(BaseClientTransportManager transportManager, PSHost clientHost, PSDataCollectionStream <ErrorRecord> errorStream, ObjectStream methodExecutorStream, bool isMethodExecutorStreamEnabled, RemoteRunspacePoolInternal runspacePool, Guid clientPowerShellId, System.Management.Automation.Remoting.RemoteHostCall remoteHostCall)
        {
            ClientMethodExecutor executor = new ClientMethodExecutor(transportManager, clientHost, runspacePool.InstanceId, clientPowerShellId, remoteHostCall);

            if (clientPowerShellId == Guid.Empty)
            {
                executor.Execute(errorStream);
            }
            else
            {
                bool flag = false;
                if (clientHost != null)
                {
                    PSObject privateData = clientHost.PrivateData;
                    if (privateData != null)
                    {
                        PSNoteProperty property = privateData.Properties["AllowSetShouldExitFromRemote"] as PSNoteProperty;
                        flag = ((property != null) && (property.Value is bool)) ? ((bool)property.Value) : false;
                    }
                }
                if ((remoteHostCall.IsSetShouldExit && isMethodExecutorStreamEnabled) && !flag)
                {
                    runspacePool.Close();
                }
                else if (isMethodExecutorStreamEnabled)
                {
                    methodExecutorStream.Write(executor);
                }
                else
                {
                    executor.Execute(errorStream);
                }
            }
        }