/// <summary> /// The main entry point for the application. /// </summary> /// <param name="args">Arguments to decompiler.</param> /// <returns>0 if sucessful, otherwise 1.</returns> public static int Main(string[] args) { AppCommon.PrepareConsoleForLocalization(); Retina retina = new Retina(); return(retina.Run(args)); }
/// <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> /// Extracts files from a binary Wixlib. /// </summary> public void ExtractBinaryWixlibFiles() { Dictionary <string, string> mapCabinetFileIdToFileName = Retina.GetCabinetFileIdToFileNameMap(this.inputFile); if (0 == mapCabinetFileIdToFileName.Count) { this.messageHandler.Display(this, WixWarnings.NotABinaryWixlib(this.inputFile)); return; } // extract the files using their cabinet names ("0", "1", etc.) using (WixExtractCab extractor = new WixExtractCab()) { extractor.Extract(this.inputFile, Path.GetDirectoryName(this.inputFile)); } // the same file can be authored multiple times in the same Wixlib Dictionary <string, bool> uniqueFiles = new Dictionary <string, bool>(); // rename those files to what was authored foreach (KeyValuePair <string, string> kvp in mapCabinetFileIdToFileName) { string cabinetFileId = Path.Combine(Path.GetDirectoryName(this.inputFile), kvp.Key); string fileName = Path.Combine(Path.GetDirectoryName(this.inputFile), kvp.Value); uniqueFiles[fileName] = true; Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(this.inputFile), Path.GetDirectoryName(fileName))); if (File.Exists(fileName)) { File.Delete(fileName); } File.Move(cabinetFileId, fileName); } foreach (string fileName in uniqueFiles.Keys) { Console.WriteLine(fileName); } }
/// <summary> /// The main entry point for the application. /// </summary> /// <param name="args">Arguments to decompiler.</param> /// <returns>0 if sucessful, otherwise 1.</returns> public static int Main(string[] args) { AppCommon.PrepareConsoleForLocalization(); Retina retina = new Retina(); return retina.Run(args); }