internal void DispatchMessageToPowerShell(RemoteDataObject <PSObject> rcvdData) { ClientPowerShellDataStructureHandler associatedPowerShellDataStructureHandler = this.GetAssociatedPowerShellDataStructureHandler(rcvdData.PowerShellId); if (associatedPowerShellDataStructureHandler != null) { associatedPowerShellDataStructureHandler.ProcessReceivedData(rcvdData); } }
private void HandleRemoveAssociation(object sender, EventArgs e) { ClientPowerShellDataStructureHandler handler = sender as ClientPowerShellDataStructureHandler; lock (this.associationSyncObject) { this.associatedPowerShellDSHandlers.Remove(handler.PowerShellId); } this.transportManager.RemoveCommandTransportManager(handler.PowerShellId); }
private void HandleRemoveAssociation(object sender, EventArgs e) { using (ClientRunspacePoolDataStructureHandler.tracer.TraceMethod()) { ClientPowerShellDataStructureHandler structureHandler = sender as ClientPowerShellDataStructureHandler; lock (this.associationSyncObject) { this.associatedPowerShellDSHandlers.Remove(structureHandler.PowerShellId); this.transportManager.RemoveCommandTransportManager(structureHandler.PowerShellId); } } }
internal void AddRemotePowerShellDSHandler(Guid psShellInstanceId, ClientPowerShellDataStructureHandler psDSHandler) { lock (this.associationSyncObject) { if (this.associatedPowerShellDSHandlers.ContainsKey(psShellInstanceId)) { this.associatedPowerShellDSHandlers.Remove(psShellInstanceId); } this.associatedPowerShellDSHandlers.Add(psShellInstanceId, psDSHandler); } psDSHandler.RemoveAssociation += new EventHandler(this.HandleRemoveAssociation); }
private ClientPowerShellDataStructureHandler GetAssociatedPowerShellDataStructureHandler(Guid clientPowerShellId) { ClientPowerShellDataStructureHandler handler = null; lock (this.associationSyncObject) { if (!this.associatedPowerShellDSHandlers.TryGetValue(clientPowerShellId, out handler)) { handler = null; } } return(handler); }
private ClientPowerShellDataStructureHandler GetAssociatedPowerShellDataStructureHandler( Guid clientPowerShellId) { using (ClientRunspacePoolDataStructureHandler.tracer.TraceMethod()) { ClientPowerShellDataStructureHandler structureHandler = (ClientPowerShellDataStructureHandler)null; lock (this.associationSyncObject) { if (!this.associatedPowerShellDSHandlers.TryGetValue(clientPowerShellId, out structureHandler)) { structureHandler = (ClientPowerShellDataStructureHandler)null; } } return(structureHandler); } }
internal void AddRemotePowerShellDSHandler(Guid psShellInstanceId, ClientPowerShellDataStructureHandler psDSHandler) { this.dataStructureHandler.AddRemotePowerShellDSHandler(psShellInstanceId, psDSHandler); }
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); }