Class ConsoleWrapperTools
Wrapper for the System.Console class to ensure safety against dumb consoles and Windows-only features.
Inheritance
Namespace: Terminaux.Base
Assembly: Terminaux.dll
Syntax
public static class ConsoleWrapperTools
Properties
Wrapper
Wrapper instance
Declaration
public static BaseConsoleWrapper Wrapper { get; }
Property Value
Type | Description |
---|---|
BaseConsoleWrapper |
WrapperNoLocal
Wrapper instance (excluding the local wrapper)
Declaration
public static BaseConsoleWrapper WrapperNoLocal { get; }
Property Value
Type | Description |
---|---|
BaseConsoleWrapper |
Methods
GetWrapper(string)
Gets the wrapper instance
Declaration
public static BaseConsoleWrapper GetWrapper(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Returns
Type | Description |
---|---|
BaseConsoleWrapper | A console wrapper |
Exceptions
Type | Condition |
---|---|
TerminauxException |
IsBuiltin(string)
Checks whether the wrapper is built-in
Declaration
public static bool IsBuiltin(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Returns
Type | Description |
---|---|
bool | True if built-in; false otherwise. |
IsRegistered(string)
Checks whether the wrapper is registered
Declaration
public static bool IsRegistered(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Returns
Type | Description |
---|---|
bool | True if registered; false otherwise. |
RegisterWrapper<T>(string, T)
Registers the console wrapper by type
Declaration
public static void RegisterWrapper<T>(string wrapperName, T wrapper) where T : BaseConsoleWrapper
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
T | wrapper | Console wrapper |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
TerminauxException |
SetWrapper(string)
Sets the current console wrapper
Declaration
public static void SetWrapper(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Exceptions
Type | Condition |
---|---|
TerminauxException |
SetWrapperLocal(string)
Sets the local console wrapper and enters the local scope
Declaration
public static void SetWrapperLocal(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Exceptions
Type | Condition |
---|---|
TerminauxException |
UnregisterWrapper(string)
Unregisters the console wrapper by type
Declaration
public static void UnregisterWrapper(string wrapperName)
Parameters
Type | Name | Description |
---|---|---|
string | wrapperName | Name of the console wrapper |
Exceptions
Type | Condition |
---|---|
TerminauxException |
UnsetWrapperLocal()
Unsets the local console wrapper and exits the local scope
Declaration
public static void UnsetWrapperLocal()
Exceptions
Type | Condition |
---|---|
TerminauxException |