protected override void ProcessFormatEntry(FormatEntryData data) { var list = data as ListFormatEntryData; if (list == null) { throw new PSInvalidOperationException("ListFormatProcessor can only process ListFormatEntryData"); } OutputWriter.WriteToErrorStream = data.WriteToErrorStream; OutputWriter.WriteLine(""); // a blank line in front of every entry int maxPropNameWidth = list.Entries.Max(entry => entry.PropertyName.Length); int totalWidth = OutputWriter.Columns - 1; // -1 because of newline if (totalWidth <= 0) { totalWidth = OutputWriter.DefaultColumns - 1; } int availableForName = totalWidth - 4; // need place for " : x" where x is the first char of the value if (maxPropNameWidth > availableForName) { maxPropNameWidth = availableForName; } foreach (var curEntry in list.Entries) { WriteEntry(curEntry, maxPropNameWidth, totalWidth); } }
protected override void ProcessFormatEntry(FormatEntryData data) { var tableEntry = data as TableFormatEntryData; if (tableEntry == null) { throw new PSInvalidOperationException("TableFormatProcessor can only process TableFormatEntryData"); } OutputWriter.WriteToErrorStream = data.WriteToErrorStream; if (_currentColumns == null) { CalculateColumns(tableEntry.Row); } if (tableEntry.ShowHeader) { WriteHeader(tableEntry); } WriteRow(tableEntry); }
protected abstract void ProcessFormatEntry(FormatEntryData data);
internal FormatEntryData(FormatEntryData entry) : base(entry.Shape) { WriteToErrorStream = entry.WriteToErrorStream; }