public virtual object Execute(object host, RPCParameter parameter) { //var method = parameter.GetRPCMethod(); var args = new object[] { parameter }; return(Method.Invoke(host, args)); }
public object GetHostObject(RPCParameter arg) { var result = Router.GetHostObjectImpl(arg); if (result != null) { return(result); } return(null); }
public static void DoReturn(RPCParameter arg, R retValue) { var pkg = new PkgWriter(arg.GetPkgSize()); byte route = (byte)ERouteTarget.Self | (byte)ERouteTarget.ReturnFlag; pkg.Write((byte)route); pkg.Write(arg.SerialId); retValue.WriteObject(pkg); pkg.SendBuffer(arg.Connect); pkg.Dispose(); }
public virtual object DoExecute(RPCParameter arg, RPCExec exec, object host) { try { return(exec.Execute(host, arg)); } catch (Exception ex) { Profiler.Log.WriteException(ex); return(null); } }
public void SetMethod(System.Reflection.MethodInfo mtd, UInt16 index, System.Type paramType) { Index = index; Method = mtd; HashString = RPCParameter.GetRPCCode(mtd); MethordHash = UniHash.APHash(HashString); mParamType = paramType; if (paramType.BaseType != null && paramType.BaseType.IsGenericType) { var typeArgs = paramType.BaseType.GenericTypeArguments; if (typeArgs.Length > 1) { if (typeArgs[0].FullName != paramType.FullName) { System.Diagnostics.Debugger.Break(); } } } }
public void RegRPC(RPCParameter arg, System.Reflection.MethodInfo method, string macro) { var desc = arg.GetMethodBinder(); if (desc.Method != null) { System.Diagnostics.Debug.Assert(desc.Method == method); //同一个RPCParameter被多个RPCMethod作为参数使用,这是不符合系统需求的 System.Diagnostics.Debug.Assert(false); return; } var index = desc.Index; if (index == MaxRPC) { index = FindValidIndex(); } desc.SetMethod(method, index, arg.GetType()); desc.Macro = macro; var rpcAttr = Rtti.AttributeHelper.GetCustomAttribute(method, typeof(RPCCallAttribute).FullName, true); if (rpcAttr != null) { var cattr = rpcAttr as RPCCallAttribute; if (cattr != null) { desc.CallAttr = cattr; } } else { desc.CallAttr = null; } HashExec[desc.MethordHash] = desc; mExec[index] = desc; }
public override object GetHostObjectImpl(RPCParameter arg) { return(HostObject); }
public virtual string GetHostObjectName(RPCParameter arg) { return(""); }
public virtual object GetHostObjectImpl(RPCParameter arg) { return(null); }
public object DoExecute(RPCParameter arg, RPCExec exec, object host) { return(Router.DoExecute(arg, exec, host)); }
public string GetHostObjectName(RPCParameter arg) { return(Router.GetHostObjectName(arg)); }
public UInt32 GetMethodHash() { var code = RPCParameter.GetRPCCode(Method); return((UInt32)UniHash.APHash(code)); }
public virtual void DestroyParameter(RPCParameter obj) { }