-
Notifications
You must be signed in to change notification settings - Fork 6
/
Program.cs
47 lines (46 loc) · 1.76 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
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace GrayStorm
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
//Still using tricks to ensure two GUI threads don't cause application hang even though this is also handled in the injector, GrayFrost.
if (!System.AppDomain.CurrentDomain.FriendlyName.Contains("GrayStorm"))
{
string name = System.Reflection.Assembly.GetCallingAssembly().FullName;
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(
delegate
{
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(
delegate
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new grayStorm());
}));
t.Priority = System.Threading.ThreadPriority.Lowest;
t.SetApartmentState(System.Threading.ApartmentState.STA);
t.Start();
t.IsBackground = true;
System.Threading.Thread.Sleep(100);
}), null);
System.Threading.Thread.Sleep(100);
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new grayStorm());
}
}
}
}