public KeyMapping ReadMapping() { KeyMapping xResult = null; while (mBuffer.Count == 0 || !GetKeyMapping(mBuffer.Dequeue(), out xResult)) { //Global.Sleep(10); //ToDo optimize value Core.Global.CPU.Halt(); } return(xResult); }
public bool GetCharValue(uint aScanCode, out char aValue) { for (var index = 0; index < mKeys.Count; index++) { KeyMapping t = mKeys[index]; if (t.Scancode == aScanCode) { var map = t; var key = '\0'; if (ShiftPressed && CapsLock) { key = map.ShiftCaps; } else if (ShiftPressed) { key = map.Shift; } else if (ControlPressed) { key = map.Ctrl; } else if (AltPressed) { key = map.Alt; } else if (ShiftPressed && NumLock) { key = map.ShiftNum; } else if (CapsLock) { key = map.Caps; } else if (NumLock) { key = map.Num; } else { key = map.Value; } aValue = key; return(true); } } aValue = '\0'; return(false); }
public bool GetMapping(out KeyMapping c) { c = null; if (mBuffer.Count > 0) { GetKeyMapping(mBuffer.Dequeue(), out c); return(true); } else { return(false); } }
public bool GetKeyMapping(uint aScanCode, out KeyMapping aValue) { for (int i = 0; i < mKeys.Count; i++) { if (mKeys[i].Scancode == aScanCode) { aValue = mKeys[i]; return(true); } } aValue = null; return(false); }
public bool GetKeyMapping(uint aScanCode, out KeyMapping aValue) { for (var index = 0; index < mKeys.Count; index++) { var t = mKeys[index]; if (t.Scancode == aScanCode) { aValue = t; return(true); } } aValue = null; return(false); }
public bool GetKeyMapping(uint aScanCode, out KeyMapping aValue) { for (var index = 0; index < mKeys.Count; index++) { var t = mKeys[index]; if (t.Scancode == aScanCode) { aValue = t; return true; } } aValue = null; return false; }
public KeyEvent ConvertScanCode(byte scan2, bool ctrl, bool shift, bool alt, bool num, bool caps, bool scroll) { KeyEvent keyev = new KeyEvent(); bool found = false; if (scan2 == 0) { found = true; return(keyev); } byte scan = scan2; if (alt) { keyev.Modifiers |= ConsoleModifiers.Alt; } if (ctrl) { keyev.Modifiers |= ConsoleModifiers.Control; } if (shift) { keyev.Modifiers |= ConsoleModifiers.Shift; } keyev.Type = (scan & 0x80) != 0 ? KeyEvent.KeyEventType.Break : KeyEvent.KeyEventType.Make; if ((scan & 0x80) != 0) { scan = (byte)(scan ^ 0x80); } Debugger.DoSend("Number of keys: "); Debugger.DoSendNumber((uint)_keys.Count); for (int index = 0; index < _keys.Count; index++) { KeyMapping t = _keys[index]; if (t == null) { Debugger.DoSend("Key received but item is NULL"); continue; } else if (t.Scancode == scan) { found = true; KeyMapping map = t; char key = '\0'; if (ctrl) { if (alt) { key = shift ^ caps ? map.ControlAltShift : map.ControlAlt; } else { key = shift ^ caps ? map.ControlShift : map.Control; } } else if (shift) { key = caps ? map.ShiftCaps : num ? map.ShiftNum : map.Shift; } else if (caps) { key = map.Caps; } else if (num) { key = map.Num; } else { key = map.Value; } keyev.KeyChar = key; keyev.Key = num ? t.NumLockKey : t.Key; break; } } return(found ? keyev : null); }