/// <summary>
        /// Send a message with the PSEventArgs to the client.
        /// </summary>
        /// <param name="e">Event to send.</param>
        internal void SendPSEventArgsToClient(PSEventArgs e)
        {
            RemoteDataObject data = RemotingEncoder.GeneratePSEventArgs(_clientRunspacePoolId, e);

            SendDataAsync(data);
        }
 /// <summary>
 /// Send the output data to the client.
 /// </summary>
 /// <param name="data">Data to send.</param>
 internal void SendOutputDataToClient(PSObject data)
 {
     SendDataAsync(RemotingEncoder.GeneratePowerShellOutput(data,
                                                            _clientPowerShellId, _clientRunspacePoolId));
 }
 /// <summary>
 /// Send the specified information record to client.
 /// </summary>
 /// <param name="record">Information record.</param>
 internal void SendInformationRecordToClient(InformationRecord record)
 {
     SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(
                       record, _clientRunspacePoolId, _clientPowerShellId));
 }
        internal void SendResponseToClient(long callId, object response)
        {
            RemoteDataObject data = RemotingEncoder.GenerateRunspacePoolOperationResponse(this.clientRunspacePoolId, response, callId);

            this.SendDataAsync(data);
        }
        internal void SendStateInfoToClient(RunspacePoolStateInfo stateInfo)
        {
            RemoteDataObject data = RemotingEncoder.GenerateRunspacePoolStateInfo(this.clientRunspacePoolId, stateInfo);

            this.SendDataAsync(data);
        }
 internal void SendWarningRecordToClient(WarningRecord record)
 {
     record.SerializeExtendedInfo = (this.streamSerializationOptions & RemoteStreamOptions.AddInvocationInfoToWarningRecord) != 0;
     this.SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(record, this.clientRunspacePoolId, this.clientPowerShellId, RemotingDataType.PowerShellWarning));
 }
 internal void SendProgressRecordToClient(ProgressRecord record)
 {
     this.SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(record, this.clientRunspacePoolId, this.clientPowerShellId));
 }
 internal void SendErrorRecordToClient(ErrorRecord errorRecord)
 {
     errorRecord.SerializeExtendedInfo = (this.streamSerializationOptions & RemoteStreamOptions.AddInvocationInfoToErrorRecord) != 0;
     this.SendDataAsync(RemotingEncoder.GeneratePowerShellError(errorRecord, this.clientRunspacePoolId, this.clientPowerShellId));
 }
 internal void SendProgressRecordToClient(ProgressRecord record)
 {
     using (ServerPowerShellDataStructureHandler.tracer.TraceMethod())
         this.SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(record, this.clientRunspacePoolId, this.clientPowerShellId));
 }
 internal void SendOutputDataToClient(PSObject data)
 {
     using (ServerPowerShellDataStructureHandler.tracer.TraceMethod())
         this.SendDataAsync(RemotingEncoder.GeneratePowerShellOutput(data, this.clientPowerShellId, this.clientRunspacePoolId));
 }