public WM_MouseHook(IntPtr hWnd) : base(hWnd, HookType.WH_MOUSE) { HookInvoked += new HookEventHandler(MouseHookInvoked); //LowLevelMouseHook = new WindowsHook( hWnd, HookType.WH_MOUSE_LL, new HookDelegate(this.CoreHookProc)); }
protected void RaiseHookInvoked(HookEventArgs e) { HookEventHandler temp = HookInvoked; if (temp != null) { temp(this, e); } }
public KeyBoardHook(HookEventHandler hookEventHandler) { this.hookEventHandler = hookEventHandler; if (hHook == 0) { KeyBoardHookProcedure = new HookProc(KeyBoardHookProc); hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyBoardHookProcedure, GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName), 0); //如果设置钩子失败. if (hHook == 0) { Hook_Clear(); } } }
private int mdNumConfigs = 5; // Does not include all gestures since it is mutually exclusive public WM_GestureHook(IntPtr hWnd) : base(hWnd, HookType.WH_GETMESSAGE) { HookInvoked += new HookEventHandler(GestureHookInvoked); mdGestureConfigSize = Marshal.SizeOf(new Win32.GESTURECONFIG()); mdGestureInfoSize = Marshal.SizeOf(new Win32.GESTUREINFO()); // Configure to accept all gestures initially. mAllGestures.config.dwID = 0; mAllGestures.config.dwWant = Win32.GC_ALLGESTURES; mAllGestures.config.dwBlock = 0; mZoom.config.dwID = Win32.GID_ZOOM; mPan.config.dwID = Win32.GID_PAN; mRotate.config.dwID = Win32.GID_ROTATE; mTwoFingerTap.config.dwID = Win32.GID_TWOFINGERTAP; mPressAndTap.config.dwID = Win32.GID_PRESSANDTAP; ClearGestureConfigs(); }
public override async Task <HttpHandlerResult> PostAsync(CancellationToken token) { var eventType = HttpContext.Request.Headers["X-GitHub-Event"]; //var deliveryId = HttpContext.Request.Headers["X-GitHub-Delivery"]; //var signature = HttpContext.Request.Headers["X-Hub-Signature"]; if (string.IsNullOrEmpty(eventType)) { return(Response.BadRequest().SetText("GitHub Webhook Event-Type is undefined!")); } var json = await Request.TextAsync(); var commit = HookEventHandler.ParseEvent(eventType, json); if (commit != null) { StartBuild(commit); } return(Response.Ok()); }
public override async Task <HttpHandlerResult> PostAsync(CancellationToken token) { var eventType = HttpContext.Request.Headers["X-GitHub-Event"]; //var deliveryId = HttpContext.Request.Headers["X-GitHub-Delivery"]; //var signature = HttpContext.Request.Headers["X-Hub-Signature"]; if (string.IsNullOrEmpty(eventType)) { return(Response.BadRequest().SetText("GitHub Webhook Event-Type is undefined!")); } var json = await Request.TextAsync(); GithubCommit commit; try { commit = HookEventHandler.ParseEvent(eventType, json); } catch (Exception error) { var subtext = json; if (subtext.Length > 96) { subtext = subtext.Substring(0, 96) + $"...+{subtext.Length-96})"; } Log.Error($"Failed to parse GitHub webhook event! [{subtext}]", error); throw; } if (commit != null) { await StartBuild(commit); } return(Response.Ok()); }
public MultiHookReader(IEnumerable<IHooker> hookerEnum) { mHookerEnum = hookerEnum; hookEventHandler = RecordSequence; ReadSequence = new List<IInput>(); }