System_String_Binding.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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_String_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.String);
  23. args = new Type[]{typeof(System.Int32), typeof(System.Int32)};
  24. method = type.GetMethod("Substring", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, Substring_0);
  26. args = new Type[]{typeof(System.Int32)};
  27. method = type.GetMethod("get_Chars", flag, null, args, null);
  28. app.RegisterCLRMethodRedirection(method, get_Chars_1);
  29. args = new Type[]{typeof(System.String), typeof(System.Object)};
  30. method = type.GetMethod("Format", flag, null, args, null);
  31. app.RegisterCLRMethodRedirection(method, Format_2);
  32. args = new Type[]{typeof(System.String), typeof(System.String)};
  33. method = type.GetMethod("Concat", flag, null, args, null);
  34. app.RegisterCLRMethodRedirection(method, Concat_3);
  35. args = new Type[]{typeof(System.String), typeof(System.Object), typeof(System.Object)};
  36. method = type.GetMethod("Format", flag, null, args, null);
  37. app.RegisterCLRMethodRedirection(method, Format_4);
  38. args = new Type[]{};
  39. method = type.GetMethod("get_Length", flag, null, args, null);
  40. app.RegisterCLRMethodRedirection(method, get_Length_5);
  41. args = new Type[]{typeof(System.String[]), typeof(System.StringSplitOptions)};
  42. method = type.GetMethod("Split", flag, null, args, null);
  43. app.RegisterCLRMethodRedirection(method, Split_6);
  44. args = new Type[]{};
  45. method = type.GetMethod("Trim", flag, null, args, null);
  46. app.RegisterCLRMethodRedirection(method, Trim_7);
  47. args = new Type[]{typeof(System.String), typeof(System.String)};
  48. method = type.GetMethod("op_Equality", flag, null, args, null);
  49. app.RegisterCLRMethodRedirection(method, op_Equality_8);
  50. app.RegisterCLRCreateArrayInstance(type, s => new System.String[s]);
  51. }
  52. static StackObject* Substring_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  53. {
  54. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  55. StackObject* ptr_of_this_method;
  56. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  57. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  58. System.Int32 @length = ptr_of_this_method->Value;
  59. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  60. System.Int32 @startIndex = ptr_of_this_method->Value;
  61. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  62. System.String instance_of_this_method = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  63. __intp.Free(ptr_of_this_method);
  64. var result_of_this_method = instance_of_this_method.Substring(@startIndex, @length);
  65. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  66. }
  67. static StackObject* get_Chars_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  68. {
  69. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  70. StackObject* ptr_of_this_method;
  71. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  72. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  73. System.Int32 @index = ptr_of_this_method->Value;
  74. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  75. System.String instance_of_this_method = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  76. __intp.Free(ptr_of_this_method);
  77. var result_of_this_method = instance_of_this_method[index];
  78. __ret->ObjectType = ObjectTypes.Integer;
  79. __ret->Value = (int)result_of_this_method;
  80. return __ret + 1;
  81. }
  82. static StackObject* Format_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  83. {
  84. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  85. StackObject* ptr_of_this_method;
  86. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  87. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  88. System.Object @arg0 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  89. __intp.Free(ptr_of_this_method);
  90. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  91. System.String @format = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  92. __intp.Free(ptr_of_this_method);
  93. var result_of_this_method = System.String.Format(@format, @arg0);
  94. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  95. }
  96. static StackObject* Concat_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  97. {
  98. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  99. StackObject* ptr_of_this_method;
  100. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  101. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  102. System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  103. __intp.Free(ptr_of_this_method);
  104. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  105. System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  106. __intp.Free(ptr_of_this_method);
  107. var result_of_this_method = System.String.Concat(@str0, @str1);
  108. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  109. }
  110. static StackObject* Format_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  111. {
  112. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  113. StackObject* ptr_of_this_method;
  114. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  115. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  116. System.Object @arg1 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  117. __intp.Free(ptr_of_this_method);
  118. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  119. System.Object @arg0 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  120. __intp.Free(ptr_of_this_method);
  121. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  122. System.String @format = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  123. __intp.Free(ptr_of_this_method);
  124. var result_of_this_method = System.String.Format(@format, @arg0, @arg1);
  125. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  126. }
  127. static StackObject* get_Length_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  128. {
  129. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  130. StackObject* ptr_of_this_method;
  131. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  132. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  133. System.String instance_of_this_method = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  134. __intp.Free(ptr_of_this_method);
  135. var result_of_this_method = instance_of_this_method.Length;
  136. __ret->ObjectType = ObjectTypes.Integer;
  137. __ret->Value = result_of_this_method;
  138. return __ret + 1;
  139. }
  140. static StackObject* Split_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  141. {
  142. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  143. StackObject* ptr_of_this_method;
  144. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  145. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  146. System.StringSplitOptions @options = (System.StringSplitOptions)typeof(System.StringSplitOptions).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  147. __intp.Free(ptr_of_this_method);
  148. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  149. System.String[] @separator = (System.String[])typeof(System.String[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  150. __intp.Free(ptr_of_this_method);
  151. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  152. System.String instance_of_this_method = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  153. __intp.Free(ptr_of_this_method);
  154. var result_of_this_method = instance_of_this_method.Split(@separator, @options);
  155. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  156. }
  157. static StackObject* Trim_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  158. {
  159. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  160. StackObject* ptr_of_this_method;
  161. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  162. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  163. System.String instance_of_this_method = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  164. __intp.Free(ptr_of_this_method);
  165. var result_of_this_method = instance_of_this_method.Trim();
  166. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  167. }
  168. static StackObject* op_Equality_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  169. {
  170. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  171. StackObject* ptr_of_this_method;
  172. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  173. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  174. System.String @b = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  175. __intp.Free(ptr_of_this_method);
  176. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  177. System.String @a = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  178. __intp.Free(ptr_of_this_method);
  179. var result_of_this_method = a == b;
  180. __ret->ObjectType = ObjectTypes.Integer;
  181. __ret->Value = result_of_this_method ? 1 : 0;
  182. return __ret + 1;
  183. }
  184. }
  185. }