mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
25 lines
No EOL
914 B
C#
25 lines
No EOL
914 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace Cosmos.IL2CPU {
|
|
public static class RuntimeEngineRefs {
|
|
public static readonly Assembly RuntimeAssemblyDef;
|
|
public static readonly MethodBase FinalizeApplicationRef;
|
|
public static readonly MethodBase InitializeApplicationRef;
|
|
public static readonly MethodBase Heap_AllocNewObjectRef;
|
|
|
|
static RuntimeEngineRefs() {
|
|
Type xType = typeof(RuntimeEngine);
|
|
foreach (FieldInfo xField in typeof(RuntimeEngineRefs).GetFields()) {
|
|
if (xField.Name.EndsWith("Ref")) {
|
|
MethodBase xTempMethod = xType.GetMethod(xField.Name.Substring(0, xField.Name.Length - "Ref".Length));
|
|
if (xTempMethod == null) {
|
|
throw new Exception("Method '" + xField.Name.Substring(0, xField.Name.Length - "Ref".Length) + "' not found on RuntimeEngine!");
|
|
}
|
|
xField.SetValue(null, xTempMethod);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |