Exemplo n.º 1
0
        private async Task <IBlog> CheckIfBlogIsHiddenTumblrBlogAsync(IBlog blog)
        {
            if (blog.GetType() == typeof(TumblrBlog) && await _tumblrBlogDetector.IsHiddenTumblrBlogAsync(blog.Url))
            {
                RemoveBlog(new[] { blog });
                blog = TumblrHiddenBlog.Create("https://www.tumblr.com/dashboard/blog/" + blog.Name, Path.Combine(_shellService.Settings.DownloadLocation, "Index"));
            }

            return(blog);
        }
Exemplo n.º 2
0
        private async Task <IBlog> CheckIfBlogIsHiddenTumblrBlogAsync(IBlog blog)
        {
            if (blog.GetType() == typeof(TumblrBlog) && await _tumblrBlogDetector.IsHiddenTumblrBlogAsync(blog.Url))
            {
                RemoveBlog(new[] { blog }, false);
                blog = TumblrHiddenBlog.Create("https://www.tumblr.com/dashboard/blog/" + blog.Name,
                                               GetIndexFolderPath(_shellService.Settings.ActiveCollectionId), _shellService.Settings.FilenameTemplate);
            }

            return(blog);
        }
Exemplo n.º 3
0
        public ICrawler GetCrawler(IBlog blog)
        {
            Lazy <ICrawler, ICrawlerData> downloader =
                DownloaderFactoryLazy.FirstOrDefault(list => list.Metadata.BlogType == blog.GetType());

            if (downloader != null)
            {
                return(downloader.Value);
            }

            throw new ArgumentException("Website is not supported!", nameof(blog));
        }
Exemplo n.º 4
0
        public Lazy <IDetailsViewModel> GetViewModel(IBlog blog)
        {
            Lazy <IDetailsViewModel, ICrawlerData> viewModel =
                ViewModelFactoryLazy.FirstOrDefault(list => list.Metadata.BlogType == blog.GetType());

            if (viewModel != null)
            {
                return(viewModel);
            }
            throw new ArgumentException("Website is not supported!", "blogType");
        }