Skip to content

Commit

Permalink
Add tests for SimpleGlobalHook
Browse files Browse the repository at this point in the history
  • Loading branch information
TolikPylypchuk committed Aug 4, 2023
1 parent b8a9b42 commit d4931b9
Show file tree
Hide file tree
Showing 7 changed files with 725 additions and 19 deletions.
14 changes: 8 additions & 6 deletions SharpHook.Reactive/SimpleReactiveGlobalHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,25 @@ public void Run()
this.ThrowIfRunning();
this.ThrowIfDisposed();

UioHookResult result;

try
{
this.globalHookProvider.SetDispatchProc(this.dispatchProc, IntPtr.Zero);

this.IsRunning = true;
var result = this.globalHookProvider.Run();
result = this.globalHookProvider.Run();
this.IsRunning = false;

if (result != UioHookResult.Success)
{
throw new HookException(result, this.FormatFailureMessage(Starting, result));
}
} catch (Exception e)
{
this.IsRunning = false;
throw new HookException(UioHookResult.Failure, e);
}

if (result != UioHookResult.Success)
{
throw new HookException(result, this.FormatFailureMessage(Starting, result));
}
}

/// <summary>
Expand Down
Loading

0 comments on commit d4931b9

Please sign in to comment.