-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
45 lines (38 loc) · 1.19 KB
/
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
36
37
38
39
40
41
42
43
44
45
using MacroBot.Hooks;
using NTDLS.Persistence;
namespace MacroBot
{
internal static class Program
{
public static Settings Settings { get; set; } = new();
[STAThread]
static void Main()
{
var mutex = new Mutex(true, "MacroBot", out bool createdNew);
try
{
if (createdNew == false)
{
MessageBox.Show("Another instance of MacroBot is already running... check the system tray?",
"MacroBot", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ApplicationConfiguration.Initialize();
try
{
Settings = LocalUserApplicationData.LoadFromDisk("MacroBot", new Settings());
KeyboardHook.Install();
Application.Run(new FormMain());
}
finally
{
KeyboardHook.Remove();
}
}
finally
{
mutex.ReleaseMutex();
}
}
}
}