UtilConsole Class

Contains Command-line Interface related utilities.

Definition

Namespace: DevCase.Core.Application.Console
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public sealed class UtilConsole
Inheritance
Object    UtilConsole

Properties

CursorPosition Gets the position of the cursor in the active console instance.

Use SetCursorPosition(Int32, Int32) to set the cursor position.

DisplayMode Gets the window handle of the console associated with the calling process.
Handle Gets the window handle of the console associated with the calling process.
SafeHandle Gets the safe window handle of the console associated with the calling process.
Transparency Gets or sets the transparency level of the console window.

A value of 0 means totally transparent. A value of 255 means totally opaque.

Methods

ClearCurrentLine Clears the current console line.
ConsoleChoice(String, Char) Allows to prompt the user to select one item from a set of single-character choices.
ConsoleChoice(String, ConsoleKey) Allows to prompt the user to select one item from a set of single-character choices.
ConsoleTextBlink(Point, Int32, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

The string must be smaller than the current console width buffer, or the blink effect will get buggy.

ConsoleTextBlink(Point, Int32, TimeSpan) Blinks the specified text for the specified amount of times on the current attached console window.

The string must be smaller than the current console width buffer, or the blink effect will get buggy.

ConsoleTextBlink(Point, Int32, Int32, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

The string must be smaller than the current console width buffer, or the blink effect will get buggy.

ConsoleTextBlink(Point, Int32, TimeSpan, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

The string must be smaller than the current console width buffer, or the blink effect will get buggy.

ConsoleTextBlinkMultiline(Point, String, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

You should call this function instead of ConsoleTextBlink(Point, Int32, Int32) when the string to blink exceeds the BufferWidth buffer width.

ConsoleTextBlinkMultiline(Point, String, TimeSpan) Blinks the specified text for the specified amount of times on the current attached console window.

You should call this function instead of ConsoleTextBlink(Point, Int32, Int32) when the string to blink exceeds the BufferWidth buffer width.

ConsoleTextBlinkMultiline(Point, String, Int32, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

You should call this function instead of ConsoleTextBlink(Point, Int32, Int32) when the string to blink exceeds the BufferWidth buffer width.

ConsoleTextBlinkMultiline(Point, String, TimeSpan, Int32) Blinks the specified text for the specified amount of times on the current attached console window.

You should call this function instead of ConsoleTextBlink(Point, Int32, Int32) when the string to blink exceeds the BufferWidth buffer width.

Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetType Gets the Type of the current instance.
(Inherited from Object)
HideConsole Hides the console window associated with the calling process.
Pause Pause the console execution indefinitely until any key is pressed.
Pause(ConsoleKey) Pause the console execution indefinitely until the specified key is pressed.
ReadLine(Int32) Reads the next line of characters from the standard input stream.

This function attempts to be a improved replacement for ReadLine function.

ReadLine(Encoding, Int32) Reads the next line of characters from the standard input stream.

This function attempts to be a improved replacement for ReadLine function.

RegisterConsoleKeyPressEventHandler Emulates a KeyPress event-handler for the specified ConsoleKey within the current console instance.

To unregister a registered KeyPress event-handler, call UnregisterConsoleKeyPressEventHandler(ConsoleKey) method.

SetColors Sets the background and foreground colors for the entire console window.
SetConsolefont Sets the text font for the console attached to the current process.
SetEncodings Sets the text encodings used to read console input and write console output.
SetInputBufferSize Sets the buffer size of the standard input stream (std-in) acquired from the OpenStandardInput function.

So the ReadLine function can benefit from a larger buffer size.

Default buffer size is: 256

ShowConsole Shows the console window associated with the calling process.
SpinCursor Animates the console cursor producing a spin effect.
SpinCursorTask Asynchronously animates the console cursor producing a spin effect.
ToString Returns a string that represents the current object.
(Inherited from Object)
UnregisterConsoleKeyPressEventHandler Unregisters a KeyPress event-handler that was previously registered with a call to RegisterConsoleKeyPressEventHandler(ConsoleKey, Action) method.
Write(Char, Boolean) Writes the specified array of Unicode characters to the standard output stream, wih the ability to keep the current cursor position on the console.
Write(String, Boolean) Writes the specified string value to the standard output stream, wih the ability to keep the current cursor position on the console.
Write(Char, Int32, Int32, Boolean) Writes the specified array of Unicode characters to the standard output stream, wih the ability to keep the current cursor position on the console.
WriteColorText(String, Char, Boolean) Writes colored text on the Console.

Use *F##* as the start delimiter of the ForeColor, use *-F* as the end delimiter of the ForeColor.

Use *B##* as the start delimiter of the BackColor, use *-B* as the end delimiter of the BackColor.

WriteColorText(String, ConsoleColor, ConsoleColor, Boolean) Writes colored text on the Console.
WriteColorTextLine(String, Char) Writes colored text on the Console and adds an empty line at the end.

Use *F##* as the start delimiter of the ForeColor, use *-F* as the end delimiter of the ForeColor.

Use *B##* as the start delimiter of the BackColor, use *-B* as the end delimiter of the BackColor.

WriteColorTextLine(String, ConsoleColor, ConsoleColor) Writes colored text on the Console and adds an empty line at the end.

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)

See Also