Beispiel #1
0
        public void HandleResponce(IObject obj)
        {
            Log.Debug("Handle RpcResult");

            var message = obj.Cast <TRpcResult>();

            Log.Debug($"Process RpcResult  with request id = '{message.ReqMsgId}'");

            ConfirmationRecieveService.ConfirmRequest(message.ReqMsgId);

            switch (message.Result)
            {
            case TRpcError error:
                HandleRpcError(message.ReqMsgId, error);
                break;

            case TgZipPacked zipPacked:
                var result = ZipPackedHandler.HandleGZipPacked(zipPacked);
                ResponseResultSetter.ReturnResult(message.ReqMsgId, result);
                break;

            default:
                ResponseResultSetter.ReturnResult(message.ReqMsgId, message.Result);
                break;
            }
        }
Beispiel #2
0
        public byte[] HandleResponce(int code, BinaryReader reader)
        {
            Log.Debug("Handle RpcResult");

            var requestId = reader.ReadUInt64();

            Log.Debug($"Process RpcResult  with request id = '{requestId}'");

            ConfirmationRecieveService.ConfirmRequest(requestId);

            var innerCode = reader.ReadUInt32();

            switch (innerCode)
            {
            case 0x2144ca19:
                HandleRpcError(reader, requestId);
                break;

            case 0x3072cfa1:
                HandleZipPacket(reader, requestId);
                break;

            default:
                reader.BaseStream.Position -= 4;
                var bytes = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));

                ResponseResultSetter.ReturnResult(requestId, bytes);
                break;
            }

            return(null);
        }