/// <summary> /// Called at the beginning of the decompilation of a database. /// </summary> /// <param name="tables">The collection of all tables.</param> public override void InitializeDecompile(TableCollection tables) { Table propertyTable = tables["Property"]; if (null != propertyTable) { foreach (Row row in propertyTable.Rows) { if ("SecureCustomProperties" == row[0].ToString()) { // if we've referenced any of the DirectX properties, add // a PropertyRef to pick up the CA from the extension and then remove // it from the SecureCustomExtensions property so we don't get duplicates StringBuilder remainingProperties = new StringBuilder(); string[] secureCustomProperties = row[1].ToString().Split(';'); foreach (string property in secureCustomProperties) { if (property.StartsWith("WIX_DIRECTX_")) { Wix.PropertyRef propertyRef = new Wix.PropertyRef(); propertyRef.Id = property; this.Core.RootElement.AddChild(propertyRef); } else { if (0 < remainingProperties.Length) { remainingProperties.Append(";"); } remainingProperties.Append(property); } } row[1] = remainingProperties.ToString(); break; } } } }
/// <summary> /// Decompile the SecureCustomProperties field to PropertyRefs for known extension properties. /// </summary> /// <remarks> /// If we've referenced any of the suite or directory properties, add /// a PropertyRef to refer to the Property (and associated custom action) /// from the extension's library. Then remove the property from /// SecureCustomExtensions property so later decompilation won't create /// new Property elements. /// </remarks> /// <param name="tables">The collection of all tables.</param> private void CleanupSecureCustomProperties(TableCollection tables) { Table propertyTable = tables["Property"]; if (null != propertyTable) { foreach (Row row in propertyTable.Rows) { if ("SecureCustomProperties" == row[0].ToString()) { StringBuilder remainingProperties = new StringBuilder(); string[] secureCustomProperties = row[1].ToString().Split(';'); foreach (string property in secureCustomProperties) { if (property.StartsWith("WIX_SUITE_", StringComparison.Ordinal) || property.StartsWith("WIX_DIR_", StringComparison.Ordinal) || property.StartsWith("WIX_ACCOUNT_", StringComparison.Ordinal)) { Wix.PropertyRef propertyRef = new Wix.PropertyRef(); propertyRef.Id = property; this.Core.RootElement.AddChild(propertyRef); } else { if (0 < remainingProperties.Length) { remainingProperties.Append(";"); } remainingProperties.Append(property); } } row[1] = remainingProperties.ToString(); break; } } } }
/// <summary> /// Adds a PropertyRef to the main Fragment. /// </summary> /// <param name="propertyRefId">Id of the PropertyRef.</param> private void AddPropertyRef(string propertyRefId) { Wix.PropertyRef propertyRef = new Wix.PropertyRef(); propertyRef.Id = propertyRefId; this.fragment.AddChild(propertyRef); }