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