Class SystemConsoleWrapper
- Namespace
- InteractiveReadLine.Abstractions
- Assembly
- InteractiveReadLine.dll
Presents System.Console through the IConsole interface. This default implementation originally existed to support unit testing. It is public so that callers can decorate or compose it to intercept output that read line operations write to the system console.
public class SystemConsoleWrapper : IConsole
- Inheritance
-
SystemConsoleWrapper
- Implements
- Inherited Members
Properties
BufferHeight
Gets the height of the provider's buffer, measured in rows
public int BufferHeight { get; }
Property Value
BufferWidth
Gets the width of the provider's buffer, measured in columns
public int BufferWidth { get; }
Property Value
CursorLeft
Gets or sets the cursor's position from the left edge of the buffer
public int CursorLeft { get; set; }
Property Value
CursorTop
Gets or sets the cursor's position from the top of the buffer
public int CursorTop { get; set; }
Property Value
InputIsRedirected
Gets whether input comes from a redirected stream instead of an interactive console. Individual keypresses cannot be read from a redirected stream.
public bool InputIsRedirected { get; }
Property Value
KeyAvailable
Gets whether a keypress is waiting, which lets callers wait for input without blocking on ReadKey.
public bool KeyAvailable { get; }
Property Value
TreatControlCAsInput
Gets or sets whether Ctrl+C is delivered as an ordinary keypress rather than being treated as a signal to terminate the program.
public bool TreatControlCAsInput { get; set; }
Property Value
Remarks
A read line operation enables this property so that a Ctrl+C key behavior can abandon the line, then restores the previous value when the operation finishes. Implementations without a system console can store the value without acting on it.
Methods
ReadKey()
Waits for a keypress and returns it without echoing it to the display.
public ConsoleKeyInfo ReadKey()
Returns
- ConsoleKeyInfo
Information about the pressed key.
Write(FormattedChar)
Writes a single formatted character at the cursor, applying its colors.
public void Write(FormattedChar c)
Parameters
cFormattedCharThe character to write.
Write(FormattedText)
Writes formatted text at the cursor, applies each character's colors, and leaves the cursor after the written text.
public void Write(FormattedText text)
Parameters
textFormattedTextThe text to write.
WriteLine(FormattedText)
Writes formatted text at the cursor followed by a newline, leaving the cursor at the start of the following row.
public void WriteLine(FormattedText text)
Parameters
textFormattedTextThe text to write.