Skip to content
ConsoleMonster

API Reference

Class

WindowsConsoleInput

Namespace ConsoleMonster.Input
Assembly ConsoleMonster
Implements
IInputSource IDisposable
Modifiers sealed

Reads the Windows console input buffer with ReadConsoleInputW: every key with its modifiers (Ctrl and Alt combinations, Shift+Tab, function keys), Alt+numpad characters, AltGr characters, pastes (a burst of characters in one read), window resizes and focus changes. While it is open, line input, echo and Ctrl+C processing are off, so Ctrl+C arrives as a key; the original console mode is restored on disposal.

Inheritance

  • Object
  • WindowsConsoleInput

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Methods

public Void Dispose() #
Returns: Void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public InputEvent? Read(TimeSpan timeout, CancellationToken cancellationToken) #
Returns: InputEvent?

Waits up to timeout for the next event.

Parameters

timeout System.TimeSpan requiredposition: 0
The longest wait; TimeSpan.Zero polls.
cancellationToken System.Threading.CancellationToken requiredposition: 1
Cancels the wait with OperationCanceledException.

Returns

The event, or null when the timeout passed without input.

Exceptions

public Void Resume() #
Returns: Void

Switches back to raw key input after WindowsConsoleInput.Suspend, discarding keys typed meanwhile.

public Void Suspend() #
Returns: Void

Gives the console back its normal input mode for a while (a live dashboard run, where Ctrl+C must reach the session as a signal); WindowsConsoleInput.Resume switches back and drops keys typed meanwhile.

public static WindowsConsoleInput? TryOpen() #
Returns: WindowsConsoleInput?

Opens the console input when standard input is a console; returns null otherwise (redirected, no console).

Returns

The source, or null.

Properties

public String Name { get; } #

A short description for diagnostics, for example windows console (ReadConsoleInputW).