Ejemplo n.º 1
0
        /// <summary>
        /// 调用服务端实现的Api
        /// </summary>
        /// <param name="api">Api行为的api</param>
        /// <param name="parameters">参数列表</param>
        /// <exception cref="SocketException"></exception>
        /// <exception cref="SerializerException"></exception>
        public void InvokeApi(string api, params object[] parameters)
        {
            var packet = new FastPacket(api, this.packetIdProvider.NewId(), true);

            packet.SetBodyParameters(this.Serializer, parameters);
            this.Send(packet);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 调用服务端实现的Api
        /// 并返回结果数据任务
        /// </summary>
        /// <typeparam name="T">返回值类型</typeparam>
        /// <param name="api">Api行为的api</param>
        /// <param name="parameters">参数</param>
        /// <exception cref="SocketException"></exception>
        /// <exception cref="SerializerException"></exception>
        /// <returns>远程数据任务</returns>
        public ApiResult <T> InvokeApi <T>(string api, params object[] parameters)
        {
            var id     = this.packetIdProvider.NewId();
            var packet = new FastPacket(api, id, true);

            packet.SetBodyParameters(this.Serializer, parameters);
            return(Common.InvokeApi <T>(this.clientSession, this.taskSetterTable, this.Serializer, packet, this.TimeOut));
        }