public static bool Parse(HidInputEventArgs hidInput, out List <ushort> pressedButtons) { var preparsedData = IntPtr.Zero; pressedButtons = new List <ushort>(); try { preparsedData = GetPreparsedData(hidInput.Device); if (preparsedData == IntPtr.Zero) { return(false); } HIDP_CAPS hidCaps; CheckError(HidP_GetCaps(preparsedData, out hidCaps)); pressedButtons = GetPressedButtons(hidCaps, preparsedData, hidInput.RawData); } catch (Win32Exception e) { return(false); } finally { if (preparsedData != IntPtr.Zero) { Marshal.FreeHGlobal(preparsedData); } } return(true); }
private void HandleRawInput(object sender, RawInputEventArgs e) { HidInputEventArgs hidArgs = e as HidInputEventArgs; if (hidArgs == null || HidInputEvent == null) { return; } HidInputEvent(sender, new HidEventArgs(hidArgs)); }
public HidEventArgs(HidInputEventArgs e) { Count = e.Count; DataSize = e.DataSize; RawData = e.RawData; }