//等待数据提交完成 public string WaitForResponse(object Timeout, out bool Succeeded) { if (!_Active) { Succeeded = false; return(""); } object obj; bool succ = false; //System.Reflection.ParameterModifier[] ParamesM = new System.Reflection.ParameterModifier[1]; //ParamesM[0] = new System.Reflection.ParameterModifier(2); // 初始化为接口参数的个数 //ParamesM[0][1] = true; // 设置第二个参数为返回参数 System.Reflection.ParameterModifier p = new System.Reflection.ParameterModifier(2); p[1] = true; System.Reflection.ParameterModifier[] ParamesM = { p }; object[] ParamArray = new object[2] { Timeout, succ }; obj = HttpObj.DoMethod("WaitForResponse", ParamArray, ParamesM); Succeeded = bool.Parse(ParamArray[1].ToString()); if (obj != null) { return(obj.ToString()); } else { return("True"); } }
//string BoundingBoxPairTypeName = "TeX2img.Converter+BoundingBoxPair, TeX2img, Version=1.5.5.0, Culture=neutral, PublicKeyToken=null"; //string BoundingBoxPairTypeName = "TeX2img.Converter+BoundingBoxPair, TeX2img"; static object CallMethod(object obj, string func, params object[] args) { if (args.Contains(null)) { return(obj.GetType().GetMethod(func, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(obj, args)); } else { var types = new Type[args.Length]; var realargs = new object[args.Length]; var modifilers = new System.Reflection.ParameterModifier[args.Length]; for (int i = 0; i < args.Length; ++i) { var arg1 = args[i] as NullArgument; if (arg1 != null) { types[i] = arg1.type; realargs[i] = null; } else { var arg2 = args[i] as ByRefType; if (arg2 != null) { types[i] = arg2.type.MakeByRefType(); realargs[i] = arg2.val; } else { types[i] = args[i].GetType(); realargs[i] = args[i]; } } modifilers[i] = new System.Reflection.ParameterModifier(); } var a = obj.GetType(); var b = a.GetMethod(func, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, types, modifilers); var c = b.Invoke(obj, realargs); for (int i = 0; i < realargs.Length; ++i) { var reftype = args[i] as ByRefType; if (reftype != null) { reftype.val = realargs[i]; } } return(c); } }
public void GetRigFrequency(out double rxKHz, out double txKHz, out bool split) { var args = new object[] { (double)0, (double)0, (bool)false }; System.Reflection.ParameterModifier mods = new System.Reflection.ParameterModifier(args.Length); mods[0] = true; mods[1] = true; mods[2] = true; remoteLoggerType.InvokeMember("GetRigFrequency", bf, null, remoteLogger, args, new System.Reflection.ParameterModifier[1] { mods }, null, null); rxKHz = (double)args[0]; txKHz = (double)args[1]; split = (bool)args[2]; }
public void CheckDupeAndMult(string call, string digitalMode, XDpack77.Pack77Message.Message m, out bool dupe, out short mult) { // XDpack77.Pack77Message.Message can't be remoted as-is // but it can be reproduced on the server side with just its Content property and i3 and n3 dupe = false; mult = 0; var args = new object[] { call, digitalMode, m.AsReceived.Content, dupe, mult, m.i3, m.n3 }; System.Reflection.ParameterModifier mods = new System.Reflection.ParameterModifier(args.Length); mods[3] = true; mods[4] = true; remoteLoggerType.InvokeMember("CheckDupeAndMult", bf, null, remoteLogger, args, new System.Reflection.ParameterModifier[1] { mods }, null, null); dupe = (bool)args[3]; mult = (short)args[4]; }
/// <summary> /// 获取string转换值 /// </summary> /// <param name="text"></param> /// <param name="itype"></param> /// <returns></returns> public static object GetPriseText(string text, Type itype) { Type obType = GetObType(itype); Type[] types = new Type[1]; System.Reflection.ParameterModifier[] par1 = new System.Reflection.ParameterModifier[1]; par1[0] = new System.Reflection.ParameterModifier(1); types[0] = typeof(string); System.Reflection.MethodInfo MethInfo = obType.GetMethod("Parse", types, par1); object[] value = new object[1]; value[0] = text; try { if (MethInfo != null) { return(MethInfo.Invoke(null, value)); } return(null); } catch { return(null); } }
//string BoundingBoxPairTypeName = "TeX2img.Converter+BoundingBoxPair, TeX2img, Version=1.5.5.0, Culture=neutral, PublicKeyToken=null"; //string BoundingBoxPairTypeName = "TeX2img.Converter+BoundingBoxPair, TeX2img"; static object CallMethod(object obj, string func, params object[] args) { if(args.Contains(null)) { return obj.GetType().GetMethod(func, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(obj, args); } else { var types = new Type[args.Length]; var realargs = new object[args.Length]; var modifilers = new System.Reflection.ParameterModifier[args.Length]; for(int i = 0 ; i < args.Length ; ++i) { var arg1 = args[i] as NullArgument; if (arg1 != null) { types[i] = arg1.type; realargs[i] = null; } else { var arg2 = args[i] as ByRefType; if (arg2 != null) { types[i] = arg2.type.MakeByRefType(); realargs[i] = arg2.val; } else { types[i] = args[i].GetType(); realargs[i] = args[i]; } } modifilers[i] = new System.Reflection.ParameterModifier(); } var a = obj.GetType(); var b = a.GetMethod(func, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, types, modifilers); var c = b.Invoke(obj, realargs); for(int i = 0; i < realargs.Length; ++i) { var reftype = args[i] as ByRefType; if(reftype != null) { reftype.val = realargs[i]; } } return c; } }