Ejemplo n.º 1
0
        Request DecodeRequest(byte[] encodedRequest)
        {
            EventOccurred?.Invoke(this,
                                  new ServerEvent {
                EventType = EventType.DetermineRequestTypeStarted
            });

            var requestType = RequestDecoder.ReadRequestType(encodedRequest);

            var newRequest = _decodeRequestFunctions[requestType].Invoke(encodedRequest);

            newRequest.Status    = RequestStatus.Pending;
            newRequest.Direction = TransferDirection.Inbound;

            newRequest.DecodeRequest();
            AssignIdToNewRequest(newRequest);

            EventOccurred?.Invoke(this, new ServerEvent
            {
                EventType   = EventType.DetermineRequestTypeComplete,
                RequestType = newRequest.Type
            });

            return(newRequest);
        }
Ejemplo n.º 2
0
        public virtual Result DecodeRequest()
        {
            if (RequestBytes == null)
            {
                return(Result.Fail("Unable to perform the requested operation, no binary data has been received"));
            }

            Type             = RequestDecoder.ReadRequestType(RequestBytes);
            RemoteServerInfo = RequestDecoder.ReadRemoteServerInfo(RequestBytes);

            return(Result.Ok());
        }