-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExecutionHook.cs
More file actions
47 lines (42 loc) · 1.46 KB
/
ExecutionHook.cs
File metadata and controls
47 lines (42 loc) · 1.46 KB
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 FrooxEngine;
namespace ResonitePackageExporter
{
[ImplementableClass(true)]
internal class ExecutionHook
{
#pragma warning disable CS0169
// fields must exist due to reflective access
private static Type? __connectorType; // needed in all Neos versions
private static Type? __connectorTypes; // needed in Neos 2021.10.17.1326 and later
#pragma warning restore CS0169
static ExecutionHook()
{
try
{
if (!HarmonyLoader.LoadHarmony())
{
Logger.Error("Harmony not found, Please put 0Harmony.dll in the Libraries folder");
return;
}
ResonitePackageExporter.Initialize();
}
catch (Exception e)
{
Logger.Log($"Thrown Exception \n{e}");
}
}
// implementation not strictly required, but method must exist due to reflective access
private static DummyConnector InstantiateConnector() => new();
private class DummyConnector : IConnector
{
public IImplementable? Owner { get; private set; }
public void ApplyChanges() { }
public void AssignOwner(IImplementable owner) => Owner = owner;
public void Destroy(bool destroyingWorld) { }
public void Initialize() { }
public void RemoveOwner() => Owner = null;
}
}
}