diff options
Diffstat (limited to 'src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs')
-rw-r--r-- | src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs index 5b06b31e..e3fd9f51 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs | |||
@@ -126,16 +126,19 @@ namespace WixToolset.Core.Burn.Bundles | |||
126 | 126 | ||
127 | foreach (XmlNode payload in payloads) | 127 | foreach (XmlNode payload in payloads) |
128 | { | 128 | { |
129 | XmlNode sourcePathNode = payload.Attributes.GetNamedItem("SourcePath"); | ||
130 | XmlNode filePathNode = payload.Attributes.GetNamedItem("FilePath"); | ||
131 | XmlNode packagingNode = payload.Attributes.GetNamedItem("Packaging"); | 129 | XmlNode packagingNode = payload.Attributes.GetNamedItem("Packaging"); |
132 | 130 | ||
133 | string sourcePath = sourcePathNode.Value; | ||
134 | string destinationPath = filePathNode.Value; | ||
135 | string packaging = packagingNode.Value; | 131 | string packaging = packagingNode.Value; |
136 | 132 | ||
137 | if (packaging.Equals("embedded", StringComparison.OrdinalIgnoreCase)) | 133 | if (packaging.Equals("embedded", StringComparison.OrdinalIgnoreCase)) |
138 | { | 134 | { |
135 | XmlNode sourcePathNode = payload.Attributes.GetNamedItem("SourcePath"); | ||
136 | XmlNode filePathNode = payload.Attributes.GetNamedItem("FilePath"); | ||
137 | XmlNode containerNode = payload.Attributes.GetNamedItem("Container"); | ||
138 | |||
139 | string sourcePath = sourcePathNode.Value; | ||
140 | string destinationPath = Path.Combine(containerNode.Value, filePathNode.Value); | ||
141 | |||
139 | this.attachedContainerPayloadNames.Add(new DictionaryEntry(sourcePath, destinationPath)); | 142 | this.attachedContainerPayloadNames.Add(new DictionaryEntry(sourcePath, destinationPath)); |
140 | } | 143 | } |
141 | } | 144 | } |
@@ -152,12 +155,11 @@ namespace WixToolset.Core.Burn.Bundles | |||
152 | /// Gets the attached container from the exe and extracts its contents to the output directory. | 155 | /// Gets the attached container from the exe and extracts its contents to the output directory. |
153 | /// </summary> | 156 | /// </summary> |
154 | /// <param name="outputDirectory">Directory to write extracted files to.</param> | 157 | /// <param name="outputDirectory">Directory to write extracted files to.</param> |
155 | /// <param name="tempDirectory">Scratch directory.</param> | ||
156 | /// <returns>True if successful, false otherwise</returns> | 158 | /// <returns>True if successful, false otherwise</returns> |
157 | public bool ExtractAttachedContainer(string outputDirectory, string tempDirectory) | 159 | public bool ExtractAttachedContainers(string outputDirectory) |
158 | { | 160 | { |
159 | // No attached container to extract | 161 | // No attached container to extract |
160 | if (this.AttachedContainerAddress == 0 || this.AttachedContainerSize == 0) | 162 | if (this.AttachedContainers.Count == 0) |
161 | { | 163 | { |
162 | return false; | 164 | return false; |
163 | } | 165 | } |
@@ -168,16 +170,19 @@ namespace WixToolset.Core.Burn.Bundles | |||
168 | } | 170 | } |
169 | 171 | ||
170 | Directory.CreateDirectory(outputDirectory); | 172 | Directory.CreateDirectory(outputDirectory); |
171 | string tempCabPath = Path.Combine(tempDirectory, "attached.cab"); | 173 | foreach (ContainerSlot cntnr in this.AttachedContainers) |
172 | |||
173 | this.binaryReader.BaseStream.Seek(this.AttachedContainerAddress, SeekOrigin.Begin); | ||
174 | using (Stream tempCab = File.Open(tempCabPath, FileMode.Create, FileAccess.Write)) | ||
175 | { | 174 | { |
176 | BurnCommon.CopyStream(this.binaryReader.BaseStream, tempCab, (int)this.AttachedContainerSize); | 175 | string tempCabPath = Path.GetTempFileName(); |
177 | } | ||
178 | 176 | ||
179 | var cabinet = new Cabinet(tempCabPath); | 177 | this.binaryReader.BaseStream.Seek(cntnr.Address, SeekOrigin.Begin); |
180 | cabinet.Extract(outputDirectory); | 178 | using (Stream tempCab = File.Open(tempCabPath, FileMode.Create, FileAccess.Write)) |
179 | { | ||
180 | BurnCommon.CopyStream(this.binaryReader.BaseStream, tempCab, (int)cntnr.Size); | ||
181 | } | ||
182 | |||
183 | var cabinet = new Cabinet(tempCabPath); | ||
184 | cabinet.Extract(outputDirectory); | ||
185 | } | ||
181 | 186 | ||
182 | foreach (DictionaryEntry entry in this.attachedContainerPayloadNames) | 187 | foreach (DictionaryEntry entry in this.attachedContainerPayloadNames) |
183 | { | 188 | { |