aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
index f1605eca..dcf67c05 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
@@ -1,20 +1,13 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller.Databases 3namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Collections.Specialized;
8 using System.ComponentModel;
9 using System.Diagnostics;
10 using System.Globalization; 7 using System.Globalization;
11 using System.IO; 8 using System.IO;
12 using System.Linq;
13 using System.Runtime.InteropServices; 9 using System.Runtime.InteropServices;
14 using System.Text; 10 using System.Text;
15 using System.Xml;
16 using System.Xml.XPath;
17 using WixToolset.Clr.Interop;
18 using WixToolset.Data; 11 using WixToolset.Data;
19 using WixToolset.Data.Rows; 12 using WixToolset.Data.Rows;
20 using WixToolset.MergeMod; 13 using WixToolset.MergeMod;
@@ -35,12 +28,10 @@ namespace WixToolset.Core.WindowsInstaller.Databases
35 28
36 public IEnumerable<string> SuppressedTableNames { private get; set; } 29 public IEnumerable<string> SuppressedTableNames { private get; set; }
37 30
38 public string TempFilesLocation { private get; set; } 31 public string IntermediateFolder { private get; set; }
39 32
40 public void Execute() 33 public void Execute()
41 { 34 {
42 Debug.Assert(OutputType.Product == this.Output.Type);
43
44 Table wixMergeTable = this.Output.Tables["WixMerge"]; 35 Table wixMergeTable = this.Output.Tables["WixMerge"];
45 Table wixFeatureModulesTable = this.Output.Tables["WixFeatureModules"]; 36 Table wixFeatureModulesTable = this.Output.Tables["WixFeatureModules"];
46 37
@@ -59,7 +50,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases
59 { 50 {
60 merge = MsmInterop.GetMsmMerge(); 51 merge = MsmInterop.GetMsmMerge();
61 52
62 logPath = Path.Combine(this.TempFilesLocation, "merge.log"); 53 logPath = Path.Combine(this.IntermediateFolder, "merge.log");
63 merge.OpenLog(logPath); 54 merge.OpenLog(logPath);
64 logOpen = true; 55 logOpen = true;
65 56
@@ -79,7 +70,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases
79 { 70 {
80 mergeLanguage = Convert.ToInt16(wixMergeRow.Language, CultureInfo.InvariantCulture); 71 mergeLanguage = Convert.ToInt16(wixMergeRow.Language, CultureInfo.InvariantCulture);
81 } 72 }
82 catch (System.FormatException) 73 catch (FormatException)
83 { 74 {
84 Messaging.Instance.OnMessage(WixErrors.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, wixMergeRow.Language)); 75 Messaging.Instance.OnMessage(WixErrors.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, wixMergeRow.Language));
85 continue; 76 continue;
@@ -284,7 +275,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases
284 Messaging.Instance.OnMessage(WixVerboses.ResequencingMergeModuleFiles()); 275 Messaging.Instance.OnMessage(WixVerboses.ResequencingMergeModuleFiles());
285 using (View view = db.OpenView("SELECT `Sequence`, `Attributes` FROM `File` WHERE `File`=?")) 276 using (View view = db.OpenView("SELECT `Sequence`, `Attributes` FROM `File` WHERE `File`=?"))
286 { 277 {
287 foreach (FileFacade file in this.FileFacades) 278 foreach (var file in this.FileFacades)
288 { 279 {
289 if (!file.FromModule) 280 if (!file.FromModule)
290 { 281 {
@@ -307,32 +298,29 @@ namespace WixToolset.Core.WindowsInstaller.Databases
307 //recordUpdate.SetInteger(1, file.File.Sequence); 298 //recordUpdate.SetInteger(1, file.File.Sequence);
308 throw new NotImplementedException(); 299 throw new NotImplementedException();
309 300
310 // update the file attributes to match the compression specified 301 // Update the file attributes to match the compression specified
311 // on the Merge element or on the Package element 302 // on the Merge element or on the Package element.
312 int attributes = 0; 303 var attributes = 0;
313 304
314 // get the current value if its not null 305 // Get the current value if its not null.
315 if (!recordUpdate.IsNull(2)) 306 if (!recordUpdate.IsNull(2))
316 { 307 {
317 attributes = recordUpdate.GetInteger(2); 308 attributes = recordUpdate.GetInteger(2);
318 } 309 }
319 310
320 // not specified
321 if (!file.File.Compressed.HasValue) 311 if (!file.File.Compressed.HasValue)
322 { 312 {
323 // clear any compression bits 313 // Clear all compression bits.
324 attributes &= ~MsiInterop.MsidbFileAttributesCompressed; 314 attributes &= ~MsiInterop.MsidbFileAttributesCompressed;
325 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; 315 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed;
326 } 316 }
327 else if (file.File.Compressed.Value) 317 else if (file.File.Compressed.Value)
328 { 318 {
329 // these are mutually exclusive
330 attributes |= MsiInterop.MsidbFileAttributesCompressed; 319 attributes |= MsiInterop.MsidbFileAttributesCompressed;
331 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; 320 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed;
332 } 321 }
333 else if (!file.File.Compressed.Value) 322 else if (!file.File.Compressed.Value)
334 { 323 {
335 // these are mutually exclusive
336 attributes |= MsiInterop.MsidbFileAttributesNoncompressed; 324 attributes |= MsiInterop.MsidbFileAttributesNoncompressed;
337 attributes &= ~MsiInterop.MsidbFileAttributesCompressed; 325 attributes &= ~MsiInterop.MsidbFileAttributesCompressed;
338 } 326 }