summaryrefslogtreecommitdiff
path: root/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs')
-rw-r--r--src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs55
1 files changed, 25 insertions, 30 deletions
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
index 933afc77..b30ac48a 100644
--- a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
+++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
@@ -84,9 +84,9 @@ namespace WixToolset.Core.Burn.Bundles
84 } 84 }
85 85
86 Directory.CreateDirectory(outputDirectory); 86 Directory.CreateDirectory(outputDirectory);
87 string tempCabPath = Path.Combine(tempDirectory, "ux.cab"); 87 var tempCabPath = Path.Combine(tempDirectory, "ux.cab");
88 string manifestOriginalPath = Path.Combine(outputDirectory, "0"); 88 var manifestOriginalPath = Path.Combine(outputDirectory, "0");
89 string manifestPath = Path.Combine(outputDirectory, "manifest.xml"); 89 var manifestPath = Path.Combine(outputDirectory, "manifest.xml");
90 var uxContainerSlot = this.AttachedContainers[0]; 90 var uxContainerSlot = this.AttachedContainers[0];
91 91
92 this.binaryReader.BaseStream.Seek(this.UXAddress, SeekOrigin.Begin); 92 this.binaryReader.BaseStream.Seek(this.UXAddress, SeekOrigin.Begin);
@@ -101,20 +101,20 @@ namespace WixToolset.Core.Burn.Bundles
101 Directory.CreateDirectory(Path.GetDirectoryName(manifestPath)); 101 Directory.CreateDirectory(Path.GetDirectoryName(manifestPath));
102 FileSystem.MoveFile(manifestOriginalPath, manifestPath); 102 FileSystem.MoveFile(manifestOriginalPath, manifestPath);
103 103
104 XmlDocument document = new XmlDocument(); 104 var document = new XmlDocument();
105 document.Load(manifestPath); 105 document.Load(manifestPath);
106 XmlNamespaceManager namespaceManager = new XmlNamespaceManager(document.NameTable); 106 var namespaceManager = new XmlNamespaceManager(document.NameTable);
107 namespaceManager.AddNamespace("burn", BurnCommon.BurnNamespace); 107 namespaceManager.AddNamespace("burn", BurnCommon.BurnNamespace);
108 XmlNodeList uxPayloads = document.SelectNodes("/burn:BurnManifest/burn:UX/burn:Payload", namespaceManager); 108 var uxPayloads = document.SelectNodes("/burn:BurnManifest/burn:UX/burn:Payload", namespaceManager);
109 XmlNodeList payloads = document.SelectNodes("/burn:BurnManifest/burn:Payload", namespaceManager); 109 var payloads = document.SelectNodes("/burn:BurnManifest/burn:Payload", namespaceManager);
110 110
111 foreach (XmlNode uxPayload in uxPayloads) 111 foreach (XmlNode uxPayload in uxPayloads)
112 { 112 {
113 XmlNode sourcePathNode = uxPayload.Attributes.GetNamedItem("SourcePath"); 113 var sourcePathNode = uxPayload.Attributes.GetNamedItem("SourcePath");
114 XmlNode filePathNode = uxPayload.Attributes.GetNamedItem("FilePath"); 114 var filePathNode = uxPayload.Attributes.GetNamedItem("FilePath");
115 115
116 string sourcePath = Path.Combine(outputDirectory, sourcePathNode.Value); 116 var sourcePath = Path.Combine(outputDirectory, sourcePathNode.Value);
117 string destinationPath = Path.Combine(outputDirectory, filePathNode.Value); 117 var destinationPath = Path.Combine(outputDirectory, filePathNode.Value);
118 118
119 Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); 119 Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));
120 FileSystem.MoveFile(sourcePath, destinationPath); 120 FileSystem.MoveFile(sourcePath, destinationPath);
@@ -122,18 +122,18 @@ namespace WixToolset.Core.Burn.Bundles
122 122
123 foreach (XmlNode payload in payloads) 123 foreach (XmlNode payload in payloads)
124 { 124 {
125 XmlNode packagingNode = payload.Attributes.GetNamedItem("Packaging"); 125 var packagingNode = payload.Attributes.GetNamedItem("Packaging");
126 126
127 string packaging = packagingNode.Value; 127 var packaging = packagingNode.Value;
128 128
129 if (packaging.Equals("embedded", StringComparison.OrdinalIgnoreCase)) 129 if (packaging.Equals("embedded", StringComparison.OrdinalIgnoreCase))
130 { 130 {
131 XmlNode sourcePathNode = payload.Attributes.GetNamedItem("SourcePath"); 131 var sourcePathNode = payload.Attributes.GetNamedItem("SourcePath");
132 XmlNode filePathNode = payload.Attributes.GetNamedItem("FilePath"); 132 var filePathNode = payload.Attributes.GetNamedItem("FilePath");
133 XmlNode containerNode = payload.Attributes.GetNamedItem("Container"); 133 var containerNode = payload.Attributes.GetNamedItem("Container");
134 134
135 string sourcePath = sourcePathNode.Value; 135 var sourcePath = sourcePathNode.Value;
136 string destinationPath = Path.Combine(containerNode.Value, filePathNode.Value); 136 var destinationPath = Path.Combine(containerNode.Value, filePathNode.Value);
137 137
138 this.attachedContainerPayloadNames.Add(new DictionaryEntry(sourcePath, destinationPath)); 138 this.attachedContainerPayloadNames.Add(new DictionaryEntry(sourcePath, destinationPath));
139 } 139 }
@@ -142,11 +142,6 @@ namespace WixToolset.Core.Burn.Bundles
142 return true; 142 return true;
143 } 143 }
144 144
145 internal void ExtractUXContainer(string uxExtractPath, object intermediateFolder)
146 {
147 throw new NotImplementedException();
148 }
149
150 /// <summary> 145 /// <summary>
151 /// Gets each non-UX attached container from the exe and extracts its contents to the output directory. 146 /// Gets each non-UX attached container from the exe and extracts its contents to the output directory.
152 /// </summary> 147 /// </summary>
@@ -167,11 +162,11 @@ namespace WixToolset.Core.Burn.Bundles
167 } 162 }
168 163
169 Directory.CreateDirectory(outputDirectory); 164 Directory.CreateDirectory(outputDirectory);
170 uint nextAddress = this.EngineSize; 165 var nextAddress = this.EngineSize;
171 for (int i = 1; i < this.AttachedContainers.Count; i++) 166 for (var i = 1; i < this.AttachedContainers.Count; i++)
172 { 167 {
173 ContainerSlot cntnr = this.AttachedContainers[i]; 168 var cntnr = this.AttachedContainers[i];
174 string tempCabPath = Path.Combine(tempDirectory, $"a{i}.cab"); 169 var tempCabPath = Path.Combine(tempDirectory, $"a{i}.cab");
175 170
176 this.binaryReader.BaseStream.Seek(nextAddress, SeekOrigin.Begin); 171 this.binaryReader.BaseStream.Seek(nextAddress, SeekOrigin.Begin);
177 using (Stream tempCab = File.Open(tempCabPath, FileMode.Create, FileAccess.Write)) 172 using (Stream tempCab = File.Open(tempCabPath, FileMode.Create, FileAccess.Write))
@@ -185,10 +180,10 @@ namespace WixToolset.Core.Burn.Bundles
185 nextAddress += cntnr.Size; 180 nextAddress += cntnr.Size;
186 } 181 }
187 182
188 foreach (DictionaryEntry entry in this.attachedContainerPayloadNames) 183 foreach (var entry in this.attachedContainerPayloadNames)
189 { 184 {
190 string sourcePath = Path.Combine(outputDirectory, (string)entry.Key); 185 var sourcePath = Path.Combine(outputDirectory, (string)entry.Key);
191 string destinationPath = Path.Combine(outputDirectory, (string)entry.Value); 186 var destinationPath = Path.Combine(outputDirectory, (string)entry.Value);
192 187
193 Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); 188 Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));
194 FileSystem.MoveFile(sourcePath, destinationPath); 189 FileSystem.MoveFile(sourcePath, destinationPath);