aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.TestPackage/BundleExtractor.cs
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-03-26 15:21:06 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-03-30 21:30:04 +1000
commitafbc6889c73d58136cb8851858ca3c17f41dc2c5 (patch)
tree1d7c66218176c7e8a28d49a4e22c60fe1e4e4c0d /src/WixToolset.Core.TestPackage/BundleExtractor.cs
parent192c5aa59b5d8e5e9df9095982317c224f3d4f04 (diff)
downloadwix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.tar.gz
wix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.tar.bz2
wix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.zip
Add BundleExtension element.
Add GetTestXml. Fix issue with building with current version of burn.
Diffstat (limited to 'src/WixToolset.Core.TestPackage/BundleExtractor.cs')
-rw-r--r--src/WixToolset.Core.TestPackage/BundleExtractor.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/WixToolset.Core.TestPackage/BundleExtractor.cs b/src/WixToolset.Core.TestPackage/BundleExtractor.cs
new file mode 100644
index 00000000..3d7b2932
--- /dev/null
+++ b/src/WixToolset.Core.TestPackage/BundleExtractor.cs
@@ -0,0 +1,44 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset.Core.TestPackage
4{
5 using System.IO;
6 using System.Xml;
7 using WixToolset.Core.Burn.Bundles;
8 using WixToolset.Extensibility.Services;
9
10 public class BundleExtractor
11 {
12 public static ExtractBAContainerResult ExtractBAContainer(IMessaging messaging, string bundleFilePath, string destinationFolderPath, string tempFolderPath)
13 {
14 var result = new ExtractBAContainerResult();
15 Directory.CreateDirectory(tempFolderPath);
16 using (var burnReader = BurnReader.Open(messaging, bundleFilePath))
17 {
18 result.Success = burnReader.ExtractUXContainer(destinationFolderPath, tempFolderPath);
19 }
20
21 if (result.Success)
22 {
23 result.ManifestDocument = LoadBurnManifest(destinationFolderPath);
24 result.ManifestNamespaceManager = GetBurnNamespaceManager(result.ManifestDocument, "burn");
25 }
26
27 return result;
28 }
29
30 public static XmlNamespaceManager GetBurnNamespaceManager(XmlDocument document, string prefix)
31 {
32 var namespaceManager = new XmlNamespaceManager(document.NameTable);
33 namespaceManager.AddNamespace(prefix, BurnCommon.BurnNamespace);
34 return namespaceManager;
35 }
36
37 public static XmlDocument LoadBurnManifest(string baFolderPath)
38 {
39 var document = new XmlDocument();
40 document.Load(Path.Combine(baFolderPath, "manifest.xml"));
41 return document;
42 }
43 }
44}