internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData) { using (ClientPowerShellDataStructureHandler.tracer.TraceMethod()) { if (receivedData.PowerShellId != this.clientPowerShellId) { throw new PSRemotingDataStructureException(PSRemotingErrorId.PipelineIdsDoNotMatch, new object[2] { (object)receivedData.PowerShellId, (object)this.clientPowerShellId }); } switch (receivedData.DataType) { case RemotingDataType.PowerShellOutput: this.OutputReceived((object)this, new RemoteDataEventArgs <object>(RemotingDecoder.GetPowerShellOutput((object)receivedData.Data))); break; case RemotingDataType.PowerShellErrorRecord: this.ErrorReceived((object)this, new RemoteDataEventArgs <ErrorRecord>((object)RemotingDecoder.GetPowerShellError((object)receivedData.Data))); break; case RemotingDataType.PowerShellStateInfo: this.InvocationStateInfoReceived((object)this, new RemoteDataEventArgs <PSInvocationStateInfo>((object)RemotingDecoder.GetPowerShellStateInfo((object)receivedData.Data))); break; case RemotingDataType.PowerShellDebug: this.InformationalMessageReceived((object)this, new RemoteDataEventArgs <InformationalMessage>((object)new InformationalMessage((object)RemotingDecoder.GetPowerShellDebug((object)receivedData.Data), RemotingDataType.PowerShellDebug))); break; case RemotingDataType.PowerShellVerbose: this.InformationalMessageReceived((object)this, new RemoteDataEventArgs <InformationalMessage>((object)new InformationalMessage((object)RemotingDecoder.GetPowerShellVerbose((object)receivedData.Data), RemotingDataType.PowerShellVerbose))); break; case RemotingDataType.PowerShellWarning: this.InformationalMessageReceived((object)this, new RemoteDataEventArgs <InformationalMessage>((object)new InformationalMessage((object)RemotingDecoder.GetPowerShellWarning((object)receivedData.Data), RemotingDataType.PowerShellWarning))); break; case RemotingDataType.PowerShellProgress: this.InformationalMessageReceived((object)this, new RemoteDataEventArgs <InformationalMessage>((object)new InformationalMessage((object)RemotingDecoder.GetPowerShellProgress((object)receivedData.Data), RemotingDataType.PowerShellProgress))); break; case RemotingDataType.RemoteHostCallUsingPowerShellHost: this.HostCallReceived((object)this, new RemoteDataEventArgs <RemoteHostCall>((object)RemoteHostCall.Decode(receivedData.Data))); break; } } }
internal void ProcessReceivedData(RemoteDataObject <PSObject> receivedData) { if (receivedData.PowerShellId != this.clientPowerShellId) { throw new PSRemotingDataStructureException(RemotingErrorIdStrings.PipelineIdsDoNotMatch, new object[] { receivedData.PowerShellId, this.clientPowerShellId }); } switch (receivedData.DataType) { case RemotingDataType.PowerShellOutput: { object powerShellOutput = RemotingDecoder.GetPowerShellOutput(receivedData.Data); this.OutputReceived.SafeInvoke <RemoteDataEventArgs <object> >(this, new RemoteDataEventArgs <object>(powerShellOutput)); return; } case RemotingDataType.PowerShellErrorRecord: { ErrorRecord powerShellError = RemotingDecoder.GetPowerShellError(receivedData.Data); this.ErrorReceived.SafeInvoke <RemoteDataEventArgs <ErrorRecord> >(this, new RemoteDataEventArgs <ErrorRecord>(powerShellError)); return; } case RemotingDataType.PowerShellStateInfo: { PSInvocationStateInfo powerShellStateInfo = RemotingDecoder.GetPowerShellStateInfo(receivedData.Data); this.InvocationStateInfoReceived.SafeInvoke <RemoteDataEventArgs <PSInvocationStateInfo> >(this, new RemoteDataEventArgs <PSInvocationStateInfo>(powerShellStateInfo)); return; } case RemotingDataType.PowerShellDebug: { DebugRecord powerShellDebug = RemotingDecoder.GetPowerShellDebug(receivedData.Data); this.InformationalMessageReceived.SafeInvoke <RemoteDataEventArgs <InformationalMessage> >(this, new RemoteDataEventArgs <InformationalMessage>(new InformationalMessage(powerShellDebug, RemotingDataType.PowerShellDebug))); return; } case RemotingDataType.PowerShellVerbose: { VerboseRecord powerShellVerbose = RemotingDecoder.GetPowerShellVerbose(receivedData.Data); this.InformationalMessageReceived.SafeInvoke <RemoteDataEventArgs <InformationalMessage> >(this, new RemoteDataEventArgs <InformationalMessage>(new InformationalMessage(powerShellVerbose, RemotingDataType.PowerShellVerbose))); return; } case RemotingDataType.PowerShellWarning: { WarningRecord powerShellWarning = RemotingDecoder.GetPowerShellWarning(receivedData.Data); this.InformationalMessageReceived.SafeInvoke <RemoteDataEventArgs <InformationalMessage> >(this, new RemoteDataEventArgs <InformationalMessage>(new InformationalMessage(powerShellWarning, RemotingDataType.PowerShellWarning))); return; } case ((RemotingDataType)0x4100a): case ((RemotingDataType)0x4100b): case ((RemotingDataType)0x4100c): case ((RemotingDataType)0x4100d): case ((RemotingDataType)0x4100e): case ((RemotingDataType)0x4100f): break; case RemotingDataType.PowerShellProgress: { ProgressRecord powerShellProgress = RemotingDecoder.GetPowerShellProgress(receivedData.Data); this.InformationalMessageReceived.SafeInvoke <RemoteDataEventArgs <InformationalMessage> >(this, new RemoteDataEventArgs <InformationalMessage>(new InformationalMessage(powerShellProgress, RemotingDataType.PowerShellProgress))); return; } case RemotingDataType.RemoteHostCallUsingPowerShellHost: { RemoteHostCall data = RemoteHostCall.Decode(receivedData.Data); this.HostCallReceived.SafeInvoke <RemoteDataEventArgs <RemoteHostCall> >(this, new RemoteDataEventArgs <RemoteHostCall>(data)); break; } default: return; } }