/// <summary> /// 将远程调用的方法解码为RpcCall调用。 /// </summary> /// <param name="data">远程调用方法的二进制数组</param> /// <param name="unLen">数据偏移量</param> protected override void DoDecode(byte[] data, ref int unLen) { FuncID = (ushort)VUInt16.Instance.Decode(data, ref unLen); if (CurrentEntity == null) { throw new DefineParseException(String.Format("Decode error: Current Entity is not set.")); } var method = CurrentEntity.TryGetClientMethod(FuncID); if (method == null) { throw new DefineParseException( String.Format("Decode error: Can not find function '{0}' in entity '{1}'.", FuncID, CurrentEntity.Name)); } FuncName = method.FuncName; Arguments = new Object[method.ArgsType.Count]; for (var i = 0; i < method.ArgsType.Count; i++) { Arguments[i] = method.ArgsType[i].Decode(data, ref unLen); } if (RPCMsgLogManager.IsRecord) { var list = new List <object>(2 + Arguments.Length); list.Add(FuncID); list.Add(FuncName); for (var i = 0; i < Arguments.Length; i++) { if (method.ArgsType[i].VType == VType.V_BLOB) { list.Add(Arguments[i] != null ? (Arguments[i] as byte[]).PackArray() : null); } else { list.Add(Arguments[i]); } } RPCMsgLogManager.Receive(MSGIDType.CLIENT_RPC_RESP, list.ToArray()); } }
/// <summary> /// 将远程调用的方法解码为RpcCall调用。 /// </summary> /// <param name="data">远程调用方法的二进制数组</param> /// <param name="unLen">数据偏移量</param> protected override void DoDecode(byte[] data, ref int unLen) { FuncID = (ushort)VUInt16.Instance.Decode(data, ref unLen); if (CurrentEntity == null) { throw new DefineParseException(String.Format("Decode error: Current Entity is not set.")); } EntityDefMethod method = CurrentEntity.TryGetClientMethod(FuncID); if (method == null) { throw new DefineParseException(String.Format("Decode error: Can not find function '{0}' in entity '{1}'.", FuncID, CurrentEntity.Name)); } FuncName = method.FuncName; Arguments = new Object[method.ArgsType.Count]; for (int i = 0; i < method.ArgsType.Count; i++) { Arguments[i] = method.ArgsType[i].Decode(data, ref unLen); } //if (FuncName != "GetServerTimeResp") // LoggerHelper.Debug("Client call RPC_" + FuncName); }