/// <summary> /// Harvest a web virtual directory. /// </summary> /// <param name="webVirtualDirEntry">The web virtual directory directory entry.</param> /// <param name="webSite">The parent web site.</param> private void HarvestWebVirtualDir(DirectoryEntry webVirtualDirEntry, IIs.WebSite webSite) { IIs.WebVirtualDir webVirtualDir = new IIs.WebVirtualDir(); foreach (string propertyName in webVirtualDirEntry.Properties.PropertyNames) { PropertyValueCollection property = webVirtualDirEntry.Properties[propertyName]; PropertyValueCollection parentProperty = webVirtualDirEntry.Parent.Properties[propertyName]; if (null == parentProperty.Value || parentProperty.Value.ToString() != property.Value.ToString()) { switch (propertyName) { case "Path": webVirtualDir.Directory = (string)property.Value; break; } } } int indexOfRoot = webVirtualDirEntry.Path.IndexOf("ROOT/", StringComparison.OrdinalIgnoreCase); webVirtualDir.Alias = webVirtualDirEntry.Path.Substring(indexOfRoot + 5); IIs.WebDirProperties webDirProps = this.HarvestWebDirProperties(webVirtualDirEntry); if (webDirProps != null) { webVirtualDir.AddChild(webDirProps); } foreach (DirectoryEntry childEntry in webVirtualDirEntry.Children) { switch (childEntry.SchemaClassName) { case "IIsWebDirectory": this.HarvestWebDirectory(childEntry, webSite); break; case "IIsWebVirtualDir": this.HarvestWebVirtualDir(childEntry, webSite); break; } } webSite.AddChild(webVirtualDir); }
/// <summary> /// Decompile the IIsWebVirtualDir table. /// </summary> /// <param name="table">The table to decompile.</param> private void DecompileIIsWebVirtualDirTable(Table table) { foreach (Row row in table.Rows) { IIs.WebVirtualDir webVirtualDir = new IIs.WebVirtualDir(); webVirtualDir.Id = (string)row[0]; // the Component_ and Web_ columns are handled in FinalizeIIsWebVirtualDirTable webVirtualDir.Alias = (string)row[3]; webVirtualDir.Directory = (string)row[4]; if (null != row[5]) { webVirtualDir.DirProperties = (string)row[5]; } // the Application_ column is handled in FinalizeIIsWebApplicationTable this.Core.IndexElement(row, webVirtualDir); } }
/// <summary> /// Harvest a web virtual directory. /// </summary> /// <param name="webVirtualDirEntry">The web virtual directory directory entry.</param> /// <param name="webSite">The parent web site.</param> private void HarvestWebVirtualDir(DirectoryEntry webVirtualDirEntry, IIs.WebSite webSite) { IIs.WebVirtualDir webVirtualDir = new IIs.WebVirtualDir(); foreach (string propertyName in webVirtualDirEntry.Properties.PropertyNames) { PropertyValueCollection property = webVirtualDirEntry.Properties[propertyName]; PropertyValueCollection parentProperty = webVirtualDirEntry.Parent.Properties[propertyName]; if (null == parentProperty.Value || parentProperty.Value.ToString() != property.Value.ToString()) { switch (propertyName) { case "Path": webVirtualDir.Directory = (string)property.Value; break; } } } int indexOfRoot = webVirtualDirEntry.Path.IndexOf("ROOT/", StringComparison.OrdinalIgnoreCase); webVirtualDir.Alias = webVirtualDirEntry.Path.Substring(indexOfRoot + 5); IIs.WebDirProperties webDirProps = this.HarvestWebDirProperties(webVirtualDirEntry); if (webDirProps != null) { webVirtualDir.AddChild(webDirProps); } foreach (DirectoryEntry childEntry in webVirtualDirEntry.Children) { switch (childEntry.SchemaClassName) { case "IIsWebDirectory": this.HarvestWebDirectory(childEntry, webSite); break; case "IIsWebVirtualDir": this.HarvestWebVirtualDir(childEntry, webSite); break; } } webSite.AddChild(webVirtualDir); }