18 instantiations of ConsoleKeyInfo
Microsoft.DotNet.HotReload.Watch (10)
UI\ConsoleInputReader.cs (1)
16
return new
ConsoleKeyInfo
('\u001b', ConsoleKey.Escape, shift: false, alt: false, control: false);
UI\PhysicalConsole.cs (9)
90
CtrlC => new
ConsoleKeyInfo
('C', ConsoleKey.C, shift: false, alt: false, control: true),
91
CtrlR => new
ConsoleKeyInfo
('R', ConsoleKey.R, shift: false, alt: false, control: true),
92
'\r' or '\n' => new
ConsoleKeyInfo
('\r', ConsoleKey.Enter, shift: false, alt: false, control: false),
93
>= 'a' and <= 'z' => new
ConsoleKeyInfo
(c, ConsoleKey.A + (c - 'a'), shift: false, alt: false, control: false),
94
>= 'A' and <= 'Z' => new
ConsoleKeyInfo
(c, ConsoleKey.A + (c - 'A'), shift: true, alt: false, control: false),
95
>= '0' and <= '9' => new
ConsoleKeyInfo
(c, ConsoleKey.NumPad0 + (c - '0'), shift: false, alt: false, control: false),
96
'.' => new
ConsoleKeyInfo
('.', ConsoleKey.OemPeriod, shift: false, alt: false, control: false),
97
'-' => new
ConsoleKeyInfo
('-', ConsoleKey.OemMinus, shift: false, alt: false, control: false),
113
KeyPressed?.Invoke(new
ConsoleKeyInfo
(CtrlC, ConsoleKey.C, shift: false, alt: false, control: true));
System.Console (8)
System\IO\KeyParser.cs (5)
27
return new
ConsoleKeyInfo
(buffer[startIndex++], ConsoleKey.Backspace, false, false, false);
36
return new
ConsoleKeyInfo
(parsed.KeyChar, parsed.Key, (parsed.Modifiers & ConsoleModifiers.Shift) != 0, alt: true, (parsed.Modifiers & ConsoleModifiers.Control) != 0);
109
parsed = new
ConsoleKeyInfo
(default, ConsoleKey.F1 + input[3] - 'A', false, false, false);
310
=>
new
(keyChar, key, (modifiers & ConsoleModifiers.Shift) != 0, (modifiers & ConsoleModifiers.Alt) != 0, (modifiers & ConsoleModifiers.Control) != 0);
353
return new
ConsoleKeyInfo
(keyChar, key, isShift, isAlt, isCtrl);
System\IO\StdInReader.cs (1)
359
return new
ConsoleKeyInfo
((char)
System\TerminalFormatStrings.cs (2)
233
KeyFormatToConsoleKey[keyFormat] = new
ConsoleKeyInfo
(key == ConsoleKey.Enter ? '\r' : '\0', key, shift, alt, control);
252
KeyFormatToConsoleKey[keyFormat] = new
ConsoleKeyInfo
('\0', key, shift, alt, control);
52 references to ConsoleKeyInfo
dotnet (2)
InteractiveConsole.cs (2)
38
var
key = Console.ReadKey();
59
static bool KeyMatches(
ConsoleKeyInfo
pressedKey, string valueKey)
dotnet-svcutil-lib (2)
CmdCredentialsProvider.cs (2)
255
ConsoleKeyInfo
keyInfo;
275
ConsoleKeyInfo
keyInfo;
dotnet-watch (5)
UI\SpectreBuildParametersSelectionPrompt.cs (5)
115
private readonly Channel<
ConsoleKeyInfo
> _channel = Channel.CreateUnbounded<
ConsoleKeyInfo
>();
124
private void OnKeyPressed(
ConsoleKeyInfo
key)
130
public
ConsoleKeyInfo
? ReadKey(bool intercept)
133
public async Task<
ConsoleKeyInfo
?> ReadKeyAsync(bool intercept, CancellationToken cancellationToken)
Microsoft.DotNet.HotReload.Watch (11)
UI\ConsoleInputReader.cs (5)
12
public async Task<
ConsoleKeyInfo
> GetKeyAsync(string prompt, Func<
ConsoleKeyInfo
, bool> validateInput, CancellationToken cancellationToken)
24
var tcs = new TaskCompletionSource<
ConsoleKeyInfo
>(TaskCreationOptions.RunContinuationsAsynchronously);
49
void KeyPressed(
ConsoleKeyInfo
key)
64
static string GetDisplayString(
ConsoleKeyInfo
key)
UI\IConsole.cs (1)
8
event Action<
ConsoleKeyInfo
> KeyPressed;
UI\PhysicalConsole.cs (3)
14
public event Action<
ConsoleKeyInfo
>? KeyPressed;
88
var
key = c switch
120
var
key = Console.ReadKey(intercept: true);
UI\RestartPrompt.cs (2)
20
var
keyInfo = await inputReader.GetKeyAsync(
45
static bool AcceptKey(
ConsoleKeyInfo
info)
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
132
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
ConsoleKeyInfo
))]
netstandard (1)
netstandard.cs (1)
436
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
ConsoleKeyInfo
))]
System.Console (30)
System\Console.cs (2)
174
public static
ConsoleKeyInfo
ReadKey()
183
public static
ConsoleKeyInfo
ReadKey(bool intercept)
System\ConsoleKeyInfo.cs (7)
8
public readonly struct ConsoleKeyInfo : IEquatable<
ConsoleKeyInfo
>
53
return value is
ConsoleKeyInfo
info && Equals(info);
56
public bool Equals(
ConsoleKeyInfo
obj)
61
public static bool operator ==(
ConsoleKeyInfo
a,
ConsoleKeyInfo
b)
66
public static bool operator !=(
ConsoleKeyInfo
a,
ConsoleKeyInfo
b)
System\ConsolePal.Unix.cs (2)
130
public static
ConsoleKeyInfo
ReadKey(bool intercept)
139
ConsoleKeyInfo
keyInfo = StdInReader.ReadKey(intercept);
System\IO\KeyParser.cs (7)
18
internal static
ConsoleKeyInfo
Parse(char[] buffer, TerminalFormatStrings terminalFormatStrings, byte posixDisableValue, byte veraseCharacter, ref int startIndex, int endIndex)
34
if (TryParseTerminalInputSequence(buffer, terminalFormatStrings, out
ConsoleKeyInfo
parsed, ref startIndex, endIndex))
40
else if (length >= MinimalSequenceLength && TryParseTerminalInputSequence(buffer, terminalFormatStrings, out
ConsoleKeyInfo
parsed, ref startIndex, endIndex))
54
private static bool TryParseTerminalInputSequence(char[] buffer, TerminalFormatStrings terminalFormatStrings, out
ConsoleKeyInfo
parsed, ref int startIndex, int endIndex)
65
Dictionary<string,
ConsoleKeyInfo
>.AlternateLookup<ReadOnlySpan<char>> terminfoDb = // the most important source of truth
309
static
ConsoleKeyInfo
Create(char keyChar, ConsoleKey key, ConsoleModifiers modifiers)
313
private static
ConsoleKeyInfo
ParseFromSingleChar(char single, bool isAlt)
System\IO\StdInReader.cs (9)
23
private readonly Stack<
ConsoleKeyInfo
> _tmpKeys = new Stack<
ConsoleKeyInfo
>(); // temporary working stack; should be empty outside of ReadLine
24
private readonly Stack<
ConsoleKeyInfo
> _availableKeys = new Stack<
ConsoleKeyInfo
>(); // a queue of already processed key infos available for reading
167
ConsoleKeyInfo
keyInfo = freshKeys ? ReadKey() : _availableKeys.Pop();
293
ConsoleKeyInfo
keyInfo = peek ? _availableKeys.Peek() : _availableKeys.Pop();
321
public
ConsoleKeyInfo
ReadKey(bool intercept)
328
ConsoleKeyInfo
keyInfo = ReadKey();
338
private unsafe
ConsoleKeyInfo
ReadKey()
System\IO\SyncTextReader.Unix.cs (1)
23
public
ConsoleKeyInfo
ReadKey(bool intercept)
System\TerminalFormatStrings.cs (2)
54
public readonly Dictionary<string,
ConsoleKeyInfo
> KeyFormatToConsoleKey = new(StringComparer.Ordinal);
166
foreach (KeyValuePair<string,
ConsoleKeyInfo
> entry in KeyFormatToConsoleKey)