aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler_2.cs
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-11 21:49:09 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-12 12:46:21 +1000
commit6d8b6f79b44b6a41a630aa3aad5a3c7f16701798 (patch)
treeb82ede9934cb7777a19e74a912c68481e76c21cd /src/WixToolset.Core/Compiler_2.cs
parentdf69d4172d3117d8b66ba51fa5ae7f4be538700d (diff)
downloadwix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.gz
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.bz2
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.zip
General cleanup.
Try not to send strings to specify the tuple or table. Try to avoid using the Set method on tuples. Always create new tuples and add them to the section in the same line.
Diffstat (limited to 'src/WixToolset.Core/Compiler_2.cs')
-rw-r--r--src/WixToolset.Core/Compiler_2.cs288
1 files changed, 113 insertions, 175 deletions
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs
index 89d4b6da..d7cb36bc 100644
--- a/src/WixToolset.Core/Compiler_2.cs
+++ b/src/WixToolset.Core/Compiler_2.cs
@@ -193,7 +193,7 @@ namespace WixToolset.Core
193 this.ParseCustomActionElement(child); 193 this.ParseCustomActionElement(child);
194 break; 194 break;
195 case "CustomActionRef": 195 case "CustomActionRef":
196 this.ParseSimpleRefElement(child, "CustomAction"); 196 this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
197 break; 197 break;
198 case "CustomTable": 198 case "CustomTable":
199 this.ParseCustomTableElement(child); 199 this.ParseCustomTableElement(child);
@@ -208,7 +208,7 @@ namespace WixToolset.Core
208 this.ParseEmbeddedChainerElement(child); 208 this.ParseEmbeddedChainerElement(child);
209 break; 209 break;
210 case "EmbeddedChainerRef": 210 case "EmbeddedChainerRef":
211 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 211 this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
212 break; 212 break;
213 case "EnsureTable": 213 case "EnsureTable":
214 this.ParseEnsureTableElement(child); 214 this.ParseEnsureTableElement(child);
@@ -248,7 +248,7 @@ namespace WixToolset.Core
248 this.ParsePropertyElement(child); 248 this.ParsePropertyElement(child);
249 break; 249 break;
250 case "PropertyRef": 250 case "PropertyRef":
251 this.ParseSimpleRefElement(child, "Property"); 251 this.ParseSimpleRefElement(child, TupleDefinitions.Property);
252 break; 252 break;
253 case "SetDirectory": 253 case "SetDirectory":
254 this.ParseSetDirectoryElement(child); 254 this.ParseSetDirectoryElement(child);
@@ -274,7 +274,7 @@ namespace WixToolset.Core
274 this.ParseUIElement(child); 274 this.ParseUIElement(child);
275 break; 275 break;
276 case "UIRef": 276 case "UIRef":
277 this.ParseSimpleRefElement(child, "WixUI"); 277 this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
278 break; 278 break;
279 case "Upgrade": 279 case "Upgrade":
280 this.ParseUpgradeElement(child); 280 this.ParseUpgradeElement(child);
@@ -297,14 +297,12 @@ namespace WixToolset.Core
297 { 297 {
298 if (null != symbols) 298 if (null != symbols)
299 { 299 {
300 var tuple = new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers) 300 this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers)
301 { 301 {
302 SymbolId = productCode, 302 SymbolId = productCode,
303 SymbolType = SymbolPathType.Product, 303 SymbolType = SymbolPathType.Product,
304 SymbolPaths = symbols 304 SymbolPaths = symbols,
305 }; 305 });
306
307 this.Core.AddTuple(tuple);
308 } 306 }
309 } 307 }
310 } 308 }
@@ -340,14 +338,14 @@ namespace WixToolset.Core
340 break; 338 break;
341 case "File": 339 case "File":
342 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 340 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
343 this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver); 341 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, driver);
344 break; 342 break;
345 case "Name": 343 case "Name":
346 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 344 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
347 break; 345 break;
348 case "SetupFile": 346 case "SetupFile":
349 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 347 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
350 this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup); 348 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, setup);
351 break; 349 break;
352 default: 350 default:
353 this.Core.UnexpectedAttribute(node, attrib); 351 this.Core.UnexpectedAttribute(node, attrib);
@@ -405,11 +403,29 @@ namespace WixToolset.Core
405 403
406 if (!this.Core.EncounteredError) 404 if (!this.Core.EncounteredError)
407 { 405 {
408 var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, id); 406 switch (tupleDefinitionType)
409 tuple.Set(1, componentId); 407 {
410 tuple.Set(2, name); 408 case TupleDefinitionType.ODBCDriver:
411 tuple.Set(3, driver); 409 this.Core.AddTuple(new ODBCDriverTuple(sourceLineNumbers, id)
412 tuple.Set(4, setup); 410 {
411 ComponentRef = componentId,
412 Description = name,
413 FileRef = driver,
414 SetupFileRef = setup,
415 });
416 break;
417 case TupleDefinitionType.ODBCTranslator:
418 this.Core.AddTuple(new ODBCTranslatorTuple(sourceLineNumbers, id)
419 {
420 ComponentRef = componentId,
421 Description = name,
422 FileRef = driver,
423 SetupFileRef = setup,
424 });
425 break;
426 default:
427 throw new ArgumentOutOfRangeException(nameof(tupleDefinitionType));
428 }
413 } 429 }
414 } 430 }
415 431
@@ -457,10 +473,28 @@ namespace WixToolset.Core
457 473
458 if (!this.Core.EncounteredError) 474 if (!this.Core.EncounteredError)
459 { 475 {
460 var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, new Identifier(AccessModifier.Private, parentId, id)); 476 var identifier = new Identifier(AccessModifier.Private, parentId, id);
461 tuple.Set(0, parentId); 477 switch (tupleDefinitionType)
462 tuple.Set(1, id); 478 {
463 tuple.Set(2, propertyValue); 479 case TupleDefinitionType.ODBCAttribute:
480 this.Core.AddTuple(new ODBCAttributeTuple(sourceLineNumbers, identifier)
481 {
482 DriverRef = parentId,
483 Attribute = id,
484 Value = propertyValue,
485 });
486 break;
487 case TupleDefinitionType.ODBCSourceAttribute:
488 this.Core.AddTuple(new ODBCSourceAttributeTuple(sourceLineNumbers, identifier)
489 {
490 DataSourceRef = parentId,
491 Attribute = id,
492 Value = propertyValue,
493 });
494 break;
495 default:
496 throw new ArgumentOutOfRangeException(nameof(tupleDefinitionType));
497 }
464 } 498 }
465 } 499 }
466 500
@@ -674,13 +708,11 @@ namespace WixToolset.Core
674 switch (installScope) 708 switch (installScope)
675 { 709 {
676 case "perMachine": 710 case "perMachine":
677 {
678 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS")) 711 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS"))
679 { 712 {
680 Value = "1" 713 Value = "1"
681 }); 714 });
682 installScopeSeen = true; 715 installScopeSeen = true;
683 }
684 break; 716 break;
685 case "perUser": 717 case "perUser":
686 sourceBits |= 8; 718 sourceBits |= 8;
@@ -1353,18 +1385,18 @@ namespace WixToolset.Core
1353 { 1385 {
1354 if (!this.Core.EncounteredError) 1386 if (!this.Core.EncounteredError)
1355 { 1387 {
1356 var tuple = new ProgIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, progId)) 1388 var tuple = this.Core.AddTuple(new ProgIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, progId))
1357 { 1389 {
1358 ProgId = progId, 1390 ProgId = progId,
1359 ParentProgIdRef = parent, 1391 ParentProgIdRef = parent,
1360 ClassRef = classId, 1392 ClassRef = classId,
1361 Description = description, 1393 Description = description,
1362 }; 1394 });
1363 1395
1364 if (null != icon) 1396 if (null != icon)
1365 { 1397 {
1366 tuple.IconRef = icon; 1398 tuple.IconRef = icon;
1367 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 1399 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
1368 } 1400 }
1369 1401
1370 if (CompilerConstants.IntegerNotSet != iconIndex) 1402 if (CompilerConstants.IntegerNotSet != iconIndex)
@@ -1372,9 +1404,7 @@ namespace WixToolset.Core
1372 tuple.IconIndex = iconIndex; 1404 tuple.IconIndex = iconIndex;
1373 } 1405 }
1374 1406
1375 this.Core.AddTuple(tuple); 1407 this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Class);
1376
1377 this.Core.EnsureTable(sourceLineNumbers, "Class");
1378 } 1408 }
1379 } 1409 }
1380 else if (YesNoType.No == advertise) 1410 else if (YesNoType.No == advertise)
@@ -1403,7 +1433,7 @@ namespace WixToolset.Core
1403 1433
1404 if (null != icon) // ProgId's Default Icon 1434 if (null != icon) // ProgId's Default Icon
1405 { 1435 {
1406 this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon); 1436 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, icon);
1407 1437
1408 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon); 1438 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon);
1409 1439
@@ -1513,7 +1543,7 @@ namespace WixToolset.Core
1513 1543
1514 if ("ErrorDialog" == id.Id) 1544 if ("ErrorDialog" == id.Id)
1515 { 1545 {
1516 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value); 1546 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, value);
1517 } 1547 }
1518 1548
1519 foreach (var child in node.Elements()) 1549 foreach (var child in node.Elements())
@@ -1764,15 +1794,13 @@ namespace WixToolset.Core
1764 1794
1765 if (!this.Core.EncounteredError && null != name) 1795 if (!this.Core.EncounteredError && null != name)
1766 { 1796 {
1767 var tuple = new RegistryTuple(sourceLineNumbers, id) 1797 this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
1768 { 1798 {
1769 Root = root.Value, 1799 Root = root.Value,
1770 Key = key, 1800 Key = key,
1771 Name = name, 1801 Name = name,
1772 ComponentRef = componentId, 1802 ComponentRef = componentId,
1773 }; 1803 });
1774
1775 this.Core.AddTuple(tuple);
1776 } 1804 }
1777 1805
1778 return keyPath; 1806 return keyPath;
@@ -2011,7 +2039,7 @@ namespace WixToolset.Core
2011 2039
2012 if (!this.Core.EncounteredError) 2040 if (!this.Core.EncounteredError)
2013 { 2041 {
2014 var tuple = new RegistryTuple(sourceLineNumbers, id) 2042 this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
2015 { 2043 {
2016 Root = root.Value, 2044 Root = root.Value,
2017 Key = key, 2045 Key = key,
@@ -2020,15 +2048,7 @@ namespace WixToolset.Core
2020 ValueType = valueType, 2048 ValueType = valueType,
2021 ValueAction = actionType, 2049 ValueAction = actionType,
2022 ComponentRef = componentId, 2050 ComponentRef = componentId,
2023 }; 2051 });
2024
2025 this.Core.AddTuple(tuple);
2026 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Registry, id);
2027 //row.Set(1, (int)root);
2028 //row.Set(2, key);
2029 //row.Set(3, name);
2030 //row.Set(4, value);
2031 //row.Set(5, componentId);
2032 } 2052 }
2033 2053
2034 // If this was just a regular registry key (that could be the key path) 2054 // If this was just a regular registry key (that could be the key path)
@@ -2134,16 +2154,14 @@ namespace WixToolset.Core
2134 2154
2135 if (!this.Core.EncounteredError) 2155 if (!this.Core.EncounteredError)
2136 { 2156 {
2137 var tuple = new RemoveRegistryTuple(sourceLineNumbers, id) 2157 this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2138 { 2158 {
2139 Root = root.Value, 2159 Root = root.Value,
2140 Key = key, 2160 Key = key,
2141 Name = name, 2161 Name = name,
2142 Action = actionType.Value, 2162 Action = actionType.Value,
2143 ComponentRef = componentId 2163 ComponentRef = componentId,
2144 }; 2164 });
2145
2146 this.Core.AddTuple(tuple);
2147 } 2165 }
2148 } 2166 }
2149 2167
@@ -2212,15 +2230,13 @@ namespace WixToolset.Core
2212 2230
2213 if (!this.Core.EncounteredError) 2231 if (!this.Core.EncounteredError)
2214 { 2232 {
2215 var tuple = new RemoveRegistryTuple(sourceLineNumbers, id) 2233 this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2216 { 2234 {
2217 Root = root.Value, 2235 Root = root.Value,
2218 Key = key, 2236 Key = key,
2219 Name = name, 2237 Name = name,
2220 ComponentRef = componentId 2238 ComponentRef = componentId
2221 }; 2239 });
2222
2223 this.Core.AddTuple(tuple);
2224 } 2240 }
2225 } 2241 }
2226 2242
@@ -2333,16 +2349,14 @@ namespace WixToolset.Core
2333 2349
2334 if (!this.Core.EncounteredError) 2350 if (!this.Core.EncounteredError)
2335 { 2351 {
2336 var tuple = new RemoveFileTuple(sourceLineNumbers, id) 2352 this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2337 { 2353 {
2338 ComponentRef = componentId, 2354 ComponentRef = componentId,
2339 FileName = this.GetMsiFilenameValue(shortName, name), 2355 FileName = this.GetMsiFilenameValue(shortName, name),
2340 DirProperty = directory ?? property ?? parentDirectory, 2356 DirProperty = directory ?? property ?? parentDirectory,
2341 OnInstall = onInstall, 2357 OnInstall = onInstall,
2342 OnUninstall = onUninstall 2358 OnUninstall = onUninstall,
2343 }; 2359 });
2344
2345 this.Core.AddTuple(tuple);
2346 } 2360 }
2347 } 2361 }
2348 2362
@@ -2423,15 +2437,13 @@ namespace WixToolset.Core
2423 2437
2424 if (!this.Core.EncounteredError) 2438 if (!this.Core.EncounteredError)
2425 { 2439 {
2426 var tuple = new RemoveFileTuple(sourceLineNumbers, id) 2440 this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2427 { 2441 {
2428 ComponentRef = componentId, 2442 ComponentRef = componentId,
2429 DirProperty = directory ?? property ?? parentDirectory, 2443 DirProperty = directory ?? property ?? parentDirectory,
2430 OnInstall = onInstall, 2444 OnInstall = onInstall,
2431 OnUninstall = onUninstall 2445 OnUninstall = onUninstall
2432 }; 2446 });
2433
2434 this.Core.AddTuple(tuple);
2435 } 2447 }
2436 } 2448 }
2437 2449
@@ -2540,7 +2552,7 @@ namespace WixToolset.Core
2540 if (customAction) 2552 if (customAction)
2541 { 2553 {
2542 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2554 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2543 this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName); 2555 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.CustomAction, actionName);
2544 } 2556 }
2545 else 2557 else
2546 { 2558 {
@@ -2551,7 +2563,7 @@ namespace WixToolset.Core
2551 if (customAction || showDialog || specialAction || specialStandardAction) 2563 if (customAction || showDialog || specialAction || specialStandardAction)
2552 { 2564 {
2553 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2565 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2554 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable.ToString(), afterAction); 2566 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.WixAction, sequenceTable.ToString(), afterAction);
2555 } 2567 }
2556 else 2568 else
2557 { 2569 {
@@ -2562,7 +2574,7 @@ namespace WixToolset.Core
2562 if (customAction || showDialog || specialAction || specialStandardAction) 2574 if (customAction || showDialog || specialAction || specialStandardAction)
2563 { 2575 {
2564 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2576 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2565 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable.ToString(), beforeAction); 2577 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.WixAction, sequenceTable.ToString(), beforeAction);
2566 } 2578 }
2567 else 2579 else
2568 { 2580 {
@@ -2573,7 +2585,7 @@ namespace WixToolset.Core
2573 if (showDialog) 2585 if (showDialog)
2574 { 2586 {
2575 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2587 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2576 this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName); 2588 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.Dialog, actionName);
2577 } 2589 }
2578 else 2590 else
2579 { 2591 {
@@ -2699,7 +2711,7 @@ namespace WixToolset.Core
2699 } 2711 }
2700 else 2712 else
2701 { 2713 {
2702 var tuple = new WixActionTuple(childSourceLineNumbers, new Identifier(AccessModifier.Public, sequenceTable, actionName)) 2714 var tuple = this.Core.AddTuple(new WixActionTuple(childSourceLineNumbers, new Identifier(AccessModifier.Public, sequenceTable, actionName))
2703 { 2715 {
2704 SequenceTable = sequenceTable, 2716 SequenceTable = sequenceTable,
2705 Action = actionName, 2717 Action = actionName,
@@ -2707,14 +2719,12 @@ namespace WixToolset.Core
2707 Before = beforeAction, 2719 Before = beforeAction,
2708 After = afterAction, 2720 After = afterAction,
2709 Overridable = overridable, 2721 Overridable = overridable,
2710 }; 2722 });
2711 2723
2712 if (CompilerConstants.IntegerNotSet != sequence) 2724 if (CompilerConstants.IntegerNotSet != sequence)
2713 { 2725 {
2714 tuple.Sequence = sequence; 2726 tuple.Sequence = sequence;
2715 } 2727 }
2716
2717 this.Core.AddTuple(tuple);
2718 } 2728 }
2719 } 2729 }
2720 } 2730 }
@@ -3008,7 +3018,7 @@ namespace WixToolset.Core
3008 { 3018 {
3009 if (!String.IsNullOrEmpty(delayedAutoStart)) 3019 if (!String.IsNullOrEmpty(delayedAutoStart))
3010 { 3020 {
3011 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".DS"))) 3021 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".DS")))
3012 { 3022 {
3013 Name = name, 3023 Name = name,
3014 OnInstall = install, 3024 OnInstall = install,
@@ -3017,20 +3027,12 @@ namespace WixToolset.Core
3017 ConfigType = MsiServiceConfigType.DelayedAutoStart, 3027 ConfigType = MsiServiceConfigType.DelayedAutoStart,
3018 Argument = delayedAutoStart, 3028 Argument = delayedAutoStart,
3019 ComponentRef = componentId, 3029 ComponentRef = componentId,
3020 }; 3030 });
3021
3022 this.Core.AddTuple(tuple);
3023 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".DS"), id.Access));
3024 //row.Set(1, name);
3025 //row.Set(2, events);
3026 //row.Set(3, 3);
3027 //row.Set(4, delayedAutoStart);
3028 //row.Set(5, componentId);
3029 } 3031 }
3030 3032
3031 if (!String.IsNullOrEmpty(failureActionsWhen)) 3033 if (!String.IsNullOrEmpty(failureActionsWhen))
3032 { 3034 {
3033 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".FA"))) 3035 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".FA")))
3034 { 3036 {
3035 Name = name, 3037 Name = name,
3036 OnInstall = install, 3038 OnInstall = install,
@@ -3039,20 +3041,12 @@ namespace WixToolset.Core
3039 ConfigType = MsiServiceConfigType.FailureActionsFlag, 3041 ConfigType = MsiServiceConfigType.FailureActionsFlag,
3040 Argument = failureActionsWhen, 3042 Argument = failureActionsWhen,
3041 ComponentRef = componentId, 3043 ComponentRef = componentId,
3042 }; 3044 });
3043
3044 this.Core.AddTuple(tuple);
3045 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".FA"), id.Access));
3046 //row.Set(1, name);
3047 //row.Set(2, events);
3048 //row.Set(3, 4);
3049 //row.Set(4, failureActionsWhen);
3050 //row.Set(5, componentId);
3051 } 3045 }
3052 3046
3053 if (!String.IsNullOrEmpty(sid)) 3047 if (!String.IsNullOrEmpty(sid))
3054 { 3048 {
3055 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".SS"))) 3049 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".SS")))
3056 { 3050 {
3057 Name = name, 3051 Name = name,
3058 OnInstall = install, 3052 OnInstall = install,
@@ -3061,20 +3055,12 @@ namespace WixToolset.Core
3061 ConfigType = MsiServiceConfigType.ServiceSidInfo, 3055 ConfigType = MsiServiceConfigType.ServiceSidInfo,
3062 Argument = sid, 3056 Argument = sid,
3063 ComponentRef = componentId, 3057 ComponentRef = componentId,
3064 }; 3058 });
3065
3066 this.Core.AddTuple(tuple);
3067 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".SS"), id.Access));
3068 //row.Set(1, name);
3069 //row.Set(2, events);
3070 //row.Set(3, 5);
3071 //row.Set(4, sid);
3072 //row.Set(5, componentId);
3073 } 3059 }
3074 3060
3075 if (!String.IsNullOrEmpty(requiredPrivileges)) 3061 if (!String.IsNullOrEmpty(requiredPrivileges))
3076 { 3062 {
3077 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".RP"))) 3063 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".RP")))
3078 { 3064 {
3079 Name = name, 3065 Name = name,
3080 OnInstall = install, 3066 OnInstall = install,
@@ -3083,20 +3069,12 @@ namespace WixToolset.Core
3083 ConfigType = MsiServiceConfigType.RequiredPrivilegesInfo, 3069 ConfigType = MsiServiceConfigType.RequiredPrivilegesInfo,
3084 Argument = requiredPrivileges, 3070 Argument = requiredPrivileges,
3085 ComponentRef = componentId, 3071 ComponentRef = componentId,
3086 }; 3072 });
3087
3088 this.Core.AddTuple(tuple);
3089 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".RP"), id.Access));
3090 //row.Set(1, name);
3091 //row.Set(2, events);
3092 //row.Set(3, 6);
3093 //row.Set(4, requiredPrivileges);
3094 //row.Set(5, componentId);
3095 } 3073 }
3096 3074
3097 if (!String.IsNullOrEmpty(preShutdownDelay)) 3075 if (!String.IsNullOrEmpty(preShutdownDelay))
3098 { 3076 {
3099 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".PD"))) 3077 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".PD")))
3100 { 3078 {
3101 Name = name, 3079 Name = name,
3102 OnInstall = install, 3080 OnInstall = install,
@@ -3105,15 +3083,7 @@ namespace WixToolset.Core
3105 ConfigType = MsiServiceConfigType.PreshutdownInfo, 3083 ConfigType = MsiServiceConfigType.PreshutdownInfo,
3106 Argument = preShutdownDelay, 3084 Argument = preShutdownDelay,
3107 ComponentRef = componentId, 3085 ComponentRef = componentId,
3108 }; 3086 });
3109
3110 this.Core.AddTuple(tuple);
3111 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".PD"), id.Access));
3112 //row.Set(1, name);
3113 //row.Set(2, events);
3114 //row.Set(3, 7);
3115 //row.Set(4, preShutdownDelay);
3116 //row.Set(5, componentId);
3117 } 3087 }
3118 } 3088 }
3119 } 3089 }
@@ -3284,7 +3254,7 @@ namespace WixToolset.Core
3284 3254
3285 if (!this.Core.EncounteredError) 3255 if (!this.Core.EncounteredError)
3286 { 3256 {
3287 var tuple = new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id) 3257 this.Core.AddTuple(new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id)
3288 { 3258 {
3289 Name = name, 3259 Name = name,
3290 OnInstall = install, 3260 OnInstall = install,
@@ -3296,9 +3266,7 @@ namespace WixToolset.Core
3296 Actions = actions, 3266 Actions = actions,
3297 DelayActions = actionsDelays, 3267 DelayActions = actionsDelays,
3298 ComponentRef = componentId, 3268 ComponentRef = componentId,
3299 }; 3269 });
3300
3301 this.Core.AddTuple(tuple);
3302 } 3270 }
3303 } 3271 }
3304 3272
@@ -3438,7 +3406,7 @@ namespace WixToolset.Core
3438 3406
3439 if (!this.Core.EncounteredError) 3407 if (!this.Core.EncounteredError)
3440 { 3408 {
3441 var tuple = new ServiceControlTuple(sourceLineNumbers, id) 3409 this.Core.AddTuple(new ServiceControlTuple(sourceLineNumbers, id)
3442 { 3410 {
3443 Name = name, 3411 Name = name,
3444 InstallRemove = installRemove, 3412 InstallRemove = installRemove,
@@ -3450,9 +3418,7 @@ namespace WixToolset.Core
3450 Arguments = arguments, 3418 Arguments = arguments,
3451 Wait = wait, 3419 Wait = wait,
3452 ComponentRef = componentId 3420 ComponentRef = componentId
3453 }; 3421 });
3454
3455 this.Core.AddTuple(tuple);
3456 } 3422 }
3457 } 3423 }
3458 3424
@@ -3697,7 +3663,7 @@ namespace WixToolset.Core
3697 3663
3698 if (!this.Core.EncounteredError) 3664 if (!this.Core.EncounteredError)
3699 { 3665 {
3700 var tuple = new ServiceInstallTuple(sourceLineNumbers, id) 3666 this.Core.AddTuple(new ServiceInstallTuple(sourceLineNumbers, id)
3701 { 3667 {
3702 Name = name, 3668 Name = name,
3703 DisplayName = displayName, 3669 DisplayName = displayName,
@@ -3713,23 +3679,7 @@ namespace WixToolset.Core
3713 Description = description, 3679 Description = description,
3714 Interactive = interactive, 3680 Interactive = interactive,
3715 Vital = vital 3681 Vital = vital
3716 }; 3682 });
3717
3718 this.Core.AddTuple(tuple);
3719
3720 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ServiceInstall, id);
3721 //row.Set(1, name);
3722 //row.Set(2, displayName);
3723 //row.Set(3, typebits);
3724 //row.Set(4, startType);
3725 //row.Set(5, errorbits);
3726 //row.Set(6, loadOrderGroup);
3727 //row.Set(7, dependencies);
3728 //row.Set(8, account);
3729 //row.Set(9, password);
3730 //row.Set(10, arguments);
3731 //row.Set(11, componentId);
3732 //row.Set(12, description);
3733 } 3683 }
3734 } 3684 }
3735 3685
@@ -3758,7 +3708,7 @@ namespace WixToolset.Core
3758 break; 3708 break;
3759 case "Id": 3709 case "Id":
3760 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3710 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3761 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); 3711 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
3762 break; 3712 break;
3763 case "Sequence": 3713 case "Sequence":
3764 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3714 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -3816,16 +3766,14 @@ namespace WixToolset.Core
3816 3766
3817 if (!this.Core.EncounteredError) 3767 if (!this.Core.EncounteredError)
3818 { 3768 {
3819 var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName)) 3769 this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3820 { 3770 {
3821 ExecutionType = executionType, 3771 ExecutionType = executionType,
3822 SourceType = CustomActionSourceType.Directory, 3772 SourceType = CustomActionSourceType.Directory,
3823 TargetType = CustomActionTargetType.TextData, 3773 TargetType = CustomActionTargetType.TextData,
3824 Source = id, 3774 Source = id,
3825 Target = value 3775 Target = value
3826 }; 3776 });
3827
3828 this.Core.AddTuple(tuple);
3829 3777
3830 foreach (var sequence in sequences) 3778 foreach (var sequence in sequences)
3831 { 3779 {
@@ -3966,16 +3914,14 @@ namespace WixToolset.Core
3966 this.Core.Write(ErrorMessages.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction)); 3914 this.Core.Write(ErrorMessages.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction));
3967 } 3915 }
3968 3916
3969 var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName)) 3917 this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3970 { 3918 {
3971 ExecutionType = executionType, 3919 ExecutionType = executionType,
3972 SourceType = CustomActionSourceType.Property, 3920 SourceType = CustomActionSourceType.Property,
3973 TargetType = CustomActionTargetType.TextData, 3921 TargetType = CustomActionTargetType.TextData,
3974 Source = id, 3922 Source = id,
3975 Target = value 3923 Target = value,
3976 }; 3924 });
3977
3978 this.Core.AddTuple(tuple);
3979 3925
3980 foreach (var sequence in sequences) 3926 foreach (var sequence in sequences)
3981 { 3927 {
@@ -4192,7 +4138,7 @@ namespace WixToolset.Core
4192 break; 4138 break;
4193 case "Icon": 4139 case "Icon":
4194 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4140 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4195 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 4141 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
4196 break; 4142 break;
4197 case "IconIndex": 4143 case "IconIndex":
4198 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue); 4144 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
@@ -4390,7 +4336,7 @@ namespace WixToolset.Core
4390 target = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget); 4336 target = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget);
4391 } 4337 }
4392 4338
4393 var tuple = new ShortcutTuple(sourceLineNumbers, id) 4339 this.Core.AddTuple(new ShortcutTuple(sourceLineNumbers, id)
4394 { 4340 {
4395 DirectoryRef = directory, 4341 DirectoryRef = directory,
4396 Name = name, 4342 Name = name,
@@ -4408,9 +4354,7 @@ namespace WixToolset.Core
4408 DisplayResourceId = displayResourceId, 4354 DisplayResourceId = displayResourceId,
4409 DescriptionResourceDll = descriptionResourceDll, 4355 DescriptionResourceDll = descriptionResourceDll,
4410 DescriptionResourceId = descriptionResourceId, 4356 DescriptionResourceId = descriptionResourceId,
4411 }; 4357 });
4412
4413 this.Core.AddTuple(tuple);
4414 } 4358 }
4415 } 4359 }
4416 4360
@@ -4679,7 +4623,7 @@ namespace WixToolset.Core
4679 4623
4680 if (!this.Core.EncounteredError) 4624 if (!this.Core.EncounteredError)
4681 { 4625 {
4682 var tuple = new TypeLibTuple(sourceLineNumbers) 4626 var tuple = this.Core.AddTuple(new TypeLibTuple(sourceLineNumbers)
4683 { 4627 {
4684 LibId = id, 4628 LibId = id,
4685 Language = language, 4629 Language = language,
@@ -4687,7 +4631,7 @@ namespace WixToolset.Core
4687 Description = description, 4631 Description = description,
4688 DirectoryRef = helpDirectory, 4632 DirectoryRef = helpDirectory,
4689 FeatureRef = Guid.Empty.ToString("B") 4633 FeatureRef = Guid.Empty.ToString("B")
4690 }; 4634 });
4691 4635
4692 if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion) 4636 if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion)
4693 { 4637 {
@@ -4698,8 +4642,6 @@ namespace WixToolset.Core
4698 { 4642 {
4699 tuple.Cost = cost; 4643 tuple.Cost = cost;
4700 } 4644 }
4701
4702 this.Core.AddTuple(tuple);
4703 } 4645 }
4704 } 4646 }
4705 else if (YesNoType.No == advertise) 4647 else if (YesNoType.No == advertise)
@@ -4894,7 +4836,7 @@ namespace WixToolset.Core
4894 4836
4895 if (!this.Core.EncounteredError) 4837 if (!this.Core.EncounteredError)
4896 { 4838 {
4897 var tuple = new UpgradeTuple(sourceLineNumbers) 4839 this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
4898 { 4840 {
4899 UpgradeCode = upgradeId, 4841 UpgradeCode = upgradeId,
4900 VersionMin = minimum, 4842 VersionMin = minimum,
@@ -4908,15 +4850,13 @@ namespace WixToolset.Core
4908 OnlyDetect = onlyDetect, 4850 OnlyDetect = onlyDetect,
4909 Remove = removeFeatures, 4851 Remove = removeFeatures,
4910 ActionProperty = actionProperty 4852 ActionProperty = actionProperty
4911 }; 4853 });
4912
4913 this.Core.AddTuple(tuple);
4914 4854
4915 // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence 4855 // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence
4916 // if at least one row in Upgrade table lacks the OnlyDetect attribute. 4856 // if at least one row in Upgrade table lacks the OnlyDetect attribute.
4917 if (!onlyDetect) 4857 if (!onlyDetect)
4918 { 4858 {
4919 this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", "RemoveExistingProducts"); 4859 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixAction, "InstallExecuteSequence", "RemoveExistingProducts");
4920 } 4860 }
4921 } 4861 }
4922 } 4862 }
@@ -4964,7 +4904,7 @@ namespace WixToolset.Core
4964 break; 4904 break;
4965 case "TargetFile": 4905 case "TargetFile":
4966 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4906 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4967 this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile); 4907 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, targetFile);
4968 break; 4908 break;
4969 case "TargetProperty": 4909 case "TargetProperty":
4970 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4910 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -5021,20 +4961,18 @@ namespace WixToolset.Core
5021 4961
5022 if (!this.Core.EncounteredError) 4962 if (!this.Core.EncounteredError)
5023 { 4963 {
5024 var tuple = new VerbTuple(sourceLineNumbers) 4964 var tuple = this.Core.AddTuple(new VerbTuple(sourceLineNumbers)
5025 { 4965 {
5026 ExtensionRef = extension, 4966 ExtensionRef = extension,
5027 Verb = id, 4967 Verb = id,
5028 Command = command, 4968 Command = command,
5029 Argument = argument, 4969 Argument = argument,
5030 }; 4970 });
5031 4971
5032 if (CompilerConstants.IntegerNotSet != sequence) 4972 if (CompilerConstants.IntegerNotSet != sequence)
5033 { 4973 {
5034 tuple.Sequence = sequence; 4974 tuple.Sequence = sequence;
5035 } 4975 }
5036
5037 this.Core.AddTuple(tuple);
5038 } 4976 }
5039 } 4977 }
5040 else if (YesNoType.No == advertise) 4978 else if (YesNoType.No == advertise)