internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            if (receivedData == null)
            {
                throw PSTraceSource.NewArgumentNullException("receivedData");
            }
            switch (receivedData.DataType)
            {
            case RemotingDataType.PowerShellInput:
                this.InputReceived.SafeInvoke <RemoteDataEventArgs <object> >(this, new RemoteDataEventArgs <object>(receivedData.Data));
                return;

            case RemotingDataType.PowerShellInputEnd:
                this.InputEndReceived.SafeInvoke(this, EventArgs.Empty);
                return;

            case RemotingDataType.StopPowerShell:
                this.StopPowerShellReceived.SafeInvoke(this, EventArgs.Empty);
                return;

            case RemotingDataType.RemotePowerShellHostResponseData:
            {
                RemoteHostResponse data = RemoteHostResponse.Decode(receivedData.Data);
                this.transportManager.ReportExecutionStatusAsRunning();
                this.HostResponseReceived.SafeInvoke <RemoteDataEventArgs <RemoteHostResponse> >(this, new RemoteDataEventArgs <RemoteHostResponse>(data));
                return;
            }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Process the data received from the powershell on
        /// the client.
        /// </summary>
        /// <param name="receivedData">Data received.</param>
        internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            if (receivedData == null)
            {
                throw PSTraceSource.NewArgumentNullException("receivedData");
            }

            Dbg.Assert(receivedData.TargetInterface == RemotingTargetInterface.PowerShell,
                       "RemotingTargetInterface must be PowerShell");

            switch (receivedData.DataType)
            {
            case RemotingDataType.StopPowerShell:
            {
                Dbg.Assert(StopPowerShellReceived != null,
                           "ServerPowerShellDriver should subscribe to all data structure handler events");
                StopPowerShellReceived.SafeInvoke(this, EventArgs.Empty);
            }

            break;

            case RemotingDataType.PowerShellInput:
            {
                Dbg.Assert(InputReceived != null,
                           "ServerPowerShellDriver should subscribe to all data structure handler events");
                InputReceived.SafeInvoke(this, new RemoteDataEventArgs <object>(receivedData.Data));
            }

            break;

            case RemotingDataType.PowerShellInputEnd:
            {
                Dbg.Assert(InputEndReceived != null,
                           "ServerPowerShellDriver should subscribe to all data structure handler events");
                InputEndReceived.SafeInvoke(this, EventArgs.Empty);
            }

            break;

            case RemotingDataType.RemotePowerShellHostResponseData:
            {
                Dbg.Assert(HostResponseReceived != null,
                           "ServerPowerShellDriver should subscribe to all data structure handler events");

                RemoteHostResponse remoteHostResponse = RemoteHostResponse.Decode(receivedData.Data);

                // part of host message robustness algo. Now the host response is back, report to transport that
                // execution status is back to running
                _transportManager.ReportExecutionStatusAsRunning();

                HostResponseReceived.SafeInvoke(this, new RemoteDataEventArgs <RemoteHostResponse>(remoteHostResponse));
            }

            break;
            }
        }
        internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            if (receivedData == null)
            {
                throw PSTraceSource.NewArgumentNullException("receivedData");
            }
            switch (receivedData.DataType)
            {
            case RemotingDataType.SetMaxRunspaces:
                this.SetMaxRunspacesReceived.SafeInvoke <RemoteDataEventArgs <PSObject> >(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
                return;

            case RemotingDataType.SetMinRunspaces:
                this.SetMinRunspacesReceived.SafeInvoke <RemoteDataEventArgs <PSObject> >(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
                return;

            case RemotingDataType.RunspacePoolOperationResponse:
            case RemotingDataType.RunspacePoolStateInfo:
            case RemotingDataType.PSEventArgs:
            case RemotingDataType.ApplicationPrivateData:
                break;

            case RemotingDataType.CreatePowerShell:
                this.CreateAndInvokePowerShell.SafeInvoke <RemoteDataEventArgs <RemoteDataObject <PSObject> > >(this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >(receivedData));
                return;

            case RemotingDataType.AvailableRunspaces:
                this.GetAvailableRunspacesReceived.SafeInvoke <RemoteDataEventArgs <PSObject> >(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
                break;

            case RemotingDataType.GetCommandMetadata:
                this.GetCommandMetadata.SafeInvoke <RemoteDataEventArgs <RemoteDataObject <PSObject> > >(this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >(receivedData));
                return;

            case RemotingDataType.RemoteRunspaceHostResponseData:
            {
                RemoteHostResponse data = RemoteHostResponse.Decode(receivedData.Data);
                this.transportManager.ReportExecutionStatusAsRunning();
                this.HostResponseReceived.SafeInvoke <RemoteDataEventArgs <RemoteHostResponse> >(this, new RemoteDataEventArgs <RemoteHostResponse>(data));
                return;
            }

            default:
                return;
            }
        }
Ejemplo n.º 4
0
        internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            using (ServerRunspacePoolDataStructureHandler.tracer.TraceMethod())
            {
                if (receivedData == null)
                {
                    throw ServerRunspacePoolDataStructureHandler.tracer.NewArgumentNullException(nameof(receivedData));
                }
                switch (receivedData.DataType)
                {
                case RemotingDataType.SetMaxRunspaces:
                    this.SetMaxRunspacesReceived((object)this, new RemoteDataEventArgs <PSObject>((object)receivedData.Data));
                    break;

                case RemotingDataType.SetMinRunspaces:
                    this.SetMinRunspacesReceived((object)this, new RemoteDataEventArgs <PSObject>((object)receivedData.Data));
                    break;

                case RemotingDataType.CreatePowerShell:
                    this.CreateAndInvokePowerShell((object)this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >((object)receivedData));
                    break;

                case RemotingDataType.AvailableRunspaces:
                    this.GetAvailableRunspacesReceived((object)this, new RemoteDataEventArgs <PSObject>((object)receivedData.Data));
                    break;

                case RemotingDataType.GetCommandMetadata:
                    this.GetCommandMetadata((object)this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >((object)receivedData));
                    break;

                case RemotingDataType.RemoteRunspaceHostResponseData:
                    this.HostResponseReceived((object)this, new RemoteDataEventArgs <RemoteHostResponse>((object)RemoteHostResponse.Decode(receivedData.Data)));
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Process the data received from the runspace pool on
        /// the server.
        /// </summary>
        /// <param name="receivedData">Data received.</param>
        internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            if (receivedData == null)
            {
                throw PSTraceSource.NewArgumentNullException("receivedData");
            }

            Dbg.Assert(receivedData.TargetInterface == RemotingTargetInterface.RunspacePool,
                       "RemotingTargetInterface must be Runspace");

            switch (receivedData.DataType)
            {
            case RemotingDataType.CreatePowerShell:
            {
                Dbg.Assert(CreateAndInvokePowerShell != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                CreateAndInvokePowerShell.SafeInvoke(this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >(receivedData));
            }

            break;

            case RemotingDataType.GetCommandMetadata:
            {
                Dbg.Assert(GetCommandMetadata != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                GetCommandMetadata.SafeInvoke(this, new RemoteDataEventArgs <RemoteDataObject <PSObject> >(receivedData));
            }

            break;

            case RemotingDataType.RemoteRunspaceHostResponseData:
            {
                Dbg.Assert(HostResponseReceived != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                RemoteHostResponse remoteHostResponse = RemoteHostResponse.Decode(receivedData.Data);

                // part of host message robustness algo. Now the host response is back, report to transport that
                // execution status is back to running
                _transportManager.ReportExecutionStatusAsRunning();

                HostResponseReceived.SafeInvoke(this, new RemoteDataEventArgs <RemoteHostResponse>(remoteHostResponse));
            }

            break;

            case RemotingDataType.SetMaxRunspaces:
            {
                Dbg.Assert(SetMaxRunspacesReceived != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                SetMaxRunspacesReceived.SafeInvoke(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
            }

            break;

            case RemotingDataType.SetMinRunspaces:
            {
                Dbg.Assert(SetMinRunspacesReceived != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                SetMinRunspacesReceived.SafeInvoke(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
            }

            break;

            case RemotingDataType.AvailableRunspaces:
            {
                Dbg.Assert(GetAvailableRunspacesReceived != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events");

                GetAvailableRunspacesReceived.SafeInvoke(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
            }

            break;

            case RemotingDataType.ResetRunspaceState:
            {
                Dbg.Assert(ResetRunspaceState != null,
                           "The ServerRunspacePoolDriver should subscribe to all data structure handler events.");

                ResetRunspaceState.SafeInvoke(this, new RemoteDataEventArgs <PSObject>(receivedData.Data));
            }

            break;
            }
        }
        internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData)
        {
            using (ServerPowerShellDataStructureHandler.tracer.TraceMethod())
            {
                if (receivedData == null)
                {
                    throw ServerPowerShellDataStructureHandler.tracer.NewArgumentNullException(nameof(receivedData));
                }
                switch (receivedData.DataType)
                {
                case RemotingDataType.PowerShellInput:
                    this.InputReceived((object)this, new RemoteDataEventArgs <object>((object)receivedData.Data));
                    break;

                case RemotingDataType.PowerShellInputEnd:
                    this.InputEndReceived((object)this, new EventArgs());
                    break;

                case RemotingDataType.StopPowerShell:
                    this.StopPowerShellReceived((object)this, new EventArgs());
                    break;

                case RemotingDataType.RemotePowerShellHostResponseData:
                    this.HostResponseReceived((object)this, new RemoteDataEventArgs <RemoteHostResponse>((object)RemoteHostResponse.Decode(receivedData.Data)));
                    break;
                }
            }
        }