aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2020-02-10 14:10:51 -0500
committerBob Arnson <bob@firegiant.com>2020-02-10 14:12:44 -0500
commita85f2e992a301abe5d2c0d58f07e7bc9692ff6e3 (patch)
tree3b732aaa25ed12032151d91dbe8403bb9a22ff44
parenta482589448fb6e0f7abc1c725c49c65344c83509 (diff)
downloadwix-a85f2e992a301abe5d2c0d58f07e7bc9692ff6e3.tar.gz
wix-a85f2e992a301abe5d2c0d58f07e7bc9692ff6e3.tar.bz2
wix-a85f2e992a301abe5d2c0d58f07e7bc9692ff6e3.zip
Support loading WindowsInstallerData and Intermediate from WixOutput.
-rw-r--r--src/WixToolset.Data/Intermediate.cs25
-rw-r--r--src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs23
2 files changed, 43 insertions, 5 deletions
diff --git a/src/WixToolset.Data/Intermediate.cs b/src/WixToolset.Data/Intermediate.cs
index 1db21d85..7fc7d6c3 100644
--- a/src/WixToolset.Data/Intermediate.cs
+++ b/src/WixToolset.Data/Intermediate.cs
@@ -108,6 +108,31 @@ namespace WixToolset.Data
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// Loads an intermediate from a WixOutput object.
112 /// </summary>
113 /// <param name="wixOutput">WixOutput object.</param>
114 /// <param name="creator">ITupleDefinitionCreator to use when reconstituting the intermediate.</param>
115 /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
116 /// <returns>Returns the loaded intermediate.</returns>
117 public static Intermediate Load(WixOutput wixOutput, bool suppressVersionCheck = false)
118 {
119 var creator = new SimpleTupleDefinitionCreator();
120 return Intermediate.LoadIntermediate(wixOutput, creator, suppressVersionCheck);
121 }
122
123 /// <summary>
124 /// Loads an intermediate from a WixOutput object.
125 /// </summary>
126 /// <param name="wixOutput">WixOutput object.</param>
127 /// <param name="creator">ITupleDefinitionCreator to use when reconstituting the intermediate.</param>
128 /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
129 /// <returns>Returns the loaded intermediate.</returns>
130 public static Intermediate Load(WixOutput wixOutput, ITupleDefinitionCreator creator, bool suppressVersionCheck = false)
131 {
132 return Intermediate.LoadIntermediate(wixOutput, creator, suppressVersionCheck);
133 }
134
135 /// <summary>
111 /// Loads several intermediates from paths on disk using the same definitions. 136 /// Loads several intermediates from paths on disk using the same definitions.
112 /// </summary> 137 /// </summary>
113 /// <param name="intermediateFiles">Paths to intermediate files saved on disk.</param> 138 /// <param name="intermediateFiles">Paths to intermediate files saved on disk.</param>
diff --git a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
index ac593152..43c19d69 100644
--- a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
+++ b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
@@ -102,11 +102,24 @@ namespace WixToolset.Data.WindowsInstaller
102 /// <param name="path">Path to output file saved on disk.</param> 102 /// <param name="path">Path to output file saved on disk.</param>
103 /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param> 103 /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
104 /// <returns>Output object.</returns> 104 /// <returns>Output object.</returns>
105 public static WindowsInstallerData Load(string path, bool suppressVersionCheck) 105 public static WindowsInstallerData Load(string path, bool suppressVersionCheck = false)
106 { 106 {
107 using (var wixout = WixOutput.Read(path)) 107 using (var wixOutput = WixOutput.Read(path))
108 using (var stream = wixout.GetDataStream(WixOutputStreamName)) 108 {
109 using (var reader = XmlReader.Create(stream, null, wixout.Uri.AbsoluteUri)) 109 return WindowsInstallerData.Load(wixOutput, suppressVersionCheck);
110 }
111 }
112
113 /// <summary>
114 /// Loads an output from a WixOutput object.
115 /// </summary>
116 /// <param name="wixOutput">WixOutput object.</param>
117 /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
118 /// <returns>Output object.</returns>
119 public static WindowsInstallerData Load(WixOutput wixOutput, bool suppressVersionCheck = false)
120 {
121 using (var stream = wixOutput.GetDataStream(WixOutputStreamName))
122 using (var reader = XmlReader.Create(stream, null, wixOutput.Uri.AbsoluteUri))
110 { 123 {
111 try 124 try
112 { 125 {
@@ -115,7 +128,7 @@ namespace WixToolset.Data.WindowsInstaller
115 } 128 }
116 catch (XmlException xe) 129 catch (XmlException xe)
117 { 130 {
118 throw new WixCorruptFileException(path, "wixout", xe); 131 throw new WixCorruptFileException(wixOutput.Uri.AbsoluteUri, "wixout", xe);
119 } 132 }
120 } 133 }
121 } 134 }