/// <summary> /// Harvest a web filter. /// </summary> /// <param name="webFilterEntry">The web filter directory entry.</param> /// <returns>The harvested web filter.</returns> private IIs.WebFilter HarvestWebFilter(DirectoryEntry webFilterEntry) { IIs.WebFilter webFilter = new IIs.WebFilter(); webFilter.Name = webFilterEntry.Name; foreach (string propertyName in webFilterEntry.Properties.PropertyNames) { PropertyValueCollection property = webFilterEntry.Properties[propertyName]; switch (propertyName) { case "FilterDescription": webFilter.Description = (string)property.Value; break; case "FilterFlags": webFilter.Flags = (int)property.Value; break; case "FilterPath": webFilter.Path = (string)property.Value; break; } } return(webFilter); }
/// <summary> /// Decompile the IIsFilter table. /// </summary> /// <param name="table">The table to decompile.</param> private void DecompileIIsFilterTable(Table table) { foreach (Row row in table.Rows) { IIs.WebFilter webFilter = new IIs.WebFilter(); webFilter.Id = (string)row[0]; webFilter.Name = (string)row[1]; if (null != row[3]) { webFilter.Path = (string)row[3]; } if (null != row[5]) { webFilter.Description = (string)row[5]; } webFilter.Flags = (int)row[6]; if (null != row[7]) { switch ((int)row[7]) { case (-1): webFilter.LoadOrder = "last"; break; case 0: webFilter.LoadOrder = "first"; break; default: webFilter.LoadOrder = Convert.ToString((int)row[7], CultureInfo.InvariantCulture); break; } } if (null != row[4]) { IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[4]); if (null != webSite) { webSite.AddChild(webFilter); } else { this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "Web_", (string)row[4], "IIsWebSite")); } } else // Component parent { Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); if (null != component) { component.AddChild(webFilter); } else { this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); } } } }
/// <summary> /// Harvest a web site. /// </summary> /// <param name="webSiteEntry">The web site directory entry.</param> /// <returns>The harvested web site.</returns> private IIs.WebSite HarvestWebSite(DirectoryEntry webSiteEntry) { IIs.WebSite webSite = new IIs.WebSite(); foreach (string propertyName in webSiteEntry.Properties.PropertyNames) { PropertyValueCollection property = webSiteEntry.Properties[propertyName]; PropertyValueCollection parentProperty = webSiteEntry.Parent.Properties[propertyName]; if (null == parentProperty.Value || parentProperty.Value.ToString() != property.Value.ToString()) { switch (propertyName) { case "SecureBindings": IIs.WebAddress secureWebAddress = this.HarvestBindings(propertyName, property); if (null != secureWebAddress) { webSite.AddChild(secureWebAddress); } break; case "ServerBindings": IIs.WebAddress webAddress = this.HarvestBindings(propertyName, property); if (null != webAddress) { webSite.AddChild(webAddress); } break; case "ServerComment": webSite.Description = (string)property.Value; break; } } } foreach (DirectoryEntry childEntry in webSiteEntry.Children) { switch (childEntry.SchemaClassName) { case "IIsFilters": string loadOrder = (string)childEntry.Properties["FilterLoadOrder"].Value; string[] filterNames = loadOrder.Split(",".ToCharArray()); for (int i = 0; i < filterNames.Length; i++) { using (DirectoryEntry webFilterEntry = new DirectoryEntry(String.Concat(childEntry.Path, '/', filterNames[i]))) { IIs.WebFilter webFilter = this.HarvestWebFilter(webFilterEntry); webFilter.LoadOrder = (i + 1).ToString(CultureInfo.InvariantCulture); webSite.AddChild(webFilter); } } break; case "IIsWebDirectory": this.HarvestWebDirectory(childEntry, webSite); break; case "IIsWebVirtualDir": foreach (string propertyName in childEntry.Properties.PropertyNames) { PropertyValueCollection property = childEntry.Properties[propertyName]; switch (propertyName) { case "Path": webSite.Directory = (string)property.Value; break; } } webSite.AddChild(this.HarvestWebDirProperties(childEntry)); foreach (DirectoryEntry child2Entry in childEntry.Children) { switch (child2Entry.SchemaClassName) { case "IIsWebDirectory": this.HarvestWebDirectory(child2Entry, webSite); break; case "IIsWebVirtualDir": this.HarvestWebVirtualDir(child2Entry, webSite); break; } } break; } } return(webSite); }
/// <summary> /// Harvest a web filter. /// </summary> /// <param name="webFilterEntry">The web filter directory entry.</param> /// <returns>The harvested web filter.</returns> private IIs.WebFilter HarvestWebFilter(DirectoryEntry webFilterEntry) { IIs.WebFilter webFilter = new IIs.WebFilter(); webFilter.Name = webFilterEntry.Name; foreach (string propertyName in webFilterEntry.Properties.PropertyNames) { PropertyValueCollection property = webFilterEntry.Properties[propertyName]; switch (propertyName) { case "FilterDescription": webFilter.Description = (string)property.Value; break; case "FilterFlags": webFilter.Flags = (int)property.Value; break; case "FilterPath": webFilter.Path = (string)property.Value; break; } } return webFilter; }