-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
69 lines (59 loc) · 2.45 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Resources;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace EDVRHUD
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
var path = Environment.CurrentDirectory + "\\openvr_api.dll";
if (!File.Exists(path))
File.WriteAllBytes(path, Properties.Resources.openvr_api);
path = Environment.CurrentDirectory + "\\LICENSES.txt";
if (!File.Exists(path))
File.WriteAllText(path, Properties.Resources.LICENSES);
path = Environment.CurrentDirectory + "\\Settings.json";
if (!File.Exists(path))
File.WriteAllBytes(path, Properties.Resources.Settings);
path = Environment.CurrentDirectory + "\\Panels.json";
if (!File.Exists(path))
File.WriteAllBytes(path, Properties.Resources.Panels);
using (var code = new NotificationApp())
{
code.Run();
}
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var assemblyName = args.Name.Split(',').First();
Assembly ass = Assembly.GetExecutingAssembly();
switch (assemblyName)
{
case "SharpDX":
return Assembly.Load(Properties.Resources.SharpDX);
case "SharpDX.Direct3D11":
return Assembly.Load(Properties.Resources.SharpDX_Direct3D11);
case "SharpDX.DXGI":
return Assembly.Load(Properties.Resources.SharpDX_DXGI);
case "SharpDX.DirectInput":
return Assembly.Load(Properties.Resources.SharpDX_DirectInput);
case "LiteDB":
return Assembly.Load(Properties.Resources.LiteDB);
case "WindowsInput":
return Assembly.Load(Properties.Resources.WindowsInput);
}
return ass;
}
}
}