public KeyStroke[] BuildForwardKeyStrokes(KeyStroke[] receiveKeyStrokes) { var forwardIndex = Information & 0xFFFF; var forwardLength = Information >> 16; var keyStrokes = new KeyStroke[forwardLength]; for (int i = 0; i < forwardLength; i++) { var receiveKeyStroke = receiveKeyStrokes[forwardIndex + i]; keyStrokes[i] = receiveKeyStroke.Code >= CharacterClassesStartCode ? new KeyStroke { Code = (ushort)receiveKeyStroke.Information, State = receiveKeyStroke.State } : receiveKeyStroke; } return(keyStrokes); }
public bool Match(KeyStroke keyStroke) { if (State != keyStroke.State) { return(false); } if (Code == keyStroke.Code) { return(true); } if (Code == AnyClassCode) { Information = keyStroke.Code; return(true); } if (Code == DigitClassCode && (0x02 <= keyStroke.Code && keyStroke.Code <= 0x0B)) { Information = keyStroke.Code; return(true); } if (Code == LetterClassCode && ((0x10 <= keyStroke.Code && keyStroke.Code <= 0x19) || (0x1E <= keyStroke.Code && keyStroke.Code <= 0x26) || (0x2C <= keyStroke.Code && keyStroke.Code <= 0x32))) { Information = keyStroke.Code; return(true); } return(false); }