Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Site"/> class.
        /// </summary>
        /// <param name="siteRootPath">The site root path.</param>
        private Site(string siteRootPath)
            : base(siteRootPath)
        {
            foreach (var path in new[] { "pages", "posts", "static", "themes" })
            {
                Paths[path] = Utility.CreateDirectoryIfNecessary(Path.Combine(siteRootPath, path));
            }

            foreach (var path in new[] { "plugins", "output", "cache" })
            {
                Paths[path] = Path.Combine(siteRootPath, path);
            }

            Config = ImportSiteConfig();

            ActiveSites.Add(siteRootPath, this);
        }
Пример #2
0
 public static Site ForPath(string siteRootPath)
 {
     Utility.AssertDirectoryExists(siteRootPath);
     siteRootPath = Path.GetFullPath(siteRootPath).ToLowerInvariant();
     return(ActiveSites.ContainsKey(siteRootPath) ? ActiveSites[siteRootPath] : new Site(siteRootPath));
 }