public DownloadFileResponse GetResponse(DownloadFileRequest request) { AuthorizationService service = new AuthorizationService(); AuthenticationContext ctx = AuthenticationContext.Get(request); if (!service.HasAccessToDirectory(ctx, request.Filepath)) { throw new AuthorizationException(); } byte[] data = IOService.ReadFile(request.Filepath, request.Offset, request.Count); return(new DownloadFileResponse { Data = data, HasNext = data.Length == request.Count }); }