internal void Initialize(ObjectStreamBase inputstream, ObjectStreamBase outputstream, ObjectStreamBase errorstream, PSInformationalBuffers informationalBuffers, PSInvocationSettings settings)
 {
     this.initialized          = true;
     this.informationalBuffers = informationalBuffers;
     this.InputStream          = inputstream;
     this.errorstream          = errorstream;
     this.outputstream         = outputstream;
     this.settings             = settings;
     if ((settings == null) || (settings.Host == null))
     {
         this.hostToUse = this.runspacePool.Host;
     }
     else
     {
         this.hostToUse = settings.Host;
     }
     this.dataStructureHandler = this.runspacePool.DataStructureHandler.CreatePowerShellDataStructureHandler(this);
     this.dataStructureHandler.InvocationStateInfoReceived += new EventHandler <RemoteDataEventArgs <PSInvocationStateInfo> >(this.HandleInvocationStateInfoReceived);
     this.dataStructureHandler.OutputReceived += new EventHandler <RemoteDataEventArgs <object> >(this.HandleOutputReceived);
     this.dataStructureHandler.ErrorReceived  += new EventHandler <RemoteDataEventArgs <ErrorRecord> >(this.HandleErrorReceived);
     this.dataStructureHandler.InformationalMessageReceived       += new EventHandler <RemoteDataEventArgs <InformationalMessage> >(this.HandleInformationalMessageReceived);
     this.dataStructureHandler.HostCallReceived                   += new EventHandler <RemoteDataEventArgs <RemoteHostCall> >(this.HandleHostCallReceived);
     this.dataStructureHandler.ClosedNotificationFromRunspacePool += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleCloseNotificationFromRunspacePool);
     this.dataStructureHandler.BrokenNotificationFromRunspacePool += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleBrokenNotificationFromRunspacePool);
     this.dataStructureHandler.ConnectCompleted                   += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleConnectCompleted);
     this.dataStructureHandler.ReconnectCompleted                 += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleConnectCompleted);
     this.dataStructureHandler.RobustConnectionNotification       += new EventHandler <ConnectionStatusEventArgs>(this.HandleRobustConnectionNotification);
     this.dataStructureHandler.CloseCompleted += new EventHandler <EventArgs>(this.HandleCloseCompleted);
 }
Example #2
0
 internal ClientRemotePowerShell(
     PowerShell shell,
     ObjectStreamBase inputstream,
     ObjectStreamBase outputstream,
     ObjectStreamBase errorstream,
     PSInformationalBuffers informationalBuffers,
     PSInvocationSettings settings,
     RemoteRunspacePoolInternal runspacePool)
 {
     using (ClientRemotePowerShell.tracer.TraceConstructor((object)this))
     {
         this.shell = shell;
         this.informationalBuffers = informationalBuffers;
         this.InputStream          = inputstream;
         this.errorstream          = errorstream;
         this.outputstream         = outputstream;
         this.settings             = settings;
         this.clientRunspacePoolId = runspacePool.InstanceId;
         this.hostToUse            = settings == null || settings.Host == null ? runspacePool.Host : settings.Host;
         this.computerName         = runspacePool.ConnectionInfo.ComputerName;
         this.dataStructureHandler = runspacePool.DataStructureHandler.CreatePowerShellDataStructureHandler(this);
         this.dataStructureHandler.InvocationStateInfoReceived += new EventHandler <RemoteDataEventArgs <PSInvocationStateInfo> >(this.HandleInvocationStateInfoReceived);
         this.dataStructureHandler.OutputReceived += new EventHandler <RemoteDataEventArgs <object> >(this.HandleOutputReceived);
         this.dataStructureHandler.ErrorReceived  += new EventHandler <RemoteDataEventArgs <ErrorRecord> >(this.HandleErrorReceived);
         this.dataStructureHandler.InformationalMessageReceived       += new EventHandler <RemoteDataEventArgs <InformationalMessage> >(this.HandleInformationalMessageReceived);
         this.dataStructureHandler.HostCallReceived                   += new EventHandler <RemoteDataEventArgs <RemoteHostCall> >(this.HandleHostCallReceived);
         this.dataStructureHandler.ClosedNotificationFromRunspacePool += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleCloseNotificationFromRunspacePool);
         this.dataStructureHandler.BrokenNotificationFromRunspacePool += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleBrokenNotificationFromRunspacePool);
     }
 }
Example #3
0
 internal void AddRemotePowerShellDSHandler(Guid psShellInstanceId, ClientPowerShellDataStructureHandler psDSHandler)
 {
     this.dataStructureHandler.AddRemotePowerShellDSHandler(psShellInstanceId, psDSHandler);
 }