diff options
author | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
commit | 155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch) | |
tree | 59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs | |
parent | 6f1665ed759b31bd095f186f9239232c653597cd (diff) | |
download | wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2 wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip |
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs index fde781a3..0c167699 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs | |||
@@ -4,13 +4,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections; | 6 | using System.Collections; |
7 | using System.Collections.Generic; | ||
8 | using System.IO; | 7 | using System.IO; |
9 | using System.Linq; | 8 | using System.Linq; |
10 | using System.Threading; | 9 | using System.Threading; |
11 | using WixToolset.Core.Bind; | 10 | using WixToolset.Core.Bind; |
12 | using WixToolset.Core.Native; | 11 | using WixToolset.Core.Native; |
13 | using WixToolset.Data; | 12 | using WixToolset.Data; |
13 | using WixToolset.Extensibility.Services; | ||
14 | 14 | ||
15 | /// <summary> | 15 | /// <summary> |
16 | /// Builds cabinets using multiple threads. This implements a thread pool that generates cabinets with multiple | 16 | /// Builds cabinets using multiple threads. This implements a thread pool that generates cabinets with multiple |
@@ -25,16 +25,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
25 | // Address of Binder's callback function for Cabinet Splitting | 25 | // Address of Binder's callback function for Cabinet Splitting |
26 | private IntPtr newCabNamesCallBackAddress; | 26 | private IntPtr newCabNamesCallBackAddress; |
27 | 27 | ||
28 | public int MaximumCabinetSizeForLargeFileSplitting { get; set; } | ||
29 | |||
30 | public int MaximumUncompressedMediaSize { get; set; } | ||
31 | |||
32 | /// <summary> | 28 | /// <summary> |
33 | /// Instantiate a new CabinetBuilder. | 29 | /// Instantiate a new CabinetBuilder. |
34 | /// </summary> | 30 | /// </summary> |
35 | /// <param name="threadCount">number of threads to use</param> | 31 | /// <param name="threadCount">number of threads to use</param> |
36 | /// <param name="newCabNamesCallBackAddress">Address of Binder's callback function for Cabinet Splitting</param> | 32 | /// <param name="newCabNamesCallBackAddress">Address of Binder's callback function for Cabinet Splitting</param> |
37 | public CabinetBuilder(int threadCount, IntPtr newCabNamesCallBackAddress) | 33 | public CabinetBuilder(IMessaging messaging, int threadCount, IntPtr newCabNamesCallBackAddress) |
38 | { | 34 | { |
39 | if (0 >= threadCount) | 35 | if (0 >= threadCount) |
40 | { | 36 | { |
@@ -43,13 +39,19 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
43 | 39 | ||
44 | this.cabinetWorkItems = new Queue(); | 40 | this.cabinetWorkItems = new Queue(); |
45 | this.lockObject = new object(); | 41 | this.lockObject = new object(); |
46 | 42 | this.Messaging = messaging; | |
47 | this.threadCount = threadCount; | 43 | this.threadCount = threadCount; |
48 | 44 | ||
49 | // Set Address of Binder's callback function for Cabinet Splitting | 45 | // Set Address of Binder's callback function for Cabinet Splitting |
50 | this.newCabNamesCallBackAddress = newCabNamesCallBackAddress; | 46 | this.newCabNamesCallBackAddress = newCabNamesCallBackAddress; |
51 | } | 47 | } |
52 | 48 | ||
49 | private IMessaging Messaging { get; } | ||
50 | |||
51 | public int MaximumCabinetSizeForLargeFileSplitting { get; set; } | ||
52 | |||
53 | public int MaximumUncompressedMediaSize { get; set; } | ||
54 | |||
53 | /// <summary> | 55 | /// <summary> |
54 | /// Enqueues a CabinetWorkItem to the queue. | 56 | /// Enqueues a CabinetWorkItem to the queue. |
55 | /// </summary> | 57 | /// </summary> |
@@ -119,11 +121,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
119 | } | 121 | } |
120 | catch (WixException we) | 122 | catch (WixException we) |
121 | { | 123 | { |
122 | Messaging.Instance.OnMessage(we.Error); | 124 | this.Messaging.Write(we.Error); |
123 | } | 125 | } |
124 | catch (Exception e) | 126 | catch (Exception e) |
125 | { | 127 | { |
126 | Messaging.Instance.OnMessage(WixErrors.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace)); | 128 | this.Messaging.Write(ErrorMessages.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace)); |
127 | } | 129 | } |
128 | } | 130 | } |
129 | 131 | ||
@@ -133,7 +135,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
133 | /// <param name="cabinetWorkItem">CabinetWorkItem containing information about the cabinet to create.</param> | 135 | /// <param name="cabinetWorkItem">CabinetWorkItem containing information about the cabinet to create.</param> |
134 | private void CreateCabinet(CabinetWorkItem cabinetWorkItem) | 136 | private void CreateCabinet(CabinetWorkItem cabinetWorkItem) |
135 | { | 137 | { |
136 | Messaging.Instance.OnMessage(WixVerboses.CreateCabinet(cabinetWorkItem.CabinetFile)); | 138 | this.Messaging.Write(VerboseMessages.CreateCabinet(cabinetWorkItem.CabinetFile)); |
137 | 139 | ||
138 | int maxCabinetSize = 0; // The value of 0 corresponds to default of 2GB which means no cabinet splitting | 140 | int maxCabinetSize = 0; // The value of 0 corresponds to default of 2GB which means no cabinet splitting |
139 | ulong maxPreCompressedSizeInBytes = 0; | 141 | ulong maxPreCompressedSizeInBytes = 0; |