From 3d49b0591a6fa2dc88c8df8915959959f81f4471 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Nov 2018 23:43:19 -0700 Subject: Update to DecompileResult move to XDocument Fixes wixtoolset/issues#5896 --- .../Decompile/DecompileMsiOrMsmCommand.cs | 6 +----- src/WixToolset.Core/CommandLine/DecompileCommand.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs index 130f5ea8..80f37eb2 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs @@ -5,7 +5,6 @@ namespace WixToolset.Core.WindowsInstaller.Unbind using System; using System.Collections.Generic; using System.ComponentModel; - using System.Xml.Linq; using WixToolset.Core.Native; using WixToolset.Data; using WixToolset.Extensibility; @@ -40,10 +39,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind var output = unbindCommand.Execute(); var decompiler = new Decompiler(this.Messaging, this.Extensions, this.Context.BaseSourcePath, this.Context.SuppressCustomTables, this.Context.SuppressDroppingEmptyTables, this.Context.SuppressUI, this.Context.TreatProductAsModule); - var wxs = decompiler.Decompile(output); - - wxs.Save(this.Context.OutputPath, SaveOptions.OmitDuplicateNamespaces); - result.SourceDocumentPath = this.Context.OutputPath; + result.Document = decompiler.Decompile(output); // extract the files from the cabinets if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets) diff --git a/src/WixToolset.Core/CommandLine/DecompileCommand.cs b/src/WixToolset.Core/CommandLine/DecompileCommand.cs index 87cead80..3aa750c8 100644 --- a/src/WixToolset.Core/CommandLine/DecompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/DecompileCommand.cs @@ -3,8 +3,8 @@ namespace WixToolset.Core.CommandLine { using System; - using System.Collections.Generic; using System.IO; + using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; @@ -29,10 +29,6 @@ namespace WixToolset.Core.CommandLine public IMessaging Messaging { get; } - private IEnumerable SourceFiles { get; } - - private string OutputPath { get; } - public int Execute() { if (this.commandLine.ShowHelp) @@ -52,6 +48,11 @@ namespace WixToolset.Core.CommandLine { var decompiler = this.ServiceProvider.GetService(); var result = decompiler.Decompile(context); + + if (!this.Messaging.EncounteredError) + { + result.Document.Save(context.OutputPath, SaveOptions.OmitDuplicateNamespaces); + } } catch (WixException e) { -- cgit v1.2.3-55-g6feb