Class TerminalSystemConsole
The default ITerminalConsole implementation that use system Console.
public class TerminalSystemConsole : ITerminalConsole
- Inheritance
-
TerminalSystemConsole
- Implements
- Inherited Members
Properties
BackgroundColor
The background color.
public ConsoleColor BackgroundColor { get; set; }
Property Value
ForegroundColor
The foreground color.
public ConsoleColor ForegroundColor { get; set; }
Property Value
In
Gets the standard input stream.
public TextReader In { get; }
Property Value
Out
Gets the standard output stream.
public TextWriter Out { get; }
Property Value
Methods
ClearAsync()
Clears the Console buffer and the corresponding display information.
public Task ClearAsync()
Returns
Ignore(string?)
Return true
if the specified string value is ignored by the ITerminalConsole, otherwise false
.
public bool Ignore(string? value)
Parameters
value
stringThe value to check.
Returns
ReadAnswerAsync(string, params string[]?)
Prints the question to the ITerminalConsole standard output stream and waits for an answer asynchronously.
public virtual Task<string> ReadAnswerAsync(string question, params string[]? answers)
Parameters
question
stringThe question to print. The
?
will be appended at the end.answers
string[]The allowed answers or
null
if all answers are allowed. It is recommended to keep the answers short for readability. If specified this method will print the answers with question in the format{question} {answer1}/{answer2}/{answer3}?
Returns
ReadLineAsync()
Reads the next line of characters from the Console input stream asynchronously.
public Task<string?> ReadLineAsync()
Returns
- Task<string>
The next line of characters from the input stream, or
null
if no more lines are available.
WriteAsync(string, params object[])
Writes the specified string value to the Console standard output stream.
public Task WriteAsync(string value, params object[] args)
Parameters
Returns
WriteColorAsync(ConsoleColor, string, params object[])
Writes the specified string value in the foreground color to the Console standard output stream.
public Task WriteColorAsync(ConsoleColor foregroundColor, string value, params object[] args)
Parameters
foregroundColor
ConsoleColorThe foreground text color.
value
stringThe text to write.
args
object[]The format arguments.
Returns
WriteLineAsync()
Writes the current newline terminator to the Console input stream asynchronously.
public Task WriteLineAsync()
Returns
WriteLineAsync(string, params object[])
Writes the specified string value followed by the current newline terminator to the Console input stream asynchronously.
public Task WriteLineAsync(string value, params object[] args)
Parameters
Returns
WriteLineColorAsync(ConsoleColor, string, params object[])
Writes the specified string value followed by the current newline terminator to the Console input stream asynchronously.
public Task WriteLineColorAsync(ConsoleColor foregroundColor, string value, params object[] args)
Parameters
foregroundColor
ConsoleColorThe foreground text color.
value
stringThe text to write.
args
object[]The format arguments.