-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (34 loc) · 1015 Bytes
/
Program.cs
File metadata and controls
41 lines (34 loc) · 1015 Bytes
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
using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace CDL_Crosshair_Installer
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
MainForm form = new MainForm();
if (!form.IsDisposed)
Application.Run(form);
}
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs e)
{
if (e.Name.Contains("resources"))
return e.RequestingAssembly;
using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream($"CDL_Crosshair_Installer.Libraries.{e.Name.Split(',')[0]}.dll"))
{
byte[] buffer = new byte[s.Length];
s.Read(buffer, 0, buffer.Length);
return Assembly.Load(buffer);
}
}
}
}