/// <summary> /// Harvest a web directory. /// </summary> /// <param name="webDirectoryEntry">The web directory directory entry.</param> /// <param name="webSite">The parent web site.</param> private void HarvestWebDirectory(DirectoryEntry webDirectoryEntry, IIs.WebSite webSite) { foreach (DirectoryEntry childEntry in webDirectoryEntry.Children) { switch (childEntry.SchemaClassName) { case "IIsWebDirectory": this.HarvestWebDirectory(childEntry, webSite); break; case "IIsWebVirtualDir": this.HarvestWebVirtualDir(childEntry, webSite); break; } } IIs.WebDirProperties webDirProperties = this.HarvestWebDirProperties(webDirectoryEntry); if (null != webDirProperties) { IIs.WebDir webDir = new IIs.WebDir(); int indexOfRoot = webDirectoryEntry.Path.IndexOf("Root/"); webDir.Path = webDirectoryEntry.Path.Substring(indexOfRoot + 5); webDir.AddChild(webDirProperties); webSite.AddChild(webDir); } }
/// <summary> /// Harvest a web directory. /// </summary> /// <param name="webDirectoryEntry">The web directory directory entry.</param> /// <param name="webSite">The parent web site.</param> private void HarvestWebDirectory(DirectoryEntry webDirectoryEntry, IIs.WebSite webSite) { foreach (DirectoryEntry childEntry in webDirectoryEntry.Children) { switch (childEntry.SchemaClassName) { case "IIsWebDirectory": this.HarvestWebDirectory(childEntry, webSite); break; case "IIsWebVirtualDir": this.HarvestWebVirtualDir(childEntry, webSite); break; } } IIs.WebDirProperties webDirProperties = this.HarvestWebDirProperties(webDirectoryEntry); if (null != webDirProperties) { IIs.WebDir webDir = new IIs.WebDir(); int indexOfRoot = webDirectoryEntry.Path.IndexOf("ROOT/", StringComparison.OrdinalIgnoreCase); webDir.Path = webDirectoryEntry.Path.Substring(indexOfRoot + 5); webDir.AddChild(webDirProperties); webSite.AddChild(webDir); } }