public ResultTableWriter(ILang lang) { Lang = lang; ColumnWidths = new int[] { Math.Max(Lang.Total().Length, Lang.Taken().Length), Math.Max(Lang.Weight().Length, 2), Math.Max(Lang.Value().Length, 2), Math.Max(Lang.DoTake().Length, TAKE_FLAG.Length) }; }
public void WriteFooter() { string footerContent(bool total, int colIndex, int colWidth) { // "| Total | 93 | 62 | |" switch (colIndex) { case 0: return(total ? Lang.Total() : Lang.Taken()); case 1: return(RightAlignInt(colWidth, total ? TotalWeight : TakenWeight)); case 2: return(RightAlignInt(colWidth, total ? TotalValue : TakenValue)); default: return(null); } } Console.WriteLine(HorizontalLine()); Console.WriteLine(TableRow((i, w) => footerContent(true, i, w))); Console.WriteLine(TableRow((i, w) => footerContent(false, i, w))); Console.WriteLine(HorizontalLine()); }