-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoader.cs
39 lines (37 loc) · 1.15 KB
/
Loader.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace CombotPatcher
{
class Loader
{
[MethodImpl(MethodImplOptions.NoInlining)]
static void Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, ARargs) =>
{
var resName = "CombotPatcher." + ARargs.Name.Split(new char[]{','})[0] + ".dll";
var thisAssembly = Assembly.GetExecutingAssembly();
using (var input = thisAssembly.GetManifestResourceStream(resName))
{
if (input != null)
{
byte[] data = new byte[input.Length];
input.Read(data, 0, (int)input.Length);
return Assembly.Load(data);
}
return null;
}
};
MainCore(args);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void MainCore(string[] args)
{
Program.Main(args);
}
}
}