/// <summary> /// Write a table to the console. /// </summary> /// <param name="table">The table to write.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="table" /> is null.</exception> public void Write(Table table) { if (table == null) { throw new ArgumentNullException(nameof(table)); } var line = HorizontalLineFactory.Create(table); WriteLine(HorizontalLineFactory.CreateTop(line, table.BorderStyle), table.BorderColor); for (var rowNumber = 0; rowNumber < table.Rows; rowNumber++) { WriteTableRow(table, rowNumber); } WriteLine(HorizontalLineFactory.CreateBottom(line, table.BorderStyle), table.BorderColor); }
/// <summary> /// Write a message box to the console. /// </summary> /// <param name="messageBox">The message box to write.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="messageBox" /> is null.</exception> public void Write(MessageBox messageBox) { if (messageBox == null) { throw new ArgumentNullException(nameof(messageBox)); } var horizontalLine = HorizontalLineFactory.Create(messageBox); WriteLine(HorizontalLineFactory.CreateTop(horizontalLine, messageBox.BorderStyle), messageBox.BorderColor); foreach (var line in messageBox.Lines) { var paddedLine = line.PadRight(horizontalLine.Length); Write(messageBox.BorderStyle.VerticalLine, messageBox.BorderColor); Write(paddedLine, messageBox.TextColor); WriteLine(messageBox.BorderStyle.VerticalLine, messageBox.BorderColor); } WriteLine(HorizontalLineFactory.CreateBottom(horizontalLine, messageBox.BorderStyle), messageBox.BorderColor); }