private bool IsDownloadablePageResource(UrlContentTypeInfo urlContentTypeInfo) { if (urlContentTypeInfo == null) { return(false); } // We should download pages that are web pages, css, or js files and treat them as web pages! return(MimeHelper.IsContentTypeWebPage(urlContentTypeInfo.ContentType)); }
public bool ShouldDownloadThisUrl(UrlContentTypeInfo info) { string url = info.FinalUrl; if (!ShouldDownloadThisUrl(url)) { return(false); } // If we've exceeded the maximum number of pages that we're allowed to download if (LimitNumberOfPages && MaxNumberOfPagesToDownload > -1 && _currentPageCount >= MaxNumberOfPagesToDownload) { return(false); } // If this file is too large // TODO: Should this apply to files or also web pages? Currently applies to web pages too if (LimitSizeOfFile && MaxFileSizeToDownload > 0 && info.ContentLength > MaxFileSizeToDownload * 1048576) { return(false); } // If we should only download pages and this isn't a page, filter it out if (DownloadFilter == SiteCaptureDownloadFilter.Pages && !MimeHelper.IsContentTypeWebPage(info.ContentType)) { return(false); } // If we should only download pages and documents and this isn't a document, filter it out if (DownloadFilter == SiteCaptureDownloadFilter.PagesAndDocuments && (!MimeHelper.IsContentTypeDocument(info.ContentType) && !MimeHelper.IsContentTypeWebPage(info.ContentType))) { return(false); } return(true); }