ReferenceCollector_Binding.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using ILRuntime.CLR.TypeSystem;
  7. using ILRuntime.CLR.Method;
  8. using ILRuntime.Runtime.Enviorment;
  9. using ILRuntime.Runtime.Intepreter;
  10. using ILRuntime.Runtime.Stack;
  11. using ILRuntime.Reflection;
  12. using ILRuntime.CLR.Utils;
  13. namespace ILRuntime.Runtime.Generated
  14. {
  15. unsafe class ReferenceCollector_Binding
  16. {
  17. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  18. {
  19. MethodBase method;
  20. Type[] args;
  21. Type type = typeof(global::ReferenceCollector);
  22. Dictionary<string, List<MethodInfo>> genericMethods = new Dictionary<string, List<MethodInfo>>();
  23. List<MethodInfo> lst = null;
  24. foreach(var m in type.GetMethods())
  25. {
  26. if(m.IsGenericMethodDefinition)
  27. {
  28. if (!genericMethods.TryGetValue(m.Name, out lst))
  29. {
  30. lst = new List<MethodInfo>();
  31. genericMethods[m.Name] = lst;
  32. }
  33. lst.Add(m);
  34. }
  35. }
  36. args = new Type[]{typeof(UnityEngine.GameObject)};
  37. if (genericMethods.TryGetValue("Get", out lst))
  38. {
  39. foreach(var m in lst)
  40. {
  41. if(m.MatchGenericParameters(args, typeof(UnityEngine.GameObject), typeof(System.String)))
  42. {
  43. method = m.MakeGenericMethod(args);
  44. app.RegisterCLRMethodRedirection(method, Get_0);
  45. break;
  46. }
  47. }
  48. }
  49. }
  50. static StackObject* Get_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  51. {
  52. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  53. StackObject* ptr_of_this_method;
  54. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  55. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  56. System.String @key = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  57. __intp.Free(ptr_of_this_method);
  58. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  59. global::ReferenceCollector instance_of_this_method = (global::ReferenceCollector)typeof(global::ReferenceCollector).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  60. __intp.Free(ptr_of_this_method);
  61. var result_of_this_method = instance_of_this_method.Get<UnityEngine.GameObject>(@key);
  62. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  63. }
  64. }
  65. }