private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) { global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null); bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(SyncListener)); return(hasDerivedMethod); }
private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) { global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(CustomAlgorithmInterface)); return(hasDerivedMethod && (methodInfo != null)); }
private bool DerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) { global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(ItemFactory)); NUILog.Debug("hasDerivedMethod=" + hasDerivedMethod); return(hasDerivedMethod && (methodInfo != null)); }
public virtual void _1_1fire(global::Compatlib.System.Object n1, global::Compatlib.System.Windows.StartupEventArgs n2) { //XMLVM_BEGIN_WRAPPER[Compatlib.System.Windows.StartUpEvent: void __fire(Compatlib.System.Object, Compatlib.System.Windows.StartupEventArgs)] foreach (Compatlib.System.Windows.StartupEventHandler handler in handlers) { global::System.Reflection.MethodInfo mi = handler.owner.GetType().GetMethod(org.xmlvm._nUtil.toNativeString(handler.method._fvalue)); mi.Invoke(handler.owner, new object[] { n1, n2 }); } //XMLVM_END_WRAPPER[Compatlib.System.Windows.StartUpEvent: void __fire(Compatlib.System.Object, Compatlib.System.Windows.StartupEventArgs)] }
internal DesignerVerb GetDesignerVerb(object obj, global::System.Reflection.MethodInfo mi) { var handler = (EventHandler)Delegate.CreateDelegate(typeof(EventHandler), obj, mi); if (cmdId != null) { return(new DesignerVerb(menuText, handler, cmdId)); } return(new DesignerVerb(menuText, handler)); }
public virtual void _1_1fire(global::Compatlib.System.Object n1, global::Compatlib.Microsoft.Devices.Sensors.AccelerometerReadingEventArgs n2) { //XMLVM_BEGIN_WRAPPER[Compatlib.Microsoft.Devices.Sensors.ReadingChangedEvent: void __fire(Compatlib.System.Object, Compatlib.Microsoft.Devices.Sensors.AccelerometerReadingEventArgs)] foreach (Compatlib.Microsoft.Devices.Sensors.ReadingChangedEventHandler handler in handlers) { global::System.Reflection.MethodInfo mi = handler.owner.GetType().GetMethod(org.xmlvm._nUtil.toNativeString(handler.method._fvalue)); mi.Invoke(handler.owner, new object[] { n1, n2 }); } //XMLVM_END_WRAPPER[Compatlib.Microsoft.Devices.Sensors.ReadingChangedEvent: void __fire(Compatlib.System.Object, Compatlib.Microsoft.Devices.Sensors.AccelerometerReadingEventArgs)] }
// Token: 0x06000580 RID: 1408 RVA: 0x0001B790 File Offset: 0x00019990 private static void InvokeIfExists(this object objectToCheck, string methodName, params object[] parameters) { global::System.Type type = objectToCheck.GetType(); global::System.Reflection.MethodInfo method = type.GetMethod(methodName, 52); bool flag = method != null; if (flag) { method.Invoke(objectToCheck, parameters); } }
public override global::System.Object getDeclaringClass() { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl>) this._faddress; global::System.Reflection.MethodInfo nativeMethodInfo = adapter.getMemberInfoAdaptee(); global::System.Type nativeType = nativeMethodInfo.DeclaringType; java.lang.Class result = org.xmlvm._nTIB.getClass(nativeType); return(result); }
public override global::System.Object getName() { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Constructor._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Constructor._nImpl>) this._faddress; global::System.Reflection.MethodInfo nativeMethodInfo = adapter.getMemberInfoAdaptee(); global::System.Type nativeType = nativeMethodInfo.DeclaringType; global::System.Object javaString = org.xmlvm._nTIB.getClass(nativeType).getName(); return(javaString); }
public virtual global::System.Object newInstance() { //XMLVM_BEGIN_WRAPPER[java.lang.Class: java.lang.Object newInstance()] org.xmlvm._nTIB tib = (org.xmlvm._nTIB) this._ftib; global::System.Type nativeType = tib.getNativeType(); global::System.Object obj = global::System.Activator.CreateInstance(nativeType); global::System.Reflection.MethodInfo jConstructor = nativeType.GetMethod("this", new global::System.Type[] {}); jConstructor.Invoke(obj, new object[] {}); return(obj); //XMLVM_END_WRAPPER[java.lang.Class: java.lang.Object newInstance()] }
private static global::net.sf.jni4net.utils.JniHandle GetBaseDefinition2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { // ()Lsystem/reflection/MethodInfo; // ()LSystem/Reflection/MethodInfo; global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); try { global::System.Reflection.MethodInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.MethodInfo>(@__env, @__obj); @__return = global::net.sf.jni4net.utils.Convertor.StrongC2Jp <global::System.Reflection.MethodInfo>(@__env, ((global::System.Runtime.InteropServices._MethodInfo)(@__real)).GetBaseDefinition()); }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); } return(@__return); }
private static global::net.sf.jni4net.utils.JniHandle MakeGenericMethod5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle typeArguments) { // ([Lsystem/Type;)Lsystem/reflection/MethodInfo; // ([LSystem/Type;)LSystem/Reflection/MethodInfo; global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); try { global::System.Reflection.MethodInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.MethodInfo>(@__env, @__obj); @__return = global::net.sf.jni4net.utils.Convertor.StrongC2Jp <global::System.Reflection.MethodInfo>(@__env, @__real.MakeGenericMethod(global::net.sf.jni4net.utils.Convertor.ArrayStrongJp2C <global::System.Type[], global::System.Type>(@__env, typeArguments))); }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); } return(@__return); }
private static global::net.sf.jni4net.utils.JniHandle ReturnParameter3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { // ()Lsystem/reflection/ParameterInfo; // ()LSystem/Reflection/ParameterInfo; global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); try { global::System.Reflection.MethodInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.MethodInfo>(@__env, @__obj); @__return = global::net.sf.jni4net.utils.Convertor.StrongC2Jp <global::System.Reflection.ParameterInfo>(@__env, @__real.ReturnParameter); }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); } return(@__return); }
private static global::net.sf.jni4net.utils.JniHandle ReturnTypeCustomAttributes1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { // ()Lsystem/reflection/ICustomAttributeProvider; // ()LSystem/Reflection/ICustomAttributeProvider; global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); try { global::System.Reflection.MethodInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.MethodInfo>(@__env, @__obj); @__return = global::net.sf.jni4net.utils.Convertor.FullC2J <global::System.Reflection.ICustomAttributeProvider>(@__env, ((global::System.Runtime.InteropServices._MethodInfo)(@__real)).ReturnTypeCustomAttributes); }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); } return(@__return); }
private static global::net.sf.jni4net.utils.JniHandle CreateDelegate7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle delegateType, global::net.sf.jni4net.utils.JniLocalHandle target) { // (Lsystem/Type;Lsystem/Object;)Lsystem/Delegate; // (LSystem/Type;LSystem/Object;)LSystem/Delegate; global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); try { global::System.Reflection.MethodInfo @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Reflection.MethodInfo>(@__env, @__obj); @__return = global::net.sf.jni4net.utils.Convertor.StrongC2Jp <global::System.Delegate>(@__env, @__real.CreateDelegate(global::net.sf.jni4net.utils.Convertor.StrongJp2C <global::System.Type>(@__env, delegateType), global::net.sf.jni4net.utils.Convertor.FullJ2C <object>(@__env, target))); }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); } return(@__return); }
public override global::System.Object getName() { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl>) this._faddress; global::System.Reflection.MethodInfo nativeMethodInfo = adapter.getMemberInfoAdaptee(); string nativeIdentifier = nativeMethodInfo.Name; string javaIdentifier = org.xmlvm._nUtil.nativeToJavaName(nativeIdentifier, false); java.lang.String result = org.xmlvm._nUtil.toJavaString(javaIdentifier); return(result); }
internal static global::System.Reflection.MethodInfo GenerateMethod(global::System.Type objectType, int schemeId, global::System.Data.DataTable dtSource) { object[] args = new object[] { objectType, schemeId, dtSource }; global::System.Reflection.MethodInfo ret = ((global::System.Reflection.MethodInfo)(m_privateType.InvokeStatic("GenerateMethod", new System.Type[] { typeof(global::System.Type), typeof(int), typeof(global::System.Data.DataTable) }, args))); return(ret); }
public override global::System.Object getParameterTypes() { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl>) this._faddress; global::System.Reflection.MethodInfo nativeMethodInfo = adapter.getMemberInfoAdaptee(); global::System.Reflection.ParameterInfo[] nativeParameterInfos = nativeMethodInfo.GetParameters(); java.lang.Class[] parameterJavaTypes = new java.lang.Class[nativeParameterInfos.Length]; for (int i = 0; i < nativeParameterInfos.Length; i++) { global::System.Type parameterNativeType = nativeParameterInfos[i].ParameterType; parameterJavaTypes[i] = org.xmlvm._nTIB.getClass(parameterNativeType); } org.xmlvm._nArrayAdapter <object> result = new org.xmlvm._nArrayAdapter <object>(parameterJavaTypes); return(result); }
public string ToStringWithCulture(object objectToConvert) { if ((objectToConvert == null)) { throw new global::System.ArgumentNullException("objectToConvert"); } global::System.Type type = objectToConvert.GetType(); global::System.Type iConvertibleType = typeof(global::System.IConvertible); if (iConvertibleType.IsAssignableFrom(type)) { return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider); } global::System.Reflection.MethodInfo methInfo = type.GetMethod("ToString", new global::System.Type[] { iConvertibleType}); if ((methInfo != null)) { return ((string)(methInfo.Invoke(objectToConvert, new object[] { this.formatProvider}))); } return objectToConvert.ToString(); }
public override global::System.Object invoke(java.lang.Object n1, org.xmlvm._nArrayAdapter <global::System.Object> n2) { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Method._nImpl>) this._faddress; global::System.Reflection.MethodInfo nativeMethodInfo = adapter.getMemberInfoAdaptee(); global::System.Reflection.ParameterInfo[] nativeParameterInfos = nativeMethodInfo.GetParameters(); object[] methodNativeParameters = n2.getCSharpArray(); for (int i = 0; i < methodNativeParameters.Length; i++) { methodNativeParameters[i] = org.xmlvm._nTIB.unboxIfPrimitive((java.lang.Object)methodNativeParameters[i], nativeParameterInfos[i].ParameterType); } object returnValue = nativeMethodInfo.Invoke(n1, methodNativeParameters); returnValue = org.xmlvm._nTIB.boxIfPrimitive(returnValue, nativeMethodInfo.ReturnType); return(returnValue); }
public override global::System.Object newInstance(org.xmlvm._nArrayAdapter <global::System.Object> n1) { org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Constructor._nImpl> adapter = (org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo, java.lang.reflect.Constructor._nImpl>) this._faddress; global::System.Reflection.MethodInfo jConstructorInfo = adapter.getMemberInfoAdaptee(); global::System.Type nativeType = jConstructorInfo.DeclaringType; object resultObj = global::System.Activator.CreateInstance(nativeType); object[] jConstructorParameters = n1.getCSharpArray(); global::System.Reflection.ParameterInfo[] parameterInfos = jConstructorInfo.GetParameters(); for (int i = 0; i < jConstructorParameters.Length; i++) { jConstructorParameters[i] = org.xmlvm._nTIB.unboxIfPrimitive((java.lang.Object)jConstructorParameters[i], parameterInfos[i].ParameterType); } jConstructorInfo.Invoke(resultObj, jConstructorParameters); return(resultObj); }
/// <summary> /// This is called from the compile/run appdomain to convert objects within an expression block to a string /// </summary> public static string ToStringWithCulture(object objectToConvert) { if ((objectToConvert == null)) { throw new global::System.ArgumentNullException("objectToConvert"); } global::System.Type t = objectToConvert.GetType(); global::System.Reflection.MethodInfo method = t.GetMethod("ToString", new global::System.Type[] { typeof(global::System.IFormatProvider) }); if ((method == null)) { return(objectToConvert.ToString()); } else { return((string)(method.Invoke(objectToConvert, new object[] { formatProviderField }))); } }
object global::System.Runtime.InteropServices.ICustomMarshaler.MarshalNativeToManaged(global::System.IntPtr pNativeData) { if (!this.lookedForFromAbi) { var assembly = typeof(global::Windows.Foundation.IMemoryBuffer).Assembly; var type = global::System.Type.GetType($"{this.winrtClassName}, {assembly.FullName}"); this.fromAbi = type.GetMethod("FromAbi"); this.lookedForFromAbi = true; } if (this.fromAbi != null) { return(this.fromAbi.Invoke(null, new object[] { pNativeData })); } else { return(global::System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(pNativeData)); } }
public static Delegate CreateDelegate(Type type, object firstArgument, global::System.Reflection.MethodInfo method) { // X:\jsc.svn\examples\javascript\async\Test\TestDelegateObjectScopeInspection\TestDelegateObjectScopeInspection\Application.cs // firstArgument: // The object to which the delegate is bound, or null to treat method as static // can we actually call the type.ctor? __MethodInfo m = method; // um. we are marking it as IntPtr but actually it seems we are using string. //var MethodToken = (string)(object)this.InternalMethod; // reverse of .Method var xIntPtr = (IntPtr)(object)m.InternalMethodToken; // [0] = {Void .ctor(System.Object, IntPtr)} //var yy = Activator.CreateInstance(typeof(Func<string>), // nRow, // y.Method //); // can we call CreateInstance with args? var withType = Activator.CreateInstance( type, firstArgument, xIntPtr ); //var typeless = new __MulticastDelegate( // firstArgument, // i //); return((MulticastDelegate)withType); }
public static object callMethod(object obj, global::System.Reflection.MethodBase[] methods, int methodLength, global::haxe.root.Array args) { unchecked { if ((methodLength == 0)) { throw global::haxe.lang.HaxeException.wrap("No available methods"); } int length = ((int)(global::haxe.lang.Runtime.getField_f(args, "length", 520590566, true))); object[] oargs = new object[((int)(length))]; global::System.Type[] ts = new global::System.Type[((int)(length))]; int[] rates = new int[((int)((methods as global::System.Array).Length))]; { int _g = 0; while ((_g < ((int)(length)))) { int i = _g++; oargs[i] = args[i]; if ((!(global::haxe.lang.Runtime.eq(args[i], default(object))))) { ts[i] = global::cs.Lib.nativeType(args[i]); } } } int last = 0; if ((methodLength > 1)) { { int _g1 = 0; while ((_g1 < methodLength)) { int i1 = _g1++; global::System.Reflection.ParameterInfo[] @params = methods[i1].GetParameters(); if (((@params as global::System.Array).Length != length)) { continue; } else { bool fits = true; int crate = 0; { int _g2 = 0; int _g11 = (@params as global::System.Array).Length; while ((_g2 < _g11)) { int i2 = _g2++; global::System.Type param = @params[i2].ParameterType; string strParam = global::haxe.lang.Runtime.concat(global::Std.@string(param), ""); if (param.IsAssignableFrom(((global::System.Type)(ts[i2])))) { continue; } else { if ((strParam.StartsWith("haxe.lang.Null") || (((global::haxe.lang.Runtime.eq(oargs[i2], default(object)) || (oargs[i2] is global::System.IConvertible))) && (((global::System.Type)(typeof(global::System.IConvertible)))).IsAssignableFrom(((global::System.Type)(param)))))) { crate++; continue; } else { if (!(param.ContainsGenericParameters)) { fits = false; break; } } } } } if (fits) { rates[last] = crate; methods[last++] = methods[i1]; } } } } methodLength = last; } else { if (((methodLength == 1) && ((methods[0].GetParameters() as global::System.Array).Length != length))) { methodLength = 0; } } if ((methodLength == 0)) { throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat("Invalid calling parameters for method ", (methods[0] as global::System.Reflection.MemberInfo).Name)); } double best = global::Math.POSITIVE_INFINITY; int bestMethod = 0; { int _g3 = 0; while ((_g3 < methodLength)) { int i3 = _g3++; if ((rates[i3] < best)) { bestMethod = i3; best = ((double)(rates[i3])); } } } methods[0] = methods[bestMethod]; global::System.Reflection.ParameterInfo[] params1 = methods[0].GetParameters(); { int _g12 = 0; int _g4 = (params1 as global::System.Array).Length; while ((_g12 < _g4)) { int i4 = _g12++; global::System.Type param1 = params1[i4].ParameterType; string strParam1 = global::haxe.lang.Runtime.concat(global::Std.@string(param1), ""); if (strParam1.StartsWith("haxe.lang.Null")) { oargs[i4] = global::haxe.lang.Runtime.mkNullable(oargs[i4], param1); } else { if ((((global::System.Type)(typeof(global::System.IConvertible)))).IsAssignableFrom(((global::System.Type)(param1)))) { if (global::haxe.lang.Runtime.eq(oargs[i4], default(object))) { if (param1.IsValueType) { oargs[i4] = global::System.Activator.CreateInstance(((global::System.Type)(param1))); } } else { oargs[i4] = (((global::System.IConvertible)(oargs[i4]))).ToType(((global::System.Type)(param1)), ((global::System.IFormatProvider)(default(global::System.IFormatProvider)))); } } } } } if ((methods[0].ContainsGenericParameters && (methods[0] is global::System.Reflection.MethodInfo))) { global::System.Reflection.MethodInfo m = ((global::System.Reflection.MethodInfo)(methods[0])); global::System.Type[] tgs = (m as global::System.Reflection.MethodBase).GetGenericArguments(); { int _g13 = 0; int _g5 = (tgs as global::System.Array).Length; while ((_g13 < _g5)) { int i5 = _g13++; tgs[i5] = typeof(object); } } m = m.MakeGenericMethod(((global::System.Type[])(tgs))); object retg = (m as global::System.Reflection.MethodBase).Invoke(((object)(obj)), ((object[])(oargs))); return(global::haxe.lang.Runtime.unbox(retg)); } global::System.Reflection.MethodBase m1 = methods[0]; if ((global::haxe.lang.Runtime.eq(obj, default(object)) && (m1 is global::System.Reflection.ConstructorInfo))) { object ret = (((global::System.Reflection.ConstructorInfo)(m1))).Invoke(((object[])(oargs))); return(global::haxe.lang.Runtime.unbox(ret)); } object ret1 = m1.Invoke(((object)(obj)), ((object[])(oargs))); return(global::haxe.lang.Runtime.unbox(ret1)); } }
public TestMethod(global::System.Reflection.MethodInfo method, global::System.Type enclosingClass) /* MethodBuilder.Create */ { }
protected override object Invoke( global::System.Reflection.MethodInfo targetMethodInfo, object[] args) { return(null); }
public AnnotationTypeMismatchException(global::System.Reflection.MethodInfo element, string foundType) /* MethodBuilder.Create */ { }
/// <summary> /// Returns a friendly strign representation of this instruction /// </summary> /// <returns></returns> public string GetCode() { string result = ""; result += GetExpandedOffset(offset) + " : " + "<b>" + code.ToString().ToUpperInvariant() + "</b>"; if (operand != null) { switch (code.OperandType) { case OperandType.InlineField: global::System.Reflection.FieldInfo fOperand = ((global::System.Reflection.FieldInfo)operand); result += " " + Globals.ProcessSpecialTypes(fOperand.FieldType.ToString()) + " " + Globals.ProcessSpecialTypes(fOperand.ReflectedType.ToString()) + "::" + fOperand.Name + ""; break; case OperandType.InlineMethod: try { global::System.Reflection.MethodInfo mOperand = (global::System.Reflection.MethodInfo)operand; result += " "; if (!mOperand.IsStatic) { result += "instance "; } result += Globals.ProcessSpecialTypes(mOperand.ReturnType.ToString()) + " " + Globals.ProcessSpecialTypes(mOperand.ReflectedType.ToString()) + "::" + mOperand.Name + "()"; } catch { try { global::System.Reflection.ConstructorInfo mOperand = (global::System.Reflection.ConstructorInfo)operand; result += " "; if (!mOperand.IsStatic) { result += "instance "; } result += "void " + Globals.ProcessSpecialTypes(mOperand.ReflectedType.ToString()) + "::" + mOperand.Name + "()"; } catch { } } break; case OperandType.ShortInlineBrTarget: case OperandType.InlineBrTarget: result += " " + GetExpandedOffset((int)operand); break; case OperandType.InlineType: result += " " + Globals.ProcessSpecialTypes(operand.ToString()); break; case OperandType.InlineString: if (operand.ToString() == "\r\n") { result += " \"\\r\\n\""; } else { result += " \"" + operand.ToString() + "\""; } break; case OperandType.ShortInlineVar: result += " " + operand.ToString(); break; case OperandType.InlineI: case OperandType.InlineI8: case OperandType.InlineR: case OperandType.ShortInlineI: case OperandType.ShortInlineR: result += " " + operand.ToString(); break; case OperandType.InlineTok: if (operand is Type) { result += ((Type)operand).FullName; } else { result += "not supported"; } break; default: result += "not supported"; break; } } return(result); }
/// <summary> /// Checks whether the method passed as parameter is an override by checking whether its DeclaringType is the same as the type passed as parameter. /// </summary> /// <param name="instance">The instance on which the events should be fired (normally "this").</param> /// <param name="callbackMethodOriginType">The type where the method was originally declared.</param> /// <param name="callbackMethodName">The method that will be checked whether it was declared in the type passed as parameter.</param> /// <param name="callbackMethodParameterTypes">The list of the callback method argument types.</param> /// <returns>True if the method is an override (its DeclaringType is different than the type passed as parameter).</returns> public static bool IsEventCallbackOverridden(object instance, Type callbackMethodOriginType, string callbackMethodName, Type[] callbackMethodParameterTypes) { bool isMethodOverridden = false; bool needReflection = true; Type instanceType = instance.GetType(); if (_typesToOverridenCallbacks.ContainsKey(instanceType)) { //Note: if _typesToOverridenCallbacks contains the instance type, we already initialized the corresponding dictionary. if (_typesToOverridenCallbacks[instanceType].ContainsKey(callbackMethodName)) { isMethodOverridden = _typesToOverridenCallbacks[instanceType][callbackMethodName]; needReflection = false; } } else { //initialize the dictionary for the type: _typesToOverridenCallbacks.Add(instanceType, new Dictionary <string, bool>()); } if (needReflection) { if (instanceType == callbackMethodOriginType) { isMethodOverridden = false; } else { #if !NETSTANDARD if (Interop.IsRunningInTheSimulator) //Bridge does not provide a fitting existing (existing as in it exists in C#) overload for Type.GetMethod to get a method from a type, a name, and specific parameters when the method is not public, so we do our own. { var methods = instanceType.GetMethods(global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance).Where((method) => { return(method.Name == callbackMethodName); }).ToArray(); if (methods.Length == 0) { throw new MissingMethodException("Could not find the method \"" + callbackMethodName + "\" in type " + instanceType.FullName); } global::System.Reflection.MethodInfo fittingMethod = null; foreach (var method in methods) { int i = 0; bool isTheOne = true; var parameters = method.GetParameters(); foreach (var parameter in parameters) { if (parameter.ParameterType != callbackMethodParameterTypes[i]) { isTheOne = false; break; } ++i; } if (isTheOne) { fittingMethod = method; break; } } if (fittingMethod == null) { List <string> parametersTypesAsString = new List <string>(); foreach (var paramType in callbackMethodParameterTypes) { parametersTypesAsString.Add(paramType.FullName); } throw new MissingMethodException("Could not find the method \"" + callbackMethodName + "(" + string.Join(", ", parametersTypesAsString) + ")" + "\" in type " + instanceType.FullName); } // We foud a fitting method, now we check whether its declaring type is the same as the origin type: isMethodOverridden = fittingMethod.DeclaringType != callbackMethodOriginType; } else //Bridge provides Type.GetMethod(String, BindingFlags, Types[]) which does what we want but does not exist in actual C# so we use it when we are not in the simulator: { isMethodOverridden = IsMethodOverriden_BrowserOnly(callbackMethodOriginType, callbackMethodName, callbackMethodParameterTypes, instanceType); } #else isMethodOverridden = instanceType.GetMethod(callbackMethodName, global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, callbackMethodParameterTypes, null).DeclaringType != callbackMethodOriginType; #endif } // Remember whether the event callback was overriden or not for the next time: _typesToOverridenCallbacks[instanceType].Add(callbackMethodName, isMethodOverridden); } return(isMethodOverridden); }