public Intermediate Execute() { #if TODO_PATCHING Output output; try { using (Database database = new Database(this.Context.InputFilePath, OpenDatabase.ReadOnly)) { var unbindCommand = new UnbindDatabaseCommand(this.Context.Messaging, database, this.Context.InputFilePath, OutputType.Product, this.Context.ExportBasePath, this.Context.IntermediateFolder, this.Context.IsAdminImage, this.Context.SuppressDemodularization, skipSummaryInfo: false); output = unbindCommand.Execute(); // extract the files from the cabinets if (!String.IsNullOrEmpty(this.Context.ExportBasePath) && !this.Context.SuppressExtractCabinets) { var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.InputFilePath, this.Context.ExportBasePath, this.Context.IntermediateFolder); extractCommand.Execute(); } } } catch (Win32Exception e) { if (0x6E == e.NativeErrorCode) // ERROR_OPEN_FAILED { throw new WixException(WixErrors.OpenDatabaseFailed(this.Context.InputFilePath)); } throw; } return(output); #endif throw new NotImplementedException(); }
public IDecompileResult Execute() { var result = this.Context.ServiceProvider.GetService <IDecompileResult>(); try { using (var database = new Database(this.Context.DecompilePath, OpenDatabase.ReadOnly)) { // Delete the directory and its files to prevent cab extraction failure due to an existing file. if (Directory.Exists(this.Context.ExtractFolder)) { Directory.Delete(this.Context.ExtractFolder, true); } var unbindCommand = new UnbindDatabaseCommand(this.Messaging, database, this.Context.DecompilePath, this.Context.DecompileType, this.Context.ExtractFolder, this.Context.IntermediateFolder, this.Context.IsAdminImage, suppressDemodularization: false, skipSummaryInfo: false); var output = unbindCommand.Execute(); var extractedFilePaths = new List <string>(unbindCommand.ExportedFiles); var decompiler = new Decompiler(this.Messaging, this.Extensions, this.Context.BaseSourcePath, this.Context.SuppressCustomTables, this.Context.SuppressDroppingEmptyTables, this.Context.SuppressUI, this.Context.TreatProductAsModule); result.Document = decompiler.Decompile(output); result.Platform = GetPlatformFromOutput(output); // extract the files from the cabinets if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets) { var fileDirectory = String.IsNullOrEmpty(this.Context.CabinetExtractFolder) ? Path.Combine(this.Context.ExtractFolder, "File") : this.Context.CabinetExtractFolder; var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, fileDirectory, this.Context.IntermediateFolder, this.Context.TreatProductAsModule); extractCommand.Execute(); extractedFilePaths.AddRange(extractCommand.ExtractedFiles); result.ExtractedFilePaths = extractedFilePaths; } else { result.ExtractedFilePaths = new string[0]; } } } catch (Win32Exception e) { if (0x6E == e.NativeErrorCode) // ERROR_OPEN_FAILED { throw new WixException(ErrorMessages.OpenDatabaseFailed(this.Context.DecompilePath)); } throw; } return(result); }