-
-
Notifications
You must be signed in to change notification settings - Fork 5
CustomConsole WriteText
Iuga Alexandru edited this page Jan 7, 2018
·
5 revisions
A number of static methods that helps writing text to the console.
- Normal, Warning, Error and Emphasised text - Specialized methods to write predefined types of text: Normal, Warning, Error and Emphasised.
- custom foreground and background colors - Can specify a custom foreground and background colors.
- Write or WriteLine - The methods come in pairs. One to just write the text and another one to write also the line terminator at the end.
- Horizontal Alignment - The text can be aligned (left, center, right) relative to the ConsoleBuffer size.
CustomConsole.WriteLine("Normal: This is a normal line of text.");
CustomConsole.WriteLine();
CustomConsole.WriteLineEmphasies("Emphasies: But I can also write an emphasized text.");
CustomConsole.WriteLine();
CustomConsole.WriteLineSuccess("Success: And everything is ok if it finishes well :)");
CustomConsole.WriteLine();
CustomConsole.WriteLineWarning("Warning: But I have to warn you about the consequences of something not being done correctly.");
CustomConsole.WriteLine();
CustomConsole.WriteLineError("Error: If some error occures and the application will crush with an exception, I will display it on the screen immediately.");
Result:
CustomConsole.WriteLine(HorizontalAlignment.Left, "This is a text aligned to left.");
CustomConsole.WriteLine(HorizontalAlignment.Left, "This is anoter text aligned to left.");
CustomConsole.WriteLine();
CustomConsole.WriteLine(HorizontalAlignment.Center, "This is a text aligned to center.");
CustomConsole.WriteLine(HorizontalAlignment.Center, "This is another text aligned to center.");
CustomConsole.WriteLine();
CustomConsole.WriteLine(HorizontalAlignment.Right, "This is a text aligned to right.");
CustomConsole.WriteLine(HorizontalAlignment.Right, "This is another text aligned to right.");
Result: