-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEntryPoint.cs
51 lines (48 loc) · 1.63 KB
/
EntryPoint.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
using SALT.Diagnostics;
using SALT.Utils;
using System;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using UnityEngine;
namespace SALT
{
internal static class EntryPoint
{
public static void Main()
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolve);
EnumPatcher.AddPartialEnumValue<Level>(Levels.DONT_DESTROY_ON_LOAD, "DONT_DESTROY_ON_LOAD");
new GameObject("Coroutiner", typeof(Coroutiner)).DontDestroyOnLoad();
}
public static void IntializeInternalServices()
{
#if DEBUG
Debug.Log("[INITIALIZING INTERNAL SERVICES]");
#endif
Services.CreateServiceObject();
Services.InitInternalServices();
}
private static Assembly Resolve(object sender, ResolveEventArgs args)
{
Debug.Log("Trying to resolve assembly: " + args.Name);
string str1 = Path.Combine(FileSystem.ModPath, args.Name.Substring(0, args.Name.IndexOf(',')) + ".dll");
Assembly assembly = null;
if (File.Exists(str1))
{
Debug.Log("Attempting path: " + str1);
try
{
assembly = AssemblyUtils.LoadWithSymbols(str1);
Debug.Log($"<color=#AAFF99>{("Successfully resolved assembly!")}</color>");
}
catch (Exception ex)
{
Debug.LogError("Failed to resolve from path! Message: " + ex.Message);
}
}
return assembly;
}
}
}