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: Terminaux.Base
Assembly: Terminaux.dll
Syntax
public static class ConsoleWrapper
Properties
| Edit this page View SourceBufferHeight
The console buffer height (rows)
Declaration
public static int BufferHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
BufferWidth
The console buffer width (columns)
Declaration
public static int BufferWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
CursorLeft
The cursor left position
Declaration
public static int CursorLeft { get; set; }
Property Value
Type | Description |
---|---|
int |
CursorTop
The cursor top position
Declaration
public static int CursorTop { get; set; }
Property Value
Type | Description |
---|---|
int |
CursorVisible
The cursor visibility mode
Declaration
public static bool CursorVisible { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsDumb
Checks to see if the console is dumb
Declaration
public static bool IsDumb { get; }
Property Value
Type | Description |
---|---|
bool |
KeyAvailable
Whether a key is pressed
Declaration
public static bool KeyAvailable { get; }
Property Value
Type | Description |
---|---|
bool |
TreatCtrlCAsInput
Whether to treat Ctrl + C as input or not
Declaration
public static bool TreatCtrlCAsInput { get; set; }
Property Value
Type | Description |
---|---|
bool |
WindowHeight
The console window height (rows)
Declaration
public static int WindowHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
WindowWidth
The console window width (columns)
Declaration
public static int WindowWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceBeep()
Beeps the console
Declaration
public static void Beep()
Beep(int, int)
Beeps the console
Declaration
public static void Beep(int freq, int ms)
Parameters
Type | Name | Description |
---|---|---|
int | freq | Frequency in hertz |
int | ms | 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
Declaration
public static Coordinate GetCursorPosition()
Returns
Type | Description |
---|---|
Coordinate |
ReadKey(bool)
Reads a key
Declaration
public static ConsoleKeyInfo ReadKey(bool intercept = false)
Parameters
Type | Name | Description |
---|---|---|
bool | intercept | Whether to intercept |
Returns
Type | Description |
---|---|
ConsoleKeyInfo |
SetBufferDimensions(int, int)
Sets the buffer dimensions
Declaration
public static void SetBufferDimensions(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The buffer width to be set (from 0) |
int | height | 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
Type | Name | Description |
---|---|---|
int | left | The left to be set (from 0) |
int | top | The top to be set (from 0) |
SetWindowDimensions(int, int)
Sets the window dimensions
Declaration
public static void SetWindowDimensions(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The window width to be set (from 0) |
int | height | The window height to be set (from 0) |
Write(char)
Writes a character to console (stdout)
Declaration
public static void Write(char value)
Parameters
Type | Name | Description |
---|---|---|
char | value | A character |
Write(string)
Writes text to console (stdout)
Declaration
public static void Write(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to write |
Write(string, params object[])
Writes text to console (stdout)
Declaration
public static void Write(string text, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to write |
object[] | args | The arguments to evaluate |
WriteError(char)
Writes a character to console (stderr)
Declaration
public static void WriteError(char value)
Parameters
Type | Name | Description |
---|---|---|
char | value | A character |
WriteError(string)
Writes text to console (stderr)
Declaration
public static void WriteError(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to write |
WriteError(string, params object[])
Writes text to console (stderr)
Declaration
public static void WriteError(string text, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to write |
object[] | args | 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
Type | Name | Description |
---|---|---|
string | text | 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
Type | Name | Description |
---|---|---|
string | text | The text to write |
object[] | args | 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
Type | Name | Description |
---|---|---|
string | text | 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
Type | Name | Description |
---|---|---|
string | text | The text to write |
object[] | args | The arguments to evaluate |