コード例 #1
0
        public static Blog Create(string url, string location)
        {
            var blog = new TumblrTagSearchBlog()
            {
                Url       = ExtractUrl(url),
                Name      = ExtractName(url),
                BlogType  = BlogTypes.tumblrtagsearch,
                Location  = location,
                Online    = true,
                Version   = "3",
                DateAdded = DateTime.Now,
            };

            Directory.CreateDirectory(location);
            Directory.CreateDirectory(Path.Combine(Directory.GetParent(location).FullName, blog.Name));

            blog.ChildId = Path.Combine(location, blog.Name + "_files." + blog.BlogType);
            if (!File.Exists(blog.ChildId))
            {
                IFiles files = new TumblrTagSearchBlogFiles(blog.Name, blog.Location);
                files.Save();
                files = null;
            }

            return(blog);
        }
コード例 #2
0
        public static Blog Create(string url, string location, string filenameTemplate)
        {
            var blog = new TumblrTagSearchBlog()
            {
                Url              = ExtractUrl(url),
                Name             = ExtractName(url),
                BlogType         = BlogTypes.tumblrtagsearch,
                OriginalBlogType = BlogTypes.tumblrtagsearch,
                Location         = location,
                Online           = true,
                Version          = "4",
                DateAdded        = DateTime.Now,
                FilenameTemplate = filenameTemplate
            };

            Directory.CreateDirectory(location);

            blog.ChildId = Path.Combine(location, blog.Name + "_files." + blog.BlogType);
            if (!File.Exists(blog.ChildId))
            {
                IFiles files = new TumblrTagSearchBlogFiles(blog.Name, blog.Location);
                files.Save();
            }

            return(blog);
        }