aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-19 12:25:40 -0800
committerRob Mensching <rob@firegiant.com>2017-12-19 12:25:40 -0800
commit155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch)
tree59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
parent6f1665ed759b31bd095f186f9239232c653597cd (diff)
downloadwix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz
wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2
wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
index 32a05d93..8d1edb41 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
@@ -13,6 +13,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
13 using WixToolset.Data; 13 using WixToolset.Data;
14 using WixToolset.Data.WindowsInstaller; 14 using WixToolset.Data.WindowsInstaller;
15 using WixToolset.Data.WindowsInstaller.Rows; 15 using WixToolset.Data.WindowsInstaller.Rows;
16 using WixToolset.Extensibility.Services;
16 using WixToolset.MergeMod; 17 using WixToolset.MergeMod;
17 using WixToolset.Msi; 18 using WixToolset.Msi;
18 19
@@ -23,6 +24,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
23 { 24 {
24 public IEnumerable<FileFacade> FileFacades { private get; set; } 25 public IEnumerable<FileFacade> FileFacades { private get; set; }
25 26
27 public IMessaging Messaging { private get; set; }
28
26 public Output Output { private get; set; } 29 public Output Output { private get; set; }
27 30
28 public string OutputPath { private get; set; } 31 public string OutputPath { private get; set; }
@@ -73,11 +76,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
73 } 76 }
74 catch (FormatException) 77 catch (FormatException)
75 { 78 {
76 Messaging.Instance.OnMessage(WixErrors.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, wixMergeRow.Language)); 79 this.Messaging.Write(ErrorMessages.InvalidMergeLanguage(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, wixMergeRow.Language));
77 continue; 80 continue;
78 } 81 }
79 82
80 Messaging.Instance.OnMessage(WixVerboses.OpeningMergeModule(wixMergeRow.SourceFile, mergeLanguage)); 83 this.Messaging.Write(VerboseMessages.OpeningMergeModule(wixMergeRow.SourceFile, mergeLanguage));
81 merge.OpenModule(wixMergeRow.SourceFile, mergeLanguage); 84 merge.OpenModule(wixMergeRow.SourceFile, mergeLanguage);
82 moduleOpen = true; 85 moduleOpen = true;
83 86
@@ -89,7 +92,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
89 } 92 }
90 93
91 // merge the module into the database that's being built 94 // merge the module into the database that's being built
92 Messaging.Instance.OnMessage(WixVerboses.MergingMergeModule(wixMergeRow.SourceFile)); 95 this.Messaging.Write(VerboseMessages.MergingMergeModule(wixMergeRow.SourceFile));
93 merge.MergeEx(wixMergeRow.Feature, wixMergeRow.Directory, callback); 96 merge.MergeEx(wixMergeRow.Feature, wixMergeRow.Directory, callback);
94 97
95 // connect any non-primary features 98 // connect any non-primary features
@@ -99,7 +102,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
99 { 102 {
100 if (wixMergeRow.Id == (string)row[1]) 103 if (wixMergeRow.Id == (string)row[1])
101 { 104 {
102 Messaging.Instance.OnMessage(WixVerboses.ConnectingMergeModule(wixMergeRow.SourceFile, (string)row[0])); 105 this.Messaging.Write(VerboseMessages.ConnectingMergeModule(wixMergeRow.SourceFile, (string)row[0]));
103 merge.Connect((string)row[0]); 106 merge.Connect((string)row[0]);
104 } 107 }
105 } 108 }
@@ -144,38 +147,38 @@ namespace WixToolset.Core.WindowsInstaller.Bind
144 switch (mergeError.Type) 147 switch (mergeError.Type)
145 { 148 {
146 case MsmErrorType.msmErrorExclusion: 149 case MsmErrorType.msmErrorExclusion:
147 Messaging.Instance.OnMessage(WixErrors.MergeExcludedModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, moduleKeys.ToString())); 150 this.Messaging.Write(ErrorMessages.MergeExcludedModule(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, moduleKeys.ToString()));
148 break; 151 break;
149 case MsmErrorType.msmErrorFeatureRequired: 152 case MsmErrorType.msmErrorFeatureRequired:
150 Messaging.Instance.OnMessage(WixErrors.MergeFeatureRequired(wixMergeRow.SourceLineNumbers, mergeError.ModuleTable, moduleKeys.ToString(), wixMergeRow.SourceFile, wixMergeRow.Id)); 153 this.Messaging.Write(ErrorMessages.MergeFeatureRequired(wixMergeRow.SourceLineNumbers, mergeError.ModuleTable, moduleKeys.ToString(), wixMergeRow.SourceFile, wixMergeRow.Id));
151 break; 154 break;
152 case MsmErrorType.msmErrorLanguageFailed: 155 case MsmErrorType.msmErrorLanguageFailed:
153 Messaging.Instance.OnMessage(WixErrors.MergeLanguageFailed(wixMergeRow.SourceLineNumbers, mergeError.Language, wixMergeRow.SourceFile)); 156 this.Messaging.Write(ErrorMessages.MergeLanguageFailed(wixMergeRow.SourceLineNumbers, mergeError.Language, wixMergeRow.SourceFile));
154 break; 157 break;
155 case MsmErrorType.msmErrorLanguageUnsupported: 158 case MsmErrorType.msmErrorLanguageUnsupported:
156 Messaging.Instance.OnMessage(WixErrors.MergeLanguageUnsupported(wixMergeRow.SourceLineNumbers, mergeError.Language, wixMergeRow.SourceFile)); 159 this.Messaging.Write(ErrorMessages.MergeLanguageUnsupported(wixMergeRow.SourceLineNumbers, mergeError.Language, wixMergeRow.SourceFile));
157 break; 160 break;
158 case MsmErrorType.msmErrorResequenceMerge: 161 case MsmErrorType.msmErrorResequenceMerge:
159 Messaging.Instance.OnMessage(WixWarnings.MergeRescheduledAction(wixMergeRow.SourceLineNumbers, mergeError.DatabaseTable, databaseKeys.ToString(), wixMergeRow.SourceFile)); 162 this.Messaging.Write(WarningMessages.MergeRescheduledAction(wixMergeRow.SourceLineNumbers, mergeError.DatabaseTable, databaseKeys.ToString(), wixMergeRow.SourceFile));
160 break; 163 break;
161 case MsmErrorType.msmErrorTableMerge: 164 case MsmErrorType.msmErrorTableMerge:
162 if ("_Validation" != mergeError.DatabaseTable) // ignore merge errors in the _Validation table 165 if ("_Validation" != mergeError.DatabaseTable) // ignore merge errors in the _Validation table
163 { 166 {
164 Messaging.Instance.OnMessage(WixWarnings.MergeTableFailed(wixMergeRow.SourceLineNumbers, mergeError.DatabaseTable, databaseKeys.ToString(), wixMergeRow.SourceFile)); 167 this.Messaging.Write(WarningMessages.MergeTableFailed(wixMergeRow.SourceLineNumbers, mergeError.DatabaseTable, databaseKeys.ToString(), wixMergeRow.SourceFile));
165 } 168 }
166 break; 169 break;
167 case MsmErrorType.msmErrorPlatformMismatch: 170 case MsmErrorType.msmErrorPlatformMismatch:
168 Messaging.Instance.OnMessage(WixErrors.MergePlatformMismatch(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile)); 171 this.Messaging.Write(ErrorMessages.MergePlatformMismatch(wixMergeRow.SourceLineNumbers, wixMergeRow.SourceFile));
169 break; 172 break;
170 default: 173 default:
171 Messaging.Instance.OnMessage(WixErrors.UnexpectedException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedMergerErrorWithType, Enum.GetName(typeof(MsmErrorType), mergeError.Type), logPath), "InvalidOperationException", Environment.StackTrace)); 174 this.Messaging.Write(ErrorMessages.UnexpectedException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedMergerErrorWithType, Enum.GetName(typeof(MsmErrorType), mergeError.Type), logPath), "InvalidOperationException", Environment.StackTrace));
172 break; 175 break;
173 } 176 }
174 } 177 }
175 178
176 if (0 >= mergeErrors.Count && !commit) 179 if (0 >= mergeErrors.Count && !commit)
177 { 180 {
178 Messaging.Instance.OnMessage(WixErrors.UnexpectedException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedMergerErrorInSourceFile, wixMergeRow.SourceFile, logPath), "InvalidOperationException", Environment.StackTrace)); 181 this.Messaging.Write(ErrorMessages.UnexpectedException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedMergerErrorInSourceFile, wixMergeRow.SourceFile, logPath), "InvalidOperationException", Environment.StackTrace));
179 } 182 }
180 183
181 if (moduleOpen) 184 if (moduleOpen)
@@ -199,7 +202,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
199 } 202 }
200 203
201 // stop processing if an error previously occurred 204 // stop processing if an error previously occurred
202 if (Messaging.Instance.EncounteredError) 205 if (this.Messaging.EncounteredError)
203 { 206 {
204 return; 207 return;
205 } 208 }
@@ -223,7 +226,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
223 { 226 {
224 if (null != record) 227 if (null != record)
225 { 228 {
226 Messaging.Instance.OnMessage(WixWarnings.SuppressMergedAction((string)row[1], row[0].ToString())); 229 this.Messaging.Write(WarningMessages.SuppressMergedAction((string)row[1], row[0].ToString()));
227 view.Modify(ModifyView.Delete, record); 230 view.Modify(ModifyView.Delete, record);
228 } 231 }
229 } 232 }
@@ -251,7 +254,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
251 break; 254 break;
252 } 255 }
253 256
254 Messaging.Instance.OnMessage(WixWarnings.SuppressMergedAction(resultRecord.GetString(1), tableName)); 257 this.Messaging.Write(WarningMessages.SuppressMergedAction(resultRecord.GetString(1), tableName));
255 } 258 }
256 } 259 }
257 } 260 }
@@ -273,7 +276,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
273 } 276 }
274 277
275 // now update the Attributes column for the files from the Merge Modules 278 // now update the Attributes column for the files from the Merge Modules
276 Messaging.Instance.OnMessage(WixVerboses.ResequencingMergeModuleFiles()); 279 this.Messaging.Write(VerboseMessages.ResequencingMergeModuleFiles());
277 using (View view = db.OpenView("SELECT `Sequence`, `Attributes` FROM `File` WHERE `File`=?")) 280 using (View view = db.OpenView("SELECT `Sequence`, `Attributes` FROM `File` WHERE `File`=?"))
278 { 281 {
279 foreach (var file in this.FileFacades) 282 foreach (var file in this.FileFacades)