PromptPlus API:IInputDrive
IInputDrive
Namespace: PPlus
Represents the interface for input console.
public interface IInputDrive
Properties
In
Get standard input stream.
public abstract TextReader In { get; }
Property Value
InputEncoding
Get/set an encoding for standard input stream.
public abstract Encoding InputEncoding { get; set; }
Property Value
IsInputRedirected
Gets a value that indicates whether input has been redirected from the standard input stream.
public abstract bool IsInputRedirected { get; }
Property Value
KeyAvailable
Gets a value indicating whether a key press is available in the input stream.
public abstract bool KeyAvailable { get; }
Property Value
Methods
ReadKey(Boolean)
Obtains the next character or function key pressed by the user.
ConsoleKeyInfo ReadKey(bool intercept)
Parameters
intercept
Boolean
Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false.
Returns
An oject that describes the System.ConsoleKey constant and Unicode character,
if any, that correspond to the pressed console key. The System.ConsoleKeyInfo
t also describes, in a bitwise combination of System.ConsoleModifiers values,
er one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously
with the console key.
ReadLine()
Read the line from stream. A line is defined as a sequence of characters followed by
a car return (‘\r’), a line feed (‘\n’), or a carriage return
immedy followed by a line feed. The resulting string does not
contain the terminating carriage return and/or line feed.
string ReadLine()
Returns
The returned value is null if the end of the input stream has been reached.
SetIn(TextReader)
set standard input stream.
void SetIn(TextReader value)
Parameters
value
TextReader
A stream that is the new standard input.
WaitKeypress(Boolean, Nullable<CancellationToken>)
Wait Keypress from standard input stream
Nullable<ConsoleKeyInfo> WaitKeypress(bool intercept, Nullable<CancellationToken> cancellationToken)
Parameters
intercept
Boolean
Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false.
cancellationToken
Nullable<CancellationToken>
The token to monitor for cancellation requests.
Returns
An oject that describes the System.ConsoleKey constant and Unicode character,
if any, that correspond to the pressed console key. The System.ConsoleKeyInfo
t also describes, in a bitwise combination of System.ConsoleModifiers values,
er one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously
with the console key.