LitJson_JsonMapper_Binding.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 LitJson_JsonMapper_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(LitJson.JsonMapper);
  23. args = new Type[]{typeof(System.Object)};
  24. method = type.GetMethod("ToJson", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, ToJson_0);
  26. args = new Type[]{typeof(System.Type), typeof(System.String)};
  27. method = type.GetMethod("ToObject", flag, null, args, null);
  28. app.RegisterCLRMethodRedirection(method, ToObject_1);
  29. }
  30. static StackObject* ToJson_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, 1);
  35. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  36. System.Object @obj = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  37. __intp.Free(ptr_of_this_method);
  38. var result_of_this_method = LitJson.JsonMapper.ToJson(@obj);
  39. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  40. }
  41. static StackObject* ToObject_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  42. {
  43. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  44. StackObject* ptr_of_this_method;
  45. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  46. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  47. System.String @json = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  48. __intp.Free(ptr_of_this_method);
  49. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  50. System.Type @type = (System.Type)typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  51. __intp.Free(ptr_of_this_method);
  52. var result_of_this_method = LitJson.JsonMapper.ToObject(@type, @json);
  53. object obj_result_of_this_method = result_of_this_method;
  54. if(obj_result_of_this_method is CrossBindingAdaptorType)
  55. {
  56. return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
  57. }
  58. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
  59. }
  60. }
  61. }