@joebigelow / wix-1 / commits / 6d8b6f79

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.

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.

Sean Hall committed Apr 11, 2020 at 21:49 UTC 6d8b6f79b44b6a41a630aa3aad5a3c7f16701798
27 files changed +660 -891
src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs
+4 -8
@@ -56,14 +56,14 @@ namespace WixToolset.Core.Burn.Bind
56
57 if (this.Facades.TryGetValue(packageId, out var facade))
58 {
59 - var dependency = new ProvidesDependencyTuple(wixDependencyProviderTuple.SourceLineNumbers, wixDependencyProviderTuple.Id)
59 + var dependency = this.Section.AddTuple(new ProvidesDependencyTuple(wixDependencyProviderTuple.SourceLineNumbers, wixDependencyProviderTuple.Id)
60 {
61 PackageRef = packageId,
62 Key = wixDependencyProviderTuple.ProviderKey,
63 Version = wixDependencyProviderTuple.Version,
64 DisplayName = wixDependencyProviderTuple.DisplayName,
65 Attributes = (int)wixDependencyProviderTuple.Attributes
66 - };
66 + });
67
68 if (String.IsNullOrEmpty(dependency.Key))
69 {
@@ -94,8 +94,6 @@ namespace WixToolset.Core.Burn.Bind
94 {
95 dependency.DisplayName = facade.PackageTuple.DisplayName;
96 }
97 -
98 - this.Section.Tuples.Add(dependency);
97 }
98 }
99
@@ -121,15 +119,13 @@ namespace WixToolset.Core.Burn.Bind
119
120 if (!String.IsNullOrEmpty(key) && !this.DependencyTuplesByKey.ContainsKey(key))
121 {
124 - var dependency = new ProvidesDependencyTuple(facade.PackageTuple.SourceLineNumbers, facade.PackageTuple.Id)
122 + var dependency = this.Section.AddTuple(new ProvidesDependencyTuple(facade.PackageTuple.SourceLineNumbers, facade.PackageTuple.Id)
123 {
124 PackageRef = facade.PackageId,
125 Key = key,
126 Version = facade.PackageTuple.Version,
127 DisplayName = facade.PackageTuple.DisplayName
130 - };
131 -
132 - this.Section.Tuples.Add(dependency);
128 + });
129
130 this.DependencyTuplesByKey.Add(dependency.Key, dependency);
131 }
src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs
+3 -8
@@ -102,17 +102,12 @@ namespace WixToolset.Core.Burn.Bundles
102
103 if (slipstreamMspIds.Add(id.Id))
104 {
105 - var slipstreamTuple = new WixBundleSlipstreamMspTuple(patchTargetCode.SourceLineNumbers)
105 + this.Section.AddTuple(new WixBundleSlipstreamMspTuple(patchTargetCode.SourceLineNumbers)
106 {
107 TargetPackageRef = msiPackage.Id.Id,
108 - MspPackageRef = patchTargetCode.PackageRef
109 - };
108 + MspPackageRef = patchTargetCode.PackageRef,
109 + });
110
111 - //var slipstreamMspRow = SlipstreamMspTable.CreateRow(tuple.SourceLineNumbers, false);
112 - //slipstreamMspRow[0] = msi.ChainPackageId;
113 - //slipstreamMspRow[1] = tuple.MspPackageId;
114 -
115 - this.Section.Tuples.Add(slipstreamTuple);
111 return true;
112 }
113
src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
+2 -4
@@ -285,7 +285,7 @@ namespace WixToolset.Core.Burn.Bundles
285 {
286 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BADataFileName);
287
288 - var tuple = new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
288 + var tuple = this.Section.AddTuple(new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
289 {
290 Name = BurnCommon.BADataFileName,
291 SourceFile = new IntermediateFieldPathValue { Path = baManifestPath },
@@ -294,7 +294,7 @@ namespace WixToolset.Core.Burn.Bundles
294 ContainerRef = BurnConstants.BurnUXContainerName,
295 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex),
296 Packaging = PackagingType.Embedded,
297 - };
297 + });
298
299 var fileInfo = new FileInfo(baManifestPath);
300
@@ -302,8 +302,6 @@ namespace WixToolset.Core.Burn.Bundles
302
303 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo);
304
305 - this.Section.Tuples.Add(tuple);
306 -
305 return tuple;
306 }
307 }
src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs
+2 -4
@@ -124,7 +124,7 @@ namespace WixToolset.Core.Burn.Bundles
124 {
125 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BundleExtensionDataFileName);
126
127 - var tuple = new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
127 + var tuple = this.Section.AddTuple(new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
128 {
129 Name = BurnCommon.BundleExtensionDataFileName,
130 SourceFile = new IntermediateFieldPathValue { Path = bextManifestPath },
@@ -133,7 +133,7 @@ namespace WixToolset.Core.Burn.Bundles
133 ContainerRef = BurnConstants.BurnUXContainerName,
134 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex),
135 Packaging = PackagingType.Embedded,
136 - };
136 + });
137
138 var fileInfo = new FileInfo(bextManifestPath);
139
@@ -141,8 +141,6 @@ namespace WixToolset.Core.Burn.Bundles
141
142 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo);
143
144 - this.Section.Tuples.Add(tuple);
145 -
144 return tuple;
145 }
146 }
src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs
+13 -21
@@ -283,7 +283,7 @@ namespace WixToolset.Core.Burn.Bundles
283 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive ? WixBundleRelatedPackageAttributes.MaxInclusive : 0;
284 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive ? WixBundleRelatedPackageAttributes.LangInclusive : 0;
285
286 - var related = new WixBundleRelatedPackageTuple(this.Facade.PackageTuple.SourceLineNumbers)
286 + this.Section.AddTuple(new WixBundleRelatedPackageTuple(this.Facade.PackageTuple.SourceLineNumbers)
287 {
288 PackageRef = this.Facade.PackageId,
289 RelatedId = record.GetString(1),
@@ -291,7 +291,7 @@ namespace WixToolset.Core.Burn.Bundles
291 MaxVersion = record.GetString(3),
292 Languages = record.GetString(4),
293 Attributes = attributes,
294 - };
294 + });
295 }
296 }
297 }
@@ -358,7 +358,7 @@ namespace WixToolset.Core.Burn.Bundles
358 }
359 }
360
361 - var feature = new WixBundleMsiFeatureTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, this.Facade.PackageId, featureName))
361 + this.Section.AddTuple(new WixBundleMsiFeatureTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, this.Facade.PackageId, featureName))
362 {
363 PackageRef = this.Facade.PackageId,
364 Name = featureName,
@@ -370,7 +370,7 @@ namespace WixToolset.Core.Burn.Bundles
370 Directory = allFeaturesResultRecord.GetString(7),
371 Attributes = allFeaturesResultRecord.GetInteger(8),
372 Size = size
373 - };
373 + });
374 }
375 }
376 }
@@ -397,7 +397,7 @@ namespace WixToolset.Core.Burn.Bundles
397 var generatedId = Common.GenerateIdentifier("cab", packagePayload.Id.Id, cabinet);
398 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, cabinet, "Cabinet", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal);
399
400 - var tuple = new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
400 + this.Section.AddTuple(new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
401 {
402 Name = cabinetName,
403 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile },
@@ -409,9 +409,7 @@ namespace WixToolset.Core.Burn.Bundles
409 EnableSignatureValidation = packagePayload.EnableSignatureValidation,
410 Packaging = packagePayload.Packaging,
411 ParentPackagePayloadRef = packagePayload.Id.Id,
412 - };
413 -
414 - this.Section.Tuples.Add(tuple);
412 + });
413 }
414 }
415 }
@@ -477,7 +475,7 @@ namespace WixToolset.Core.Burn.Bundles
475 var generatedId = Common.GenerateIdentifier("f", packagePayload.Id.Id, record.GetString(2));
476 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, fileSourcePath, "File", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal);
477
480 - var tuple = new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
478 + this.Section.AddTuple(new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
479 {
480 Name = name,
481 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile },
@@ -489,9 +487,7 @@ namespace WixToolset.Core.Burn.Bundles
487 EnableSignatureValidation = packagePayload.EnableSignatureValidation,
488 Packaging = packagePayload.Packaging,
489 ParentPackagePayloadRef = packagePayload.Id.Id,
492 - };
493 -
494 - this.Section.Tuples.Add(tuple);
490 + });
491 }
492 }
493
@@ -506,14 +502,12 @@ namespace WixToolset.Core.Burn.Bundles
502
503 private void AddMsiProperty(WixBundleMsiPackageTuple msiPackage, string name, string value)
504 {
509 - var tuple = new WixBundleMsiPropertyTuple(msiPackage.SourceLineNumbers, new Identifier(AccessModifier.Private, msiPackage.Id.Id, name))
505 + this.Section.AddTuple(new WixBundleMsiPropertyTuple(msiPackage.SourceLineNumbers, new Identifier(AccessModifier.Private, msiPackage.Id.Id, name))
506 {
507 PackageRef = msiPackage.Id.Id,
508 Name = name,
513 - Value = value
514 - };
515 -
516 - this.Section.Tuples.Add(tuple);
509 + Value = value,
510 + });
511 }
512
513 private void ImportDependencyProviders(WixBundleMsiPackageTuple msiPackage, Dtf.Database db)
@@ -535,7 +529,7 @@ namespace WixToolset.Core.Burn.Bundles
529 }
530
531 // Import the provider key and attributes.
538 - var tuple = new ProvidesDependencyTuple(msiPackage.SourceLineNumbers)
532 + this.Section.AddTuple(new ProvidesDependencyTuple(msiPackage.SourceLineNumbers)
533 {
534 PackageRef = msiPackage.Id.Id,
535 Key = record.GetString(1),
@@ -543,9 +537,7 @@ namespace WixToolset.Core.Burn.Bundles
537 DisplayName = record.GetString(3) ?? this.Facade.PackageTuple.DisplayName,
538 Attributes = record.GetInteger(4),
539 Imported = true
546 - };
547 -
548 - this.Section.Tuples.Add(tuple);
540 + });
541 }
542 }
543 }
src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs
+2 -4
@@ -127,14 +127,12 @@ namespace WixToolset.Core.Burn.Bundles
127
128 if (uniqueTargetCodes.Add(targetCode))
129 {
130 - var tuple = new WixBundlePatchTargetCodeTuple(packagePayload.SourceLineNumbers)
130 + this.Section.AddTuple(new WixBundlePatchTargetCodeTuple(packagePayload.SourceLineNumbers)
131 {
132 PackageRef = packagePayload.Id.Id,
133 TargetCode = targetCode,
134 Attributes = attributes
135 - };
136 -
137 - this.Section.Tuples.Add(tuple);
135 + });
136 }
137 }
138
src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs
+2 -4
@@ -26,13 +26,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
26 {
27 if (!createFolderTuplesByComponentRef.Contains(componentTuple.Id.Id))
28 {
29 - var createFolderTuple = new CreateFolderTuple(componentTuple.SourceLineNumbers)
29 + this.Section.AddTuple(new CreateFolderTuple(componentTuple.SourceLineNumbers)
30 {
31 DirectoryRef = componentTuple.DirectoryRef,
32 ComponentRef = componentTuple.Id.Id,
33 - };
34 -
35 - this.Section.Tuples.Add(createFolderTuple);
33 + });
34 }
35 }
36 }
src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
+14 -17
@@ -71,12 +71,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
71 // When building merge module, all the files go to "#MergeModule.CABinet".
72 if (SectionType.Module == this.Section.Type)
73 {
74 - var mergeModuleMediaRow = new MediaTuple();
75 - mergeModuleMediaRow.Cabinet = "#MergeModule.CABinet";
76 -
77 - this.Section.Tuples.Add(mergeModuleMediaRow);
74 + var mergeModuleMediaTuple = this.Section.AddTuple(new MediaTuple
75 + {
76 + Cabinet = "#MergeModule.CABinet",
77 + });
78
79 - filesByCabinetMedia.Add(mergeModuleMediaRow, new List<FileFacade>(this.FileFacades));
79 + filesByCabinetMedia.Add(mergeModuleMediaTuple, new List<FileFacade>(this.FileFacades));
80 }
81 else if (mediaTemplateTable.Count == 0)
82 {
@@ -212,13 +212,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
212 // If there are uncompressed files and no MediaRow, create a default one.
213 if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any())
214 {
215 - var defaultMediaRow = new MediaTuple(null, new Identifier(AccessModifier.Private, 1))
215 + var defaultMediaRow = this.Section.AddTuple(new MediaTuple(null, new Identifier(AccessModifier.Private, 1))
216 {
217 - DiskId = 1
218 - };
217 + DiskId = 1,
218 + });
219
220 mediaRows.Add(1, defaultMediaRow);
221 - this.Section.Tuples.Add(defaultMediaRow);
221 }
222 }
223
@@ -298,14 +297,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
297 /// <returns></returns>
298 private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex)
299 {
301 - var currentMediaTuple = new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex));
302 - currentMediaTuple.DiskId = cabIndex;
303 - currentMediaTuple.Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex);
304 - currentMediaTuple.CompressionLevel = mediaTemplateTuple.CompressionLevel;
305 -
306 - this.Section.Tuples.Add(currentMediaTuple);
307 -
308 - return currentMediaTuple;
300 + return this.Section.AddTuple(new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex))
301 + {
302 + DiskId = cabIndex,
303 + Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex),
304 + CompressionLevel = mediaTemplateTuple.CompressionLevel,
305 + });
306 }
307 }
308 }
src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
+1 -1
@@ -225,7 +225,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
225 // Put the summary information that was extracted back in now that it is updated.
226 foreach (var readSummaryInfo in summaryInfo.Values.OrderBy(s => s.PropertyId))
227 {
228 - section.Tuples.Add(readSummaryInfo);
228 + section.AddTuple(readSummaryInfo);
229 }
230
231 this.SubStorages = subStorages;
src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs
+19 -19
@@ -44,10 +44,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
44 this.InstallerVersion = 0;
45 this.ModularizationGuid = null;
46
47 - bool foundCreateDataTime = false;
48 - bool foundLastSaveDataTime = false;
49 - bool foundCreatingApplication = false;
50 - string now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
47 + var foundCreateDataTime = false;
48 + var foundLastSaveDataTime = false;
49 + var foundCreatingApplication = false;
50 + var now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
51
52 foreach (var summaryInformationTuple in this.Section.Tuples.OfType<SummaryInformationTuple>())
53 {
@@ -110,31 +110,31 @@ namespace WixToolset.Core.WindowsInstaller.Bind
110 // add a summary information row for the create time/date property if its not already set
111 if (!foundCreateDataTime)
112 {
113 - var createTimeDateRow = new SummaryInformationTuple(null);
114 - createTimeDateRow.PropertyId = SumaryInformationType.Created;
115 - createTimeDateRow.Value = now;
116 -
117 - this.Section.Tuples.Add(createTimeDateRow);
113 + this.Section.AddTuple(new SummaryInformationTuple(null)
114 + {
115 + PropertyId = SumaryInformationType.Created,
116 + Value = now,
117 + });
118 }
119
120 // add a summary information row for the last save time/date property if its not already set
121 if (!foundLastSaveDataTime)
122 {
123 - var lastSaveTimeDateRow = new SummaryInformationTuple(null);
124 - lastSaveTimeDateRow.PropertyId = SumaryInformationType.LastSaved;
125 - lastSaveTimeDateRow.Value = now;
126 -
127 - this.Section.Tuples.Add(lastSaveTimeDateRow);
123 + this.Section.AddTuple(new SummaryInformationTuple(null)
124 + {
125 + PropertyId = SumaryInformationType.LastSaved,
126 + Value = now,
127 + });
128 }
129
130 // add a summary information row for the creating application property if its not already set
131 if (!foundCreatingApplication)
132 {
133 - var creatingApplicationRow = new SummaryInformationTuple(null);
134 - creatingApplicationRow.PropertyId = SumaryInformationType.CreatingApplication;
135 - creatingApplicationRow.Value = String.Format(CultureInfo.InvariantCulture, AppCommon.GetCreatingApplicationString());
136 -
137 - this.Section.Tuples.Add(creatingApplicationRow);
133 + this.Section.AddTuple(new SummaryInformationTuple(null)
134 + {
135 + PropertyId = SumaryInformationType.CreatingApplication,
136 + Value = String.Format(CultureInfo.InvariantCulture, AppCommon.GetCreatingApplicationString()),
137 + });
138 }
139 }
140 }
src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
+12 -12
@@ -57,26 +57,26 @@ namespace WixToolset.Core.WindowsInstaller.Bind
57
58 if (0 < adminProperties.Count)
59 {
60 - var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties"));
61 - tuple.Value = String.Join(";", adminProperties);
62 -
63 - this.Section.Tuples.Add(tuple);
60 + this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties"))
61 + {
62 + Value = String.Join(";", adminProperties),
63 + });
64 }
65
66 if (0 < secureProperties.Count)
67 {
68 - var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "SecureCustomProperties"));
69 - tuple.Value = String.Join(";", secureProperties);
70 -
71 - this.Section.Tuples.Add(tuple);
68 + this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "SecureCustomProperties"))
69 + {
70 + Value = String.Join(";", secureProperties),
71 + });
72 }
73
74 if (0 < hiddenProperties.Count)
75 {
76 - var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "MsiHiddenProperties"));
77 - tuple.Value = String.Join(";", hiddenProperties);
78 -
79 - this.Section.Tuples.Add(tuple);
76 + this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "MsiHiddenProperties"))
77 + {
78 + Value = String.Join(";", hiddenProperties)
79 + });
80 }
81 }
82 }
src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
+1 -1
@@ -186,7 +186,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
186
187 foreach (var action in scheduledActionTuples)
188 {
189 - this.Section.Tuples.Add(action);
189 + this.Section.AddTuple(action);
190 }
191 }
192
src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
+10 -10
@@ -158,8 +158,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
158
159 if (null == facade.Hash)
160 {
161 - facade.Hash = new MsiFileHashTuple(facade.SourceLineNumber, facade.Identifier);
162 - this.Section.Tuples.Add(facade.Hash);
161 + facade.Hash = this.Section.AddTuple(new MsiFileHashTuple(facade.SourceLineNumber, facade.Identifier));
162 }
163
164 facade.Hash.Options = 0;
@@ -337,23 +336,24 @@ namespace WixToolset.Core.WindowsInstaller.Bind
336
337 // override directly authored value
338 var lookup = String.Concat(facade.ComponentRef, "/", name);
340 - if (!assemblyNameTuples.TryGetValue(lookup, out var assemblyNameRow))
339 + if (!assemblyNameTuples.TryGetValue(lookup, out var assemblyNameTuple))
340 {
342 - assemblyNameRow = new MsiAssemblyNameTuple(facade.SourceLineNumber);
343 - assemblyNameRow.ComponentRef = facade.ComponentRef;
344 - assemblyNameRow.Name = name;
345 - assemblyNameRow.Value = value;
341 + assemblyNameTuple = this.Section.AddTuple(new MsiAssemblyNameTuple(facade.SourceLineNumber)
342 + {
343 + ComponentRef = facade.ComponentRef,
344 + Name = name,
345 + Value = value,
346 + });
347
348 if (null == facade.AssemblyNames)
349 {
350 facade.AssemblyNames = new List<MsiAssemblyNameTuple>();
351 }
352
352 - facade.AssemblyNames.Add(assemblyNameRow);
353 - this.Section.Tuples.Add(assemblyNameRow);
353 + facade.AssemblyNames.Add(assemblyNameTuple);
354 }
355
356 - assemblyNameRow.Value = value;
356 + assemblyNameTuple.Value = value;
357
358 if (this.VariableCache != null)
359 {
src/WixToolset.Core/Binder.cs
+5 -5
@@ -81,16 +81,16 @@ namespace WixToolset.Core
81 var executingAssembly = Assembly.GetExecutingAssembly();
82 var fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location);
83
84 - var buildInfoTuple = new WixBuildInfoTuple();
85 - buildInfoTuple.WixVersion = fileVersion.FileVersion;
86 - buildInfoTuple.WixOutputFile = outputFile;
84 + var buildInfoTuple = entrySection.AddTuple(new WixBuildInfoTuple()
85 + {
86 + WixVersion = fileVersion.FileVersion,
87 + WixOutputFile = outputFile,
88 + });
89
90 if (!String.IsNullOrEmpty(outputPdbPath))
91 {
92 buildInfoTuple.WixPdbFile = outputPdbPath;
93 }
92 -
93 - entrySection.Tuples.Add(buildInfoTuple);
94 }
95 }
96 }
src/WixToolset.Core/Compiler.cs
+168 -247
@@ -12,6 +12,7 @@ namespace WixToolset.Core
12 using System.Xml.Linq;
13 using WixToolset.Data;
14 using WixToolset.Data.Tuples;
15 + using WixToolset.Data.WindowsInstaller;
16 using WixToolset.Extensibility;
17 using WixToolset.Extensibility.Data;
18 using WixToolset.Extensibility.Services;
@@ -163,7 +164,7 @@ namespace WixToolset.Core
164 this.Core = null;
165 }
166
166 - target.UpdateLevel(IntermediateLevels.Compiled);
167 + target.UpdateLevel(Data.IntermediateLevels.Compiled);
168
169 return this.Messaging.EncounteredError ? null : target;
170 }
@@ -324,13 +325,11 @@ namespace WixToolset.Core
325 this.Core.Write(ErrorMessages.SearchPropertyNotUppercase(sourceLineNumbers, "Property", "Id", propertyId.Id));
326 }
327
327 - var tuple = new AppSearchTuple(sourceLineNumbers, new Identifier(propertyId.Access, propertyId.Id, signature))
328 + this.Core.AddTuple(new AppSearchTuple(sourceLineNumbers, new Identifier(propertyId.Access, propertyId.Id, signature))
329 {
330 PropertyRef = propertyId.Id,
331 SignatureRef = signature
331 - };
332 -
333 - this.Core.AddTuple(tuple);
332 + });
333 }
334 }
335
@@ -371,7 +370,7 @@ namespace WixToolset.Core
370 {
371 var section = this.Core.ActiveSection;
372
374 - // Add the row to a separate section if requested.
373 + // Add the tuple to a separate section if requested.
374 if (fragment)
375 {
376 var id = String.Concat(this.Core.ActiveSection.Id, ".", propertyId.Id);
@@ -379,26 +378,24 @@ namespace WixToolset.Core
378 section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId);
379
380 // Reference the property in the active section.
382 - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", propertyId.Id);
381 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, propertyId.Id);
382 }
383
385 - // Allow row to exist with no value so that PropertyRefs can be made for *Search elements
386 - // the linker will remove these rows before the final output is created.
387 - var tuple = new PropertyTuple(sourceLineNumbers, propertyId)
384 + // Allow tuple to exist with no value so that PropertyRefs can be made for *Search elements
385 + // the linker will remove these tuples before the final output is created.
386 + section.AddTuple(new PropertyTuple(sourceLineNumbers, propertyId)
387 {
388 Value = value,
390 - };
391 -
392 - section.Tuples.Add(tuple);
389 + });
390
391 if (admin || hidden || secure)
392 {
396 - this.AddWixPropertyRow(sourceLineNumbers, propertyId, admin, secure, hidden, section);
393 + this.AddWixPropertyTuple(sourceLineNumbers, propertyId, admin, secure, hidden, section);
394 }
395 }
396 }
397
401 - private void AddWixPropertyRow(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, IntermediateSection section = null)
398 + private void AddWixPropertyTuple(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, IntermediateSection section = null)
399 {
400 if (secure && property.Id != property.Id.ToUpperInvariant())
401 {
@@ -409,18 +406,16 @@ namespace WixToolset.Core
406 {
407 section = this.Core.ActiveSection;
408
412 - this.Core.EnsureTable(sourceLineNumbers, "Property"); // Property table is always required when using WixProperty table.
409 + this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Property); // Property table is always required when using WixProperty table.
410 }
411
415 - var tuple = new WixPropertyTuple(sourceLineNumbers)
412 + section.AddTuple(new WixPropertyTuple(sourceLineNumbers)
413 {
414 PropertyRef = property.Id,
415 Admin = admin,
416 Hidden = hidden,
417 Secure = secure
421 - };
422 -
423 - section.Tuples.Add(tuple);
418 + });
419 }
420
421 /// <summary>
@@ -550,7 +545,7 @@ namespace WixToolset.Core
545
546 if (!this.Core.EncounteredError)
547 {
553 - var tuple = new AppIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, appId))
548 + this.Core.AddTuple(new AppIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, appId))
549 {
550 AppId = appId,
551 RemoteServerName = remoteServerName,
@@ -558,10 +553,8 @@ namespace WixToolset.Core
553 ServiceParameters = serviceParameters,
554 DllSurrogate = dllSurrogate,
555 ActivateAtStorage = activateAtStorage,
561 - RunAsInteractiveUser = runAsInteractiveUser
562 - };
563 -
564 - this.Core.AddTuple(tuple);
556 + RunAsInteractiveUser = runAsInteractiveUser,
557 + });
558 }
559 }
560 else if (YesNoType.No == advertise)
@@ -650,14 +643,12 @@ namespace WixToolset.Core
643
644 if (!this.Core.EncounteredError)
645 {
653 - var tuple = new MsiAssemblyNameTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, componentId, id))
646 + this.Core.AddTuple(new MsiAssemblyNameTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, componentId, id))
647 {
648 ComponentRef = componentId,
649 Name = id,
657 - Value = value
658 - };
659 -
660 - this.Core.AddTuple(tuple);
650 + Value = value,
651 + });
652 }
653 }
654
@@ -739,12 +730,10 @@ namespace WixToolset.Core
730
731 if (!this.Core.EncounteredError)
732 {
742 - var tuple = new BinaryTuple(sourceLineNumbers, id)
733 + var tuple = this.Core.AddTuple(new BinaryTuple(sourceLineNumbers, id)
734 {
735 Data = new IntermediateFieldPathValue { Path = sourceFile }
745 - };
746 -
747 - this.Core.AddTuple(tuple);
736 + });
737
738 if (YesNoType.Yes == suppressModularization)
739 {
@@ -820,7 +809,7 @@ namespace WixToolset.Core
809 {
810 this.Core.AddTuple(new IconTuple(sourceLineNumbers, id)
811 {
823 - Data = new IntermediateFieldPathValue { Path = sourceFile }
812 + Data = new IntermediateFieldPathValue { Path = sourceFile },
813 });
814 }
815
@@ -844,7 +833,7 @@ namespace WixToolset.Core
833 {
834 case "Property":
835 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
847 - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property);
836 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, property);
837 break;
838 default:
839 this.Core.UnexpectedAttribute(node, attrib);
@@ -940,15 +929,13 @@ namespace WixToolset.Core
929
930 if (!this.Core.EncounteredError)
931 {
943 - var tuple = new WixInstanceTransformsTuple(sourceLineNumbers, id)
932 + this.Core.AddTuple(new WixInstanceTransformsTuple(sourceLineNumbers, id)
933 {
934 PropertyId = propertyId,
935 ProductCode = productCode,
936 ProductName = productName,
937 UpgradeCode = upgradeCode
949 - };
950 -
951 - this.Core.AddTuple(tuple);
938 + });
939 }
940 }
941
@@ -979,7 +966,7 @@ namespace WixToolset.Core
966 break;
967 case "Feature":
968 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
982 - this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature);
969 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, feature);
970 break;
971 case "Qualifier":
972 qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -1009,16 +996,14 @@ namespace WixToolset.Core
996
997 if (!this.Core.EncounteredError)
998 {
1012 - var tuple = new PublishComponentTuple(sourceLineNumbers)
999 + this.Core.AddTuple(new PublishComponentTuple(sourceLineNumbers)
1000 {
1001 ComponentId = id,
1002 Qualifier = qualifier,
1003 ComponentRef = componentId,
1004 AppData = appData,
1005 FeatureRef = feature ?? Guid.Empty.ToString("B"),
1019 - };
1020 -
1021 - this.Core.AddTuple(tuple);
1006 + });
1007 }
1008 }
1009
@@ -1195,7 +1180,7 @@ namespace WixToolset.Core
1180
1181 if (!String.IsNullOrEmpty(localFileServer))
1182 {
1198 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", localFileServer);
1183 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, localFileServer);
1184 }
1185
1186 // Local variables used strictly for child node processing.
@@ -1268,7 +1253,7 @@ namespace WixToolset.Core
1253 {
1254 foreach (var context in contexts)
1255 {
1271 - var tuple = new ClassTuple(sourceLineNumbers)
1256 + var tuple = this.Core.AddTuple(new ClassTuple(sourceLineNumbers)
1257 {
1258 CLSID = classId,
1259 Context = context,
@@ -1280,26 +1265,24 @@ namespace WixToolset.Core
1265 Argument = argument,
1266 FeatureRef = Guid.Empty.ToString("B"),
1267 RelativePath = YesNoType.Yes == relativePath,
1283 - };
1268 + });
1269
1270 if (null != appId)
1271 {
1272 tuple.AppIdRef = appId;
1288 - this.Core.CreateSimpleReference(sourceLineNumbers, "AppId", appId);
1273 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.AppId, appId);
1274 }
1275
1276 if (null != icon)
1277 {
1278 tuple.IconRef = icon;
1294 - this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon);
1279 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
1280 }
1281
1282 if (CompilerConstants.IntegerNotSet != iconIndex)
1283 {
1284 tuple.IconIndex = iconIndex;
1285 }
1301 -
1302 - this.Core.AddTuple(tuple);
1286 }
1287 }
1288 }
@@ -1379,7 +1362,7 @@ namespace WixToolset.Core
1362
1363 if (null != icon) // ClassId default icon
1364 {
1382 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon);
1365 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, icon);
1366
1367 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon);
1368
@@ -1709,7 +1692,7 @@ namespace WixToolset.Core
1692
1693 if (!this.Core.EncounteredError)
1694 {
1712 - var tuple = new UpgradeTuple(sourceLineNumbers)
1695 + this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
1696 {
1697 UpgradeCode = upgradeCode,
1698 VersionMin = minimum,
@@ -1720,9 +1703,7 @@ namespace WixToolset.Core
1703 ExcludeLanguages = excludeLanguages,
1704 VersionMaxInclusive = maxInclusive,
1705 VersionMinInclusive = minInclusive,
1723 - };
1724 -
1725 - this.Core.AddTuple(tuple);
1706 + });
1707 }
1708 }
1709
@@ -1862,7 +1843,7 @@ namespace WixToolset.Core
1843 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1844 }
1845 oneChild = true;
1865 - var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
1846 + var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
1847 id = new Identifier(AccessModifier.Private, newId);
1848 signature = null;
1849 break;
@@ -1879,16 +1860,14 @@ namespace WixToolset.Core
1860
1861 if (!this.Core.EncounteredError)
1862 {
1882 - var tuple = new RegLocatorTuple(sourceLineNumbers, id)
1863 + this.Core.AddTuple(new RegLocatorTuple(sourceLineNumbers, id)
1864 {
1865 Root = root.Value,
1866 Key = key,
1867 Name = name,
1868 Type = type.Value,
1888 - Win64 = search64bit
1889 - };
1890 -
1891 - this.Core.AddTuple(tuple);
1869 + Win64 = search64bit,
1870 + });
1871 }
1872
1873 return signature;
@@ -1912,7 +1891,7 @@ namespace WixToolset.Core
1891 {
1892 case "Id":
1893 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1915 - this.Core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id);
1894 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.RegLocator, id);
1895 break;
1896 default:
1897 this.Core.UnexpectedAttribute(node, attrib);
@@ -2524,7 +2503,7 @@ namespace WixToolset.Core
2503 // finally add the Component table row
2504 if (!this.Core.EncounteredError)
2505 {
2527 - var tuple = new ComponentTuple(sourceLineNumbers, id)
2506 + this.Core.AddTuple(new ComponentTuple(sourceLineNumbers, id)
2507 {
2508 ComponentId = guid,
2509 DirectoryRef = directoryId,
@@ -2539,10 +2518,8 @@ namespace WixToolset.Core
2518 Shared = shared,
2519 Transitive = transitive,
2520 UninstallWhenSuperseded = uninstallWhenSuperseded,
2542 - Win64 = win64
2543 - };
2544 -
2545 - this.Core.AddTuple(tuple);
2521 + Win64 = win64,
2522 + });
2523
2524 if (multiInstance)
2525 {
@@ -2554,26 +2531,22 @@ namespace WixToolset.Core
2531
2532 if (0 < symbols.Count)
2533 {
2557 - var tupleDelaPatch = new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, SymbolPathType.Component, id.Id))
2534 + this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, SymbolPathType.Component, id.Id))
2535 {
2536 SymbolType = SymbolPathType.Component,
2537 SymbolId = id.Id,
2561 - SymbolPaths = String.Join(";", symbols)
2562 - };
2563 -
2564 - this.Core.AddTuple(tupleDelaPatch);
2538 + SymbolPaths = String.Join(";", symbols),
2539 + });
2540 }
2541
2542 // Complus
2543 if (CompilerConstants.IntegerNotSet != comPlusBits)
2544 {
2570 - var complusTuple = new ComplusTuple(sourceLineNumbers)
2545 + this.Core.AddTuple(new ComplusTuple(sourceLineNumbers)
2546 {
2547 ComponentRef = id.Id,
2548 ExpType = comPlusBits,
2574 - };
2575 -
2576 - this.Core.AddTuple(complusTuple);
2549 + });
2550 }
2551
2552 // if this is a module, automatically add this component to the references to ensure it gets in the ModuleComponents table
@@ -2698,7 +2671,7 @@ namespace WixToolset.Core
2671 {
2672 case "Id":
2673 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2701 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id);
2674 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixComponentGroup, id);
2675 break;
2676 case "Primary":
2677 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -2747,7 +2720,7 @@ namespace WixToolset.Core
2720 {
2721 case "Id":
2722 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2750 - this.Core.CreateSimpleReference(sourceLineNumbers, "Component", id);
2723 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Component, id);
2724 break;
2725 case "Primary":
2726 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -2871,7 +2844,7 @@ namespace WixToolset.Core
2844 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2845 }
2846 oneChild = true;
2874 - var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
2847 + var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
2848 id = new Identifier(AccessModifier.Private, newId);
2849 signature = null;
2850 break;
@@ -2888,18 +2861,12 @@ namespace WixToolset.Core
2861
2862 if (!this.Core.EncounteredError)
2863 {
2891 - var tuple = new CompLocatorTuple(sourceLineNumbers, id)
2864 + this.Core.AddTuple(new CompLocatorTuple(sourceLineNumbers, id)
2865 {
2866 SignatureRef = id.Id,
2867 ComponentId = componentId,
2868 Type = type,
2896 - };
2897 -
2898 - this.Core.AddTuple(tuple);
2899 -
2900 - //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CompLocator, id);
2901 - //row.Set(1, componentId);
2902 - //row.Set(2, type);
2869 + });
2870 }
2871
2872 return signature;
@@ -2965,13 +2932,11 @@ namespace WixToolset.Core
2932
2933 if (!this.Core.EncounteredError)
2934 {
2968 - var tuple = new CreateFolderTuple(sourceLineNumbers)
2935 + this.Core.AddTuple(new CreateFolderTuple(sourceLineNumbers)
2936 {
2937 DirectoryRef = directoryId,
2971 - ComponentRef = componentId
2972 - };
2973 -
2974 - this.Core.AddTuple(tuple);
2938 + ComponentRef = componentId,
2939 + });
2940 }
2941
2942 return directoryId;
@@ -3027,7 +2992,7 @@ namespace WixToolset.Core
2992 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
2993 }
2994 fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3030 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", fileId);
2995 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, fileId);
2996 break;
2997 case "SourceDirectory":
2998 sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
@@ -3092,17 +3057,15 @@ namespace WixToolset.Core
3057
3058 if (!this.Core.EncounteredError)
3059 {
3095 - var tuple = new MoveFileTuple(sourceLineNumbers, id)
3060 + this.Core.AddTuple(new MoveFileTuple(sourceLineNumbers, id)
3061 {
3062 ComponentRef = componentId,
3063 SourceName = sourceName,
3064 DestName= String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName),
3065 SourceFolder = sourceDirectory ?? sourceProperty,
3066 DestFolder = destinationDirectory ?? destinationProperty,
3102 - Delete = delete
3103 - };
3104 -
3105 - this.Core.AddTuple(tuple);
3067 + Delete = delete,
3068 + });
3069 }
3070 }
3071 else // copy the file
@@ -3139,15 +3102,13 @@ namespace WixToolset.Core
3102
3103 if (!this.Core.EncounteredError)
3104 {
3142 - var tuple = new DuplicateFileTuple(sourceLineNumbers, id)
3105 + this.Core.AddTuple(new DuplicateFileTuple(sourceLineNumbers, id)
3106 {
3107 ComponentRef = componentId,
3108 FileRef = fileId,
3109 DestinationName = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName),
3147 - DestinationFolder = destinationDirectory ?? destinationProperty
3148 - };
3149 -
3150 - this.Core.AddTuple(tuple);
3110 + DestinationFolder = destinationDirectory ?? destinationProperty,
3111 + });
3112 }
3113 }
3114 }
@@ -3194,7 +3155,7 @@ namespace WixToolset.Core
3155 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3156 //sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData;
3157 sourceType = CustomActionSourceType.Binary;
3197 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary
3158 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, source); // add a reference to the appropriate Binary
3159 break;
3160 case "Directory":
3161 if (null != source)
@@ -3229,7 +3190,7 @@ namespace WixToolset.Core
3190 // to add a reference. No need to look at the value.
3191 if (Int32.TryParse(target, out var ignored))
3192 {
3232 - this.Core.CreateSimpleReference(sourceLineNumbers, "Error", target);
3193 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Error, target);
3194 }
3195 break;
3196 case "ExeCommand":
@@ -3285,7 +3246,7 @@ namespace WixToolset.Core
3246 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3247 //sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile;
3248 sourceType = CustomActionSourceType.File;
3288 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File
3249 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, source); // add a reference to the appropriate File
3250 break;
3251 case "HideTarget":
3252 hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -3533,7 +3494,7 @@ namespace WixToolset.Core
3494
3495 if (!this.Core.EncounteredError)
3496 {
3536 - var tuple = new CustomActionTuple(sourceLineNumbers, id)
3497 + this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, id)
3498 {
3499 ExecutionType = executionType,
3500 Source = source,
@@ -3547,9 +3508,7 @@ namespace WixToolset.Core
3508 TSAware = tsAware,
3509 Win64 = win64,
3510 Hidden = hidden,
3550 - };
3551 -
3552 - this.Core.AddTuple(tuple);
3511 + });
3512
3513 if (YesNoType.Yes == suppressModularization)
3514 {
@@ -3562,9 +3521,9 @@ namespace WixToolset.Core
3521 /// Parses a simple reference element.
3522 /// </summary>
3523 /// <param name="node">Element to parse.</param>
3565 - /// <param name="table">Table which contains the target of the simple reference.</param>
3524 + /// <param name="tupleDefinition">Tuple which contains the target of the simple reference.</param>
3525 /// <returns>Id of the referenced element.</returns>
3567 - private string ParseSimpleRefElement(XElement node, string table)
3526 + private string ParseSimpleRefElement(XElement node, IntermediateTupleDefinition tupleDefinition)
3527 {
3528 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3529 string id = null;
@@ -3577,7 +3536,7 @@ namespace WixToolset.Core
3536 {
3537 case "Id":
3538 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3580 - this.Core.CreateSimpleReference(sourceLineNumbers, table, id);
3539 + this.Core.CreateSimpleReference(sourceLineNumbers, tupleDefinition.Name, id);
3540 break;
3541 default:
3542 this.Core.UnexpectedAttribute(node, attrib);
@@ -3640,7 +3599,7 @@ namespace WixToolset.Core
3599 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
3600 }
3601
3643 - this.Core.CreateSimpleReference(sourceLineNumbers, "MsiPatchSequence", primaryKeys);
3602 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.MsiPatchSequence, primaryKeys);
3603
3604 this.Core.ParseForExtensionElements(node);
3605
@@ -3932,14 +3891,14 @@ namespace WixToolset.Core
3891 }
3892 }
3893
3935 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId);
3894 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixCustomTable, tableId);
3895
3896 if (!this.Core.EncounteredError)
3897 {
3898 this.Core.AddTuple(new WixCustomRowTuple(childSourceLineNumbers)
3899 {
3900 Table = tableId,
3942 - FieldData = dataValue
3901 + FieldData = dataValue,
3902 });
3903 }
3904 break;
@@ -3963,7 +3922,7 @@ namespace WixToolset.Core
3922
3923 if (!this.Core.EncounteredError)
3924 {
3966 - var tuple = new WixCustomTableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, tableId))
3925 + this.Core.AddTuple(new WixCustomTableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, tableId))
3926 {
3927 ColumnCount = columnCount,
3928 ColumnNames = columnNames,
@@ -3977,10 +3936,8 @@ namespace WixToolset.Core
3936 Sets = sets,
3937 Descriptions = descriptions,
3938 Modularizations = modularizations,
3980 - Unreal = bootstrapperApplicationData
3981 - };
3982 -
3983 - this.Core.AddTuple(tuple);
3939 + Unreal = bootstrapperApplicationData,
3940 + });
3941 }
3942 }
3943 }
@@ -4079,7 +4036,7 @@ namespace WixToolset.Core
4036 if (inlineSyntax[0].EndsWith(":"))
4037 {
4038 parentId = inlineSyntax[0].TrimEnd(':');
4082 - this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", parentId);
4039 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, parentId);
4040
4041 pathStartsAt = 1;
4042 }
@@ -4224,7 +4181,7 @@ namespace WixToolset.Core
4181
4182 if (!this.Core.EncounteredError)
4183 {
4227 - var tuple = new DirectoryTuple(sourceLineNumbers, id)
4184 + this.Core.AddTuple(new DirectoryTuple(sourceLineNumbers, id)
4185 {
4186 ParentDirectoryRef = parentId,
4187 Name = name,
@@ -4232,9 +4189,7 @@ namespace WixToolset.Core
4189 SourceName = sourceName,
4190 SourceShortName = shortSourceName,
4191 ComponentGuidGenerationSeed = componentGuidGenerationSeed
4235 - };
4236 -
4237 - this.Core.AddTuple(tuple);
4192 + });
4193
4194 if (null != symbols)
4195 {
@@ -4268,7 +4223,7 @@ namespace WixToolset.Core
4223 {
4224 case "Id":
4225 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4271 - this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id);
4226 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
4227 break;
4228 case "DiskId":
4229 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
@@ -4415,7 +4370,7 @@ namespace WixToolset.Core
4370 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4371 }
4372 oneChild = true;
4418 - signature = this.ParseSimpleRefElement(child, "Signature");
4373 + signature = this.ParseSimpleRefElement(child, TupleDefinitions.Signature);
4374 break;
4375 default:
4376 this.Core.UnexpectedElement(node, child);
@@ -4460,19 +4415,17 @@ namespace WixToolset.Core
4415 signature = id.Id;
4416 }
4417
4463 - var tuple = new DrLocatorTuple(sourceLineNumbers, new Identifier(access, rowId, parentSignature, path))
4418 + var tuple = this.Core.AddTuple(new DrLocatorTuple(sourceLineNumbers, new Identifier(access, rowId, parentSignature, path))
4419 {
4420 SignatureRef = rowId,
4421 Parent = parentSignature,
4422 Path = path,
4468 - };
4423 + });
4424
4425 if (CompilerConstants.IntegerNotSet != depth)
4426 {
4427 tuple.Depth = depth;
4428 }
4474 -
4475 - this.Core.AddTuple(tuple);
4429 }
4430
4431 return signature;
@@ -4575,7 +4528,7 @@ namespace WixToolset.Core
4528 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4529 }
4530 oneChild = true;
4578 - signature = this.ParseSimpleRefElement(child, "Signature");
4531 + signature = this.ParseSimpleRefElement(child, TupleDefinitions.Signature);
4532 break;
4533 default:
4534 this.Core.UnexpectedElement(node, child);
@@ -4589,7 +4542,7 @@ namespace WixToolset.Core
4542 }
4543
4544
4592 - this.Core.CreateSimpleReference(sourceLineNumbers, "DrLocator", id.Id, parentSignature, path);
4545 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.DrLocator, id.Id, parentSignature, path);
4546
4547 return signature;
4548 }
@@ -4829,7 +4782,7 @@ namespace WixToolset.Core
4782
4783 if (!this.Core.EncounteredError)
4784 {
4832 - var tuple = new FeatureTuple(sourceLineNumbers, id)
4785 + this.Core.AddTuple(new FeatureTuple(sourceLineNumbers, id)
4786 {
4787 ParentFeatureRef = null, // this field is set in the linker
4788 Title = title,
@@ -4841,9 +4794,7 @@ namespace WixToolset.Core
4794 DisallowAdvertise = disallowAdvertise,
4795 InstallDefault = installDefault,
4796 TypicalDefault = typicalDefault,
4844 - };
4845 -
4846 - this.Core.AddTuple(tuple);
4797 + });
4798
4799 if (ComplexReferenceParentType.Unknown != parentType)
4800 {
@@ -4873,7 +4824,7 @@ namespace WixToolset.Core
4824 {
4825 case "Id":
4826 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4876 - this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", id);
4827 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, id);
4828 break;
4829 case "IgnoreParent":
4830 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -5053,7 +5004,7 @@ namespace WixToolset.Core
5004 {
5005 case "Id":
5006 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5056 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id);
5007 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixFeatureGroup, id);
5008 break;
5009 case "IgnoreParent":
5010 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -5222,7 +5173,7 @@ namespace WixToolset.Core
5173
5174 if (!this.Core.EncounteredError)
5175 {
5225 - var tuple = new EnvironmentTuple(sourceLineNumbers, id)
5176 + this.Core.AddTuple(new EnvironmentTuple(sourceLineNumbers, id)
5177 {
5178 Name = name,
5179 Value = value,
@@ -5232,14 +5183,7 @@ namespace WixToolset.Core
5183 Permanent = permanent,
5184 System = system,
5185 ComponentRef = componentId
5235 - };
5236 -
5237 - this.Core.AddTuple(tuple);
5238 -
5239 - //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Environment, id);
5240 - //row.Set(1, String.Concat(action, uninstall, system ? "*" : String.Empty, name));
5241 - //row.Set(2, text);
5242 - //row.Set(3, componentId);
5186 + });
5187 }
5188 }
5189
@@ -5282,12 +5226,10 @@ namespace WixToolset.Core
5226
5227 if (!this.Core.EncounteredError)
5228 {
5285 - var tuple = new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
5229 + this.Core.AddTuple(new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
5230 {
5231 Message = Common.GetInnerText(node)
5288 - };
5289 -
5290 - this.Core.AddTuple(tuple);
5232 + });
5233 }
5234 }
5235
@@ -5373,18 +5315,16 @@ namespace WixToolset.Core
5315 {
5316 if (!this.Core.EncounteredError)
5317 {
5376 - var tuple = new ExtensionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, extension, componentId))
5318 + this.Core.AddTuple(new ExtensionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, extension, componentId))
5319 {
5320 Extension = extension,
5321 ComponentRef = componentId,
5322 ProgIdRef = progId,
5323 MimeRef = mime,
5382 - FeatureRef = Guid.Empty.ToString("B")
5383 - };
5384 -
5385 - this.Core.AddTuple(tuple);
5324 + FeatureRef = Guid.Empty.ToString("B"),
5325 + });
5326
5387 - this.Core.EnsureTable(sourceLineNumbers, "Verb");
5327 + this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Verb);
5328 }
5329 }
5330 else if (YesNoType.No == advertise)
@@ -5481,11 +5421,11 @@ namespace WixToolset.Core
5421 break;
5422 case "AssemblyApplication":
5423 assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5484 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication);
5424 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, assemblyApplication);
5425 break;
5426 case "AssemblyManifest":
5427 assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5488 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest);
5428 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, assemblyManifest);
5429 break;
5430 case "BindPath":
5431 bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
@@ -5499,7 +5439,7 @@ namespace WixToolset.Core
5439 break;
5440 case "CompanionFile":
5441 companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5502 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", companionFile);
5442 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, companionFile);
5443 break;
5444 case "Compressed":
5445 var compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
@@ -5797,7 +5737,7 @@ namespace WixToolset.Core
5737 attributes |= compressed.HasValue && compressed == false ? FileTupleAttributes.Uncompressed : 0;
5738 attributes |= generatedShortFileName ? FileTupleAttributes.GeneratedShortFileName : 0;
5739
5800 - var tuple = new FileTuple(sourceLineNumbers, id)
5740 + this.Core.AddTuple(new FileTuple(sourceLineNumbers, id)
5741 {
5742 ComponentRef = componentId,
5743 Name = name,
@@ -5831,10 +5771,8 @@ namespace WixToolset.Core
5771 IgnoreOffsets = ignoreOffsets,
5772 IgnoreLengths = ignoreLengths,
5773 RetainOffsets = protectOffsets,
5834 - SymbolPaths = symbols
5835 - };
5836 -
5837 - this.Core.AddTuple(tuple);
5774 + SymbolPaths = symbols,
5775 + });
5776
5777 if (AssemblyType.NotAnAssembly != assemblyType)
5778 {
@@ -5850,7 +5788,7 @@ namespace WixToolset.Core
5788 }
5789 }
5790
5853 - this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
5791 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Media, diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
5792
5793 // If this component does not have a companion file this file is a possible keypath.
5794 possibleKeyPath = null;
@@ -5990,13 +5928,13 @@ namespace WixToolset.Core
5928
5929 if (!this.Core.EncounteredError)
5930 {
5993 - var tuple = new SignatureTuple(sourceLineNumbers, id)
5931 + var tuple = this.Core.AddTuple(new SignatureTuple(sourceLineNumbers, id)
5932 {
5933 FileName = name ?? shortName,
5934 MinVersion = minVersion,
5935 MaxVersion = maxVersion,
5936 Languages = languages
5999 - };
5937 + });
5938
5939 if (CompilerConstants.IntegerNotSet != minSize)
5940 {
@@ -6018,8 +5956,6 @@ namespace WixToolset.Core
5956 tuple.MaxDate = maxDate;
5957 }
5958
6021 - this.Core.AddTuple(tuple);
6022 -
5959 // Create a DrLocator row to associate the file with a directory
5960 // when a different identifier is specified for the FileSearch.
5961 if (!isSameId)
@@ -6125,7 +6061,7 @@ namespace WixToolset.Core
6061 this.ParseBundleExtensionElement(child);
6062 break;
6063 case "BundleExtensionRef":
6128 - this.ParseSimpleRefElement(child, "WixBundleExtension");
6064 + this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleExtension);
6065 break;
6066 case "ComplianceCheck":
6067 this.ParseComplianceCheckElement(child);
@@ -6146,7 +6082,7 @@ namespace WixToolset.Core
6082 this.ParseCustomActionElement(child);
6083 break;
6084 case "CustomActionRef":
6149 - this.ParseSimpleRefElement(child, "CustomAction");
6085 + this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
6086 break;
6087 case "CustomTable":
6088 this.ParseCustomTableElement(child);
@@ -6161,7 +6097,7 @@ namespace WixToolset.Core
6097 this.ParseEmbeddedChainerElement(child);
6098 break;
6099 case "EmbeddedChainerRef":
6164 - this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
6100 + this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
6101 break;
6102 case "EnsureTable":
6103 this.ParseEnsureTableElement(child);
@@ -6210,7 +6146,7 @@ namespace WixToolset.Core
6146 this.ParsePropertyElement(child);
6147 break;
6148 case "PropertyRef":
6213 - this.ParseSimpleRefElement(child, "Property");
6149 + this.ParseSimpleRefElement(child, TupleDefinitions.Property);
6150 break;
6151 case "RelatedBundle":
6152 this.ParseRelatedBundleElement(child);
@@ -6225,7 +6161,7 @@ namespace WixToolset.Core
6161 this.ParseSetVariableElement(child);
6162 break;
6163 case "SetVariableRef":
6228 - this.ParseSimpleRefElement(child, "WixSetVariable");
6164 + this.ParseSimpleRefElement(child, TupleDefinitions.WixSetVariable);
6165 break;
6166 case "SFPCatalog":
6167 string parentName = null;
@@ -6235,7 +6171,7 @@ namespace WixToolset.Core
6171 this.ParseUIElement(child);
6172 break;
6173 case "UIRef":
6238 - this.ParseSimpleRefElement(child, "WixUI");
6174 + this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
6175 break;
6176 case "Upgrade":
6177 this.ParseUpgradeElement(child);
@@ -6555,7 +6491,7 @@ namespace WixToolset.Core
6491
6492 if (!this.Core.EncounteredError)
6493 {
6558 - var tuple = new IniFileTuple(sourceLineNumbers, id)
6494 + this.Core.AddTuple(new IniFileTuple(sourceLineNumbers, id)
6495 {
6496 FileName = this.GetMsiFilenameValue(shortName, name),
6497 DirProperty = directory,
@@ -6564,9 +6500,7 @@ namespace WixToolset.Core
6500 Value = value,
6501 Action = action.Value,
6502 ComponentRef = componentId
6567 - };
6568 -
6569 - this.Core.AddTuple(tuple);
6503 + });
6504 }
6505 }
6506
@@ -6724,7 +6658,7 @@ namespace WixToolset.Core
6658 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
6659 }
6660 oneChild = true;
6727 - var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
6661 + var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
6662 id = new Identifier(AccessModifier.Private, newId);
6663 signature = null;
6664 break;
@@ -6741,21 +6675,19 @@ namespace WixToolset.Core
6675
6676 if (!this.Core.EncounteredError)
6677 {
6744 - var tuple = new IniLocatorTuple(sourceLineNumbers, id)
6678 + var tuple = this.Core.AddTuple(new IniLocatorTuple(sourceLineNumbers, id)
6679 {
6680 SignatureRef = id.Id,
6681 FileName = this.GetMsiFilenameValue(shortName, name),
6682 Section = section,
6683 Key = key,
6684 Type = type
6751 - };
6685 + });
6686
6687 if (CompilerConstants.IntegerNotSet != field)
6688 {
6689 tuple.Field = field;
6690 }
6757 -
6758 - this.Core.AddTuple(tuple);
6691 }
6692
6693 return signature;
@@ -6779,7 +6711,7 @@ namespace WixToolset.Core
6711 {
6712 case "Shared":
6713 shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
6782 - this.Core.CreateSimpleReference(sourceLineNumbers, "Component", shared);
6714 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Component, shared);
6715 break;
6716 default:
6717 this.Core.UnexpectedAttribute(node, attrib);
@@ -6841,9 +6773,22 @@ namespace WixToolset.Core
6773
6774 if (!this.Core.EncounteredError)
6775 {
6844 - var tuple = this.Core.CreateTuple(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? TupleDefinitionType.MsiPatchCertificate : TupleDefinitionType.MsiPackageCertificate);
6845 - tuple.Set(0, name);
6846 - tuple.Set(1, name);
6776 + if ("PatchCertificates" == node.Name.LocalName)
6777 + {
6778 + this.Core.AddTuple(new MsiPatchCertificateTuple(sourceLineNumbers)
6779 + {
6780 + PatchCertificate = name,
6781 + DigitalCertificateRef = name,
6782 + });
6783 + }
6784 + else
6785 + {
6786 + this.Core.AddTuple(new MsiPackageCertificateTuple(sourceLineNumbers)
6787 + {
6788 + PackageCertificate = name,
6789 + DigitalCertificateRef = name,
6790 + });
6791 + }
6792 }
6793 break;
6794 default:
@@ -7109,14 +7054,14 @@ namespace WixToolset.Core
7054 if (!this.Core.EncounteredError)
7055 {
7056 // create the row that performs the upgrade (or downgrade)
7112 - var tuple = new UpgradeTuple(sourceLineNumbers)
7057 + var tuple = this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
7058 {
7059 UpgradeCode = upgradeCode,
7060 Remove = removeFeatures,
7061 MigrateFeatures = migrateFeatures,
7062 IgnoreRemoveFailures = ignoreRemoveFailure,
7063 ActionProperty = Common.UpgradeDetectedProperty
7119 - };
7064 + });
7065
7066 if (allowDowngrades)
7067 {
@@ -7131,24 +7076,20 @@ namespace WixToolset.Core
7076 tuple.VersionMaxInclusive = allowSameVersionUpgrades;
7077 }
7078
7134 - this.Core.AddTuple(tuple);
7135 -
7079 // Add launch condition that blocks upgrades
7080 if (blockUpgrades)
7081 {
7139 - var conditionTuple = new LaunchConditionTuple(sourceLineNumbers)
7082 + this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers)
7083 {
7084 Condition = Common.UpgradePreventedCondition,
7085 Description = downgradeErrorMessage
7143 - };
7144 -
7145 - this.Core.AddTuple(conditionTuple);
7086 + });
7087 }
7088
7089 // now create the Upgrade row and launch conditions to prevent downgrades (unless explicitly permitted)
7090 if (!allowDowngrades)
7091 {
7151 - var upgradeTuple = new UpgradeTuple(sourceLineNumbers)
7092 + this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
7093 {
7094 UpgradeCode = upgradeCode,
7095 VersionMin = productVersion,
@@ -7156,17 +7097,13 @@ namespace WixToolset.Core
7097 OnlyDetect = true,
7098 IgnoreRemoveFailures = ignoreRemoveFailure,
7099 ActionProperty = Common.DowngradeDetectedProperty
7159 - };
7160 -
7161 - this.Core.AddTuple(upgradeTuple);
7100 + });
7101
7163 - var conditionTuple = new LaunchConditionTuple(sourceLineNumbers)
7102 + this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers)
7103 {
7104 Condition = Common.DowngradePreventedCondition,
7105 Description = downgradeErrorMessage
7167 - };
7168 -
7169 - this.Core.AddTuple(conditionTuple);
7106 + });
7107 }
7108
7109 // finally, schedule RemoveExistingProducts
@@ -7232,7 +7169,7 @@ namespace WixToolset.Core
7169 break;
7170 case "DiskPrompt":
7171 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7235 - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7172 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7173 break;
7174 case "EmbedCab":
7175 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7364,7 +7301,7 @@ namespace WixToolset.Core
7301 // add the row to the section
7302 if (!this.Core.EncounteredError)
7303 {
7367 - var tuple = new MediaTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
7304 + this.Core.AddTuple(new MediaTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
7305 {
7306 DiskId = id,
7307 DiskPrompt = diskPrompt,
@@ -7373,9 +7310,7 @@ namespace WixToolset.Core
7310 Source = source, // the Source column is only set when creating a patch
7311 CompressionLevel = compressionLevel,
7312 Layout = layout
7376 - };
7377 -
7378 - this.Core.AddTuple(tuple);
7313 + });
7314
7315 if (null != symbols)
7316 {
@@ -7441,7 +7376,7 @@ namespace WixToolset.Core
7376 break;
7377 case "DiskPrompt":
7378 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7444 - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7379 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7380 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
7381 break;
7382 case "EmbedCab":
@@ -7480,7 +7415,7 @@ namespace WixToolset.Core
7415 DiskId = 1
7416 });
7417
7483 - var tuple = new WixMediaTemplateTuple(sourceLineNumbers)
7418 + this.Core.AddTuple(new WixMediaTemplateTuple(sourceLineNumbers)
7419 {
7420 CabinetTemplate = cabinetTemplate,
7421 VolumeLabel = volumeLabel,
@@ -7488,7 +7423,7 @@ namespace WixToolset.Core
7423 MaximumUncompressedMediaSize = maximumUncompressedMediaSize,
7424 MaximumCabinetSizeForLargeFileSplitting = maximumCabinetSizeForLargeFileSplitting,
7425 CompressionLevel = compressionLevel
7491 - };
7426 + });
7427
7428 //else
7429 //{
@@ -7499,8 +7434,6 @@ namespace WixToolset.Core
7434 //{
7435 // mediaTemplateRow.MaximumCabinetSizeForLargeFileSplitting = 0; // Default value of 0 corresponds to max size of 2048 MB (i.e. 2 GB)
7436 //}
7502 -
7503 - this.Core.AddTuple(tuple);
7437 }
7438 }
7439
@@ -7530,7 +7463,7 @@ namespace WixToolset.Core
7463 break;
7464 case "DiskId":
7465 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
7533 - this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
7466 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Media, diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
7467 break;
7468 case "FileCompression":
7469 var compress = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7604,7 +7537,7 @@ namespace WixToolset.Core
7537
7538 if (!this.Core.EncounteredError)
7539 {
7607 - var tuple = new WixMergeTuple(sourceLineNumbers, id)
7540 + var tuple = this.Core.AddTuple(new WixMergeTuple(sourceLineNumbers, id)
7541 {
7542 DirectoryRef = directoryId,
7543 SourceFile = sourceFile,
@@ -7612,11 +7545,9 @@ namespace WixToolset.Core
7545 ConfigurationData = configData,
7546 FileAttributes = attributes,
7547 FeatureRef = Guid.Empty.ToString("B")
7615 - };
7548 + });
7549
7550 tuple.Set((int)WixMergeTupleFields.Language, language);
7618 -
7619 - this.Core.AddTuple(tuple);
7551 }
7552 }
7553
@@ -7701,7 +7632,7 @@ namespace WixToolset.Core
7632 {
7633 case "Id":
7634 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
7704 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id);
7635 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixMerge, id);
7636 break;
7637 case "Primary":
7638 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7794,14 +7725,12 @@ namespace WixToolset.Core
7725
7726 if (!this.Core.EncounteredError)
7727 {
7797 - var tuple = new MIMETuple(sourceLineNumbers, new Identifier(AccessModifier.Private, contentType))
7728 + this.Core.AddTuple(new MIMETuple(sourceLineNumbers, new Identifier(AccessModifier.Private, contentType))
7729 {
7730 ContentType = contentType,
7731 ExtensionRef = extension,
7732 CLSID = classId
7802 - };
7803 -
7804 - this.Core.AddTuple(tuple);
7733 + });
7734 }
7735 }
7736 else if (YesNoType.No == advertise)
@@ -7902,12 +7831,10 @@ namespace WixToolset.Core
7831 {
7832 if (!this.Core.EncounteredError)
7833 {
7905 - var tuple = new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
7834 + this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
7835 {
7836 Value = value
7908 - };
7909 -
7910 - this.Core.AddTuple(tuple);
7837 + });
7838 }
7839 }
7840
@@ -8063,13 +7990,11 @@ namespace WixToolset.Core
7990
7991 if (!this.Core.EncounteredError)
7992 {
8066 - var tuple = new WixPatchRefTuple(sourceLineNumbers)
7993 + this.Core.AddTuple(new WixPatchRefTuple(sourceLineNumbers)
7994 {
7995 Table = "*",
8069 - PrimaryKeys = "*"
8070 - };
8071 -
8072 - this.Core.AddTuple(tuple);
7996 + PrimaryKeys = "*",
7997 + });
7998 }
7999 }
8000
@@ -8112,13 +8037,11 @@ namespace WixToolset.Core
8037
8038 if (!this.Core.EncounteredError)
8039 {
8115 - var tuple = new WixPatchRefTuple(sourceLineNumbers)
8040 + this.Core.AddTuple(new WixPatchRefTuple(sourceLineNumbers)
8041 {
8042 Table = tableName,
8043 PrimaryKeys = id
8119 - };
8120 -
8121 - this.Core.AddTuple(tuple);
8044 + });
8045 }
8046 }
8047
@@ -8232,16 +8155,14 @@ namespace WixToolset.Core
8155
8156 if (!this.Core.EncounteredError)
8157 {
8235 - var tuple = new WixPatchBaselineTuple(sourceLineNumbers, id)
8158 + this.Core.AddTuple(new WixPatchBaselineTuple(sourceLineNumbers, id)
8159 {
8160 DiskId = diskId ?? 1,
8161 ValidationFlags = validationFlags,
8162 BaselineFile = new IntermediateFieldPathValue { Path = baselineFile },
8163 UpdateFile = new IntermediateFieldPathValue { Path = updateFile },
8241 - TransformFile = new IntermediateFieldPathValue { Path = transformFile }
8242 - };
8243 -
8244 - this.Core.AddTuple(tuple);
8164 + TransformFile = new IntermediateFieldPathValue { Path = transformFile },
8165 + });
8166 }
8167 }
8168
src/WixToolset.Core/CompilerCore.cs
+36 -26
@@ -14,6 +14,7 @@ namespace WixToolset.Core
14 using System.Xml.Linq;
15 using WixToolset.Data;
16 using WixToolset.Data.Tuples;
17 + using WixToolset.Data.WindowsInstaller;
18 using WixToolset.Extensibility;
19 using WixToolset.Extensibility.Data;
20 using WixToolset.Extensibility.Services;
@@ -166,9 +167,10 @@ namespace WixToolset.Core
167 /// Add a tuple to the active section.
168 /// </summary>
169 /// <param name="tuple">Tuple to add.</param>
169 - public void AddTuple(IntermediateTuple tuple)
170 + public T AddTuple<T>(T tuple)
171 + where T : IntermediateTuple
172 {
171 - this.ActiveSection.Tuples.Add(tuple);
173 + return this.ActiveSection.AddTuple(tuple);
174 }
175
176 /// <summary>
@@ -350,23 +352,6 @@ namespace WixToolset.Core
352 return this.parseHelper.CreateGuid(namespaceGuid, value);
353 }
354
353 - /// <summary>
354 - /// Creates a tuple in the active section.
355 - /// </summary>
356 - /// <param name="sourceLineNumbers">Source and line number of current row.</param>
357 - /// <param name="tupleType">Type of tuple to create.</param>
358 - /// <param name="identifier">Optional identifier.</param>
359 - /// <returns>New tuple.</returns>
360 - public IntermediateTuple CreateTuple(SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null)
361 - {
362 - var tupleDefinition = TupleDefinitions.ByType(tupleType);
363 - var tuple = tupleDefinition.CreateTuple(sourceLineNumbers, identifier);
364 -
365 - this.ActiveSection.Tuples.Add(tuple);
366 -
367 - return tuple;
368 - }
369 -
355 /// <summary>
356 /// Creates directories using the inline directory syntax.
357 /// </summary>
@@ -394,26 +379,37 @@ namespace WixToolset.Core
379 }
380
381 /// <summary>
397 - /// Create a WixSimpleReference row in the active section.
382 + /// Create a WixSimpleReferenceTuple in the active section.
383 /// </summary>
384 /// <param name="sourceLineNumbers">Source line information for the row.</param>
400 - /// <param name="tableName">The table name of the simple reference.</param>
385 + /// <param name="tupleName">The tuple name of the simple reference.</param>
386 /// <param name="primaryKeys">The primary keys of the simple reference.</param>
402 - public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys)
387 + public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys)
388 {
389 if (!this.EncounteredError)
390 {
406 - string joinedKeys = String.Join("/", primaryKeys);
407 - string id = String.Concat(tableName, ":", joinedKeys);
391 + var joinedKeys = String.Join("/", primaryKeys);
392 + var id = String.Concat(tupleName, ":", joinedKeys);
393
394 // If this simple reference hasn't been added to the active section already, add it.
395 if (this.activeSectionSimpleReferences.Add(id))
396 {
412 - this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tableName, primaryKeys);
397 + this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tupleName, primaryKeys);
398 }
399 }
400 }
401
402 + /// <summary>
403 + /// Create a WixSimpleReferenceTuple in the active section.
404 + /// </summary>
405 + /// <param name="sourceLineNumbers">Source line information for the row.</param>
406 + /// <param name="tupleDefinition">The tuple definition of the simple reference.</param>
407 + /// <param name="primaryKeys">The primary keys of the simple reference.</param>
408 + public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys)
409 + {
410 + this.CreateSimpleReference(sourceLineNumbers, tupleDefinition.Name, primaryKeys);
411 + }
412 +
413 /// <summary>
414 /// A row in the WixGroup table is added for this child node and its parent node.
415 /// </summary>
@@ -431,7 +427,7 @@ namespace WixToolset.Core
427 }
428
429 /// <summary>
434 - /// Add the appropriate rows to make sure that the given table shows up
430 + /// Add the appropriate tuples to make sure that the given table shows up
431 /// in the resulting output.
432 /// </summary>
433 /// <param name="sourceLineNumbers">Source line numbers.</param>
@@ -444,6 +440,20 @@ namespace WixToolset.Core
440 }
441 }
442
443 + /// <summary>
444 + /// Add the appropriate tuples to make sure that the given table shows up
445 + /// in the resulting output.
446 + /// </summary>
447 + /// <param name="sourceLineNumbers">Source line numbers.</param>
448 + /// <param name="tableDefinition">Definition of the table to ensure existance of.</param>
449 + public void EnsureTable(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition)
450 + {
451 + if (!this.EncounteredError)
452 + {
453 + this.parseHelper.EnsureTable(this.ActiveSection, sourceLineNumbers, tableDefinition);
454 + }
455 + }
456 +
457 /// <summary>
458 /// Get an attribute value.
459 /// </summary>
src/WixToolset.Core/Compiler_2.cs
+113 -175
@@ -193,7 +193,7 @@ namespace WixToolset.Core
193 this.ParseCustomActionElement(child);
194 break;
195 case "CustomActionRef":
196 - this.ParseSimpleRefElement(child, "CustomAction");
196 + this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
197 break;
198 case "CustomTable":
199 this.ParseCustomTableElement(child);
@@ -208,7 +208,7 @@ namespace WixToolset.Core
208 this.ParseEmbeddedChainerElement(child);
209 break;
210 case "EmbeddedChainerRef":
211 - this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
211 + this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
212 break;
213 case "EnsureTable":
214 this.ParseEnsureTableElement(child);
@@ -248,7 +248,7 @@ namespace WixToolset.Core
248 this.ParsePropertyElement(child);
249 break;
250 case "PropertyRef":
251 - this.ParseSimpleRefElement(child, "Property");
251 + this.ParseSimpleRefElement(child, TupleDefinitions.Property);
252 break;
253 case "SetDirectory":
254 this.ParseSetDirectoryElement(child);
@@ -274,7 +274,7 @@ namespace WixToolset.Core
274 this.ParseUIElement(child);
275 break;
276 case "UIRef":
277 - this.ParseSimpleRefElement(child, "WixUI");
277 + this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
278 break;
279 case "Upgrade":
280 this.ParseUpgradeElement(child);
@@ -297,14 +297,12 @@ namespace WixToolset.Core
297 {
298 if (null != symbols)
299 {
300 - var tuple = new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers)
300 + this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers)
301 {
302 SymbolId = productCode,
303 SymbolType = SymbolPathType.Product,
304 - SymbolPaths = symbols
305 - };
306 -
307 - this.Core.AddTuple(tuple);
304 + SymbolPaths = symbols,
305 + });
306 }
307 }
308 }
@@ -340,14 +338,14 @@ namespace WixToolset.Core
338 break;
339 case "File":
340 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
343 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver);
341 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, driver);
342 break;
343 case "Name":
344 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
345 break;
346 case "SetupFile":
347 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
350 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup);
348 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, setup);
349 break;
350 default:
351 this.Core.UnexpectedAttribute(node, attrib);
@@ -405,11 +403,29 @@ namespace WixToolset.Core
403
404 if (!this.Core.EncounteredError)
405 {
408 - var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, id);
409 - tuple.Set(1, componentId);
410 - tuple.Set(2, name);
411 - tuple.Set(3, driver);
412 - tuple.Set(4, setup);
406 + switch (tupleDefinitionType)
407 + {
408 + case TupleDefinitionType.ODBCDriver:
409 + this.Core.AddTuple(new ODBCDriverTuple(sourceLineNumbers, id)
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 + }
429 }
430 }
431
@@ -457,10 +473,28 @@ namespace WixToolset.Core
473
474 if (!this.Core.EncounteredError)
475 {
460 - var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, new Identifier(AccessModifier.Private, parentId, id));
461 - tuple.Set(0, parentId);
462 - tuple.Set(1, id);
463 - tuple.Set(2, propertyValue);
476 + var identifier = new Identifier(AccessModifier.Private, parentId, id);
477 + switch (tupleDefinitionType)
478 + {
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 + }
498 }
499 }
500
@@ -674,13 +708,11 @@ namespace WixToolset.Core
708 switch (installScope)
709 {
710 case "perMachine":
677 - {
711 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS"))
712 {
713 Value = "1"
714 });
715 installScopeSeen = true;
683 - }
716 break;
717 case "perUser":
718 sourceBits |= 8;
@@ -1353,18 +1385,18 @@ namespace WixToolset.Core
1385 {
1386 if (!this.Core.EncounteredError)
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))
1389 {
1390 ProgId = progId,
1391 ParentProgIdRef = parent,
1392 ClassRef = classId,
1393 Description = description,
1362 - };
1394 + });
1395
1396 if (null != icon)
1397 {
1398 tuple.IconRef = icon;
1367 - this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon);
1399 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
1400 }
1401
1402 if (CompilerConstants.IntegerNotSet != iconIndex)
@@ -1372,9 +1404,7 @@ namespace WixToolset.Core
1404 tuple.IconIndex = iconIndex;
1405 }
1406
1375 - this.Core.AddTuple(tuple);
1376 -
1377 - this.Core.EnsureTable(sourceLineNumbers, "Class");
1407 + this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Class);
1408 }
1409 }
1410 else if (YesNoType.No == advertise)
@@ -1403,7 +1433,7 @@ namespace WixToolset.Core
1433
1434 if (null != icon) // ProgId's Default Icon
1435 {
1406 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon);
1436 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, icon);
1437
1438 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon);
1439
@@ -1513,7 +1543,7 @@ namespace WixToolset.Core
1543
1544 if ("ErrorDialog" == id.Id)
1545 {
1516 - this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value);
1546 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, value);
1547 }
1548
1549 foreach (var child in node.Elements())
@@ -1764,15 +1794,13 @@ namespace WixToolset.Core
1794
1795 if (!this.Core.EncounteredError && null != name)
1796 {
1767 - var tuple = new RegistryTuple(sourceLineNumbers, id)
1797 + this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
1798 {
1799 Root = root.Value,
1800 Key = key,
1801 Name = name,
1802 ComponentRef = componentId,
1773 - };
1774 -
1775 - this.Core.AddTuple(tuple);
1803 + });
1804 }
1805
1806 return keyPath;
@@ -2011,7 +2039,7 @@ namespace WixToolset.Core
2039
2040 if (!this.Core.EncounteredError)
2041 {
2014 - var tuple = new RegistryTuple(sourceLineNumbers, id)
2042 + this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
2043 {
2044 Root = root.Value,
2045 Key = key,
@@ -2020,15 +2048,7 @@ namespace WixToolset.Core
2048 ValueType = valueType,
2049 ValueAction = actionType,
2050 ComponentRef = componentId,
2023 - };
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);
2051 + });
2052 }
2053
2054 // If this was just a regular registry key (that could be the key path)
@@ -2134,16 +2154,14 @@ namespace WixToolset.Core
2154
2155 if (!this.Core.EncounteredError)
2156 {
2137 - var tuple = new RemoveRegistryTuple(sourceLineNumbers, id)
2157 + this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2158 {
2159 Root = root.Value,
2160 Key = key,
2161 Name = name,
2162 Action = actionType.Value,
2143 - ComponentRef = componentId
2144 - };
2145 -
2146 - this.Core.AddTuple(tuple);
2163 + ComponentRef = componentId,
2164 + });
2165 }
2166 }
2167
@@ -2212,15 +2230,13 @@ namespace WixToolset.Core
2230
2231 if (!this.Core.EncounteredError)
2232 {
2215 - var tuple = new RemoveRegistryTuple(sourceLineNumbers, id)
2233 + this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2234 {
2235 Root = root.Value,
2236 Key = key,
2237 Name = name,
2238 ComponentRef = componentId
2221 - };
2222 -
2223 - this.Core.AddTuple(tuple);
2239 + });
2240 }
2241 }
2242
@@ -2333,16 +2349,14 @@ namespace WixToolset.Core
2349
2350 if (!this.Core.EncounteredError)
2351 {
2336 - var tuple = new RemoveFileTuple(sourceLineNumbers, id)
2352 + this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2353 {
2354 ComponentRef = componentId,
2355 FileName = this.GetMsiFilenameValue(shortName, name),
2356 DirProperty = directory ?? property ?? parentDirectory,
2357 OnInstall = onInstall,
2342 - OnUninstall = onUninstall
2343 - };
2344 -
2345 - this.Core.AddTuple(tuple);
2358 + OnUninstall = onUninstall,
2359 + });
2360 }
2361 }
2362
@@ -2423,15 +2437,13 @@ namespace WixToolset.Core
2437
2438 if (!this.Core.EncounteredError)
2439 {
2426 - var tuple = new RemoveFileTuple(sourceLineNumbers, id)
2440 + this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2441 {
2442 ComponentRef = componentId,
2443 DirProperty = directory ?? property ?? parentDirectory,
2444 OnInstall = onInstall,
2445 OnUninstall = onUninstall
2432 - };
2433 -
2434 - this.Core.AddTuple(tuple);
2446 + });
2447 }
2448 }
2449
@@ -2540,7 +2552,7 @@ namespace WixToolset.Core
2552 if (customAction)
2553 {
2554 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2543 - this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName);
2555 + this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.CustomAction, actionName);
2556 }
2557 else
2558 {
@@ -2551,7 +2563,7 @@ namespace WixToolset.Core
2563 if (customAction || showDialog || specialAction || specialStandardAction)
2564 {
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);
2567 }
2568 else
2569 {
@@ -2562,7 +2574,7 @@ namespace WixToolset.Core
2574 if (customAction || showDialog || specialAction || specialStandardAction)
2575 {
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);
2578 }
2579 else
2580 {
@@ -2573,7 +2585,7 @@ namespace WixToolset.Core
2585 if (showDialog)
2586 {
2587 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2576 - this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName);
2588 + this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.Dialog, actionName);
2589 }
2590 else
2591 {
@@ -2699,7 +2711,7 @@ namespace WixToolset.Core
2711 }
2712 else
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))
2715 {
2716 SequenceTable = sequenceTable,
2717 Action = actionName,
@@ -2707,14 +2719,12 @@ namespace WixToolset.Core
2719 Before = beforeAction,
2720 After = afterAction,
2721 Overridable = overridable,
2710 - };
2722 + });
2723
2724 if (CompilerConstants.IntegerNotSet != sequence)
2725 {
2726 tuple.Sequence = sequence;
2727 }
2716 -
2717 - this.Core.AddTuple(tuple);
2728 }
2729 }
2730 }
@@ -3008,7 +3018,7 @@ namespace WixToolset.Core
3018 {
3019 if (!String.IsNullOrEmpty(delayedAutoStart))
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")))
3022 {
3023 Name = name,
3024 OnInstall = install,
@@ -3017,20 +3027,12 @@ namespace WixToolset.Core
3027 ConfigType = MsiServiceConfigType.DelayedAutoStart,
3028 Argument = delayedAutoStart,
3029 ComponentRef = componentId,
3020 - };
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);
3030 + });
3031 }
3032
3033 if (!String.IsNullOrEmpty(failureActionsWhen))
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")))
3036 {
3037 Name = name,
3038 OnInstall = install,
@@ -3039,20 +3041,12 @@ namespace WixToolset.Core
3041 ConfigType = MsiServiceConfigType.FailureActionsFlag,
3042 Argument = failureActionsWhen,
3043 ComponentRef = componentId,
3042 - };
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);
3044 + });
3045 }
3046
3047 if (!String.IsNullOrEmpty(sid))
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")))
3050 {
3051 Name = name,
3052 OnInstall = install,
@@ -3061,20 +3055,12 @@ namespace WixToolset.Core
3055 ConfigType = MsiServiceConfigType.ServiceSidInfo,
3056 Argument = sid,
3057 ComponentRef = componentId,
3064 - };
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);
3058 + });
3059 }
3060
3061 if (!String.IsNullOrEmpty(requiredPrivileges))
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")))
3064 {
3065 Name = name,
3066 OnInstall = install,
@@ -3083,20 +3069,12 @@ namespace WixToolset.Core
3069 ConfigType = MsiServiceConfigType.RequiredPrivilegesInfo,
3070 Argument = requiredPrivileges,
3071 ComponentRef = componentId,
3086 - };
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);
3072 + });
3073 }
3074
3075 if (!String.IsNullOrEmpty(preShutdownDelay))
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")))
3078 {
3079 Name = name,
3080 OnInstall = install,
@@ -3105,15 +3083,7 @@ namespace WixToolset.Core
3083 ConfigType = MsiServiceConfigType.PreshutdownInfo,
3084 Argument = preShutdownDelay,
3085 ComponentRef = componentId,
3108 - };
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);
3086 + });
3087 }
3088 }
3089 }
@@ -3284,7 +3254,7 @@ namespace WixToolset.Core
3254
3255 if (!this.Core.EncounteredError)
3256 {
3287 - var tuple = new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id)
3257 + this.Core.AddTuple(new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id)
3258 {
3259 Name = name,
3260 OnInstall = install,
@@ -3296,9 +3266,7 @@ namespace WixToolset.Core
3266 Actions = actions,
3267 DelayActions = actionsDelays,
3268 ComponentRef = componentId,
3299 - };
3300 -
3301 - this.Core.AddTuple(tuple);
3269 + });
3270 }
3271 }
3272
@@ -3438,7 +3406,7 @@ namespace WixToolset.Core
3406
3407 if (!this.Core.EncounteredError)
3408 {
3441 - var tuple = new ServiceControlTuple(sourceLineNumbers, id)
3409 + this.Core.AddTuple(new ServiceControlTuple(sourceLineNumbers, id)
3410 {
3411 Name = name,
3412 InstallRemove = installRemove,
@@ -3450,9 +3418,7 @@ namespace WixToolset.Core
3418 Arguments = arguments,
3419 Wait = wait,
3420 ComponentRef = componentId
3453 - };
3454 -
3455 - this.Core.AddTuple(tuple);
3421 + });
3422 }
3423 }
3424
@@ -3697,7 +3663,7 @@ namespace WixToolset.Core
3663
3664 if (!this.Core.EncounteredError)
3665 {
3700 - var tuple = new ServiceInstallTuple(sourceLineNumbers, id)
3666 + this.Core.AddTuple(new ServiceInstallTuple(sourceLineNumbers, id)
3667 {
3668 Name = name,
3669 DisplayName = displayName,
@@ -3713,23 +3679,7 @@ namespace WixToolset.Core
3679 Description = description,
3680 Interactive = interactive,
3681 Vital = vital
3716 - };
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);
3682 + });
3683 }
3684 }
3685
@@ -3758,7 +3708,7 @@ namespace WixToolset.Core
3708 break;
3709 case "Id":
3710 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3761 - this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id);
3711 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
3712 break;
3713 case "Sequence":
3714 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -3816,16 +3766,14 @@ namespace WixToolset.Core
3766
3767 if (!this.Core.EncounteredError)
3768 {
3819 - var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3769 + this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3770 {
3771 ExecutionType = executionType,
3772 SourceType = CustomActionSourceType.Directory,
3773 TargetType = CustomActionTargetType.TextData,
3774 Source = id,
3775 Target = value
3826 - };
3827 -
3828 - this.Core.AddTuple(tuple);
3776 + });
3777
3778 foreach (var sequence in sequences)
3779 {
@@ -3966,16 +3914,14 @@ namespace WixToolset.Core
3914 this.Core.Write(ErrorMessages.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction));
3915 }
3916
3969 - var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3917 + this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3918 {
3919 ExecutionType = executionType,
3920 SourceType = CustomActionSourceType.Property,
3921 TargetType = CustomActionTargetType.TextData,
3922 Source = id,
3975 - Target = value
3976 - };
3977 -
3978 - this.Core.AddTuple(tuple);
3923 + Target = value,
3924 + });
3925
3926 foreach (var sequence in sequences)
3927 {
@@ -4192,7 +4138,7 @@ namespace WixToolset.Core
4138 break;
4139 case "Icon":
4140 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4195 - this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon);
4141 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
4142 break;
4143 case "IconIndex":
4144 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
@@ -4390,7 +4336,7 @@ namespace WixToolset.Core
4336 target = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget);
4337 }
4338
4393 - var tuple = new ShortcutTuple(sourceLineNumbers, id)
4339 + this.Core.AddTuple(new ShortcutTuple(sourceLineNumbers, id)
4340 {
4341 DirectoryRef = directory,
4342 Name = name,
@@ -4408,9 +4354,7 @@ namespace WixToolset.Core
4354 DisplayResourceId = displayResourceId,
4355 DescriptionResourceDll = descriptionResourceDll,
4356 DescriptionResourceId = descriptionResourceId,
4411 - };
4412 -
4413 - this.Core.AddTuple(tuple);
4357 + });
4358 }
4359 }
4360
@@ -4679,7 +4623,7 @@ namespace WixToolset.Core
4623
4624 if (!this.Core.EncounteredError)
4625 {
4682 - var tuple = new TypeLibTuple(sourceLineNumbers)
4626 + var tuple = this.Core.AddTuple(new TypeLibTuple(sourceLineNumbers)
4627 {
4628 LibId = id,
4629 Language = language,
@@ -4687,7 +4631,7 @@ namespace WixToolset.Core
4631 Description = description,
4632 DirectoryRef = helpDirectory,
4633 FeatureRef = Guid.Empty.ToString("B")
4690 - };
4634 + });
4635
4636 if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion)
4637 {
@@ -4698,8 +4642,6 @@ namespace WixToolset.Core
4642 {
4643 tuple.Cost = cost;
4644 }
4701 -
4702 - this.Core.AddTuple(tuple);
4645 }
4646 }
4647 else if (YesNoType.No == advertise)
@@ -4894,7 +4836,7 @@ namespace WixToolset.Core
4836
4837 if (!this.Core.EncounteredError)
4838 {
4897 - var tuple = new UpgradeTuple(sourceLineNumbers)
4839 + this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
4840 {
4841 UpgradeCode = upgradeId,
4842 VersionMin = minimum,
@@ -4908,15 +4850,13 @@ namespace WixToolset.Core
4850 OnlyDetect = onlyDetect,
4851 Remove = removeFeatures,
4852 ActionProperty = actionProperty
4911 - };
4912 -
4913 - this.Core.AddTuple(tuple);
4853 + });
4854
4855 // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence
4856 // if at least one row in Upgrade table lacks the OnlyDetect attribute.
4857 if (!onlyDetect)
4858 {
4919 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", "RemoveExistingProducts");
4859 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixAction, "InstallExecuteSequence", "RemoveExistingProducts");
4860 }
4861 }
4862 }
@@ -4964,7 +4904,7 @@ namespace WixToolset.Core
4904 break;
4905 case "TargetFile":
4906 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4967 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile);
4907 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, targetFile);
4908 break;
4909 case "TargetProperty":
4910 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -5021,20 +4961,18 @@ namespace WixToolset.Core
4961
4962 if (!this.Core.EncounteredError)
4963 {
5024 - var tuple = new VerbTuple(sourceLineNumbers)
4964 + var tuple = this.Core.AddTuple(new VerbTuple(sourceLineNumbers)
4965 {
4966 ExtensionRef = extension,
4967 Verb = id,
4968 Command = command,
4969 Argument = argument,
5030 - };
4970 + });
4971
4972 if (CompilerConstants.IntegerNotSet != sequence)
4973 {
4974 tuple.Sequence = sequence;
4975 }
5036 -
5037 - this.Core.AddTuple(tuple);
4976 }
4977 }
4978 else if (YesNoType.No == advertise)
src/WixToolset.Core/Compiler_Bundle.cs
+36 -61
@@ -84,14 +84,12 @@ namespace WixToolset.Core
84
85 if (!this.Core.EncounteredError)
86 {
87 - var tuple = new WixApprovedExeForElevationTuple(sourceLineNumbers, id)
87 + this.Core.AddTuple(new WixApprovedExeForElevationTuple(sourceLineNumbers, id)
88 {
89 Key = key,
90 ValueName = valueName,
91 - Attributes = attributes
92 - };
93 -
94 - this.Core.AddTuple(tuple);
91 + Attributes = attributes,
92 + });
93 }
94 }
95
@@ -282,7 +280,7 @@ namespace WixToolset.Core
280 this.ParseBundleExtensionElement(child);
281 break;
282 case "BundleExtensionRef":
285 - this.ParseSimpleRefElement(child, "WixBundleExtension");
283 + this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleExtension);
284 break;
285 case "OptionalUpdateRegistration":
286 this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name);
@@ -303,7 +301,7 @@ namespace WixToolset.Core
301 this.ParseContainerElement(child);
302 break;
303 case "ContainerRef":
306 - this.ParseSimpleRefElement(child, "WixBundleContainer");
304 + this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleContainer);
305 break;
306 case "Log":
307 if (logSeen)
@@ -327,7 +325,7 @@ namespace WixToolset.Core
325 this.ParseSetVariableElement(child);
326 break;
327 case "SetVariableRef":
330 - this.ParseSimpleRefElement(child, "WixSetVariable");
328 + this.ParseSimpleRefElement(child, TupleDefinitions.WixSetVariable);
329 break;
330 case "Update":
331 this.ParseUpdateElement(child);
@@ -356,7 +354,7 @@ namespace WixToolset.Core
354
355 if (!this.Core.EncounteredError)
356 {
359 - var tuple = new WixBundleTuple(sourceLineNumbers)
357 + var tuple = this.Core.AddTuple(new WixBundleTuple(sourceLineNumbers)
358 {
359 UpgradeCode = upgradeCode,
360 Version = version,
@@ -375,7 +373,7 @@ namespace WixToolset.Core
373 Tag = tag,
374 Platform = this.CurrentPlatform,
375 ParentName = parentName,
378 - };
376 + });
377
378 if (!String.IsNullOrEmpty(logVariablePrefixAndExtension))
379 {
@@ -385,8 +383,6 @@ namespace WixToolset.Core
383 tuple.LogExtension = split[2];
384 }
385
388 - this.Core.AddTuple(tuple);;
389 -
386 if (null != upgradeCode)
387 {
388 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers)
@@ -399,32 +395,32 @@ namespace WixToolset.Core
395 this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, Compiler.BurnDefaultAttachedContainerId)
396 {
397 Name = "bundle-attached.cab",
402 - Type = ContainerType.Attached
398 + Type = ContainerType.Attached,
399 });
400
401 // Ensure that the bundle stores the well-known persisted values.
402 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_NAME))
403 {
404 Hidden = false,
409 - Persisted = true
405 + Persisted = true,
406 });
407
408 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE))
409 {
410 Hidden = false,
415 - Persisted = true
411 + Persisted = true,
412 });
413
414 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER))
415 {
416 Hidden = false,
421 - Persisted = true
417 + Persisted = true,
418 });
419
420 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE))
421 {
422 Hidden = false,
427 - Persisted = true
423 + Persisted = true,
424 });
425 }
426 }
@@ -767,7 +763,7 @@ namespace WixToolset.Core
763 }
764 else
765 {
770 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixBootstrapperApplication", id);
766 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBootstrapperApplication, id);
767 }
768 }
769
@@ -830,11 +826,10 @@ namespace WixToolset.Core
826 // Add the BundleExtension.
827 if (!this.Core.EncounteredError)
828 {
833 - var tuple = new WixBundleExtensionTuple(sourceLineNumbers, id)
829 + this.Core.AddTuple(new WixBundleExtensionTuple(sourceLineNumbers, id)
830 {
831 PayloadRef = id.Id,
836 - };
837 - this.Core.AddTuple(tuple);
832 + });
833 }
834 }
835
@@ -1194,7 +1189,7 @@ namespace WixToolset.Core
1189
1190 if (!this.Core.EncounteredError)
1191 {
1197 - tuple = new WixBundlePayloadTuple(sourceLineNumbers, id)
1192 + tuple = this.Core.AddTuple(new WixBundlePayloadTuple(sourceLineNumbers, id)
1193 {
1194 Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name,
1195 SourceFile = new IntermediateFieldPathValue { Path = sourceFile },
@@ -1204,7 +1199,7 @@ namespace WixToolset.Core
1199 DisplayName = displayName,
1200 Description = description,
1201 EnableSignatureValidation = (YesNoType.Yes == enableSignatureVerification)
1207 - };
1202 + });
1203
1204 if (null != remotePayload)
1205 {
@@ -1217,8 +1212,6 @@ namespace WixToolset.Core
1212 tuple.Version = remotePayload.Version;
1213 }
1214
1220 - this.Core.AddTuple(tuple);
1221 -
1215 this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId.Id, ComplexReferenceChildType.Payload, id.Id, previousType, previousId?.Id);
1216 }
1217
@@ -1322,7 +1315,7 @@ namespace WixToolset.Core
1315 {
1316 case "Id":
1317 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
1325 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id.Id);
1318 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePayloadGroup, id.Id);
1319 break;
1320 default:
1321 this.Core.UnexpectedAttribute(node, attrib);
@@ -1377,15 +1370,13 @@ namespace WixToolset.Core
1370 // TODO: Should we define our own enum for this, just to ensure there's no "cross-contamination"?
1371 // TODO: Also, we could potentially include an 'Attributes' field to track things like
1372 // 'before' vs. 'after', and explicit vs. inferred dependencies.
1380 - var tuple = new WixOrderingTuple(sourceLineNumbers)
1373 + this.Core.AddTuple(new WixOrderingTuple(sourceLineNumbers)
1374 {
1375 ItemType = type,
1376 ItemIdRef = id,
1377 DependsOnType = previousType,
1378 DependsOnIdRef = previousId
1386 - };
1387 -
1388 - this.Core.AddTuple(tuple);
1379 + });
1380 }
1381 }
1382
@@ -2101,7 +2092,7 @@ namespace WixToolset.Core
2092 attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0;
2093 attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0;
2094
2104 - var chainPackageTuple = new WixBundlePackageTuple(sourceLineNumbers, id)
2095 + var chainPackageTuple = this.Core.AddTuple(new WixBundlePackageTuple(sourceLineNumbers, id)
2096 {
2097 Type = packageType,
2098 PayloadRef = id.Id,
@@ -2110,7 +2101,7 @@ namespace WixToolset.Core
2101 CacheId = cacheId,
2102 LogPathVariable = logPathVariable,
2103 RollbackLogPathVariable = rollbackPathVariable,
2113 - };
2104 + });
2105
2106 if (YesNoAlwaysType.NotSet != cache)
2107 {
@@ -2132,8 +2123,6 @@ namespace WixToolset.Core
2123 chainPackageTuple.InstallSize = installSize;
2124 }
2125
2135 - this.Core.AddTuple(chainPackageTuple);
2136 -
2126 switch (packageType)
2127 {
2128 case WixBundlePackageType.Exe:
@@ -2370,7 +2359,7 @@ namespace WixToolset.Core
2359 {
2360 case "Id":
2361 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2373 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id);
2362 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePackageGroup, id);
2363 break;
2364 case "After":
2365 after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
@@ -2425,7 +2414,7 @@ namespace WixToolset.Core
2414 {
2415 this.Core.AddTuple(new WixChainItemTuple(sourceLineNumbers, id));
2416
2428 - var rollbackBoundary = new WixBundleRollbackBoundaryTuple(sourceLineNumbers, id);
2417 + var rollbackBoundary = this.Core.AddTuple(new WixBundleRollbackBoundaryTuple(sourceLineNumbers, id));
2418
2419 if (YesNoType.NotSet != vital)
2420 {
@@ -2437,8 +2426,6 @@ namespace WixToolset.Core
2426 rollbackBoundary.Transaction = (transaction == YesNoType.Yes);
2427 }
2428
2440 - this.Core.AddTuple(rollbackBoundary);
2441 -
2429 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null);
2430 }
2431
@@ -2520,19 +2507,17 @@ namespace WixToolset.Core
2507
2508 if (!this.Core.EncounteredError)
2509 {
2523 - var tuple = new WixBundleMsiPropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, name))
2510 + var tuple = this.Core.AddTuple(new WixBundleMsiPropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, name))
2511 {
2512 PackageRef = packageId,
2513 Name = name,
2514 Value = value
2528 - };
2515 + });
2516
2517 if (!String.IsNullOrEmpty(condition))
2518 {
2519 tuple.Condition = condition;
2520 }
2534 -
2535 - this.Core.AddTuple(tuple);
2521 }
2522 }
2523
@@ -2554,7 +2539,7 @@ namespace WixToolset.Core
2539 {
2540 case "Id":
2541 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2557 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id);
2542 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePackage, id);
2543 break;
2544 default:
2545 this.Core.UnexpectedAttribute(node, attrib);
@@ -2650,16 +2635,11 @@ namespace WixToolset.Core
2635
2636 if (!this.Core.EncounteredError)
2637 {
2653 - var tuple = new WixRelatedBundleTuple(sourceLineNumbers)
2638 + this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers)
2639 {
2640 BundleId = id,
2641 Action = actionType,
2657 - };
2658 -
2659 - this.Core.AddTuple(tuple);
2660 - //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixRelatedBundle);
2661 - //row.Set(0, id);
2662 - //row.Set(1, (int)actionType);
2642 + });
2643 }
2644 }
2645
@@ -2701,12 +2681,10 @@ namespace WixToolset.Core
2681
2682 if (!this.Core.EncounteredError)
2683 {
2704 - var tuple = new WixBundleUpdateTuple(sourceLineNumbers)
2684 + this.Core.AddTuple(new WixBundleUpdateTuple(sourceLineNumbers)
2685 {
2686 Location = location
2707 - };
2708 -
2709 - this.Core.AddTuple(tuple);
2687 + });
2688 }
2689 }
2690
@@ -2773,12 +2751,11 @@ namespace WixToolset.Core
2751
2752 if (!this.Messaging.EncounteredError)
2753 {
2776 - var tuple = new WixSetVariableTuple(sourceLineNumbers, id)
2754 + this.Core.AddTuple(new WixSetVariableTuple(sourceLineNumbers, id)
2755 {
2756 Value = value,
2757 Type = type,
2780 - };
2781 - this.Core.AddTuple(tuple);
2758 + });
2759 }
2760 }
2761
@@ -2848,15 +2825,13 @@ namespace WixToolset.Core
2825
2826 if (!this.Core.EncounteredError)
2827 {
2851 - var tuple = new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
2828 + this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
2829 {
2830 Value = value,
2831 Type = type,
2832 Hidden = hidden,
2833 Persisted = persisted
2857 - };
2858 -
2859 - this.Core.AddTuple(tuple);
2834 + });
2835 }
2836 }
2837
src/WixToolset.Core/Compiler_EmbeddedUI.cs
+6 -10
@@ -42,7 +42,7 @@ namespace WixToolset.Core
42 }
43 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
44 type = 0x2;
45 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary
45 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, source); // add a reference to the appropriate Binary
46 break;
47 case "CommandLine":
48 commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -54,7 +54,7 @@ namespace WixToolset.Core
54 }
55 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
56 type = 0x12;
57 - this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File
57 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, source); // add a reference to the appropriate File
58 break;
59 case "PropertySource":
60 if (null != source)
@@ -317,16 +317,14 @@ namespace WixToolset.Core
317
318 if (!this.Core.EncounteredError)
319 {
320 - var tuple = new MsiEmbeddedUITuple(sourceLineNumbers, id)
320 + this.Core.AddTuple(new MsiEmbeddedUITuple(sourceLineNumbers, id)
321 {
322 FileName = name,
323 EntryPoint = true,
324 SupportsBasicUI = supportsBasicUI,
325 MessageFilter = messageFilter,
326 Source = sourceFile
327 - };
328 -
329 - this.Core.AddTuple(tuple);
327 + });
328 }
329 }
330
@@ -406,13 +404,11 @@ namespace WixToolset.Core
404
405 if (!this.Core.EncounteredError)
406 {
409 - var tuple = new MsiEmbeddedUITuple(sourceLineNumbers, id)
407 + this.Core.AddTuple(new MsiEmbeddedUITuple(sourceLineNumbers, id)
408 {
409 FileName = name,
410 Source = sourceFile
413 - };
414 -
415 - this.Core.AddTuple(tuple);
411 + });
412 }
413 }
414 }
src/WixToolset.Core/Compiler_Module.cs
+14 -24
@@ -136,7 +136,7 @@ namespace WixToolset.Core
136 this.ParseCustomActionElement(child);
137 break;
138 case "CustomActionRef":
139 - this.ParseSimpleRefElement(child, "CustomAction");
139 + this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
140 break;
141 case "CustomTable":
142 this.ParseCustomTableElement(child);
@@ -154,7 +154,7 @@ namespace WixToolset.Core
154 this.ParseEmbeddedChainerElement(child);
155 break;
156 case "EmbeddedChainerRef":
157 - this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
157 + this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
158 break;
159 case "EnsureTable":
160 this.ParseEnsureTableElement(child);
@@ -178,7 +178,7 @@ namespace WixToolset.Core
178 this.ParsePropertyElement(child);
179 break;
180 case "PropertyRef":
181 - this.ParseSimpleRefElement(child, "Property");
181 + this.ParseSimpleRefElement(child, TupleDefinitions.Property);
182 break;
183 case "SetDirectory":
184 this.ParseSetDirectoryElement(child);
@@ -197,7 +197,7 @@ namespace WixToolset.Core
197 this.ParseUIElement(child);
198 break;
199 case "UIRef":
200 - this.ParseSimpleRefElement(child, "WixUI");
200 + this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
201 break;
202 case "WixVariable":
203 this.ParseWixVariableElement(child);
@@ -216,15 +216,13 @@ namespace WixToolset.Core
216
217 if (!this.Core.EncounteredError)
218 {
219 - var tuple = new ModuleSignatureTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage))
219 + var tuple = this.Core.AddTuple(new ModuleSignatureTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage))
220 {
221 ModuleID = this.activeName,
222 Version = version
223 - };
223 + });
224
225 tuple.Set((int)ModuleSignatureTupleFields.Language, this.activeLanguage);
226 -
227 - this.Core.AddTuple(tuple);
226 }
227 }
228 finally
@@ -286,17 +284,15 @@ namespace WixToolset.Core
284
285 if (!this.Core.EncounteredError)
286 {
289 - var tuple = new ModuleDependencyTuple(sourceLineNumbers)
287 + var tuple = this.Core.AddTuple(new ModuleDependencyTuple(sourceLineNumbers)
288 {
289 ModuleID = this.activeName,
290 RequiredID = requiredId,
291 RequiredLanguage = requiredLanguage,
292 RequiredVersion = requiredVersion
295 - };
293 + });
294
295 tuple.Set((int)ModuleDependencyTupleFields.ModuleLanguage, this.activeLanguage);
298 -
299 - this.Core.AddTuple(tuple);
296 }
297 }
298
@@ -369,18 +365,16 @@ namespace WixToolset.Core
365
366 if (!this.Core.EncounteredError)
367 {
372 - var tuple = new ModuleExclusionTuple(sourceLineNumbers)
368 + var tuple = this.Core.AddTuple(new ModuleExclusionTuple(sourceLineNumbers)
369 {
370 ModuleID = this.activeName,
371 ExcludedID = excludedId,
372 ExcludedMinVersion = excludedMinVersion,
373 ExcludedMaxVersion = excludedMaxVersion
378 - };
374 + });
375
376 tuple.Set((int)ModuleExclusionTupleFields.ModuleLanguage, this.activeLanguage);
377 tuple.Set((int)ModuleExclusionTupleFields.ExcludedLanguage, excludedLanguageField);
382 -
383 - this.Core.AddTuple(tuple);
378 }
379 }
380
@@ -491,7 +485,7 @@ namespace WixToolset.Core
485
486 if (!this.Core.EncounteredError)
487 {
494 - var tuple = new ModuleConfigurationTuple(sourceLineNumbers, name)
488 + this.Core.AddTuple(new ModuleConfigurationTuple(sourceLineNumbers, name)
489 {
490 Format = format,
491 Type = type,
@@ -503,9 +497,7 @@ namespace WixToolset.Core
497 Description = description,
498 HelpLocation = helpLocation,
499 HelpKeyword = helpKeyword
506 - };
507 -
508 - this.Core.AddTuple(tuple);
500 + });
501 }
502 }
503
@@ -571,15 +563,13 @@ namespace WixToolset.Core
563
564 if (!this.Core.EncounteredError)
565 {
574 - var tuple = new ModuleSubstitutionTuple(sourceLineNumbers)
566 + this.Core.AddTuple(new ModuleSubstitutionTuple(sourceLineNumbers)
567 {
568 Table = table,
569 Row = rowKeys,
570 Column = column,
571 Value = value
580 - };
581 -
582 - this.Core.AddTuple(tuple);
572 + });
573 }
574 }
575
src/WixToolset.Core/Compiler_Patch.cs
+6 -10
@@ -197,14 +197,12 @@ namespace WixToolset.Core
197
198 if (!this.Core.EncounteredError)
199 {
200 - var tuple = new WixPatchIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, patchId))
200 + this.Core.AddTuple(new WixPatchIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, patchId))
201 {
202 ClientPatchId = clientPatchId,
203 OptimizePatchSizeForLargeFiles = optimizePatchSizeForLargeFiles,
204 - ApiPatchingSymbolFlags = apiPatchingSymbolFlags
205 - };
206 -
207 - this.Core.AddTuple(tuple);
204 + ApiPatchingSymbolFlags = apiPatchingSymbolFlags,
205 + });
206
207 if (allowRemoval)
208 {
@@ -427,15 +425,13 @@ namespace WixToolset.Core
425
426 if (!this.Core.EncounteredError)
427 {
430 - var tuple = new MsiPatchSequenceTuple(sourceLineNumbers)
428 + this.Core.AddTuple(new MsiPatchSequenceTuple(sourceLineNumbers)
429 {
430 PatchFamily = id.Id,
431 ProductCode = productCode,
432 Sequence = version,
433 Attributes = attributes
436 - };
437 -
438 - this.Core.AddTuple(tuple);
434 + });
435
436 if (ComplexReferenceParentType.Unknown != parentType)
437 {
@@ -536,7 +532,7 @@ namespace WixToolset.Core
532 {
533 case "Id":
534 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
539 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id);
535 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixPatchFamilyGroup, id);
536 break;
537 default:
538 this.Core.UnexpectedAttribute(node, attrib);
src/WixToolset.Core/Compiler_PatchCreation.cs
+15 -23
@@ -258,13 +258,13 @@ namespace WixToolset.Core
258
259 if (!this.Core.EncounteredError)
260 {
261 - var tuple = new ImageFamiliesTuple(sourceLineNumbers)
261 + var tuple = this.Core.AddTuple(new ImageFamiliesTuple(sourceLineNumbers)
262 {
263 Family = name,
264 MediaSrcPropName = mediaSrcProp,
265 DiskPrompt = diskPrompt,
266 VolumeLabel = volumeLabel
267 - };
267 + });
268
269 if (CompilerConstants.IntegerNotSet != diskId)
270 {
@@ -275,8 +275,6 @@ namespace WixToolset.Core
275 {
276 tuple.FileSequenceStart = sequenceStart;
277 }
278 -
279 - this.Core.AddTuple(tuple);
278 }
279 }
280
@@ -675,16 +673,14 @@ namespace WixToolset.Core
673
674 if (!this.Core.EncounteredError)
675 {
678 - var tuple = new TargetFilesOptionalDataTuple(sourceLineNumbers)
676 + var tuple = this.Core.AddTuple(new TargetFilesOptionalDataTuple(sourceLineNumbers)
677 {
678 Target = target,
679 FTK = file,
680 SymbolPaths = symbols,
681 IgnoreOffsets = ignoreOffsets,
684 - IgnoreLengths = ignoreLengths
685 - };
686 -
687 - this.Core.AddTuple(tuple);
682 + IgnoreLengths = ignoreLengths,
683 + });
684
685 if (null != protectOffsets)
686 {
@@ -695,7 +691,7 @@ namespace WixToolset.Core
691 Family = family,
692 FTK = file,
693 RetainOffsets = protectOffsets,
698 - RetainLengths = protectLengths
694 + RetainLengths = protectLengths,
695 });
696 }
697 }
@@ -797,15 +793,15 @@ namespace WixToolset.Core
793
794 if (!this.Core.EncounteredError)
795 {
800 - var tuple = new ExternalFilesTuple(sourceLineNumbers)
796 + var tuple = this.Core.AddTuple(new ExternalFilesTuple(sourceLineNumbers)
797 {
798 Family = family,
799 FTK = file,
800 FilePath = source,
801 SymbolPaths = symbols,
802 IgnoreOffsets = ignoreOffsets,
807 - IgnoreLengths = ignoreLengths
808 - };
803 + IgnoreLengths = ignoreLengths,
804 + });
805
806 if (null != protectOffsets)
807 {
@@ -817,8 +813,6 @@ namespace WixToolset.Core
813 tuple.Order = order;
814 }
815
820 - this.Core.AddTuple(tuple);
821 -
816 if (null != protectOffsets)
817 {
818 this.Core.AddTuple(new FamilyFileRangesTuple(sourceLineNumbers)
@@ -826,7 +820,7 @@ namespace WixToolset.Core
820 Family = family,
821 FTK = file,
822 RetainOffsets = protectOffsets,
829 - RetainLengths = protectLengths
823 + RetainLengths = protectLengths,
824 });
825 }
826 }
@@ -1257,7 +1251,7 @@ namespace WixToolset.Core
1251 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode"));
1252 }
1253 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1260 - this.Core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target);
1254 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.TargetImages, target);
1255 break;
1256 case "Sequence":
1257 sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
@@ -1288,15 +1282,13 @@ namespace WixToolset.Core
1282
1283 if (!this.Core.EncounteredError)
1284 {
1291 - var tuple = new PatchSequenceTuple(sourceLineNumbers)
1285 + this.Core.AddTuple(new PatchSequenceTuple(sourceLineNumbers)
1286 {
1287 PatchFamily = family,
1288 Target = target,
1289 Sequence = sequence,
1296 - Supersede = attributes
1297 - };
1298 -
1299 - this.Core.AddTuple(tuple);
1290 + Supersede = attributes,
1291 + });
1292 }
1293 }
1294
@@ -1306,7 +1298,7 @@ namespace WixToolset.Core
1298 {
1299 Company = company,
1300 Property = property,
1309 - Value = value
1301 + Value = value,
1302 });
1303 }
1304 }
src/WixToolset.Core/Compiler_UI.cs
+79 -74
@@ -76,7 +76,7 @@ namespace WixToolset.Core
76 this.ParseDialogElement(child);
77 break;
78 case "DialogRef":
79 - this.ParseSimpleRefElement(child, "Dialog");
79 + this.ParseSimpleRefElement(child, TupleDefinitions.Dialog);
80 break;
81 case "EmbeddedUI":
82 if (0 < embeddedUICount) // there can be only one embedded UI
@@ -132,10 +132,10 @@ namespace WixToolset.Core
132 this.ParsePropertyElement(child);
133 break;
134 case "PropertyRef":
135 - this.ParseSimpleRefElement(child, "Property");
135 + this.ParseSimpleRefElement(child, TupleDefinitions.Property);
136 break;
137 case "UIRef":
138 - this.ParseSimpleRefElement(child, "WixUI");
138 + this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
139 break;
140
141 default:
@@ -151,8 +151,7 @@ namespace WixToolset.Core
151
152 if (null != id && !this.Core.EncounteredError)
153 {
154 - var tuple = new WixUITuple(sourceLineNumbers, id);
155 - this.Core.AddTuple(tuple);
154 + this.Core.AddTuple(new WixUITuple(sourceLineNumbers, id));
155 }
156 }
157
@@ -160,7 +159,7 @@ namespace WixToolset.Core
159 /// Parses a list item element.
160 /// </summary>
161 /// <param name="node">Element to parse.</param>
163 - /// <param name="table">Table to add row to.</param>
162 + /// <param name="tupleType">Type of tuple to create.</param>
163 /// <param name="property">Identifier of property referred to by list item.</param>
164 /// <param name="order">Relative order of list items.</param>
165 private void ParseListItemElement(XElement node, TupleDefinitionType tupleType, string property, ref int order)
@@ -180,7 +179,7 @@ namespace WixToolset.Core
179 if (TupleDefinitionType.ListView == tupleType)
180 {
181 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
183 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", icon);
182 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, icon);
183 }
184 else
185 {
@@ -213,14 +212,42 @@ namespace WixToolset.Core
212
213 if (!this.Core.EncounteredError)
214 {
216 - var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleType);
217 - tuple.Set(0, property);
218 - tuple.Set(1, ++order);
219 - tuple.Set(2, value);
220 - tuple.Set(3, text);
221 - if (null != icon)
215 + switch (tupleType)
216 {
223 - tuple.Set(4, icon);
217 + case TupleDefinitionType.ComboBox:
218 + this.Core.AddTuple(new ComboBoxTuple(sourceLineNumbers)
219 + {
220 + Property = property,
221 + Order = ++order,
222 + Value = value,
223 + Text = text,
224 + });
225 + break;
226 + case TupleDefinitionType.ListBox:
227 + this.Core.AddTuple(new ListBoxTuple(sourceLineNumbers)
228 + {
229 + Property = property,
230 + Order = ++order,
231 + Value = value,
232 + Text = text,
233 + });
234 + break;
235 + case TupleDefinitionType.ListView:
236 + var tuple = this.Core.AddTuple(new ListViewTuple(sourceLineNumbers)
237 + {
238 + Property = property,
239 + Order = ++order,
240 + Value = value,
241 + Text = text,
242 + });
243 +
244 + if (null != icon)
245 + {
246 + tuple.BinaryRef = icon;
247 + }
248 + break;
249 + default:
250 + throw new ArgumentOutOfRangeException(nameof(tupleType));
251 }
252 }
253 }
@@ -257,7 +284,7 @@ namespace WixToolset.Core
284 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text"));
285 }
286 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
260 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text);
287 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
288 type = RadioButtonType.Bitmap;
289 break;
290 case "Height":
@@ -272,7 +299,7 @@ namespace WixToolset.Core
299 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text"));
300 }
301 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
275 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text);
302 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
303 type = RadioButtonType.Icon;
304 break;
305 case "Text":
@@ -338,21 +365,19 @@ namespace WixToolset.Core
365
366 if (!this.Core.EncounteredError)
367 {
341 - var tuple = new RadioButtonTuple(sourceLineNumbers)
368 + var tuple = this.Core.AddTuple(new RadioButtonTuple(sourceLineNumbers)
369 {
370 Property = property,
371 Order = ++order,
372 Value = value,
373 Text = text,
374 Help = (null != tooltip || null != help) ? String.Concat(tooltip, "|", help) : null
348 - };
375 + });
376
377 tuple.Set((int)RadioButtonTupleFields.X, x);
378 tuple.Set((int)RadioButtonTupleFields.Y, y);
379 tuple.Set((int)RadioButtonTupleFields.Width, width);
380 tuple.Set((int)RadioButtonTupleFields.Height, height);
354 -
355 - this.Core.AddTuple(tuple);
381 }
382
383 return type;
@@ -376,7 +401,7 @@ namespace WixToolset.Core
401 {
402 case "Id":
403 action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
379 - this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action);
404 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixAction, "InstallExecuteSequence", action);
405 break;
406 default:
407 this.Core.UnexpectedAttribute(node, attrib);
@@ -439,7 +464,7 @@ namespace WixToolset.Core
464 break;
465 case "Feature":
466 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
442 - this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature);
467 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, feature);
468 break;
469 default:
470 this.Core.UnexpectedAttribute(node, attrib);
@@ -486,14 +511,12 @@ namespace WixToolset.Core
511
512 if (!this.Core.EncounteredError)
513 {
489 - var tuple = new BillboardTuple(sourceLineNumbers, id)
514 + this.Core.AddTuple(new BillboardTuple(sourceLineNumbers, id)
515 {
516 FeatureRef = feature,
517 Action = action,
518 Ordering = order
494 - };
495 -
496 - this.Core.AddTuple(tuple);
519 + });
520 }
521 }
522
@@ -501,7 +524,7 @@ namespace WixToolset.Core
524 /// Parses a control group element.
525 /// </summary>
526 /// <param name="node">Element to parse.</param>
504 - /// <param name="table">Table referred to by control group.</param>
527 + /// <param name="tupleType">Tuple type referred to by control group.</param>
528 /// <param name="childTag">Expected child elements.</param>
529 private void ParseControlGroupElement(XElement node, TupleDefinitionType tupleType, string childTag)
530 {
@@ -584,7 +607,7 @@ namespace WixToolset.Core
607 {
608 case "Property":
609 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
587 - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property);
610 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, property);
611 break;
612 default:
613 this.Core.UnexpectedAttribute(node, attrib);
@@ -677,14 +700,12 @@ namespace WixToolset.Core
700
701 if (!this.Core.EncounteredError)
702 {
680 - var tuple = new ActionTextTuple(sourceLineNumbers)
703 + this.Core.AddTuple(new ActionTextTuple(sourceLineNumbers)
704 {
705 Action = action,
706 Description = Common.GetInnerText(node),
684 - Template = template
685 - };
686 -
687 - this.Core.AddTuple(tuple);
707 + Template = template,
708 + });
709 }
710 }
711
@@ -729,12 +750,10 @@ namespace WixToolset.Core
750
751 if (!this.Core.EncounteredError)
752 {
732 - var tuple = new UITextTuple(sourceLineNumbers, id)
753 + this.Core.AddTuple(new UITextTuple(sourceLineNumbers, id)
754 {
755 Text = text,
735 - };
736 -
737 - this.Core.AddTuple(tuple);
756 + });
757 }
758 }
759
@@ -836,7 +855,7 @@ namespace WixToolset.Core
855
856 if (!this.Core.EncounteredError)
857 {
839 - var tuple = new TextStyleTuple(sourceLineNumbers, id)
858 + var tuple = this.Core.AddTuple(new TextStyleTuple(sourceLineNumbers, id)
859 {
860 FaceName = faceName,
861 Red = red,
@@ -846,11 +865,9 @@ namespace WixToolset.Core
865 Italic = italic,
866 Strike = strike,
867 Underline = underline,
849 - };
868 + });
869
870 tuple.Set((int)TextStyleTupleFields.Size, size);
852 -
853 - this.Core.AddTuple(tuple);
871 }
872 }
873
@@ -994,7 +1011,7 @@ namespace WixToolset.Core
1011
1012 if (!this.Core.EncounteredError)
1013 {
997 - var tuple = new DialogTuple(sourceLineNumbers, id)
1014 + this.Core.AddTuple(new DialogTuple(sourceLineNumbers, id)
1015 {
1016 HCentering = x,
1017 VCentering = y,
@@ -1015,9 +1032,7 @@ namespace WixToolset.Core
1032 FirstControlRef = firstControl,
1033 DefaultControlRef = defaultControl,
1034 CancelControlRef = cancelControl,
1018 - };
1019 -
1020 - this.Core.AddTuple(tuple);
1035 + });
1036 }
1037 }
1038
@@ -1083,7 +1098,7 @@ namespace WixToolset.Core
1098 notTabbable = true;
1099 disabled = true;
1100
1086 - this.Core.EnsureTable(sourceLineNumbers, "Billboard");
1101 + this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Billboard);
1102 break;
1103 case "Bitmap":
1104 specialAttributes = BitmapControlAttributes;
@@ -1449,17 +1464,15 @@ namespace WixToolset.Core
1464 }
1465 else if (!String.IsNullOrEmpty(property))
1466 {
1452 - var checkBoxTuple = new CheckBoxTuple(sourceLineNumbers)
1467 + this.Core.AddTuple(new CheckBoxTuple(sourceLineNumbers)
1468 {
1469 Property = property,
1455 - Value = checkboxValue
1456 - };
1457 -
1458 - this.Core.AddTuple(checkBoxTuple);
1470 + Value = checkboxValue,
1471 + });
1472 }
1473 else
1474 {
1462 - this.Core.CreateSimpleReference(sourceLineNumbers, "CheckBox", checkBoxPropertyRef);
1475 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.CheckBox, checkBoxPropertyRef);
1476 }
1477 }
1478
@@ -1467,7 +1480,7 @@ namespace WixToolset.Core
1480
1481 if (TupleDefinitionType.BBControl == tupleType)
1482 {
1470 - var bbTuple = new BBControlTuple(sourceLineNumbers, id)
1483 + var bbTuple = this.Core.AddTuple(new BBControlTuple(sourceLineNumbers, id)
1484 {
1485 BillboardRef = dialog,
1486 BBControl = controlId.Id,
@@ -1482,21 +1495,19 @@ namespace WixToolset.Core
1495 Sunken = sunken,
1496 Visible = !hidden,
1497 Text = text,
1485 - SourceFile = sourceFile
1486 - };
1498 + SourceFile = sourceFile,
1499 + });
1500
1501 bbTuple.Set((int)BBControlTupleFields.X, x);
1502 bbTuple.Set((int)BBControlTupleFields.Y, y);
1503 bbTuple.Set((int)BBControlTupleFields.Width, width);
1504 bbTuple.Set((int)BBControlTupleFields.Height, height);
1505
1493 - this.Core.AddTuple(bbTuple);
1494 -
1506 tuple = bbTuple;
1507 }
1508 else
1509 {
1499 - var controlTuple = new ControlTuple(sourceLineNumbers, id)
1510 + var controlTuple = this.Core.AddTuple(new ControlTuple(sourceLineNumbers, id)
1511 {
1512 DialogRef = dialog,
1513 Control = controlId.Id,
@@ -1514,15 +1525,13 @@ namespace WixToolset.Core
1525 Text = text,
1526 Help = (null == tooltip && null == help) ? null : String.Concat(tooltip, "|", help), // Separator is required, even if only one is non-null.};
1527 SourceFile = sourceFile
1517 - };
1528 + });
1529
1530 controlTuple.Set((int)BBControlTupleFields.X, x);
1531 controlTuple.Set((int)BBControlTupleFields.Y, y);
1532 controlTuple.Set((int)BBControlTupleFields.Width, width);
1533 controlTuple.Set((int)BBControlTupleFields.Height, height);
1534
1524 - this.Core.AddTuple(controlTuple);
1525 -
1535 tuple = controlTuple;
1536 }
1537 }
@@ -1552,7 +1561,7 @@ namespace WixToolset.Core
1561 // add a reference if the identifier of the binary entry is known during compilation
1562 if (("Bitmap" == controlType || "Icon" == controlType) && Common.IsIdentifier(text))
1563 {
1555 - this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text);
1564 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
1565 }
1566 }
1567
@@ -1593,7 +1602,7 @@ namespace WixToolset.Core
1602 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
1603 }
1604 dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1596 - this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog);
1605 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, dialog);
1606 break;
1607 case "Event":
1608 controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib));
@@ -1656,7 +1665,7 @@ namespace WixToolset.Core
1665
1666 if (!this.Core.EncounteredError)
1667 {
1659 - var tuple = new ControlEventTuple(sourceLineNumbers)
1668 + this.Core.AddTuple(new ControlEventTuple(sourceLineNumbers)
1669 {
1670 DialogRef = dialog,
1671 ControlRef = control,
@@ -1664,9 +1673,7 @@ namespace WixToolset.Core
1673 Argument = argument,
1674 Condition = condition,
1675 Ordering = order
1667 - };
1668 -
1669 - this.Core.AddTuple(tuple);
1676 + });
1677 }
1678
1679 if ("DoAction" == controlEvent && null != argument)
@@ -1675,14 +1682,14 @@ namespace WixToolset.Core
1682 // to the custom action.
1683 if (!WindowsInstallerStandard.IsStandardAction(argument) && !Common.ContainsProperty(argument))
1684 {
1678 - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", argument);
1685 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.CustomAction, argument);
1686 }
1687 }
1688
1689 // if we're referring to a dialog but not through a property, add it to the references
1690 if (("NewDialog" == controlEvent || "SpawnDialog" == controlEvent || "SpawnWaitDialog" == controlEvent || "SelectionBrowse" == controlEvent) && Common.IsIdentifier(argument))
1691 {
1685 - this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", argument);
1692 + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, argument);
1693 }
1694 }
1695
@@ -1725,15 +1732,13 @@ namespace WixToolset.Core
1732
1733 if (!this.Core.EncounteredError)
1734 {
1728 - var tuple = new EventMappingTuple(sourceLineNumbers)
1735 + this.Core.AddTuple(new EventMappingTuple(sourceLineNumbers)
1736 {
1737 DialogRef = dialog,
1738 ControlRef = control,
1739 Event = eventMapping,
1733 - Attribute = controlAttribute
1734 - }; ;
1735 -
1736 - this.Core.AddTuple(tuple);
1740 + Attribute = controlAttribute,
1741 + });
1742 }
1743 }
1744 }
src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+51 -64
@@ -54,7 +54,7 @@ namespace WixToolset.Core.ExtensibilityServices
54 public void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary)
55 {
56
57 - var tuple = new WixComplexReferenceTuple(sourceLineNumbers)
57 + section.AddTuple(new WixComplexReferenceTuple(sourceLineNumbers)
58 {
59 Parent = parentId,
60 ParentType = parentType,
@@ -62,9 +62,7 @@ namespace WixToolset.Core.ExtensibilityServices
62 Child = childId,
63 ChildType = childType,
64 IsPrimary = isPrimary
65 - };
66 -
67 - section.Tuples.Add(tuple);
65 + });
66
67 this.CreateWixGroupTuple(section, sourceLineNumbers, parentType, parentId, childType, childId);
68 }
@@ -100,24 +98,22 @@ namespace WixToolset.Core.ExtensibilityServices
98 }
99 }
100
103 - var tuple = new DirectoryTuple(sourceLineNumbers, id)
101 + var tuple = section.AddTuple(new DirectoryTuple(sourceLineNumbers, id)
102 {
103 ParentDirectoryRef = parentId,
104 Name = name,
105 ShortName = shortName,
106 SourceName = sourceName,
107 SourceShortName = shortSourceName
110 - };
111 -
112 - section.Tuples.Add(tuple);
108 + });
109
114 - return id;
110 + return tuple.Id;
111 }
112
113 public string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, string parentId, XAttribute attribute, ISet<string> sectionInlinedDirectoryIds)
114 {
115 string id = null;
120 - string[] inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true);
116 + var inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true);
117
118 if (null != inlineSyntax)
119 {
@@ -126,13 +122,13 @@ namespace WixToolset.Core.ExtensibilityServices
122 if (1 == inlineSyntax.Length)
123 {
124 id = inlineSyntax[0];
129 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.Directory), id);
125 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, id);
126 }
127 else // start creating tuples for the entries in the inline syntax
128 {
129 id = parentId;
130
135 - int pathStartsAt = 0;
131 + var pathStartsAt = 0;
132 if (inlineSyntax[0].EndsWith(":"))
133 {
134 // TODO: should overriding the parent identifier with a specific id be an error or a warning or just let it slide?
@@ -142,14 +138,14 @@ namespace WixToolset.Core.ExtensibilityServices
138 //}
139
140 id = inlineSyntax[0].TrimEnd(':');
145 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.Directory), id);
141 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, id);
142
143 pathStartsAt = 1;
144 }
145
150 - for (int i = pathStartsAt; i < inlineSyntax.Length; ++i)
146 + for (var i = pathStartsAt; i < inlineSyntax.Length; ++i)
147 {
152 - Identifier inlineId = this.CreateDirectoryTuple(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds);
148 + var inlineId = this.CreateDirectoryTuple(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds);
149 id = inlineId.Id;
150 }
151 }
@@ -206,29 +202,25 @@ namespace WixToolset.Core.ExtensibilityServices
202
203 var id = this.CreateIdentifier("reg", componentId, ((int)root).ToString(CultureInfo.InvariantCulture.NumberFormat), key.ToLowerInvariant(), (null != name ? name.ToLowerInvariant() : name));
204
209 - var tuple = new RegistryTuple(sourceLineNumbers, id)
205 + var tuple = section.AddTuple(new RegistryTuple(sourceLineNumbers, id)
206 {
207 Root = root,
208 Key = key,
209 Name = name,
210 Value = value,
211 ComponentRef = componentId,
216 - };
217 -
218 - section.Tuples.Add(tuple);
212 + });
213
220 - return id;
214 + return tuple.Id;
215 }
216
217 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys)
218 {
225 - var tuple = new WixSimpleReferenceTuple(sourceLineNumbers)
219 + section.AddTuple(new WixSimpleReferenceTuple(sourceLineNumbers)
220 {
221 Table = tupleName,
222 PrimaryKeys = String.Join("/", primaryKeys)
229 - };
230 -
231 - section.Tuples.Add(tuple);
223 + });
224 }
225
226 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys)
@@ -254,15 +246,13 @@ namespace WixToolset.Core.ExtensibilityServices
246 throw new ArgumentNullException("childId");
247 }
248
257 - var tuple = new WixGroupTuple(sourceLineNumbers)
249 + section.AddTuple(new WixGroupTuple(sourceLineNumbers)
250 {
251 ParentId = parentId,
252 ParentType = parentType,
253 ChildId = childId,
254 ChildType = childType,
263 - };
264 -
265 - section.Tuples.Add(tuple);
255 + });
256 }
257
258 public void CreateWixSearchTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId)
@@ -273,7 +263,7 @@ namespace WixToolset.Core.ExtensibilityServices
263 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, elementName, "Variable"));
264 }
265
276 - section.Tuples.Add(new WixSearchTuple(sourceLineNumbers, id)
266 + section.AddTuple(new WixSearchTuple(sourceLineNumbers, id)
267 {
268 Variable = variable,
269 Condition = condition,
@@ -282,20 +272,20 @@ namespace WixToolset.Core.ExtensibilityServices
272
273 if (after != null)
274 {
285 - this.CreateSimpleReference(section, sourceLineNumbers, "WixSearch", after);
275 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixSearch, after);
276 // TODO: We're currently defaulting to "always run after", which we will need to change...
277 this.CreateWixSearchRelationTuple(section, sourceLineNumbers, id, after, 2);
278 }
279
280 if (!String.IsNullOrEmpty(bundleExtensionId))
281 {
292 - this.CreateSimpleReference(section, sourceLineNumbers, "WixBundleExtension", bundleExtensionId);
282 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixBundleExtension, bundleExtensionId);
283 }
284 }
285
286 public void CreateWixSearchRelationTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes)
287 {
298 - section.Tuples.Add(new WixSearchRelationTuple(sourceLineNumbers, id)
288 + section.AddTuple(new WixSearchRelationTuple(sourceLineNumbers, id)
289 {
290 ParentSearchRef = parentId,
291 Attributes = attributes,
@@ -351,13 +341,13 @@ namespace WixToolset.Core.ExtensibilityServices
341 }
342
343 // collect all the data
354 - List<string> strings = new List<string>(1 + args.Length);
344 + var strings = new List<string>(1 + args.Length);
345 strings.Add(longName);
346 strings.AddRange(args);
347
348 // prepare for hashing
359 - string stringData = String.Join("|", strings);
360 - byte[] data = Encoding.UTF8.GetBytes(stringData);
349 + var stringData = String.Join("|", strings);
350 + var data = Encoding.UTF8.GetBytes(stringData);
351
352 // hash the data
353 byte[] hash;
@@ -367,12 +357,12 @@ namespace WixToolset.Core.ExtensibilityServices
357 }
358
359 // generate the short file/directory name without an extension
370 - StringBuilder shortName = new StringBuilder(Convert.ToBase64String(hash));
360 + var shortName = new StringBuilder(Convert.ToBase64String(hash));
361 shortName.Remove(8, shortName.Length - 8).Replace('+', '-').Replace('/', '_');
362
363 if (keepExtension)
364 {
375 - string extension = Path.GetExtension(longName);
365 + var extension = Path.GetExtension(longName);
366
367 if (4 < extension.Length)
368 {
@@ -405,9 +395,9 @@ namespace WixToolset.Core.ExtensibilityServices
395
396 public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName)
397 {
408 - section.Tuples.Add(new WixEnsureTableTuple(sourceLineNumbers)
398 + section.AddTuple(new WixEnsureTableTuple(sourceLineNumbers)
399 {
410 - Table = tableName
400 + Table = tableName,
401 });
402
403 if (this.Creator == null)
@@ -419,7 +409,7 @@ namespace WixToolset.Core.ExtensibilityServices
409 // We don't add custom table definitions to the tableDefinitions collection,
410 // so if it's not in there, it better be a custom table. If the Id is just wrong,
411 // instead of a custom table, we get an unresolved reference at link time.
422 - if (!this.Creator.TryGetTupleDefinitionByName(tableName, out var ignored))
412 + if (!this.Creator.TryGetTupleDefinitionByName(tableName, out var _))
413 {
414 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixCustomTable, tableName);
415 }
@@ -432,8 +422,8 @@ namespace WixToolset.Core.ExtensibilityServices
422 throw new ArgumentNullException("attribute");
423 }
424
435 - EmptyRule emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly;
436 - string value = this.GetAttributeValue(sourceLineNumbers, attribute, emptyRule);
425 + var emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly;
426 + var value = this.GetAttributeValue(sourceLineNumbers, attribute, emptyRule);
427
428 if (String.IsNullOrEmpty(value) && canBeEmpty)
429 {
@@ -516,15 +506,15 @@ namespace WixToolset.Core.ExtensibilityServices
506 public string[] GetAttributeInlineDirectorySyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool resultUsedToCreateReference = false)
507 {
508 string[] result = null;
519 - string value = this.GetAttributeValue(sourceLineNumbers, attribute);
509 + var value = this.GetAttributeValue(sourceLineNumbers, attribute);
510
511 if (!String.IsNullOrEmpty(value))
512 {
523 - int pathStartsAt = 0;
513 + var pathStartsAt = 0;
514 result = value.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
515 if (result[0].EndsWith(":", StringComparison.Ordinal))
516 {
527 - string id = result[0].TrimEnd(':');
517 + var id = result[0].TrimEnd(':');
518 if (1 == result.Length)
519 {
520 this.Messaging.Write(ErrorMessages.InlineDirectorySyntaxRequiresPath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, id));
@@ -558,7 +548,7 @@ namespace WixToolset.Core.ExtensibilityServices
548 }
549
550 // Check each part of the relative path to ensure that it is a valid directory name.
561 - for (int i = pathStartsAt; i < result.Length; ++i)
551 + for (var i = pathStartsAt; i < result.Length; ++i)
552 {
553 if (!this.IsValidLongFilename(result[i], false, false))
554 {
@@ -588,7 +578,7 @@ namespace WixToolset.Core.ExtensibilityServices
578 throw new ArgumentNullException("attribute");
579 }
580
591 - string value = this.GetAttributeValue(sourceLineNumbers, attribute);
581 + var value = this.GetAttributeValue(sourceLineNumbers, attribute);
582
583 if (0 < value.Length)
584 {
@@ -605,7 +595,7 @@ namespace WixToolset.Core.ExtensibilityServices
595 }
596 else if (allowRelative)
597 {
608 - string normalizedPath = value.Replace('\\', '/');
598 + var normalizedPath = value.Replace('\\', '/');
599 if (normalizedPath.StartsWith("../", StringComparison.Ordinal) || normalizedPath.Contains("/../"))
600 {
601 this.Messaging.Write(ErrorMessages.PayloadMustBeRelativeToCache(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value));
@@ -624,13 +614,13 @@ namespace WixToolset.Core.ExtensibilityServices
614 {
615 Debug.Assert(minimum > CompilerConstants.LongNotSet && minimum > CompilerConstants.IllegalLong, "The legal values for this attribute collide with at least one sentinel used during parsing.");
616
627 - string value = this.GetAttributeValue(sourceLineNumbers, attribute);
617 + var value = this.GetAttributeValue(sourceLineNumbers, attribute);
618
619 if (0 < value.Length)
620 {
621 try
622 {
633 - long longValue = Convert.ToInt64(value, CultureInfo.InvariantCulture.NumberFormat);
623 + var longValue = Convert.ToInt64(value, CultureInfo.InvariantCulture.NumberFormat);
624
625 if (CompilerConstants.LongNotSet == longValue || CompilerConstants.IllegalLong == longValue)
626 {
@@ -664,7 +654,7 @@ namespace WixToolset.Core.ExtensibilityServices
654
655 public RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu)
656 {
667 - string value = this.GetAttributeValue(sourceLineNumbers, attribute);
657 + var value = this.GetAttributeValue(sourceLineNumbers, attribute);
658 if (String.IsNullOrEmpty(value))
659 {
660 return null;
@@ -814,8 +804,8 @@ namespace WixToolset.Core.ExtensibilityServices
804 }
805
806 // Check for a non-period character (all periods is not legal)
817 - bool nonPeriodFound = false;
818 - foreach (char character in filename)
807 + var nonPeriodFound = false;
808 + foreach (var character in filename)
809 {
810 if ('.' != character)
811 {
@@ -867,7 +857,6 @@ namespace WixToolset.Core.ExtensibilityServices
857 {
858 if (ParseHelper.TryFindExtension(extensions, element.Name.Namespace, out var extension))
859 {
870 - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement);
860 extension.ParseElement(intermediate, section, parentElement, element, context);
861 }
862 else
@@ -896,7 +885,7 @@ namespace WixToolset.Core.ExtensibilityServices
885
886 public void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element)
887 {
899 - foreach (XElement child in element.Elements())
888 + foreach (var child in element.Elements())
889 {
890 if (element.Name.Namespace == child.Name.Namespace)
891 {
@@ -913,7 +902,7 @@ namespace WixToolset.Core.ExtensibilityServices
902 {
903 var actionId = new Identifier(access, sequence, actionName);
904
916 - var actionTuple = new WixActionTuple(sourceLineNumbers, actionId)
905 + var actionTuple = section.AddTuple(new WixActionTuple(sourceLineNumbers, actionId)
906 {
907 SequenceTable = sequence,
908 Action = actionName,
@@ -921,19 +910,17 @@ namespace WixToolset.Core.ExtensibilityServices
910 Before = beforeAction,
911 After = afterAction,
912 Overridable = overridable,
924 - };
925 -
926 - section.Tuples.Add(actionTuple);
913 + });
914
915 if (null != beforeAction)
916 {
917 if (WindowsInstallerStandard.IsStandardAction(beforeAction))
918 {
932 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.WixAction), sequence.ToString(), beforeAction);
919 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), beforeAction);
920 }
921 else
922 {
936 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), beforeAction);
923 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, beforeAction);
924 }
925 }
926
@@ -941,11 +928,11 @@ namespace WixToolset.Core.ExtensibilityServices
928 {
929 if (WindowsInstallerStandard.IsStandardAction(afterAction))
930 {
944 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.WixAction), sequence.ToString(), afterAction);
931 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), afterAction);
932 }
933 else
934 {
948 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), afterAction);
935 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, afterAction);
936 }
937 }
938
@@ -981,7 +968,7 @@ namespace WixToolset.Core.ExtensibilityServices
968 break;
969 }
970
984 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), name + suffix);
971 + this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, name + suffix);
972 }
973 }
974
src/WixToolset.Core/Link/WixGroupingOrdering.cs
+8 -8
@@ -171,15 +171,15 @@ namespace WixToolset.Core.Link
171 // does WiX (although they do, currently). We probably want to "upgrade" this to a new
172 // table that includes a sequence number, and then change the code that uses ordered
173 // groups to read from that table instead.
174 - foreach (Item item in orderedItems)
174 + foreach (var item in orderedItems)
175 {
176 - var row = new WixGroupTuple(item.Row.SourceLineNumbers);
177 - row.ParentId = parentId;
178 - row.ParentType = (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), parentType);
179 - row.ChildId = item.Id;
180 - row.ChildType = (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), item.Type);
181 -
182 - this.EntrySection.Tuples.Add(row);
176 + this.EntrySection.AddTuple(new WixGroupTuple(item.Row.SourceLineNumbers)
177 + {
178 + ParentId = parentId,
179 + ParentType = (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), parentType),
180 + ChildId = item.Id,
181 + ChildType = (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), item.Type),
182 + });
183 }
184 }
185
src/WixToolset.Core/Linker.cs
+33 -46
@@ -211,9 +211,6 @@ namespace WixToolset.Core
211 // resolve the feature to feature connects
212 this.ResolveFeatureToFeatureConnects(featuresToFeatures, find.Symbols);
213
214 - // start generating OutputTables and OutputRows for all the sections in the output
215 - var ensureTableRows = new List<IntermediateTuple>();
216 -
214 // Create the section to hold the linked content.
215 var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage);
216
@@ -239,7 +236,7 @@ namespace WixToolset.Core
236 case TupleDefinitionType.Class:
237 if (SectionType.Product == resolvedSection.Type)
238 {
242 - this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents);
239 + this.ResolveFeatures(tuple, (int)ClassTupleFields.ComponentRef, (int)ClassTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
240 }
241 break;
242
@@ -294,7 +291,7 @@ namespace WixToolset.Core
291 case TupleDefinitionType.Extension:
292 if (SectionType.Product == resolvedSection.Type)
293 {
297 - this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents);
294 + this.ResolveFeatures(tuple, (int)ExtensionTupleFields.ComponentRef, (int)ExtensionTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
295 }
296 break;
297
@@ -311,35 +308,31 @@ namespace WixToolset.Core
308 case TupleDefinitionType.Assembly:
309 if (SectionType.Product == resolvedSection.Type)
310 {
314 - this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents);
311 + this.ResolveFeatures(tuple, (int)AssemblyTupleFields.ComponentRef, (int)AssemblyTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
312 }
313 break;
314
315 case TupleDefinitionType.PublishComponent:
316 if (SectionType.Product == resolvedSection.Type)
317 {
321 - this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents);
318 + this.ResolveFeatures(tuple, (int)PublishComponentTupleFields.ComponentRef, (int)PublishComponentTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
319 }
320 break;
321
322 case TupleDefinitionType.Shortcut:
323 if (SectionType.Product == resolvedSection.Type)
324 {
328 - this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents);
325 + this.ResolveFeatures(tuple, (int)ShortcutTupleFields.ComponentRef, (int)ShortcutTupleFields.Target, componentsToFeatures, multipleFeatureComponents);
326 }
327 break;
328
329 case TupleDefinitionType.TypeLib:
330 if (SectionType.Product == resolvedSection.Type)
331 {
335 - this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents);
332 + this.ResolveFeatures(tuple, (int)TypeLibTupleFields.ComponentRef, (int)TypeLibTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
333 }
334 break;
335
339 - case TupleDefinitionType.WixEnsureTable:
340 - ensureTableRows.Add(tuple);
341 - break;
342 -
336 #if MOVE_TO_BACKEND
337 case "WixFile":
338 foreach (Row row in table.Rows)
@@ -404,7 +397,7 @@ namespace WixToolset.Core
397
398 if (copyTuple)
399 {
407 - resolvedSection.Tuples.Add(tuple);
400 + resolvedSection.AddTuple(tuple);
401 }
402 }
403 }
@@ -414,13 +407,11 @@ namespace WixToolset.Core
407 {
408 foreach (var feature in connectToFeature.ConnectFeatures)
409 {
417 - var row = new WixFeatureModulesTuple
410 + resolvedSection.AddTuple(new WixFeatureModulesTuple
411 {
412 FeatureRef = feature,
413 WixMergeRef = connectToFeature.ChildId
421 - };
422 -
423 - resolvedSection.Tuples.Add(row);
414 + });
415 }
416 }
417
@@ -554,9 +545,9 @@ namespace WixToolset.Core
545 #endif
546
547 // copy the wix variable rows to the output after all overriding has been accounted for.
557 - foreach (var row in wixVariables.Values)
548 + foreach (var tuple in wixVariables.Values)
549 {
559 - resolvedSection.Tuples.Add(row);
550 + resolvedSection.AddTuple(tuple);
551 }
552
553 // Bundles have groups of data that must be flattened in a way different from other types.
@@ -774,9 +765,8 @@ namespace WixToolset.Core
765
766 foreach (var section in sections)
767 {
777 - var featureComponents = new List<FeatureComponentsTuple>();
778 -
779 - foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>())
768 + // Need ToList since we might want to add tuples while processing.
769 + foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>().ToList())
770 {
771 ConnectToFeature connection;
772 switch (wixComplexReferenceRow.ParentType)
@@ -810,11 +800,11 @@ namespace WixToolset.Core
800 }
801
802 // add a row to the FeatureComponents table
813 - var featureComponent = new FeatureComponentsTuple();
814 - featureComponent.FeatureRef = wixComplexReferenceRow.Parent;
815 - featureComponent.ComponentRef = wixComplexReferenceRow.Child;
816 -
817 - featureComponents.Add(featureComponent);
803 + section.AddTuple(new FeatureComponentsTuple
804 + {
805 + FeatureRef = wixComplexReferenceRow.Parent,
806 + ComponentRef = wixComplexReferenceRow.Child,
807 + });
808
809 // index the component for finding orphaned records
810 var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
@@ -878,10 +868,12 @@ namespace WixToolset.Core
868 componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new
869
870 // add a row to the ModuleComponents table
881 - var moduleComponent = new ModuleComponentsTuple();
882 - moduleComponent.Component = wixComplexReferenceRow.Child;
883 - moduleComponent.ModuleID = wixComplexReferenceRow.Parent;
884 - moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage);
871 + section.AddTuple(new ModuleComponentsTuple
872 + {
873 + Component = wixComplexReferenceRow.Child,
874 + ModuleID = wixComplexReferenceRow.Parent,
875 + Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage),
876 + });
877 }
878
879 // index the component for finding orphaned records
@@ -931,11 +923,6 @@ namespace WixToolset.Core
923 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType)));
924 }
925 }
934 -
935 - foreach (var featureComponent in featureComponents)
936 - {
937 - section.Tuples.Add(featureComponent);
938 - }
926 }
927 }
928
@@ -1048,7 +1035,7 @@ namespace WixToolset.Core
1035 (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) &&
1036 (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType))
1037 {
1051 - section.Tuples.Add(wixComplexReferenceRow);
1038 + section.AddTuple(wixComplexReferenceRow);
1039 }
1040 }
1041 }
@@ -1322,15 +1309,15 @@ namespace WixToolset.Core
1309 /// <summary>
1310 /// Resolve features for columns that have null guid placeholders.
1311 /// </summary>
1325 - /// <param name="rows">Rows to resolve.</param>
1312 + /// <param name="tuple">Tuple to resolve.</param>
1313 /// <param name="connectionColumn">Number of the column containing the connection identifier.</param>
1314 /// <param name="featureColumn">Number of the column containing the feature.</param>
1315 /// <param name="connectToFeatures">Connect to feature complex references.</param>
1316 /// <param name="multipleFeatureComponents">Hashtable of known components under multiple features.</param>
1330 - private void ResolveFeatures(IntermediateTuple row, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents)
1317 + private void ResolveFeatures(IntermediateTuple tuple, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents)
1318 {
1332 - var connectionId = row.AsString(connectionColumn);
1333 - var featureId = row.AsString(featureColumn);
1319 + var connectionId = tuple.AsString(connectionColumn);
1320 + var featureId = tuple.AsString(featureColumn);
1321
1322 if (EmptyGuid == featureId)
1323 {
@@ -1338,14 +1325,14 @@ namespace WixToolset.Core
1325
1326 if (null == connection)
1327 {
1341 - // display an error for the component or merge module as approrpriate
1328 + // display an error for the component or merge module as appropriate
1329 if (null != multipleFeatureComponents)
1330 {
1344 - this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id));
1331 + this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(tuple.SourceLineNumbers, connectionId, tuple.Definition.Name, tuple.Id.Id));
1332 }
1333 else
1334 {
1348 - this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId));
1335 + this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(tuple.SourceLineNumbers, connectionId));
1336 }
1337 }
1338 else
@@ -1373,7 +1360,7 @@ namespace WixToolset.Core
1360 }
1361
1362 // set the feature
1376 - row.Set(featureColumn, connection.PrimaryFeature);
1363 + tuple.Set(featureColumn, connection.PrimaryFeature);
1364 }
1365 }
1366 }
src/test/Example.Extension/ExampleCompilerExtension.cs
+5 -5
@@ -157,10 +157,10 @@ namespace Example.Extension
157
158 if (!this.Messaging.EncounteredError)
159 {
160 -
161 - var tuple = new ExampleSearchTuple(sourceLineNumbers, id);
162 - section.Tuples.Add(tuple);
163 - tuple.SearchFor = searchFor;
160 + var tuple = section.AddTuple(new ExampleSearchTuple(sourceLineNumbers, id)
161 + {
162 + SearchFor = searchFor,
163 + });
164 }
165 }
166
@@ -176,7 +176,7 @@ namespace Example.Extension
176 {
177 case "Id":
178 var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
179 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ExampleSearch", refId);
179 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ExampleTupleDefinitions.ExampleSearch, refId);
180 break;
181 default:
182 this.ParseHelper.UnexpectedAttribute(element, attrib);