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/ExtractMergeModuleFilesCommand.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/ExtractMergeModuleFilesCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs index a31c8079..e1777246 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs | |||
@@ -15,18 +15,22 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
15 | using WixToolset.Core.Native; | 15 | using WixToolset.Core.Native; |
16 | using WixToolset.Core.Bind; | 16 | using WixToolset.Core.Bind; |
17 | using WixToolset.Data.Tuples; | 17 | using WixToolset.Data.Tuples; |
18 | using WixToolset.Extensibility.Services; | ||
18 | 19 | ||
19 | /// <summary> | 20 | /// <summary> |
20 | /// Retrieve files information and extract them from merge modules. | 21 | /// Retrieve files information and extract them from merge modules. |
21 | /// </summary> | 22 | /// </summary> |
22 | internal class ExtractMergeModuleFilesCommand | 23 | internal class ExtractMergeModuleFilesCommand |
23 | { | 24 | { |
24 | public ExtractMergeModuleFilesCommand(IntermediateSection section, List<WixMergeTuple> wixMergeTuples) | 25 | public ExtractMergeModuleFilesCommand(IMessaging messaging, IntermediateSection section, List<WixMergeTuple> wixMergeTuples) |
25 | { | 26 | { |
27 | this.Messaging = messaging; | ||
26 | this.Section = section; | 28 | this.Section = section; |
27 | this.WixMergeTuples = wixMergeTuples; | 29 | this.WixMergeTuples = wixMergeTuples; |
28 | } | 30 | } |
29 | 31 | ||
32 | private IMessaging Messaging { get; } | ||
33 | |||
30 | private IntermediateSection Section { get; } | 34 | private IntermediateSection Section { get; } |
31 | 35 | ||
32 | private List<WixMergeTuple> WixMergeTuples { get; } | 36 | private List<WixMergeTuple> WixMergeTuples { get; } |
@@ -121,11 +125,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
121 | // If case-sensitive collision with another merge module or a user-authored file identifier. | 125 | // If case-sensitive collision with another merge module or a user-authored file identifier. |
122 | if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.File, out var collidingFacade)) | 126 | if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.File, out var collidingFacade)) |
123 | { | 127 | { |
124 | Messaging.Instance.OnMessage(WixErrors.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, collidingFacade.File.File)); | 128 | this.Messaging.Write(ErrorMessages.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, collidingFacade.File.File)); |
125 | } | 129 | } |
126 | else if (uniqueModuleFileIdentifiers.TryGetValue(mergeModuleFileFacade.File.File, out collidingFacade)) // case-insensitive collision with another file identifier in the same merge module | 130 | else if (uniqueModuleFileIdentifiers.TryGetValue(mergeModuleFileFacade.File.File, out collidingFacade)) // case-insensitive collision with another file identifier in the same merge module |
127 | { | 131 | { |
128 | Messaging.Instance.OnMessage(WixErrors.DuplicateModuleCaseInsensitiveFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, mergeModuleFileFacade.File.File, collidingFacade.File.File)); | 132 | this.Messaging.Write(ErrorMessages.DuplicateModuleCaseInsensitiveFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, mergeModuleFileFacade.File.File, collidingFacade.File.File)); |
129 | } | 133 | } |
130 | else // no collision | 134 | else // no collision |
131 | { | 135 | { |
@@ -152,23 +156,23 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
152 | int moduleInstallerVersion = Convert.ToInt32(moduleInstallerVersionString, CultureInfo.InvariantCulture); | 156 | int moduleInstallerVersion = Convert.ToInt32(moduleInstallerVersionString, CultureInfo.InvariantCulture); |
153 | if (moduleInstallerVersion > this.OutputInstallerVersion) | 157 | if (moduleInstallerVersion > this.OutputInstallerVersion) |
154 | { | 158 | { |
155 | Messaging.Instance.OnMessage(WixWarnings.InvalidHigherInstallerVersionInModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, moduleInstallerVersion, this.OutputInstallerVersion)); | 159 | this.Messaging.Write(WarningMessages.InvalidHigherInstallerVersionInModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, moduleInstallerVersion, this.OutputInstallerVersion)); |
156 | } | 160 | } |
157 | } | 161 | } |
158 | catch (FormatException) | 162 | catch (FormatException) |
159 | { | 163 | { |
160 | throw new WixException(WixErrors.MissingOrInvalidModuleInstallerVersion(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, wixMergeRow.SourceFile, moduleInstallerVersionString)); | 164 | throw new WixException(ErrorMessages.MissingOrInvalidModuleInstallerVersion(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, wixMergeRow.SourceFile, moduleInstallerVersionString)); |
161 | } | 165 | } |
162 | } | 166 | } |
163 | } | 167 | } |
164 | } | 168 | } |
165 | catch (FileNotFoundException) | 169 | catch (FileNotFoundException) |
166 | { | 170 | { |
167 | throw new WixException(WixErrors.FileNotFound(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile)); | 171 | throw new WixException(ErrorMessages.FileNotFound(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile)); |
168 | } | 172 | } |
169 | catch (Win32Exception) | 173 | catch (Win32Exception) |
170 | { | 174 | { |
171 | throw new WixException(WixErrors.CannotOpenMergeModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, wixMergeRow.SourceFile)); | 175 | throw new WixException(ErrorMessages.CannotOpenMergeModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, wixMergeRow.SourceFile)); |
172 | } | 176 | } |
173 | 177 | ||
174 | return containsFiles; | 178 | return containsFiles; |
@@ -187,7 +191,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
187 | } | 191 | } |
188 | catch (FormatException) | 192 | catch (FormatException) |
189 | { | 193 | { |
190 | Messaging.Instance.OnMessage(WixErrors.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, mergeId, wixMergeRow.Language.ToString())); | 194 | this.Messaging.Write(ErrorMessages.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, mergeId, wixMergeRow.Language.ToString())); |
191 | return; | 195 | return; |
192 | } | 196 | } |
193 | 197 | ||
@@ -210,16 +214,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
210 | } | 214 | } |
211 | catch (FileNotFoundException) | 215 | catch (FileNotFoundException) |
212 | { | 216 | { |
213 | throw new WixException(WixErrors.CabFileDoesNotExist(moduleCabPath, wixMergeRow.SourceFile, mergeIdPath)); | 217 | throw new WixException(ErrorMessages.CabFileDoesNotExist(moduleCabPath, wixMergeRow.SourceFile, mergeIdPath)); |
214 | } | 218 | } |
215 | catch | 219 | catch |
216 | { | 220 | { |
217 | throw new WixException(WixErrors.CabExtractionFailed(moduleCabPath, wixMergeRow.SourceFile, mergeIdPath)); | 221 | throw new WixException(ErrorMessages.CabExtractionFailed(moduleCabPath, wixMergeRow.SourceFile, mergeIdPath)); |
218 | } | 222 | } |
219 | } | 223 | } |
220 | catch (COMException ce) | 224 | catch (COMException ce) |
221 | { | 225 | { |
222 | throw new WixException(WixErrors.UnableToOpenModule(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile, ce.Message)); | 226 | throw new WixException(ErrorMessages.UnableToOpenModule(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile, ce.Message)); |
223 | } | 227 | } |
224 | finally | 228 | finally |
225 | { | 229 | { |