public virtual void RenderOnBottom(StringBuilderInterlaced stream, string value) { var rowsOfValue = value.Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (var s in rowsOfValue) { if (string.IsNullOrWhiteSpace(s)) { continue; } for (var i = 0; i < Math.Max(1, s.Length / _width); i++) { var line = s.Take(_width - 1).Select(e => e.ToString()).Aggregate((e, f) => e + f); var toEnd = _width - line.Length - 1; stream.Append(VerticalLineSeperator); if (DrawSpace) { stream.Append(" "); } stream.Append(line); for (var f = 0; f < toEnd; f++) { stream.Append(" "); } if (DrawSpace) { stream.Append(" "); } stream.AppendLine(VerticalLineSeperator.ToString()); } } DrawHorizontalLine(stream, LowerLeftBound, LowerRightBound, DrawSpace, HorizontalLineSeperator, _width); }
public virtual int RenderHeader(StringBuilderInterlaced stream, IList <ConsoleGridColumn> columnHeader) { _width = columnHeader.Sum(s => s.Name.Length) + columnHeader.Count; if (DrawSpace) { _width += columnHeader.Count * 2; _width -= 2; } stream.Append(UpperLeftBound); if (DrawSpace) { stream.Append(" "); } DrawHorizontalLineEx(stream, columnHeader, '┬'); if (DrawSpace) { stream.Append(" "); } stream.Append(UpperRightBound); stream.AppendLine(); var maxRows = columnHeader.Max(f => f.AlignedProperty.Rows); for (var i = 0; i < maxRows; i++) { stream.Append(VerticalLineSeperator); if (DrawSpace) { stream.Append(" "); } for (var index = 0; index < columnHeader.Count; index++) { var propName = columnHeader[index]; if (DrawSpace && index != 0) { stream.Append(" "); } var columnOverwrite = ColumnStyles.FirstOrDefault(e => e.Key.Equals(propName.Name)); stream.Append(propName.Name, columnOverwrite.Value?.ForegroundColorStyle, columnOverwrite.Value?.BackgroundColorStyle); if (DrawSpace) { stream.Append(" "); } if (index + 1 < columnHeader.Count) { stream.Append(VerticalLineSeperator); } } stream.Append(VerticalLineSeperator); stream.AppendLine(); } stream.Append('├'); DrawHorizontalLineEx(stream, columnHeader, '┼'); stream.Append('┤'); //DrawHorizontalLine(stream, '├', '┤'); return(_width); }