Esempio n. 1
0
        public static void RegisterMethod(MethodInfo method, Func <object[], object> callback)
        {
            var rpcResponse = method.GetCustomAttribute <RpcResponseAttribute>(true);
            var id          = rpcResponse.GetId();

            if (RpcResponseManager.GetRpcMethod(id) != null)
            {
                Logger.Warn($"方法:{id}已经注册!");
                return;
            }

            RpcResponseManager.AddRpcMethod(id, callback);
        }
Esempio n. 2
0
        public static void RegisterMethod(string id, Func <object[], object> callback)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (RpcResponseManager.GetRpcMethod(id) != null)
            {
                Logger.Warn($"方法:{id}已经注册!");
                return;
            }

            RpcResponseManager.AddRpcMethod(id, callback);
        }