private static IntPtr RegisterHook(LowLevelKeyboardProc proc, HookId hookType) { using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { return(SetWindowsHookEx((int)hookType, proc, GetModuleHandle(curModule.ModuleName), 0)); } }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Org != null && HookId != null && Hook != null) { var orgValue = Org.GetValue(dc.State); var hookIdValue = HookId.GetValue(dc.State); var hookValue = Hook.GetValue(dc.State); return(await gitHubClient.Organization.Hook.Edit(orgValue, (Int32)hookIdValue, hookValue).ConfigureAwait(false)); } throw new ArgumentNullException("Required [org,hookId,hook] arguments missing for GitHubClient.Organization.Hook.Edit"); }
private bool isIdHookVaild(int idHook) { HookId hi = new HookId(); foreach (PropertyInfo prop in propertyInfos) { if (idHook == (int)prop.GetValue(hi, null)) { return(true); } } return(false); }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Owner != null && Name != null && HookId != null) { var ownerValue = Owner.GetValue(dc.State); var nameValue = Name.GetValue(dc.State); var hookIdValue = HookId.GetValue(dc.State); return(gitHubClient.Repository.Hooks.Test(ownerValue, nameValue, (Int32)hookIdValue)); } if (RepositoryId != null && HookId != null) { var repositoryIdValue = RepositoryId.GetValue(dc.State); var hookIdValue = HookId.GetValue(dc.State); return(gitHubClient.Repository.Hooks.Test((Int64)repositoryIdValue, (Int32)hookIdValue)); } throw new ArgumentNullException("Required [hookId] arguments missing for GitHubClient.Repository.Hooks.Test"); }
public static extern IntPtr SetWindowsHookEx(HookId idHook, GetMsgProc lpfn, IntPtr hmod, int dwThreadId);
public static extern IntPtr SetWindowsHookEx(HookId idHook, Hook lpfn, IntPtr hMod, int dwThreadId);
public BaseListener(HookId hookId) { this.hookId = hookId; }
static extern int UnInstallHook(IntPtr hWnd, ref HookId id);
internal HookBase(HookId hookId) => HookId = hookId;
private static extern IntPtr SetWindowsHookEx(HookId hookId, HProc hookProc, IntPtr hInstance, Int32 threadId);