Beispiel #1
0
        public List <CachedPageResourceDescription> GetHtmlPageResources(CachedPageDescription cachedPageDescription)
        {
            List <CachedPageResourceDescription> result = new List <CachedPageResourceDescription>();
            string resourcesFolder = GetHtmlPageResourcesFolder(cachedPageDescription);

            var pathDelimiter = _fileManager.PathDelimiter.ToString();

            if (!resourcesFolder.EndsWith(pathDelimiter))
            {
                resourcesFolder += pathDelimiter;
            }

            var files = _fileManager.GetFiles(resourcesFolder);

            foreach (var file in files)
            {
                if (!file.IsDirectory)
                {
                    CachedPageResourceDescription resource =
                        new CachedPageResourceDescription(cachedPageDescription, Path.GetFileName(file.Path));
                    result.Add(resource);
                }
            }

            return(result);
        }
Beispiel #2
0
        private string GetResourceFilePath(CacheFileDescription cacheFileDescription)
        {
            CachedPageResourceDescription resourceDescription = cacheFileDescription as CachedPageResourceDescription;

            if (resourceDescription == null)
            {
                throw new InvalidOperationException(
                          "cacheFileDescription object should be an instance of CachedPageResourceDescription class");
            }

            string resourcesPath = GetHtmlPageResourcesFolder(resourceDescription.CachedPageDescription);

            return(Path.Combine(resourcesPath, resourceDescription.ResourceName));
        }