Class ConsoleWrapper
Wrapper for the System.Console class to ensure safety against dumb consoles. This connects to the console wrapper that Terminaux manages.
Inheritance
Namespace
Syntax
public static class ConsoleWrapper
Properties
BufferHeight
The console buffer height (rows)
Property Value
Declaration
public static int BufferHeight { get; set; }
BufferWidth
The console buffer width (columns)
Property Value
Declaration
public static int BufferWidth { get; set; }
CursorLeft
The cursor left position
Property Value
Declaration
public static int CursorLeft { get; set; }
CursorTop
The cursor top position
Property Value
Declaration
public static int CursorTop { get; set; }
CursorVisible
The cursor visibility mode
Property Value
Declaration
public static bool CursorVisible { get; set; }
IsDumb
Checks to see if the console is dumb
Property Value
Declaration
public static bool IsDumb { get; }
KeyAvailable
Whether a key is pressed
Property Value
Declaration
public static bool KeyAvailable { get; }
MovementDetected
Has the console moved? Should be set by Write*, Set*, and all console functions that have to do with moving the console.
Property Value
Declaration
public static bool MovementDetected { get; }
TreatCtrlCAsInput
Whether to treat Ctrl + C as input or not
Property Value
Declaration
public static bool TreatCtrlCAsInput { get; set; }
WindowHeight
The console window height (rows)
Property Value
Declaration
public static int WindowHeight { get; set; }
WindowWidth
The console window width (columns)
Property Value
Declaration
public static int WindowWidth { get; set; }
Methods
Beep()
Beeps the console
Declaration
public static void Beep()
Beep(int, int)
Beeps the console
Declaration
public static void Beep(int freq, int ms)
Parameters
| Name | Type | Description |
|---|---|---|
| freq | int | Frequency in hertz |
| ms | int | Duration in milliseconds |
BeepSeq()
Beeps the console (VT Sequence method)
Declaration
public static void BeepSeq()
Clear()
Clears the console screen.
Declaration
public static void Clear()
ClearLoadBack()
Clears the console screen while loading the background.
Declaration
public static void ClearLoadBack()
GetCursorPosition()
The cursor top position
ReadKey(bool)
Reads a key
Returns
Declaration
public static ConsoleKeyInfo ReadKey(bool intercept = false)
Parameters
| Name | Type | Description |
|---|---|---|
| intercept | bool | Whether to intercept |
SetBufferDimensions(int, int)
Sets the buffer dimensions
Declaration
public static void SetBufferDimensions(int width, int height)
Parameters
| Name | Type | Description |
|---|---|---|
| width | int | The buffer width to be set (from 0) |
| height | int | The buffer height to be set (from 0) |
SetCursorPosition(int, int)
Sets the cursor position
Declaration
public static void SetCursorPosition(int left, int top)
Parameters
| Name | Type | Description |
|---|---|---|
| left | int | The left to be set (from 0) |
| top | int | The top to be set (from 0) |
SetWindowDimensions(int, int)
Sets the window dimensions
Declaration
public static void SetWindowDimensions(int width, int height)
Parameters
| Name | Type | Description |
|---|---|---|
| width | int | The window width to be set (from 0) |
| height | int | The window height to be set (from 0) |
Write(char)
Writes a character to console (stdout)
Declaration
public static void Write(char value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | char | A character |
Write(string)
Writes text to console (stdout)
Declaration
public static void Write(string text)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
Write(string, params object[])
Writes text to console (stdout)
Declaration
public static void Write(string text, params object[] args)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
| args | object[] | The arguments to evaluate |
WriteError(char)
Writes a character to console (stderr)
Declaration
public static void WriteError(char value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | char | A character |
WriteError(string)
Writes text to console (stderr)
Declaration
public static void WriteError(string text)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
WriteError(string, params object[])
Writes text to console (stderr)
Declaration
public static void WriteError(string text, params object[] args)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
| args | object[] | The arguments to evaluate |
WriteLine()
Writes new line to console (stdout)
Declaration
public static void WriteLine()
WriteLine(string)
Writes text to console (stdout) with line terminator
Declaration
public static void WriteLine(string text)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
WriteLine(string, params object[])
Writes text to console (stdout) with line terminator
Declaration
public static void WriteLine(string text, params object[] args)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
| args | object[] | The arguments to evaluate |
WriteLineError()
Writes new line to console (stderr)
Declaration
public static void WriteLineError()
WriteLineError(string)
Writes text to console (stderr) with line terminator
Declaration
public static void WriteLineError(string text)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
WriteLineError(string, params object[])
Writes text to console (stderr) with line terminator
Declaration
public static void WriteLineError(string text, params object[] args)
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The text to write |
| args | object[] | The arguments to evaluate |