System_Array_Binding.cs 3.1 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 System_Array_Binding
  16. {
  17. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  18. {
  19. BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
  20. MethodBase method;
  21. Type[] args;
  22. Type type = typeof(System.Array);
  23. args = new Type[]{typeof(System.Int32)};
  24. method = type.GetMethod("GetValue", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, GetValue_0);
  26. args = new Type[]{};
  27. method = type.GetMethod("get_Length", flag, null, args, null);
  28. app.RegisterCLRMethodRedirection(method, get_Length_1);
  29. }
  30. static StackObject* GetValue_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  31. {
  32. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  33. StackObject* ptr_of_this_method;
  34. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  35. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  36. System.Int32 @index = ptr_of_this_method->Value;
  37. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  38. System.Array instance_of_this_method = (System.Array)typeof(System.Array).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  39. __intp.Free(ptr_of_this_method);
  40. var result_of_this_method = instance_of_this_method.GetValue(@index);
  41. object obj_result_of_this_method = result_of_this_method;
  42. if(obj_result_of_this_method is CrossBindingAdaptorType)
  43. {
  44. return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
  45. }
  46. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
  47. }
  48. static StackObject* get_Length_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  49. {
  50. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  51. StackObject* ptr_of_this_method;
  52. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  53. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  54. System.Array instance_of_this_method = (System.Array)typeof(System.Array).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  55. __intp.Free(ptr_of_this_method);
  56. var result_of_this_method = instance_of_this_method.Length;
  57. __ret->ObjectType = ObjectTypes.Integer;
  58. __ret->Value = result_of_this_method;
  59. return __ret + 1;
  60. }
  61. }
  62. }