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