Cosmos/source2/IL2CPU/Cosmos.IL2CPU/RuntimeEngineRefs.cs
2010-09-04 19:07:11 +00:00

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);
}
}
}
}
}