forked from gmamaladze/globalmousekeyhook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90ab329
commit 6bdd2d1
Showing
36 changed files
with
327 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
using System; | ||
// This code is distributed under MIT license. | ||
// Copyright (c) 2010-2018 George Mamaladze | ||
// See license.txt or http://opensource.org/licenses/mit-license.php | ||
|
||
using System; | ||
using System.Reactive.Linq; | ||
using System.Threading; | ||
using System.Windows.Forms; | ||
using Gma.System.MouseKeyHook; | ||
using MouseKeyHook.Rx; | ||
using System.Collections.Generic; | ||
|
||
namespace ConsoleHook.Rx | ||
{ | ||
internal class DetectSequences | ||
{ | ||
public static void Do(AutoResetEvent quit) | ||
{ | ||
var map = new [] | ||
var expected = new HashSet<KeySequence> | ||
{ | ||
new Sequence<Keys>(Keys.Control, Keys.Q), | ||
new Sequence<Keys>(Keys.Alt, Keys.Shift), | ||
new KeySequence(Keys.Control, Keys.Q), | ||
new KeySequence(Keys.Alt, Keys.Shift) | ||
}; | ||
|
||
Hook | ||
.GlobalEvents() | ||
.KeyDownObservable() | ||
.Sequences(2,3) | ||
//.Matching(map) | ||
//.Matching(expected) | ||
.ForEachAsync(sequence => | ||
{ | ||
//if (sequence.Id == "Control+Q") quit.Set(); | ||
if (sequence.ToString() == "Control+Q") quit.Set(); | ||
Console.WriteLine(sequence); | ||
}); | ||
|
||
Console.WriteLine("Press Control+Q to quit."); | ||
Console.WriteLine("Monitoring folowing sequences:"); | ||
foreach (var name in map) | ||
{ | ||
foreach (var name in expected) | ||
Console.WriteLine("\t" + name); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
// This code is distributed under MIT license. | ||
// Copyright (c) 2010-2018 George Mamaladze | ||
// See license.txt or http://opensource.org/licenses/mit-license.php | ||
|
||
using System.Linq; | ||
using System.Windows.Forms; | ||
|
||
namespace MouseKeyHook.Rx | ||
{ | ||
public class KeySequence : Sequence<Keys> | ||
{ | ||
public KeySequence(params Keys[] keys) | ||
: base(keys.Select(k=>KeysExtensions.Normalize(k)).ToArray()) | ||
public KeySequence(params Keys[] keys) | ||
: base(keys.Select(k => k.Normalize()).ToArray()) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.