public object Invoke(ThreadContext context, object _this, object[] _params, bool bVisual) { bool flag = context == null; if (flag) { context = ThreadContext.activeContext; } bool flag2 = context == null; if (flag2) { throw new Exception("这个线程上没有CLRSharp:ThreadContext"); } bool flag3 = bVisual && this.method_CLRSharp.IsVirtual; object result; if (flag3) { CLRSharp_Instance cLRSharp_Instance = _this as CLRSharp_Instance; bool flag4 = cLRSharp_Instance.type != this.DeclaringType; if (flag4) { IMethod vMethod = cLRSharp_Instance.type.GetVMethod(this); bool flag5 = vMethod != this; if (flag5) { result = vMethod.Invoke(context, _this, _params); return(result); } } } bool flag6 = this.method_CLRSharp.Name == ".ctor"; if (flag6) { CLRSharp_Instance cLRSharp_Instance2 = _this as CLRSharp_Instance; bool flag7 = cLRSharp_Instance2 == null; if (flag7) { cLRSharp_Instance2 = new CLRSharp_Instance(this._DeclaringType); } context.ExecuteFunc(this, cLRSharp_Instance2, _params); result = cLRSharp_Instance2; } else { object obj = context.ExecuteFunc(this, _this, _params); bool flag8 = obj is CLRSharp_Instance && this.ReturnType is ICLRType_System; if (flag8) { ICrossBind crossBind = context.environment.GetCrossBind((this.ReturnType as ICLRType_System).TypeForSystem); bool flag9 = crossBind != null; if (flag9) { obj = crossBind.CreateBind(obj as CLRSharp_Instance); } } result = obj; } return(result); }
public object Invoke(ThreadContext context, object _this, object[] _params) { bool flag = _this is CLRSharp_Instance; if (flag) { CLRSharp_Instance cLRSharp_Instance = _this as CLRSharp_Instance; bool hasSysBase = cLRSharp_Instance.type.HasSysBase; if (hasSysBase) { bool flag2 = cLRSharp_Instance.type.ContainBase(this.method_System.DeclaringType); bool flag3 = flag2; if (flag3) { ICrossBind crossBind = context.environment.GetCrossBind(this.method_System.DeclaringType); bool flag4 = crossBind != null; if (flag4) { _this = crossBind.CreateBind(cLRSharp_Instance); } else { _this = (_this as CLRSharp_Instance).system_base; } } } } bool flag5 = this.method_System is ConstructorInfo; object result; if (flag5) { bool flag6 = this.method_System.DeclaringType.IsSubclassOf(typeof(Delegate)); if (flag6) { object obj = _params[0]; RefFunc refFunc = _params[1] as RefFunc; ICLRType_Sharp iCLRType_Sharp = refFunc._method.DeclaringType as ICLRType_Sharp; bool flag7 = iCLRType_Sharp != null; if (flag7) { CLRSharp_Instance cLRSharp_Instance2 = obj as CLRSharp_Instance; bool flag8 = refFunc._method.isStatic && iCLRType_Sharp != null; if (flag8) { cLRSharp_Instance2 = iCLRType_Sharp.staticInstance; } result = cLRSharp_Instance2.GetDelegate(context, this.method_System.DeclaringType, refFunc._method); } else { ICLRType_System iCLRType_System = refFunc._method.DeclaringType as ICLRType_System; result = iCLRType_System.CreateDelegate(this.method_System.DeclaringType, obj, refFunc._method as IMethod_System); } } else { object[] array = null; bool flag9 = _params != null && _params.Length != 0; if (flag9) { array = new object[_params.Length]; ParameterInfo[] parameters = this.method_System.GetParameters(); for (int i = 0; i < _params.Length; i++) { bool flag10 = _params[i] == null; if (flag10) { array[i] = null; } Type type = _params[i].GetType(); Type parameterType = parameters[i].ParameterType; bool flag11 = type == parameterType; if (flag11) { array[i] = _params[i]; } else { bool flag12 = type.IsSubclassOf(parameterType); if (flag12) { array[i] = _params[i]; } else { bool isEnum = parameters[i].ParameterType.IsEnum; if (isEnum) { MethodInfo[] methods = parameters[i].ParameterType.GetMethods(); array[i] = Enum.ToObject(parameters[i].ParameterType, _params[i]); } else { bool flag13 = parameterType == typeof(byte); if (flag13) { array[i] = (byte)Convert.ToDecimal(_params[i]); } else { array[i] = _params[i]; } } } } } } object obj2 = (this.method_System as ConstructorInfo).Invoke(array); result = obj2; } } else { Dictionary <int, object> dictionary = new Dictionary <int, object>(); object[] array2 = null; bool flag14 = _params != null && _params.Length != 0; if (flag14) { array2 = new object[_params.Length]; ParameterInfo[] parameters2 = this.method_System.GetParameters(); for (int j = 0; j < _params.Length; j++) { bool flag15 = _params[j] is StackFrame.RefObj; if (flag15) { object obj3 = (_params[j] as StackFrame.RefObj).Get(); bool flag16 = obj3 is VBox; if (flag16) { obj3 = (obj3 as VBox).BoxDefine(); } dictionary[j] = obj3; array2[j] = obj3; } else { bool isEnum2 = parameters2[j].ParameterType.IsEnum; if (isEnum2) { MethodInfo[] methods2 = parameters2[j].ParameterType.GetMethods(); array2[j] = Enum.ToObject(parameters2[j].ParameterType, _params[j]); } else { bool flag17 = parameters2[j].ParameterType == typeof(ulong) && _params[j] is long; if (flag17) { array2[j] = (ulong)((long)_params[j]); } else { bool flag18 = parameters2[j].ParameterType == typeof(uint) && _params[j] is int; if (flag18) { array2[j] = (uint)((int)_params[j]); } else { array2[j] = _params[j]; } } } } } } object obj4 = this.method_System.Invoke(_this, array2); foreach (KeyValuePair <int, object> current in dictionary) { bool flag19 = current.Value is VBox; if (flag19) { (current.Value as VBox).SetDirect(array2[current.Key]); } else { (_params[current.Key] as StackFrame.RefObj).Set(array2[current.Key]); } } result = obj4; } return(result); }