Beispiel #1
0
		private static void HandleInvalidInputException(ParameterInfo currentParameterInfo, Method m)
		{
			string name = "N/A";
			if (currentParameterInfo != null)
			{
				name = currentParameterInfo.Name;
			}
			m.Error = string.Concat("不正确的输入: ", name);
		}
Beispiel #2
0
		public Method AddMethod(string name)
		{
			Method r = new Method { Name = name };
			Methods.Add(r);
			return r;
		}
Beispiel #3
0
		private static void HandleUnknownException(Method m, Exception err)
		{
			m.Error = ErrorHandler.Handle(err).Message;
		}
Beispiel #4
0
		private static void HandleInvokeException(MethodInfo currentMethod, Method m)
		{
			m.Error = string.Concat("请求的方法调用失败: ", currentMethod.Name);
		}
Beispiel #5
0
		private void InvokeJsMethod(ref ParameterInfo currentParameterInfo, Method m, MethodInfo mi)
		{
			if (mi != null && mi.IsPublic)
			{
				object[] args = m.ToArray();
				ParameterInfo[] pis = mi.GetParameters();
				if (pis.Length == 1 && args.Length > 1)
				{
					args = new object[] {args};
				}
				for (int ii = 0; ii < pis.Length; ii++)
				{
					ParameterInfo pi = pis[ii];
					currentParameterInfo = pi;
					Type ptype = pi.ParameterType;
					Param p = args[ii] as Param;
					args[ii] = Convert.ChangeType(p == null ? args[ii] : p.Value, ptype);
				}
				if (mi.ReturnType != typeof (void))
				{
					m.MethodReturnValue = mi.Invoke(this, args);
				}
				else
				{
					mi.Invoke(this, args);
				}
			}
		}
Beispiel #6
0
		private static void HandleInvokeException(MethodInfo currentMethod, Method m)
		{
			string name = "N/A";
			if (currentMethod != null)
			{
				name = currentMethod.Name;
			}
			m.Error = string.Concat("请求的方法调用失败: ", currentMethod.Name);
		}