private void ProcessOutputHelper() { for (object obj = this.outputReader.Read(); obj != AutomationNull.Value; obj = this.outputReader.Read()) { ProcessOutputObject processOutputObject = obj as ProcessOutputObject; if (processOutputObject.Stream == MinishellStream.Error) { ErrorRecord data = processOutputObject.Data as ErrorRecord; data.SetInvocationInfo(this.Command.MyInvocation); this.commandRuntime._WriteErrorSkipAllowCheck(data); } else if (processOutputObject.Stream == MinishellStream.Output) { this.commandRuntime._WriteObjectSkipAllowCheck(processOutputObject.Data); } else if (processOutputObject.Stream == MinishellStream.Debug) { this.Command.PSHostInternal.UI.WriteDebugLine(processOutputObject.Data as string); } else if (processOutputObject.Stream == MinishellStream.Verbose) { this.Command.PSHostInternal.UI.WriteVerboseLine(processOutputObject.Data as string); } else if (processOutputObject.Stream == MinishellStream.Warning) { this.Command.PSHostInternal.UI.WriteWarningLine(processOutputObject.Data as string); } else if (processOutputObject.Stream == MinishellStream.Progress && processOutputObject.Data is PSObject data) { long sourceId = 0; PSMemberInfo property1 = (PSMemberInfo)data.Properties["SourceId"]; if (property1 != null) { sourceId = (long)property1.Value; } PSMemberInfo property2 = (PSMemberInfo)data.Properties["Record"]; ProgressRecord record = (ProgressRecord)null; if (property2 != null) { record = property2.Value as ProgressRecord; } if (record != null) { this.Command.PSHostInternal.UI.WriteProgress(sourceId, record); } } if (this.Command.Context.CurrentPipelineStopping) { this.StopProcessing(); break; } } }
private void AddObjectToWriter(object data, MinishellStream stream) { try { ProcessOutputObject processOutputObject = new ProcessOutputObject(data, stream); lock (this.writer) this.writer.Write((object)processOutputObject); } catch (PipelineClosedException ex) { } catch (ObjectDisposedException ex) { } }
private void AddObjectToWriter(object data, MinishellStream stream) { try { ProcessOutputObject obj2 = new ProcessOutputObject(data, stream); lock (this.writer) { this.writer.Write(obj2); } } catch (PipelineClosedException) { } catch (ObjectDisposedException) { } }
/// <summary> /// Adds one object to writer /// </summary> private void AddObjectToWriter(object data, MinishellStream stream) { try { ProcessOutputObject dataObject = new ProcessOutputObject(data, stream); //writer is shared between Error and Output reader. lock (_writer) { _writer.Write(dataObject); } } catch (PipelineClosedException) { // The output queue may have been closed asynchronously ; } catch (System.ObjectDisposedException) { // The output queue may have been disposed asynchronously when StopProcessing is called... ; } }
private void ProcessOutputHelper() { for (object obj2 = this.outputReader.Read(); obj2 != AutomationNull.Value; obj2 = this.outputReader.Read()) { ProcessOutputObject obj3 = obj2 as ProcessOutputObject; if (obj3.Stream == MinishellStream.Error) { ErrorRecord data = obj3.Data as ErrorRecord; data.SetInvocationInfo(base.Command.MyInvocation); ActionPreference?actionPreference = null; base.commandRuntime._WriteErrorSkipAllowCheck(data, actionPreference); } else if (obj3.Stream == MinishellStream.Output) { base.commandRuntime._WriteObjectSkipAllowCheck(obj3.Data); } else if (obj3.Stream == MinishellStream.Debug) { string message = obj3.Data as string; base.Command.PSHostInternal.UI.WriteDebugLine(message); } else if (obj3.Stream == MinishellStream.Verbose) { string str2 = obj3.Data as string; base.Command.PSHostInternal.UI.WriteVerboseLine(str2); } else if (obj3.Stream == MinishellStream.Warning) { string str3 = obj3.Data as string; base.Command.PSHostInternal.UI.WriteWarningLine(str3); } else if (obj3.Stream == MinishellStream.Progress) { PSObject obj4 = obj3.Data as PSObject; if (obj4 != null) { long sourceId = 0L; PSMemberInfo info = obj4.Properties["SourceId"]; if (info != null) { sourceId = (long)info.Value; } info = obj4.Properties["Record"]; ProgressRecord record = null; if (info != null) { record = info.Value as ProgressRecord; } if (record != null) { base.Command.PSHostInternal.UI.WriteProgress(sourceId, record); } } } if (base.Command.Context.CurrentPipelineStopping) { this.StopProcessing(); return; } } }