Esempio n. 1
0
        public static Blog Create(string url, string location, string filenameTemplate)
        {
            var blog = new TumblrBlog()
            {
                Url              = ExtractUrl(url),
                Name             = ExtractName(url),
                BlogType         = Models.BlogTypes.tumblr,
                OriginalBlogType = Models.BlogTypes.tumblr,
                Location         = location,
                Online           = true,
                Version          = "4",
                DateAdded        = DateTime.Now,
                FilenameTemplate = filenameTemplate
            };

            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 TumblrBlogFiles(blog.Name, blog.Location);
                files.Save();
            }

            return(blog);
        }
Esempio n. 2
0
        public static Blog Create(string url, string location, string filenameTemplate, bool isCustomDomain = false)
        {
            url = isCustomDomain ? url : ExtractUrl(url);
            var name = isCustomDomain ? ExtractCustomName(url) : ExtractName(url);
            var blog = new TumblrBlog()
            {
                Url              = url,
                Name             = name,
                BlogType         = Models.BlogTypes.tumblr,
                OriginalBlogType = Models.BlogTypes.tumblr,
                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 TumblrBlogFiles(blog.Name, blog.Location);
                files.Save();
            }

            return(blog);
        }