/// <summary> /// Map from cabinet file ids to a normalized relative path. /// </summary> /// <param name="path">Path to Wixlib.</param> /// <returns>Returns the map.</returns> private static Dictionary <string, string> GetCabinetFileIdToFileNameMap(string path) { Dictionary <string, string> mapCabinetFileIdToFileName = new Dictionary <string, string>(); BlastBinderFileManager binderFileManager = new BlastBinderFileManager(path); Librarian librarian = new Librarian(); Library library = Library.Load(path, librarian.TableDefinitions, false, false); foreach (Section section in library.Sections) { foreach (Table table in section.Tables) { foreach (Row row in table.Rows) { foreach (Field field in row.Fields) { ObjectField objectField = field as ObjectField; if (null != objectField && null != objectField.Data) { string filePath = binderFileManager.ResolveFile(objectField.Data as string, "source", row.SourceLineNumbers, BindStage.Normal); mapCabinetFileIdToFileName[objectField.CabinetFileId] = filePath; } } } } } return(mapCabinetFileIdToFileName); }
/// <summary> /// Rebuild the Wixlib using the original Wixlib and updated files. /// </summary> private void RebuildWixlib() { Librarian librarian = new Librarian(); WixVariableResolver wixVariableResolver = new WixVariableResolver(); BlastBinderFileManager binderFileManager = new BlastBinderFileManager(this.outputFile); if (0 == Retina.GetCabinetFileIdToFileNameMap(this.outputFile).Count) { this.messageHandler.Display(this, WixWarnings.NotABinaryWixlib(this.outputFile)); return; } Library library = Library.Load(this.outputFile, librarian.TableDefinitions, false, false); library.Save(this.outputFile, binderFileManager, wixVariableResolver); }
/// <summary> /// Map from cabinet file ids to a normalized relative path. /// </summary> /// <param name="path">Path to Wixlib.</param> /// <returns>Returns the map.</returns> private static Dictionary<string, string> GetCabinetFileIdToFileNameMap(string path) { Dictionary<string, string> mapCabinetFileIdToFileName = new Dictionary<string, string>(); BlastBinderFileManager binderFileManager = new BlastBinderFileManager(path); Librarian librarian = new Librarian(); Library library = Library.Load(path, librarian.TableDefinitions, false, false); foreach (Section section in library.Sections) { foreach (Table table in section.Tables) { foreach (Row row in table.Rows) { foreach (Field field in row.Fields) { ObjectField objectField = field as ObjectField; if (null != objectField && null != objectField.Data) { string filePath = binderFileManager.ResolveFile(objectField.Data as string, "source", row.SourceLineNumbers, BindStage.Normal); mapCabinetFileIdToFileName[objectField.CabinetFileId] = filePath; } } } } } return mapCabinetFileIdToFileName; }