private static IEnumerable<string> FormatCol(PropertyColumnFormat pcf, object item, 
     int width, int tabLength, int firstLineHangingIndent)
 {
     var rawValue = pcf.Property.GetValue(item);
     var value = ValueFormatter.Format(pcf.Format, rawValue);
     return FormatColWithPreFormattedValue(pcf, value, width, tabLength, firstLineHangingIndent);
 }
 public void AddColumn(PropertyColumnFormat format, IEnumerable<FormattingIntermediate> values)
 {
     var newItem = new StackPropertyInfo
     {
         Column = format,
         Values = values.ToList()
     };
     _columns.Insert(0, newItem);
 }
Exemplo n.º 3
0
        private static void ProduceColumnsUsingProperties(Type type, bool includeAllColumns, bool formatValid,
            IEnumerator<ColumnFormat> formatEnumerator, List<PropertyColumnFormat> output)
        {
            foreach (var prop in type.GetProperties())
            {
                PropertyColumnFormat matchedFormat = null;
                if (formatValid)
                {
                    if (formatEnumerator.Current != null)
                        matchedFormat = new PropertyColumnFormat(prop, formatEnumerator.Current);
                    formatValid = formatEnumerator.MoveNext();
                }

                if (matchedFormat == null)
                {
                    if (!includeAllColumns) break;
                    matchedFormat = new PropertyColumnFormat(prop,
                        new ColumnFormat(PropertyNameConverter.ToHeading(prop), ConvertPropertyType(prop.PropertyType)));
                }

                output.Add(matchedFormat);
            }
        }
 private static IEnumerable<string> FormatColWithPreFormattedValue(PropertyColumnFormat pcf, string preFormattedValue, 
     int width, int tabLength, int firstLineHangingIndent)
 {
     return PropertyStackFormatter.Format(pcf.Format, preFormattedValue, width, tabLength, firstLineHangingIndent);
 }
Exemplo n.º 5
0
 private static string[] WrapValue(int tabLength, PropertyColumnFormat pcf, object value)
 {
     var formatted = ValueFormatter.Format(pcf.Format, value);
     return ColumnWrapper.WrapValue(formatted, pcf.Format, pcf.Format.ActualWidth, tabLength);
 }