public Object[] call_method_asm(Int32 asem_type, Int32 sec_unrestricted, String assem, String atype, String method, Object[] vparams, IntPtr [] oparams) { Object [] ret = new Object[2]; #if !MONO try { #endif Type type = get_type(asem_type, assem, atype); vparams = change_ptr(vparams, oparams); /* Get the methods from the type */ MethodInfo[] methods = type.GetMethods(); if (methods == null) { throw new Exception("No methods Found in " + type.FullName); } StringBuilder failureExcuses = new StringBuilder(); try { foreach (MethodInfo m in methods) { if (m.Name == method && CheckArgs(m, vparams)) { #if !MONO if (sec_unrestricted == 0) { ZoneIdentityPermission zip = new ZoneIdentityPermission(SecurityZone.NoZone); zip.PermitOnly(); } #endif return(res_to_ptr(m.Invoke(null, vparams))); } } } catch (TargetInvocationException e) { throw e.InnerException; } throw new Exception("No method " + method + " called"); #if !MONO } catch (Exception e) { ret[0] = 0; ret[1] = e.Message; return(ret); } #endif }
public Object[] call_method_asm (Int32 asem_type, Int32 sec_unrestricted, String assem, String atype, String method, Object[] vparams, IntPtr [] oparams) { Object [] ret = new Object[2]; #if !MONO try { #endif Type type = get_type (asem_type, assem, atype); vparams = change_ptr (vparams, oparams); /* Get the methods from the type */ MethodInfo[] methods = type.GetMethods(); if(methods == null) { throw new Exception ("No methods Found in " + type.FullName); } StringBuilder failureExcuses = new StringBuilder(); try { foreach(MethodInfo m in methods) { if (m.Name == method && CheckArgs (m, vparams)) { #if !MONO if (sec_unrestricted == 0) { ZoneIdentityPermission zip = new ZoneIdentityPermission(SecurityZone.NoZone); zip.PermitOnly(); } #endif return res_to_ptr (m.Invoke (null, vparams)); } } } catch (TargetInvocationException e) { throw e.InnerException; } throw new Exception ("No method " + method + " called"); #if !MONO } catch (Exception e) { ret[0] = 0; ret[1] = e.Message; return ret; } #endif }
public Object[] call_ins(IntPtr instance, Int32 sec_unrestricted, String method, Object[] vparams, IntPtr [] oparams) { Object new_instance; Type instance_type; String assem_name; Object [] ret = new Object[2]; #if !MONO try { #endif new_instance = get_inst(instance); instance_type = new_instance.GetType(); assem_name = instance_type.Assembly.FullName.ToString(); int pos = assem_name.IndexOf(","); if (pos != -1) { assem_name = assem_name.Substring(0, pos); } vparams = change_ptr(vparams, oparams); MethodInfo[] methods = instance_type.GetMethods(); /* TODO Change to temp.GetMethod (strin, Binding Flags, NULL, Type[], NULL) */ try { foreach (MethodInfo m in methods) { if (m.Name != method) { continue; } else { if (CheckArgs(m, vparams)) { #if !MONO if (sec_unrestricted == 0) { ZoneIdentityPermission zip = new ZoneIdentityPermission(SecurityZone.NoZone); zip.PermitOnly(); } #endif /* -> Ready <- */ return(res_to_ptr(m.Invoke(new_instance, vparams))); } else { continue; } } } } catch (TargetInvocationException e) { throw e.InnerException; } throw new Exception("Method " + method + " not found in call_ins"); #if !MONO } catch (Exception e) { ret[0] = 0; ret[1] = e.Message; return(ret); } #endif }
public Object[] call_ins (IntPtr instance, Int32 sec_unrestricted, String method, Object[] vparams, IntPtr [] oparams) { Object new_instance; Type instance_type; String assem_name; Object [] ret = new Object[2]; #if !MONO try { #endif new_instance = get_inst (instance); instance_type = new_instance.GetType(); assem_name = instance_type.Assembly.FullName.ToString(); int pos = assem_name.IndexOf (","); if (pos != -1) assem_name = assem_name.Substring (0, pos); vparams = change_ptr (vparams, oparams); MethodInfo[] methods = instance_type.GetMethods(); /* TODO Change to temp.GetMethod (strin, Binding Flags, NULL, Type[], NULL) */ try { foreach(MethodInfo m in methods) { if (m.Name != method) { continue; } else { if (CheckArgs(m, vparams)) { #if !MONO if (sec_unrestricted == 0) { ZoneIdentityPermission zip = new ZoneIdentityPermission(SecurityZone.NoZone); zip.PermitOnly(); } #endif /* -> Ready <- */ return res_to_ptr (m.Invoke(new_instance, vparams)); } else continue; } } } catch (TargetInvocationException e) { throw e.InnerException; } throw new Exception ("Method " + method + " not found in call_ins"); #if !MONO } catch (Exception e) { ret[0] = 0; ret[1] = e.Message; return ret; } #endif }