/// <summary> /// Enables the site root folder. /// </summary> /// <param name="folder"></param> private void EnableSiteRoot(string folder) { if (_WebSite != null) { _SiteRoot.Folder = folder; if (String.IsNullOrEmpty(_SiteRoot.Folder)) { _WebSite.RemoveSiteRoot(_SiteRoot); } else { var siteRootActive = _WebSite.IsSiteRootActive(_SiteRoot, false); var folderChanged = siteRootActive && !_WebSite.IsSiteRootActive(_SiteRoot, true); if (folderChanged) { _WebSite.RemoveSiteRoot(_SiteRoot); siteRootActive = false; } if (!siteRootActive) { _WebSite.AddSiteRoot(_SiteRoot); } } } }
/// <summary> /// Adds or removes content to the web site. /// </summary> private void EnableDisableContent() { if (_WebSite != null) { if (!Enabled) { if (_SiteRoot != null) { _WebSite.RemoveSiteRoot(_SiteRoot); } foreach (var contentInjector in _ContentInjectors) { _WebSite.RemoveHtmlContentInjector(contentInjector); } } else { if (_SiteRoot != null) { _WebSite.AddSiteRoot(_SiteRoot); } foreach (var contentInjector in _ContentInjectors) { _WebSite.AddHtmlContentInjector(contentInjector); } } } }
/// <summary> /// Registers or deregisters a single site root with the web site. Call within a lock. /// </summary> /// <param name="siteRoot"></param> private void EnableDisableSiteRoot(SiteRoot siteRoot) { if (_WebSite != null) { if (_Enabled) { _WebSite.AddSiteRoot(siteRoot); } else { _WebSite.RemoveSiteRoot(siteRoot); } } }