Exemplo n.º 1
0
 private async Task <IBlog> CheckIfCrawlableBlog(string blogUrl)
 {
     if (!_blogFactory.IsValidTumblrBlogUrl(blogUrl) && _blogFactory.IsValidUrl(blogUrl))
     {
         if (await _tumblrBlogDetector.IsTumblrBlogWithCustomDomainAsync(blogUrl))
         {
             return(TumblrBlog.Create(blogUrl, Path.Combine(_shellService.Settings.DownloadLocation, "Index"), _shellService.Settings.FilenameTemplate, true));
         }
         throw new Exception($"The url '{blogUrl}' cannot be recognized as Tumblr blog!");
     }
     return(_blogFactory.GetBlog(blogUrl, Path.Combine(_shellService.Settings.DownloadLocation, "Index"), _shellService.Settings.FilenameTemplate));
 }
Exemplo n.º 2
0
 private async Task <IBlog> CheckIfCrawlableBlog(string blogUrl, bool fromClipboard)
 {
     if (!_blogFactory.IsValidBlogUrl(blogUrl))
     {
         if (fromClipboard)
         {
             throw new Exception();
         }
         if (_blogFactory.IsValidUrl(blogUrl) && await _tumblrBlogDetector.IsTumblrBlogWithCustomDomainAsync(blogUrl))
         {
             return(TumblrBlog.Create(blogUrl, GetIndexFolderPath(_shellService.Settings.ActiveCollectionId), _shellService.Settings.FilenameTemplate, true));
         }
         throw new Exception($"The url '{blogUrl}' cannot be recognized as valid blog!");
     }
     return(_blogFactory.GetBlog(blogUrl, GetIndexFolderPath(_shellService.Settings.ActiveCollectionId), _shellService.Settings.FilenameTemplate));
 }