15 instantiations of ConsoleKeyInfo
dotnet-watch (5)
UI\PhysicalConsole.cs (5)
69CtrlC => new ConsoleKeyInfo('C', ConsoleKey.C, shift: false, alt: false, control: true), 70CtrlR => new ConsoleKeyInfo('R', ConsoleKey.R, shift: false, alt: false, control: true), 71>= 'a' and <= 'z' => new ConsoleKeyInfo(c, ConsoleKey.A + (c - 'a'), shift: false, alt: false, control: false), 72>= 'A' and <= 'Z' => new ConsoleKeyInfo(c, ConsoleKey.A + (c - 'A'), shift: true, alt: false, control: false), 88KeyPressed?.Invoke(new ConsoleKeyInfo(CtrlC, ConsoleKey.C, shift: false, alt: false, control: true));
dotnet-watch.Tests (2)
CommandLine\ProgramTests.cs (1)
38console.PressKey(new ConsoleKeyInfo('C', ConsoleKey.C, shift: false, alt: false, control: true));
HotReload\RuntimeProcessLauncherTests.cs (1)
484w.Console.PressKey(new ConsoleKeyInfo('R', ConsoleKey.R, 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);
48 references to ConsoleKeyInfo
dotnet (2)
InteractiveConsole.cs (2)
40var key = Console.ReadKey(); 61static bool KeyMatches(ConsoleKeyInfo pressedKey, string valueKey)
dotnet-svcutil-lib (2)
CmdCredentialsProvider.cs (2)
255ConsoleKeyInfo keyInfo; 275ConsoleKeyInfo keyInfo;
dotnet-watch (8)
UI\ConsoleInputReader.cs (3)
10public async Task<ConsoleKey> GetKeyAsync(string prompt, Func<ConsoleKeyInfo, bool> validateInput, CancellationToken cancellationToken) 47void KeyPressed(ConsoleKeyInfo key) 62static string GetDisplayString(ConsoleKeyInfo key)
UI\IConsole.cs (1)
12event Action<ConsoleKeyInfo> KeyPressed;
UI\PhysicalConsole.cs (3)
17public event Action<ConsoleKeyInfo>? KeyPressed; 67var key = c switch 95var key = Console.ReadKey(intercept: true);
UI\RestartPrompt.cs (1)
45static bool AcceptKey(ConsoleKeyInfo info)
dotnet-watch.Tests (3)
ConsoleReporterTests.cs (1)
53event Action<ConsoleKeyInfo> IConsole.KeyPressed
TestUtilities\TestConsole.cs (2)
10public event Action<ConsoleKeyInfo>? KeyPressed; 31public void PressKey(ConsoleKeyInfo key)
mscorlib (1)
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))]
QueueSharing (1)
Program.cs (1)
21var key = Console.ReadKey();
System.Console (30)
System\Console.cs (2)
173public static ConsoleKeyInfo ReadKey() 182public 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)
122public static ConsoleKeyInfo ReadKey(bool intercept) 131ConsoleKeyInfo 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)