public CheckCacheInfoResponse CheckCacheInfo(CheckCacheInfoRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            var cache = ServiceHelper.Cache;
            DocumentCacheInfo cacheInfo = DocumentFactory.GetDocumentCacheInfo(cache, request.Uri.ToString());

            if (cacheInfo == null)
            {
                return(new CheckCacheInfoResponse());
            }

            var documentMimeType = cacheInfo.MimeType;
            var status           = DocumentFactory.MimeTypes.GetStatus(documentMimeType);
            var isAccepted       = status != DocumentMimeTypeStatus.Denied;

            var serviceCacheInfo = new CacheInfo
            {
                IsVirtual          = cacheInfo.IsVirtual,
                IsLoaded           = cacheInfo.IsLoaded,
                HasAnnotations     = cacheInfo.HasAnnotations,
                Name               = cacheInfo.Name,
                MimeType           = documentMimeType,
                IsMimeTypeAccepted = isAccepted,
                PageCount          = cacheInfo.PageCount
            };

            return(new CheckCacheInfoResponse
            {
                CacheInfo = serviceCacheInfo
            });
        }
예제 #2
0
            public async Task <Result <CheckCacheInfoResponse> > CheckCacheInfo(CheckCacheInfoRequest request)
            {
                const string api      = "api/Factory/CheckCacheInfo";
                var          response = await _owner.PostAsync <CheckCacheInfoRequest, CheckCacheInfoResponse>(api, request);

                return(response);
            }