Пример #1
0
 private void WriteResultsForJobsInCollection(List <System.Management.Automation.Job> jobs, bool checkForRecurse, bool registerInsteadOfWrite)
 {
     foreach (System.Management.Automation.Job job in jobs)
     {
         if (base.JobManager.IsJobFromAdapter(job.InstanceId, "PSWorkflowJob") && (job.JobStateInfo.State == JobState.Stopped))
         {
             MshCommandRuntime commandRuntime = base.CommandRuntime as MshCommandRuntime;
             if (commandRuntime != null)
             {
                 commandRuntime.WriteWarning(new WarningRecord(StringUtil.Format(RemotingErrorIdStrings.JobWasStopped, job.Name)), true);
             }
         }
         if (checkForRecurse && this.recurse)
         {
             this.WriteJobResultsRecursively(job, registerInsteadOfWrite);
         }
         else if (registerInsteadOfWrite)
         {
             this._eventArgsWritten[job.InstanceId] = false;
             this.AggregateResultsFromJob(job);
         }
         else
         {
             this.WriteJobResults(job);
             this.WriteJobStateInformationIfRequired(job, null);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// This method implements the ProcessRecord method for Write-Warning command
        /// </summary>
        protected override void ProcessRecord()
        {
            //
            // The write-warning command must use the script's InvocationInfo rather than its own,
            // so we create the WarningRecord here and fill it up with the appropriate InvocationInfo;
            // then, we call the command runtime directly and pass this record to WriteWarning().
            //
            MshCommandRuntime mshCommandRuntime = this.CommandRuntime as MshCommandRuntime;

            if (mshCommandRuntime != null)
            {
                WarningRecord record = new WarningRecord(Message);

                InvocationInfo invocationInfo = GetVariableValue(SpecialVariables.MyInvocation) as InvocationInfo;

                if (invocationInfo != null)
                {
                    record.SetInvocationInfo(invocationInfo);
                }

                mshCommandRuntime.WriteWarning(record);
            }
            else
            {
                WriteWarning(Message);
            }
        } //processrecord
Пример #3
0
        protected override void ProcessRecord()
        {
            MshCommandRuntime commandRuntime = base.CommandRuntime as MshCommandRuntime;

            if (commandRuntime != null)
            {
                WarningRecord  record        = new WarningRecord(this.Message);
                InvocationInfo variableValue = base.GetVariableValue("MyInvocation") as InvocationInfo;
                if (variableValue != null)
                {
                    record.SetInvocationInfo(variableValue);
                }
                commandRuntime.WriteWarning(record, false);
            }
            else
            {
                base.WriteWarning(this.Message);
            }
        }
Пример #4
0
        /// <summary>
        /// Handle the object obtained from an ObjectStream's reader
        /// based on its type.
        /// </summary>
        /// <param name="cmdlet">Cmdlet to use for outputting the object.</param>
        /// <param name="instanceId"></param>
        /// <param name="overrideInquire">Suppresses prompt on messages with Inquire preference.
        /// Needed for Receive-Job</param>
        internal void WriteStreamObject(Cmdlet cmdlet, Guid instanceId, bool overrideInquire = false)
        {
            switch (ObjectType)
            {
            case PSStreamObjectType.Output:
            {
                if (instanceId != Guid.Empty)
                {
                    PSObject o = Value as PSObject;
                    if (o != null)
                    {
                        AddSourceJobNoteProperty(o, instanceId);
                    }
                }

                cmdlet.WriteObject(Value);
            }

            break;

            case PSStreamObjectType.Error:
            {
                ErrorRecord         errorRecord       = (ErrorRecord)this.Value;
                RemotingErrorRecord remoteErrorRecord = errorRecord as RemotingErrorRecord;

                if (remoteErrorRecord == null)
                {
                    // if we get a base ErrorRecord object, check if the computerName is
                    // populated in the RecommendedAction field
                    if (errorRecord.ErrorDetails != null && !string.IsNullOrEmpty(errorRecord.ErrorDetails.RecommendedAction))
                    {
                        string computerName;
                        Guid   jobInstanceId;
                        GetIdentifierInfo(errorRecord.ErrorDetails.RecommendedAction,
                                          out jobInstanceId, out computerName);

                        errorRecord = new RemotingErrorRecord(errorRecord,
                                                              new OriginInfo(computerName, Guid.Empty,
                                                                             jobInstanceId));
                    }
                }
                else
                {
                    errorRecord = remoteErrorRecord;
                }

                errorRecord.PreserveInvocationInfoOnce = true;
                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteError(errorRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.Warning:
            {
                string            warning           = (string)Value;
                WarningRecord     warningRecord     = new WarningRecord(warning);
                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteWarning(warningRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.Verbose:
            {
                string            verbose           = (string)Value;
                VerboseRecord     verboseRecord     = new VerboseRecord(verbose);
                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteVerbose(verboseRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.Progress:
            {
                ProgressRecord progressRecord = (ProgressRecord)Value;

                RemotingProgressRecord remotingProgressRecord = progressRecord as RemotingProgressRecord;
                if (remotingProgressRecord == null)
                {
                    Guid   jobInstanceId;
                    string computerName;
                    GetIdentifierInfo(progressRecord.CurrentOperation, out jobInstanceId,
                                      out computerName);
                    OriginInfo info = new OriginInfo(computerName, Guid.Empty, jobInstanceId);
                    progressRecord = new RemotingProgressRecord(progressRecord, info);
                }
                else
                {
                    progressRecord = remotingProgressRecord;
                }

                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteProgress(progressRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.Debug:
            {
                string            debug             = (string)Value;
                DebugRecord       debugRecord       = new DebugRecord(debug);
                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteDebug(debugRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.Information:
            {
                InformationRecord         informationRecord       = (InformationRecord)this.Value;
                RemotingInformationRecord remoteInformationRecord = informationRecord as RemotingInformationRecord;

                if (remoteInformationRecord == null)
                {
                    // if we get a base InformationRecord object, check if the computerName is
                    // populated in the Source field
                    if (!string.IsNullOrEmpty(informationRecord.Source))
                    {
                        string computerName;
                        Guid   jobInstanceId;
                        GetIdentifierInfo(informationRecord.Source, out jobInstanceId, out computerName);
                        informationRecord = new RemotingInformationRecord(informationRecord,
                                                                          new OriginInfo(computerName, Guid.Empty,
                                                                                         jobInstanceId));
                    }
                }
                else
                {
                    informationRecord = remoteInformationRecord;
                }

                MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (mshCommandRuntime != null)
                {
                    mshCommandRuntime.WriteInformation(informationRecord, overrideInquire);
                }
            }

            break;

            case PSStreamObjectType.WarningRecord:
            case PSStreamObjectType.MethodExecutor:
            case PSStreamObjectType.BlockingError:
            case PSStreamObjectType.ShouldMethod:
            {
                WriteStreamObject(cmdlet, overrideInquire);
            }

            break;
            }
        }
Пример #5
0
        /// <summary>
        /// Handle the object obtained from an ObjectStream's reader
        /// based on its type.
        /// </summary>
        /// <param name="cmdlet">Cmdlet to use for outputting the object.</param>
        /// <param name="overrideInquire">Used by Receive-Job to suppress inquire preference.</param>
        public void WriteStreamObject(Cmdlet cmdlet, bool overrideInquire = false)
        {
            if (cmdlet != null)
            {
                switch (this.ObjectType)
                {
                case PSStreamObjectType.Output:
                {
                    cmdlet.WriteObject(this.Value);
                }

                break;

                case PSStreamObjectType.Error:
                {
                    ErrorRecord errorRecord = (ErrorRecord)this.Value;
                    errorRecord.PreserveInvocationInfoOnce = true;
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteError(errorRecord, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.Debug:
                {
                    string            debug             = (string)Value;
                    DebugRecord       debugRecord       = new DebugRecord(debug);
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteDebug(debugRecord, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.Warning:
                {
                    string            warning           = (string)Value;
                    WarningRecord     warningRecord     = new WarningRecord(warning);
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteWarning(warningRecord, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.Verbose:
                {
                    string            verbose           = (string)Value;
                    VerboseRecord     verboseRecord     = new VerboseRecord(verbose);
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteVerbose(verboseRecord, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.Progress:
                {
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteProgress((ProgressRecord)Value, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.Information:
                {
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.WriteInformation((InformationRecord)Value, overrideInquire);
                    }
                }

                break;

                case PSStreamObjectType.WarningRecord:
                {
                    WarningRecord     warningRecord     = (WarningRecord)Value;
                    MshCommandRuntime mshCommandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                    if (mshCommandRuntime != null)
                    {
                        mshCommandRuntime.AppendWarningVarList(warningRecord);
                    }
                }

                break;

                case PSStreamObjectType.MethodExecutor:
                {
                    Dbg.Assert(this.Value is ClientMethodExecutor,
                               "Expected psstreamObject.value is ClientMethodExecutor");
                    ClientMethodExecutor methodExecutor = (ClientMethodExecutor)Value;
                    methodExecutor.Execute(cmdlet);
                }

                break;

                case PSStreamObjectType.BlockingError:
                {
                    CmdletMethodInvoker <object> methodInvoker = (CmdletMethodInvoker <object>)Value;
                    InvokeCmdletMethodAndWaitForResults(methodInvoker, cmdlet);
                }

                break;

                case PSStreamObjectType.ShouldMethod:
                {
                    CmdletMethodInvoker <bool> methodInvoker = (CmdletMethodInvoker <bool>)Value;
                    InvokeCmdletMethodAndWaitForResults(methodInvoker, cmdlet);
                }

                break;

                case PSStreamObjectType.Exception:
                {
                    Exception e = (Exception)Value;
                    throw e;
                }
                }
            }
            else if (ObjectType == PSStreamObjectType.Exception)
            {
                Exception e = (Exception)Value;
                throw e;
            }
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        protected override void BeginProcessing()
        {
            //ValidateNotNullOrEmpty attribute is not working for System.Uri datatype, so handling it here
            if ((_cssuriSpecified) && (string.IsNullOrEmpty(_cssuri.OriginalString.Trim())))
            {
                ArgumentException ex = new ArgumentException(StringUtil.Format(UtilityCommonStrings.EmptyCSSUri, "CSSUri"));
                ErrorRecord       er = new ErrorRecord(ex, "ArgumentException", ErrorCategory.InvalidArgument, "CSSUri");
                ThrowTerminatingError(er);
            }

            _propertyMshParameterList = ProcessParameter(_property);

            if (!String.IsNullOrEmpty(_title))
            {
                WebUtility.HtmlEncode(_title);
            }


            // This first line ensures w3c validation will succeed. However we are not specifying
            // an encoding in the HTML because we don't know where the text will be written and
            // if a particular encoding will be used.

            if (!_fragment)
            {
                if (!_transitional)
                {
                    WriteObject("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
                }
                else
                {
                    WriteObject("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
                }
                WriteObject("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
                WriteObject("<head>");
                if (_charsetSpecified)
                {
                    WriteObject("<meta charset=\"" + _charset + "\">");
                }
                if (_metaSpecified)
                {
                    List <string> useditems = new List <string>();
                    foreach (string s in _meta.Keys)
                    {
                        if (!useditems.Contains(s))
                        {
                            switch (s.ToLower())
                            {
                            case "content-type":
                            case "default-style":
                            case "x-ua-compatible":
                                WriteObject("<meta http-equiv=\"" + s + "\" content=\"" + _meta[s] + "\">");
                                break;

                            case "application-name":
                            case "author":
                            case "description":
                            case "generator":
                            case "keywords":
                            case "viewport":
                                WriteObject("<meta name=\"" + s + "\" content=\"" + _meta[s] + "\">");
                                break;

                            default:
                                MshCommandRuntime mshCommandRuntime = this.CommandRuntime as MshCommandRuntime;
                                string            Message           = StringUtil.Format(ConvertHTMLStrings.MetaPropertyNotFound, s, _meta[s]);
                                WarningRecord     record            = new WarningRecord(Message);
                                InvocationInfo    invocationInfo    = GetVariableValue(SpecialVariables.MyInvocation) as InvocationInfo;

                                if (invocationInfo != null)
                                {
                                    record.SetInvocationInfo(invocationInfo);
                                }
                                mshCommandRuntime.WriteWarning(record);
                                WriteObject("<meta name=\"" + s + "\" content=\"" + _meta[s] + "\">");
                                break;
                            }
                            useditems.Add(s);
                        }
                    }
                }
                WriteObject(_head ?? new string[] { "<title>" + _title + "</title>" }, true);
                if (_cssuriSpecified)
                {
                    WriteObject("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + _cssuri + "\" />");
                }
                WriteObject("</head><body>");
                if (_body != null)
                {
                    WriteObject(_body, true);
                }
            }
            if (_preContent != null)
            {
                WriteObject(_preContent, true);
            }
            WriteObject("<table>");
            _isTHWritten       = false;
            _propertyCollector = new StringCollection();
        }
Пример #7
0
        internal void WriteStreamObject(Cmdlet cmdlet, Guid instanceId, bool overrideInquire = false)
        {
            switch (this.ObjectType)
            {
            case PSStreamObjectType.Output:
                if (instanceId != Guid.Empty)
                {
                    PSObject psObj = this.Value as PSObject;
                    if (psObj != null)
                    {
                        AddSourceJobNoteProperty(psObj, instanceId);
                    }
                }
                cmdlet.WriteObject(this.Value);
                return;

            case PSStreamObjectType.Error:
            {
                ErrorRecord errorRecord = (ErrorRecord)this.Value;
                if ((!(errorRecord is RemotingErrorRecord) && (errorRecord.ErrorDetails != null)) && !string.IsNullOrEmpty(errorRecord.ErrorDetails.RecommendedAction))
                {
                    string str;
                    Guid   guid;
                    GetIdentifierInfo(errorRecord.ErrorDetails.RecommendedAction, out guid, out str);
                    errorRecord = new RemotingErrorRecord(errorRecord, new OriginInfo(str, Guid.Empty, guid));
                }
                errorRecord.PreserveInvocationInfoOnce = true;
                MshCommandRuntime commandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (commandRuntime == null)
                {
                    break;
                }
                commandRuntime.WriteError(errorRecord, overrideInquire);
                return;
            }

            case PSStreamObjectType.MethodExecutor:
            case PSStreamObjectType.BlockingError:
            case PSStreamObjectType.ShouldMethod:
            case PSStreamObjectType.WarningRecord:
                this.WriteStreamObject(cmdlet, overrideInquire);
                break;

            case PSStreamObjectType.Warning:
            {
                string            message  = (string)this.Value;
                WarningRecord     record   = new WarningRecord(message);
                MshCommandRuntime runtime2 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime2 == null)
                {
                    break;
                }
                runtime2.WriteWarning(record, overrideInquire);
                return;
            }

            case PSStreamObjectType.Debug:
            {
                string            str5     = (string)this.Value;
                DebugRecord       record7  = new DebugRecord(str5);
                MshCommandRuntime runtime5 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime5 == null)
                {
                    break;
                }
                runtime5.WriteDebug(record7, overrideInquire);
                return;
            }

            case PSStreamObjectType.Progress:
            {
                ProgressRecord progressRecord = (ProgressRecord)this.Value;
                if (!(progressRecord is RemotingProgressRecord))
                {
                    Guid   guid2;
                    string str4;
                    GetIdentifierInfo(progressRecord.CurrentOperation, out guid2, out str4);
                    OriginInfo originInfo = new OriginInfo(str4, Guid.Empty, guid2);
                    progressRecord = new RemotingProgressRecord(progressRecord, originInfo);
                }
                MshCommandRuntime runtime4 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime4 == null)
                {
                    break;
                }
                runtime4.WriteProgress(progressRecord, overrideInquire);
                return;
            }

            case PSStreamObjectType.Verbose:
            {
                string            str3     = (string)this.Value;
                VerboseRecord     record4  = new VerboseRecord(str3);
                MshCommandRuntime runtime3 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime3 == null)
                {
                    break;
                }
                runtime3.WriteVerbose(record4, overrideInquire);
                return;
            }

            default:
                return;
            }
        }
Пример #8
0
        internal void WriteStreamObject(Cmdlet cmdlet, bool overrideInquire = false)
        {
            switch (this.ObjectType)
            {
            case PSStreamObjectType.Output:
                cmdlet.WriteObject(this.Value);
                return;

            case PSStreamObjectType.Error:
            {
                ErrorRecord errorRecord = (ErrorRecord)this.Value;
                errorRecord.PreserveInvocationInfoOnce = true;
                MshCommandRuntime commandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
                if (commandRuntime == null)
                {
                    break;
                }
                commandRuntime.WriteError(errorRecord, overrideInquire);
                return;
            }

            case PSStreamObjectType.MethodExecutor:
                ((ClientMethodExecutor)this.Value).Execute(cmdlet);
                return;

            case PSStreamObjectType.Warning:
            {
                string            message  = (string)this.Value;
                WarningRecord     record   = new WarningRecord(message);
                MshCommandRuntime runtime3 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime3 == null)
                {
                    break;
                }
                runtime3.WriteWarning(record, overrideInquire);
                return;
            }

            case PSStreamObjectType.BlockingError:
            {
                CmdletMethodInvoker <object> cmdletMethodInvoker = (CmdletMethodInvoker <object>) this.Value;
                InvokeCmdletMethodAndWaitForResults <object>(cmdletMethodInvoker, cmdlet);
                return;
            }

            case PSStreamObjectType.ShouldMethod:
            {
                CmdletMethodInvoker <bool> invoker2 = (CmdletMethodInvoker <bool>) this.Value;
                InvokeCmdletMethodAndWaitForResults <bool>(invoker2, cmdlet);
                return;
            }

            case PSStreamObjectType.WarningRecord:
            {
                WarningRecord     record5  = (WarningRecord)this.Value;
                MshCommandRuntime runtime6 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime6 == null)
                {
                    break;
                }
                runtime6.AppendWarningVarList(record5);
                return;
            }

            case PSStreamObjectType.Debug:
            {
                string            str      = (string)this.Value;
                DebugRecord       record2  = new DebugRecord(str);
                MshCommandRuntime runtime2 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime2 == null)
                {
                    break;
                }
                runtime2.WriteDebug(record2, overrideInquire);
                return;
            }

            case PSStreamObjectType.Progress:
            {
                MshCommandRuntime runtime5 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime5 == null)
                {
                    break;
                }
                runtime5.WriteProgress((ProgressRecord)this.Value, overrideInquire);
                return;
            }

            case PSStreamObjectType.Verbose:
            {
                string            str3     = (string)this.Value;
                VerboseRecord     record4  = new VerboseRecord(str3);
                MshCommandRuntime runtime4 = cmdlet.CommandRuntime as MshCommandRuntime;
                if (runtime4 == null)
                {
                    break;
                }
                runtime4.WriteVerbose(record4, overrideInquire);
                return;
            }

            case PSStreamObjectType.Exception:
            {
                Exception exception = (Exception)this.Value;
                throw exception;
            }

            default:
                return;
            }
        }
Пример #9
0
 private void WriteJobResults(System.Management.Automation.Job job)
 {
     if (job != null)
     {
         if (job.JobStateInfo.State == JobState.Disconnected)
         {
             PSRemotingChildJob job2 = job as PSRemotingChildJob;
             if ((job2 != null) && job2.DisconnectedAndBlocked)
             {
                 return;
             }
         }
         if (job.JobStateInfo.State == JobState.Blocked)
         {
             DoUnblockJob(job);
         }
         if (!(job is Job2) && job.UsesResultsCollection)
         {
             Collection <PSStreamObject> collection = this.ReadAll <PSStreamObject>(job.Results);
             if (this._wait)
             {
                 foreach (PSStreamObject obj2 in collection)
                 {
                     obj2.WriteStreamObject(this, job.Results.SourceId, false);
                 }
             }
             else
             {
                 foreach (PSStreamObject obj3 in collection)
                 {
                     obj3.WriteStreamObject(this, false);
                 }
             }
         }
         else
         {
             foreach (PSObject obj4 in this.ReadAll <PSObject>(job.Output))
             {
                 if (obj4 != null)
                 {
                     base.WriteObject(obj4);
                 }
             }
             foreach (ErrorRecord record in this.ReadAll <ErrorRecord>(job.Error))
             {
                 if (record != null)
                 {
                     MshCommandRuntime commandRuntime = base.CommandRuntime as MshCommandRuntime;
                     if (commandRuntime != null)
                     {
                         commandRuntime.WriteError(record, true);
                     }
                 }
             }
             foreach (VerboseRecord record2 in this.ReadAll <VerboseRecord>(job.Verbose))
             {
                 if (record2 != null)
                 {
                     MshCommandRuntime runtime2 = base.CommandRuntime as MshCommandRuntime;
                     if (runtime2 != null)
                     {
                         runtime2.WriteVerbose(record2, true);
                     }
                 }
             }
             foreach (DebugRecord record3 in this.ReadAll <DebugRecord>(job.Debug))
             {
                 if (record3 != null)
                 {
                     MshCommandRuntime runtime3 = base.CommandRuntime as MshCommandRuntime;
                     if (runtime3 != null)
                     {
                         runtime3.WriteDebug(record3, true);
                     }
                 }
             }
             foreach (WarningRecord record4 in this.ReadAll <WarningRecord>(job.Warning))
             {
                 if (record4 != null)
                 {
                     MshCommandRuntime runtime4 = base.CommandRuntime as MshCommandRuntime;
                     if (runtime4 != null)
                     {
                         runtime4.WriteWarning(record4, true);
                     }
                 }
             }
             foreach (ProgressRecord record5 in this.ReadAll <ProgressRecord>(job.Progress))
             {
                 if (record5 != null)
                 {
                     MshCommandRuntime runtime5 = base.CommandRuntime as MshCommandRuntime;
                     if (runtime5 != null)
                     {
                         runtime5.WriteProgress(record5, true);
                     }
                 }
             }
         }
         if (job.JobStateInfo.State == JobState.Failed)
         {
             this.WriteReasonError(job);
         }
     }
 }