aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Linker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Linker.cs')
-rw-r--r--src/WixToolset.Core/Linker.cs459
1 files changed, 41 insertions, 418 deletions
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs
index 9526ac95..81696840 100644
--- a/src/WixToolset.Core/Linker.cs
+++ b/src/WixToolset.Core/Linker.cs
@@ -20,7 +20,6 @@ namespace WixToolset.Core
20 /// </summary> 20 /// </summary>
21 internal class Linker : ILinker 21 internal class Linker : ILinker
22 { 22 {
23 private static readonly char[] ColonCharacter = new[] { ':' };
24 private static readonly string EmptyGuid = Guid.Empty.ToString("B"); 23 private static readonly string EmptyGuid = Guid.Empty.ToString("B");
25 24
26 private readonly bool sectionIdOnRows; 25 private readonly bool sectionIdOnRows;
@@ -56,9 +55,7 @@ namespace WixToolset.Core
56 /// <summary> 55 /// <summary>
57 /// Links a collection of sections into an output. 56 /// Links a collection of sections into an output.
58 /// </summary> 57 /// </summary>
59 /// <param name="inputs">The collection of sections to link together.</param> 58 /// <returns>Output intermediate from the linking.</returns>
60 /// <param name="expectedOutputType">Expected output type, based on output file extension provided to the linker.</param>
61 /// <returns>Output object from the linking.</returns>
62 public Intermediate Link(ILinkContext context) 59 public Intermediate Link(ILinkContext context)
63 { 60 {
64 this.Context = context; 61 this.Context = context;
@@ -97,9 +94,6 @@ namespace WixToolset.Core
97 94
98 //this.activeOutput = null; 95 //this.activeOutput = null;
99 96
100 //TableDefinitionCollection customTableDefinitions = new TableDefinitionCollection();
101 //IntermediateTuple customRows = new List<IntermediateTuple>();
102
103#if MOVE_TO_BACKEND 97#if MOVE_TO_BACKEND
104 StringCollection generatedShortFileNameIdentifiers = new StringCollection(); 98 StringCollection generatedShortFileNameIdentifiers = new StringCollection();
105 Hashtable generatedShortFileNames = new Hashtable(); 99 Hashtable generatedShortFileNames = new Hashtable();
@@ -123,11 +117,11 @@ namespace WixToolset.Core
123 117
124 if (0 >= columnDefinition.KeyColumn || keyTableDefinition.Columns.Count < columnDefinition.KeyColumn) 118 if (0 >= columnDefinition.KeyColumn || keyTableDefinition.Columns.Count < columnDefinition.KeyColumn)
125 { 119 {
126 this.OnMessage(WixErrors.InvalidKeyColumn(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn)); 120 this.Messaging.Write(WixErrors.InvalidKeyColumn(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn));
127 } 121 }
128 else if (keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType != columnDefinition.ModularizeType && ColumnModularizeType.CompanionFile != columnDefinition.ModularizeType) 122 else if (keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType != columnDefinition.ModularizeType && ColumnModularizeType.CompanionFile != columnDefinition.ModularizeType)
129 { 123 {
130 this.OnMessage(WixErrors.CollidingModularizationTypes(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn, columnDefinition.ModularizeType.ToString(), keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType.ToString())); 124 this.Messaging.Write(WixErrors.CollidingModularizationTypes(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn, columnDefinition.ModularizeType.ToString(), keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType.ToString()));
131 } 125 }
132 } 126 }
133 catch (WixMissingTableDefinitionException) 127 catch (WixMissingTableDefinitionException)
@@ -141,8 +135,7 @@ namespace WixToolset.Core
141 135
142 // First find the entry section and while processing all sections load all the symbols from all of the sections. 136 // First find the entry section and while processing all sections load all the symbols from all of the sections.
143 // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); 137 // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols);
144 var find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, sections); 138 var find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, sections, this.Context.ExpectedOutputType);
145 find.ExpectedOutputType = this.Context.ExpectedOutputType;
146 find.Execute(); 139 find.Execute();
147 140
148 // Must have found the entry section by now. 141 // Must have found the entry section by now.
@@ -157,7 +150,6 @@ namespace WixToolset.Core
157 // Resolve the symbol references to find the set of sections we care about for linking. 150 // Resolve the symbol references to find the set of sections we care about for linking.
158 // Of course, we start with the entry section (that's how it got its name after all). 151 // Of course, we start with the entry section (that's how it got its name after all).
159 var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.Symbols); 152 var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.Symbols);
160 resolve.BuildingMergeModule = (SectionType.Module == find.EntrySection.Type);
161 153
162 resolve.Execute(); 154 resolve.Execute();
163 155
@@ -197,7 +189,7 @@ namespace WixToolset.Core
197 { 189 {
198 if (!referencedComponents.Contains(symbol.Name)) 190 if (!referencedComponents.Contains(symbol.Name))
199 { 191 {
200 this.OnMessage(ErrorMessages.OrphanedComponent(symbol.Row.SourceLineNumbers, symbol.Row.Id.Id)); 192 this.Messaging.Write(ErrorMessages.OrphanedComponent(symbol.Row.SourceLineNumbers, symbol.Row.Id.Id));
201 } 193 }
202 } 194 }
203 195
@@ -238,12 +230,6 @@ namespace WixToolset.Core
238 // handle special tables 230 // handle special tables
239 switch (tuple.Definition.Type) 231 switch (tuple.Definition.Type)
240 { 232 {
241#if MOVE_TO_BACKEND
242 case "AppSearch":
243 this.activeOutput.EnsureTable(this.tableDefinitions["Signature"]);
244 break;
245#endif
246
247 case TupleDefinitionType.Class: 233 case TupleDefinitionType.Class:
248 if (SectionType.Product == resolvedSection.Type) 234 if (SectionType.Product == resolvedSection.Type)
249 { 235 {
@@ -263,10 +249,6 @@ namespace WixToolset.Core
263 } 249 }
264 break; 250 break;
265 251
266 case "Dialog":
267 this.activeOutput.EnsureTable(this.tableDefinitions["ListBox"]);
268 break;
269
270 case "Directory": 252 case "Directory":
271 foreach (Row row in table.Rows) 253 foreach (Row row in table.Rows)
272 { 254 {
@@ -295,7 +277,7 @@ namespace WixToolset.Core
295 { 277 {
296 if (directory.StartsWith(standardDirectory, StringComparison.Ordinal)) 278 if (directory.StartsWith(standardDirectory, StringComparison.Ordinal))
297 { 279 {
298 this.OnMessage(WixWarnings.StandardDirectoryConflictInMergeModule(row.SourceLineNumbers, directory, standardDirectory)); 280 this.Messaging.Write(WixWarnings.StandardDirectoryConflictInMergeModule(row.SourceLineNumbers, directory, standardDirectory));
299 } 281 }
300 } 282 }
301 } 283 }
@@ -327,26 +309,6 @@ namespace WixToolset.Core
327 } 309 }
328 break; 310 break;
329 311
330#if MOVE_TO_BACKEND
331 case "ProgId":
332 // the Extension table is required with a ProgId table
333 this.activeOutput.EnsureTable(this.tableDefinitions["Extension"]);
334 break;
335
336 case "Property":
337 // Remove property rows with no value. These are properties associated with
338 // AppSearch but without a default value.
339 for (int i = 0; i < table.Rows.Count; i++)
340 {
341 if (null == table.Rows[i][1])
342 {
343 table.Rows.RemoveAt(i);
344 i--;
345 }
346 }
347 break;
348#endif
349
350 case TupleDefinitionType.PublishComponent: 312 case TupleDefinitionType.PublishComponent:
351 if (SectionType.Product == resolvedSection.Type) 313 if (SectionType.Product == resolvedSection.Type)
352 { 314 {
@@ -368,27 +330,10 @@ namespace WixToolset.Core
368 } 330 }
369 break; 331 break;
370 332
371#if SOLVE_CUSTOM_TABLE
372 case "WixCustomTable":
373 this.LinkCustomTable(table, customTableDefinitions);
374 copyTuple = false; // we've created table definitions from these rows, no need to process them any longer
375 break;
376
377 case "WixCustomRow":
378 foreach (Row row in table.Rows)
379 {
380 row.SectionId = (this.sectionIdOnRows ? sectionId : null);
381 customRows.Add(row);
382 }
383 copyTuple = false;
384 break;
385#endif
386
387 case TupleDefinitionType.WixEnsureTable: 333 case TupleDefinitionType.WixEnsureTable:
388 ensureTableRows.Add(tuple); 334 ensureTableRows.Add(tuple);
389 break; 335 break;
390 336
391
392#if MOVE_TO_BACKEND 337#if MOVE_TO_BACKEND
393 case "WixFile": 338 case "WixFile":
394 foreach (Row row in table.Rows) 339 foreach (Row row in table.Rows)
@@ -427,23 +372,23 @@ namespace WixToolset.Core
427 case TupleDefinitionType.WixVariable: 372 case TupleDefinitionType.WixVariable:
428 // check for colliding values and collect the wix variable rows 373 // check for colliding values and collect the wix variable rows
429 { 374 {
430 var row = (WixVariableTuple)tuple; 375 var wixVariableTuple = (WixVariableTuple)tuple;
431 var id = row.Id.Id; 376 var id = wixVariableTuple.Id.Id;
432 377
433 if (wixVariables.TryGetValue(id, out var collidingRow)) 378 if (wixVariables.TryGetValue(id, out var collidingTuple))
434 { 379 {
435 if (collidingRow.Overridable && !row.Overridable) 380 if (collidingTuple.Overridable && !wixVariableTuple.Overridable)
436 { 381 {
437 wixVariables[id] = row; 382 wixVariables[id] = wixVariableTuple;
438 } 383 }
439 else if (!row.Overridable || (collidingRow.Overridable && row.Overridable)) 384 else if (!wixVariableTuple.Overridable || (collidingTuple.Overridable && wixVariableTuple.Overridable))
440 { 385 {
441 this.OnMessage(ErrorMessages.WixVariableCollision(row.SourceLineNumbers, id)); 386 this.Messaging.Write(ErrorMessages.WixVariableCollision(wixVariableTuple.SourceLineNumbers, id));
442 } 387 }
443 } 388 }
444 else 389 else
445 { 390 {
446 wixVariables.Add(id, row); 391 wixVariables.Add(id, wixVariableTuple);
447 } 392 }
448 } 393 }
449 394
@@ -463,36 +408,15 @@ namespace WixToolset.Core
463 { 408 {
464 foreach (var feature in connectToFeature.ConnectFeatures) 409 foreach (var feature in connectToFeature.ConnectFeatures)
465 { 410 {
466 var row = new WixFeatureModulesTuple(); 411 var row = new WixFeatureModulesTuple
467 row.FeatureRef = feature;
468 row.WixMergeRef = connectToFeature.ChildId;
469
470 resolvedSection.Tuples.Add(row);
471 }
472 }
473
474#if MOVE_TO_BACKEND
475 // ensure the creation of tables that need to exist
476 if (0 < ensureTableRows.Count)
477 {
478 foreach (Row row in ensureTableRows)
479 {
480 string tableId = (string)row[0];
481 TableDefinition tableDef = null;
482
483 try
484 { 412 {
485 tableDef = this.tableDefinitions[tableId]; 413 FeatureRef = feature,
486 } 414 WixMergeRef = connectToFeature.ChildId
487 catch (WixMissingTableDefinitionException) 415 };
488 {
489 tableDef = customTableDefinitions[tableId];
490 }
491 416
492 this.activeOutput.EnsureTable(tableDef); 417 resolvedSection.Tuples.Add(row);
493 } 418 }
494 } 419 }
495#endif
496 420
497#if MOVE_TO_BACKEND 421#if MOVE_TO_BACKEND
498 // check for missing table and add them or display an error as appropriate 422 // check for missing table and add them or display an error as appropriate
@@ -513,17 +437,17 @@ namespace WixToolset.Core
513 437
514 if (null == imageFamiliesTable || 1 > imageFamiliesTable.Rows.Count) 438 if (null == imageFamiliesTable || 1 > imageFamiliesTable.Rows.Count)
515 { 439 {
516 this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("ImageFamilies")); 440 this.Messaging.Write(WixErrors.ExpectedRowInPatchCreationPackage("ImageFamilies"));
517 } 441 }
518 442
519 if (null == targetImagesTable || 1 > targetImagesTable.Rows.Count) 443 if (null == targetImagesTable || 1 > targetImagesTable.Rows.Count)
520 { 444 {
521 this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("TargetImages")); 445 this.Messaging.Write(WixErrors.ExpectedRowInPatchCreationPackage("TargetImages"));
522 } 446 }
523 447
524 if (null == upgradedImagesTable || 1 > upgradedImagesTable.Rows.Count) 448 if (null == upgradedImagesTable || 1 > upgradedImagesTable.Rows.Count)
525 { 449 {
526 this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("UpgradedImages")); 450 this.Messaging.Write(WixErrors.ExpectedRowInPatchCreationPackage("UpgradedImages"));
527 } 451 }
528 452
529 this.activeOutput.EnsureTable(this.tableDefinitions["Properties"]); 453 this.activeOutput.EnsureTable(this.tableDefinitions["Properties"]);
@@ -537,81 +461,6 @@ namespace WixToolset.Core
537 this.CheckForIllegalTables(this.activeOutput); 461 this.CheckForIllegalTables(this.activeOutput);
538#endif 462#endif
539 463
540#if SOLVE_CUSTOM_TABLE
541 // add the custom row data
542 foreach (Row row in customRows)
543 {
544 TableDefinition customTableDefinition = (TableDefinition)customTableDefinitions[row[0].ToString()];
545 Table customTable = this.activeOutput.EnsureTable(customTableDefinition);
546 Row customRow = customTable.CreateRow(row.SourceLineNumbers);
547
548 customRow.SectionId = row.SectionId;
549
550 string[] data = row[1].ToString().Split(Common.CustomRowFieldSeparator);
551
552 for (int i = 0; i < data.Length; ++i)
553 {
554 bool foundColumn = false;
555 string[] item = data[i].Split(colonCharacter, 2);
556
557 for (int j = 0; j < customRow.Fields.Length; ++j)
558 {
559 if (customRow.Fields[j].Column.Name == item[0])
560 {
561 if (0 < item[1].Length)
562 {
563 if (ColumnType.Number == customRow.Fields[j].Column.Type)
564 {
565 try
566 {
567 customRow.Fields[j].Data = Convert.ToInt32(item[1], CultureInfo.InvariantCulture);
568 }
569 catch (FormatException)
570 {
571 this.OnMessage(WixErrors.IllegalIntegerValue(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name, item[1]));
572 }
573 catch (OverflowException)
574 {
575 this.OnMessage(WixErrors.IllegalIntegerValue(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name, item[1]));
576 }
577 }
578 else if (ColumnCategory.Identifier == customRow.Fields[j].Column.Category)
579 {
580 if (Common.IsIdentifier(item[1]) || Common.IsValidBinderVariable(item[1]) || ColumnCategory.Formatted == customRow.Fields[j].Column.Category)
581 {
582 customRow.Fields[j].Data = item[1];
583 }
584 else
585 {
586 this.OnMessage(WixErrors.IllegalIdentifier(row.SourceLineNumbers, "Data", item[1]));
587 }
588 }
589 else
590 {
591 customRow.Fields[j].Data = item[1];
592 }
593 }
594 foundColumn = true;
595 break;
596 }
597 }
598
599 if (!foundColumn)
600 {
601 this.OnMessage(WixErrors.UnexpectedCustomTableColumn(row.SourceLineNumbers, item[0]));
602 }
603 }
604
605 for (int i = 0; i < customTableDefinition.Columns.Count; ++i)
606 {
607 if (!customTableDefinition.Columns[i].Nullable && (null == customRow.Fields[i].Data || 0 == customRow.Fields[i].Data.ToString().Length))
608 {
609 this.OnMessage(WixErrors.NoDataForColumn(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name));
610 }
611 }
612 }
613#endif
614
615 //correct the section Id in FeatureComponents table 464 //correct the section Id in FeatureComponents table
616 if (this.sectionIdOnRows) 465 if (this.sectionIdOnRows)
617 { 466 {
@@ -683,7 +532,7 @@ namespace WixToolset.Core
683 // sort the rows by DiskId 532 // sort the rows by DiskId
684 fileRows.Sort(); 533 fileRows.Sort();
685 534
686 this.OnMessage(WixWarnings.GeneratedShortFileNameConflict(((FileRow)fileRows[0]).SourceLineNumbers, shortFileName)); 535 this.Messaging.Write(WixWarnings.GeneratedShortFileNameConflict(((FileRow)fileRows[0]).SourceLineNumbers, shortFileName));
687 536
688 for (int i = 1; i < fileRows.Count; i++) 537 for (int i = 1; i < fileRows.Count; i++)
689 { 538 {
@@ -691,7 +540,7 @@ namespace WixToolset.Core
691 540
692 if (null != fileRow.SourceLineNumbers) 541 if (null != fileRow.SourceLineNumbers)
693 { 542 {
694 this.OnMessage(WixWarnings.GeneratedShortFileNameConflict2(fileRow.SourceLineNumbers)); 543 this.Messaging.Write(WixWarnings.GeneratedShortFileNameConflict2(fileRow.SourceLineNumbers));
695 } 544 }
696 } 545 }
697 } 546 }
@@ -732,223 +581,6 @@ namespace WixToolset.Core
732 return this.Messaging.EncounteredError ? null : intermediate; 581 return this.Messaging.EncounteredError ? null : intermediate;
733 } 582 }
734 583
735#if SOLVE_CUSTOM_TABLE
736 /// <summary>
737 /// Links the definition of a custom table.
738 /// </summary>
739 /// <param name="table">The table to link.</param>
740 /// <param name="customTableDefinitions">Receives the linked definition of the custom table.</param>
741 private void LinkCustomTable(Table table, TableDefinitionCollection customTableDefinitions)
742 {
743 foreach (Row row in table.Rows)
744 {
745 bool bootstrapperApplicationData = (null != row[13] && 1 == (int)row[13]);
746
747 if (null == row[4])
748 {
749 this.OnMessage(WixErrors.ExpectedAttribute(row.SourceLineNumbers, "CustomTable/Column", "PrimaryKey"));
750 }
751
752 string[] columnNames = row[2].ToString().Split('\t');
753 string[] columnTypes = row[3].ToString().Split('\t');
754 string[] primaryKeys = row[4].ToString().Split('\t');
755 string[] minValues = row[5] == null ? null : row[5].ToString().Split('\t');
756 string[] maxValues = row[6] == null ? null : row[6].ToString().Split('\t');
757 string[] keyTables = row[7] == null ? null : row[7].ToString().Split('\t');
758 string[] keyColumns = row[8] == null ? null : row[8].ToString().Split('\t');
759 string[] categories = row[9] == null ? null : row[9].ToString().Split('\t');
760 string[] sets = row[10] == null ? null : row[10].ToString().Split('\t');
761 string[] descriptions = row[11] == null ? null : row[11].ToString().Split('\t');
762 string[] modularizations = row[12] == null ? null : row[12].ToString().Split('\t');
763
764 int currentPrimaryKey = 0;
765
766 List<ColumnDefinition> columns = new List<ColumnDefinition>(columnNames.Length);
767 for (int i = 0; i < columnNames.Length; ++i)
768 {
769 string name = columnNames[i];
770 ColumnType type = ColumnType.Unknown;
771
772 if (columnTypes[i].StartsWith("s", StringComparison.OrdinalIgnoreCase))
773 {
774 type = ColumnType.String;
775 }
776 else if (columnTypes[i].StartsWith("l", StringComparison.OrdinalIgnoreCase))
777 {
778 type = ColumnType.Localized;
779 }
780 else if (columnTypes[i].StartsWith("i", StringComparison.OrdinalIgnoreCase))
781 {
782 type = ColumnType.Number;
783 }
784 else if (columnTypes[i].StartsWith("v", StringComparison.OrdinalIgnoreCase))
785 {
786 type = ColumnType.Object;
787 }
788 else
789 {
790 throw new WixException(WixErrors.UnknownCustomTableColumnType(row.SourceLineNumbers, columnTypes[i]));
791 }
792
793 bool nullable = columnTypes[i].Substring(0, 1) == columnTypes[i].Substring(0, 1).ToUpper(CultureInfo.InvariantCulture);
794 int length = Convert.ToInt32(columnTypes[i].Substring(1), CultureInfo.InvariantCulture);
795
796 bool primaryKey = false;
797 if (currentPrimaryKey < primaryKeys.Length && primaryKeys[currentPrimaryKey] == columnNames[i])
798 {
799 primaryKey = true;
800 currentPrimaryKey++;
801 }
802
803 bool minValSet = null != minValues && null != minValues[i] && 0 < minValues[i].Length;
804 int minValue = 0;
805 if (minValSet)
806 {
807 minValue = Convert.ToInt32(minValues[i], CultureInfo.InvariantCulture);
808 }
809
810 bool maxValSet = null != maxValues && null != maxValues[i] && 0 < maxValues[i].Length;
811 int maxValue = 0;
812 if (maxValSet)
813 {
814 maxValue = Convert.ToInt32(maxValues[i], CultureInfo.InvariantCulture);
815 }
816
817 bool keyColumnSet = null != keyColumns && null != keyColumns[i] && 0 < keyColumns[i].Length;
818 int keyColumn = 0;
819 if (keyColumnSet)
820 {
821 keyColumn = Convert.ToInt32(keyColumns[i], CultureInfo.InvariantCulture);
822 }
823
824 ColumnCategory category = ColumnCategory.Unknown;
825 if (null != categories && null != categories[i] && 0 < categories[i].Length)
826 {
827 switch (categories[i])
828 {
829 case "Text":
830 category = ColumnCategory.Text;
831 break;
832 case "UpperCase":
833 category = ColumnCategory.UpperCase;
834 break;
835 case "LowerCase":
836 category = ColumnCategory.LowerCase;
837 break;
838 case "Integer":
839 category = ColumnCategory.Integer;
840 break;
841 case "DoubleInteger":
842 category = ColumnCategory.DoubleInteger;
843 break;
844 case "TimeDate":
845 category = ColumnCategory.TimeDate;
846 break;
847 case "Identifier":
848 category = ColumnCategory.Identifier;
849 break;
850 case "Property":
851 category = ColumnCategory.Property;
852 break;
853 case "Filename":
854 category = ColumnCategory.Filename;
855 break;
856 case "WildCardFilename":
857 category = ColumnCategory.WildCardFilename;
858 break;
859 case "Path":
860 category = ColumnCategory.Path;
861 break;
862 case "Paths":
863 category = ColumnCategory.Paths;
864 break;
865 case "AnyPath":
866 category = ColumnCategory.AnyPath;
867 break;
868 case "DefaultDir":
869 category = ColumnCategory.DefaultDir;
870 break;
871 case "RegPath":
872 category = ColumnCategory.RegPath;
873 break;
874 case "Formatted":
875 category = ColumnCategory.Formatted;
876 break;
877 case "FormattedSddl":
878 category = ColumnCategory.FormattedSDDLText;
879 break;
880 case "Template":
881 category = ColumnCategory.Template;
882 break;
883 case "Condition":
884 category = ColumnCategory.Condition;
885 break;
886 case "Guid":
887 category = ColumnCategory.Guid;
888 break;
889 case "Version":
890 category = ColumnCategory.Version;
891 break;
892 case "Language":
893 category = ColumnCategory.Language;
894 break;
895 case "Binary":
896 category = ColumnCategory.Binary;
897 break;
898 case "CustomSource":
899 category = ColumnCategory.CustomSource;
900 break;
901 case "Cabinet":
902 category = ColumnCategory.Cabinet;
903 break;
904 case "Shortcut":
905 category = ColumnCategory.Shortcut;
906 break;
907 default:
908 break;
909 }
910 }
911
912 string keyTable = keyTables != null ? keyTables[i] : null;
913 string setValue = sets != null ? sets[i] : null;
914 string description = descriptions != null ? descriptions[i] : null;
915 string modString = modularizations != null ? modularizations[i] : null;
916 ColumnModularizeType modularization = ColumnModularizeType.None;
917 if (modString != null)
918 {
919 switch (modString)
920 {
921 case "None":
922 modularization = ColumnModularizeType.None;
923 break;
924 case "Column":
925 modularization = ColumnModularizeType.Column;
926 break;
927 case "Property":
928 modularization = ColumnModularizeType.Property;
929 break;
930 case "Condition":
931 modularization = ColumnModularizeType.Condition;
932 break;
933 case "CompanionFile":
934 modularization = ColumnModularizeType.CompanionFile;
935 break;
936 case "SemicolonDelimited":
937 modularization = ColumnModularizeType.SemicolonDelimited;
938 break;
939 }
940 }
941
942 ColumnDefinition columnDefinition = new ColumnDefinition(name, type, length, primaryKey, nullable, modularization, ColumnType.Localized == type, minValSet, minValue, maxValSet, maxValue, keyTable, keyColumnSet, keyColumn, category, setValue, description, true, true);
943 columns.Add(columnDefinition);
944 }
945
946 TableDefinition customTable = new TableDefinition((string)row[0], columns, false, bootstrapperApplicationData, bootstrapperApplicationData);
947 customTableDefinitions.Add(customTable);
948 }
949 }
950#endif
951
952#if MOVE_TO_BACKEND 584#if MOVE_TO_BACKEND
953 /// <summary> 585 /// <summary>
954 /// Checks for any tables in the output which are not allowed in the output type. 586 /// Checks for any tables in the output which are not allowed in the output type.
@@ -973,14 +605,14 @@ namespace WixToolset.Core
973 { 605 {
974 foreach (Row row in table.Rows) 606 foreach (Row row in table.Rows)
975 { 607 {
976 this.OnMessage(WixErrors.UnexpectedTableInMergeModule(row.SourceLineNumbers, table.Name)); 608 this.Messaging.Write(WixErrors.UnexpectedTableInMergeModule(row.SourceLineNumbers, table.Name));
977 } 609 }
978 } 610 }
979 else if ("Error" == table.Name) 611 else if ("Error" == table.Name)
980 { 612 {
981 foreach (Row row in table.Rows) 613 foreach (Row row in table.Rows)
982 { 614 {
983 this.OnMessage(WixWarnings.DangerousTableInMergeModule(row.SourceLineNumbers, table.Name)); 615 this.Messaging.Write(WixWarnings.DangerousTableInMergeModule(row.SourceLineNumbers, table.Name));
984 } 616 }
985 } 617 }
986 break; 618 break;
@@ -1001,7 +633,7 @@ namespace WixToolset.Core
1001 { 633 {
1002 foreach (Row row in table.Rows) 634 foreach (Row row in table.Rows)
1003 { 635 {
1004 this.OnMessage(WixErrors.UnexpectedTableInPatchCreationPackage(row.SourceLineNumbers, table.Name)); 636 this.Messaging.Write(WixErrors.UnexpectedTableInPatchCreationPackage(row.SourceLineNumbers, table.Name));
1005 } 637 }
1006 } 638 }
1007 break; 639 break;
@@ -1014,7 +646,7 @@ namespace WixToolset.Core
1014 { 646 {
1015 foreach (Row row in table.Rows) 647 foreach (Row row in table.Rows)
1016 { 648 {
1017 this.OnMessage(WixErrors.UnexpectedTableInPatch(row.SourceLineNumbers, table.Name)); 649 this.Messaging.Write(WixErrors.UnexpectedTableInPatch(row.SourceLineNumbers, table.Name));
1018 } 650 }
1019 } 651 }
1020 break; 652 break;
@@ -1035,7 +667,7 @@ namespace WixToolset.Core
1035 { 667 {
1036 foreach (Row row in table.Rows) 668 foreach (Row row in table.Rows)
1037 { 669 {
1038 this.OnMessage(WixWarnings.UnexpectedTableInProduct(row.SourceLineNumbers, table.Name)); 670 this.Messaging.Write(WixWarnings.UnexpectedTableInProduct(row.SourceLineNumbers, table.Name));
1039 } 671 }
1040 } 672 }
1041 break; 673 break;
@@ -1080,7 +712,7 @@ namespace WixToolset.Core
1080 { 712 {
1081 foreach (Row row in isolatedComponentTable.Rows) 713 foreach (Row row in isolatedComponentTable.Rows)
1082 { 714 {
1083 this.OnMessage(WixWarnings.TableIncompatibleWithInstallerVersion(row.SourceLineNumbers, "IsolatedComponent", outputInstallerVersion)); 715 this.Messaging.Write(WixWarnings.TableIncompatibleWithInstallerVersion(row.SourceLineNumbers, "IsolatedComponent", outputInstallerVersion));
1084 } 716 }
1085 } 717 }
1086 } 718 }
@@ -1095,7 +727,7 @@ namespace WixToolset.Core
1095 { 727 {
1096 if (null != row[12] || null != row[13] || null != row[14] || null != row[15]) 728 if (null != row[12] || null != row[13] || null != row[14] || null != row[15])
1097 { 729 {
1098 this.OnMessage(WixWarnings.ColumnsIncompatibleWithInstallerVersion(row.SourceLineNumbers, "Shortcut", outputInstallerVersion)); 730 this.Messaging.Write(WixWarnings.ColumnsIncompatibleWithInstallerVersion(row.SourceLineNumbers, "Shortcut", outputInstallerVersion));
1099 } 731 }
1100 } 732 }
1101 } 733 }
@@ -1104,15 +736,6 @@ namespace WixToolset.Core
1104#endif 736#endif
1105 737
1106 /// <summary> 738 /// <summary>
1107 /// Sends a message to the message delegate if there is one.
1108 /// </summary>
1109 /// <param name="message">Message event arguments.</param>
1110 public void OnMessage(Message message)
1111 {
1112 this.Messaging.Write(message);
1113 }
1114
1115 /// <summary>
1116 /// Load the standard action symbols. 739 /// Load the standard action symbols.
1117 /// </summary> 740 /// </summary>
1118 /// <param name="symbols">Collection of symbols.</param> 741 /// <param name="symbols">Collection of symbols.</param>
@@ -1165,7 +788,7 @@ namespace WixToolset.Core
1165 { 788 {
1166 if (connection.IsExplicitPrimaryFeature) 789 if (connection.IsExplicitPrimaryFeature)
1167 { 790 {
1168 this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), connection.PrimaryFeature ?? resolvedSection.Id)); 791 this.Messaging.Write(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), connection.PrimaryFeature ?? resolvedSection.Id));
1169 continue; 792 continue;
1170 } 793 }
1171 else 794 else
@@ -1197,7 +820,7 @@ namespace WixToolset.Core
1197 connection = featuresToFeatures[wixComplexReferenceRow.Child]; 820 connection = featuresToFeatures[wixComplexReferenceRow.Child];
1198 if (null != connection) 821 if (null != connection)
1199 { 822 {
1200 this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); 823 this.Messaging.Write(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1201 continue; 824 continue;
1202 } 825 }
1203 826
@@ -1214,7 +837,7 @@ namespace WixToolset.Core
1214 { 837 {
1215 if (connection.IsExplicitPrimaryFeature) 838 if (connection.IsExplicitPrimaryFeature)
1216 { 839 {
1217 this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); 840 this.Messaging.Write(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1218 continue; 841 continue;
1219 } 842 }
1220 else 843 else
@@ -1241,7 +864,7 @@ namespace WixToolset.Core
1241 case ComplexReferenceChildType.Component: 864 case ComplexReferenceChildType.Component:
1242 if (componentsToModules.ContainsKey(wixComplexReferenceRow.Child)) 865 if (componentsToModules.ContainsKey(wixComplexReferenceRow.Child))
1243 { 866 {
1244 this.OnMessage(ErrorMessages.ComponentReferencedTwice(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.Child)); 867 this.Messaging.Write(ErrorMessages.ComponentReferencedTwice(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.Child));
1245 continue; 868 continue;
1246 } 869 }
1247 else 870 else
@@ -1285,7 +908,7 @@ namespace WixToolset.Core
1285 connection = featuresToFeatures[wixComplexReferenceRow.Child]; 908 connection = featuresToFeatures[wixComplexReferenceRow.Child];
1286 if (null != connection) 909 if (null != connection)
1287 { 910 {
1288 this.OnMessage(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); 911 this.Messaging.Write(ErrorMessages.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id)));
1289 continue; 912 continue;
1290 } 913 }
1291 914
@@ -1470,7 +1093,7 @@ namespace WixToolset.Core
1470 // way up to present the loop as a directed graph. 1093 // way up to present the loop as a directed graph.
1471 var loop = String.Join(" -> ", loopDetector); 1094 var loop = String.Join(" -> ", loopDetector);
1472 1095
1473 this.OnMessage(ErrorMessages.ReferenceLoopDetected(wixComplexReferenceRow?.SourceLineNumbers, loop)); 1096 this.Messaging.Write(ErrorMessages.ReferenceLoopDetected(wixComplexReferenceRow?.SourceLineNumbers, loop));
1474 1097
1475 // Cleanup the parentGroupsNeedingProcessing and the loopDetector just like the 1098 // Cleanup the parentGroupsNeedingProcessing and the loopDetector just like the
1476 // exit of this method does at the end because we are exiting early. 1099 // exit of this method does at the end because we are exiting early.
@@ -1712,11 +1335,11 @@ namespace WixToolset.Core
1712 // display an error for the component or merge module as approrpriate 1335 // display an error for the component or merge module as approrpriate
1713 if (null != multipleFeatureComponents) 1336 if (null != multipleFeatureComponents)
1714 { 1337 {
1715 this.OnMessage(ErrorMessages.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id)); 1338 this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id));
1716 } 1339 }
1717 else 1340 else
1718 { 1341 {
1719 this.OnMessage(ErrorMessages.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId)); 1342 this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId));
1720 } 1343 }
1721 } 1344 }
1722 else 1345 else
@@ -1731,7 +1354,7 @@ namespace WixToolset.Core
1731 { 1354 {
1732 if (!multipleFeatureComponents.Contains(connectionId)) 1355 if (!multipleFeatureComponents.Contains(connectionId))
1733 { 1356 {
1734 this.OnMessage(WarningMessages.ImplicitComponentPrimaryFeature(connectionId)); 1357 this.Messaging.Write(WarningMessages.ImplicitComponentPrimaryFeature(connectionId));
1735 1358
1736 // remember this component so only one warning is generated for it 1359 // remember this component so only one warning is generated for it
1737 multipleFeatureComponents[connectionId] = null; 1360 multipleFeatureComponents[connectionId] = null;
@@ -1739,7 +1362,7 @@ namespace WixToolset.Core
1739 } 1362 }
1740 else 1363 else
1741 { 1364 {
1742 this.OnMessage(WarningMessages.ImplicitMergeModulePrimaryFeature(connectionId)); 1365 this.Messaging.Write(WarningMessages.ImplicitMergeModulePrimaryFeature(connectionId));
1743 } 1366 }
1744 } 1367 }
1745 1368