using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using UnityFusion.CLR.TypeSystem; using UnityFusion.CLR.Method; using UnityFusion.Runtime.Enviorment; using UnityFusion.Runtime.Intepreter; using UnityFusion.Runtime.Stack; using UnityFusion.Reflection; using UnityFusion.CLR.Utils; #if DEBUG && !DISABLE_UNITYFUSION_DEBUG using AutoList = System.Collections.Generic.List; #else using AutoList = UnityFusion.Other.UncheckedList; #endif namespace UnityFusion.Runtime.Generated { unsafe class System_Activator_Binding { public static void Register(UnityFusion.Runtime.Enviorment.AppDomain app) { MethodBase method; Type[] args; Type type = typeof(System.Activator); Dictionary> genericMethods = new Dictionary>(); List lst = null; foreach(var m in type.GetMethods()) { if(m.IsGenericMethodDefinition) { if (!genericMethods.TryGetValue(m.Name, out lst)) { lst = new List(); genericMethods[m.Name] = lst; } lst.Add(m); } } args = new Type[]{typeof(UnityFusion.Runtime.Intepreter.ILTypeInstance)}; if (genericMethods.TryGetValue("CreateInstance", out lst)) { foreach(var m in lst) { if(m.MatchGenericParameters(args, typeof(UnityFusion.Runtime.Intepreter.ILTypeInstance))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, CreateInstance_0); break; } } } } static StackObject* CreateInstance_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* __ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = System.Activator.CreateInstance(); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } } }