示例#1
0
        public static Blog Create(string url, string location)
        {
            var blog = new TumblrHiddenBlog()
            {
                Url       = ExtractUrl(url),
                Name      = ExtractName(url),
                BlogType  = BlogTypes.tmblrpriv,
                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 TumblrHiddenBlogFiles(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 TumblrHiddenBlog()
            {
                Url              = ExtractUrl(url),
                Name             = ExtractName(url),
                BlogType         = Models.BlogTypes.tmblrpriv,
                OriginalBlogType = Models.BlogTypes.tmblrpriv,
                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 TumblrHiddenBlogFiles(blog.Name, blog.Location);
                files.Save();
            }

            return(blog);
        }