From 2bb37beda887d120a0ddabf874ad25357101faa1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Nov 2017 10:59:45 -0700 Subject: Update to WiX Intermediate Representation --- .../ColumnDefinition.cs | 1032 ++++++++++ src/WixToolset.Data.WindowsInstaller/Common.cs | 25 + .../Data/actions.xml | 76 + .../Data/tables.xml | 1962 ++++++++++++++++++++ src/WixToolset.Data.WindowsInstaller/Field.cs | 266 +++ .../ObjectField.cs | 183 ++ src/WixToolset.Data.WindowsInstaller/Output.cs | 342 ++++ src/WixToolset.Data.WindowsInstaller/Pdb.cs | 163 ++ src/WixToolset.Data.WindowsInstaller/Row.cs | 620 +++++++ .../RowDictionary.cs | 84 + .../RowIndexedList.cs | 301 +++ .../RowOperation.cs | 30 + .../Rows/BBControlRow.cs | 113 ++ .../Rows/ComponentRow.cs | 245 +++ .../Rows/ContainerType.cs | 13 + .../Rows/ControlRow.cs | 143 ++ .../Rows/FileRow.cs | 640 +++++++ .../Rows/MediaRow.cs | 80 + .../Rows/PropertyRow.cs | 42 + .../Rows/SummaryInfoRowCollection.cs | 42 + .../Rows/SymbolPathType.cs | 17 + .../Rows/UpgradeRow.cs | 90 + .../Rows/WixActionRow.cs | 374 ++++ .../Rows/WixActionRowCollection.cs | 222 +++ .../Rows/WixApprovedExeForElevationRow.cs | 79 + .../Rows/WixBundleCatalogRow.cs | 50 + .../Rows/WixBundleContainerRow.cs | 78 + .../Rows/WixBundleExePackageRow.cs | 103 + .../Rows/WixBundleMsiFeatureRow.cs | 93 + .../Rows/WixBundleMsiPackageRow.cs | 138 ++ .../Rows/WixBundleMsiPropertyRow.cs | 58 + .../Rows/WixBundleMspPackageRow.cs | 101 + .../Rows/WixBundleMsuPackageRow.cs | 57 + .../Rows/WixBundlePackageCommandLineRow.cs | 82 + .../Rows/WixBundlePackageExitCodeRow.cs | 53 + .../Rows/WixBundlePackageRow.cs | 228 +++ .../Rows/WixBundlePatchTargetCodeRow.cs | 81 + .../Rows/WixBundlePayloadRow.cs | 185 ++ .../Rows/WixBundleRelatedPackageRow.cs | 87 + .../Rows/WixBundleRollbackBoundaryRow.cs | 59 + .../Rows/WixBundleRow.cs | 228 +++ .../Rows/WixBundleSlipstreamMspRow.cs | 48 + .../Rows/WixBundleUpdateRow.cs | 38 + .../Rows/WixBundleVariableRow.cs | 80 + .../Rows/WixChainItemRow.cs | 39 + .../Rows/WixChainRow.cs | 65 + .../Rows/WixComplexReferenceRow.cs | 204 ++ .../Rows/WixDeltaPatchFileRow.cs | 142 ++ .../Rows/WixDeltaPatchSymbolPathsRow.cs | 58 + .../Rows/WixFileRow.cs | 163 ++ .../Rows/WixGroupRow.cs | 62 + .../Rows/WixMediaRow.cs | 60 + .../Rows/WixMediaTemplateRow.cs | 81 + .../Rows/WixMergeRow.cs | 149 ++ .../Rows/WixPayloadPropertiesRow.cs | 81 + .../Rows/WixPropertyRow.cs | 118 ++ .../Rows/WixRelatedBundleRow.cs | 52 + .../Rows/WixSimpleReferenceRow.cs | 63 + .../Rows/WixUpdateRegistrationRow.cs | 62 + src/WixToolset.Data.WindowsInstaller/SubStorage.cs | 109 ++ src/WixToolset.Data.WindowsInstaller/Table.cs | 435 +++++ .../TableDefinition.cs | 334 ++++ .../TableDefinitionCollection.cs | 229 +++ .../TableExtensions.cs | 23 + .../TableIndexedCollection.cs | 153 ++ .../TableOperation.cs | 25 + .../WindowsInstallerStandard.cs | 442 +++++ .../WixInvalidIdtException.cs | 32 + .../WixMissingTableDefinitionException.cs | 22 + .../WixToolset.Data.WindowsInstaller.csproj | 27 + 70 files changed, 12261 insertions(+) create mode 100644 src/WixToolset.Data.WindowsInstaller/ColumnDefinition.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Common.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Data/actions.xml create mode 100644 src/WixToolset.Data.WindowsInstaller/Data/tables.xml create mode 100644 src/WixToolset.Data.WindowsInstaller/Field.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/ObjectField.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Output.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Pdb.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Row.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/RowDictionary.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/RowIndexedList.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/RowOperation.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/BBControlRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/ComponentRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/ContainerType.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/ControlRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/FileRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/MediaRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/PropertyRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/SummaryInfoRowCollection.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/SymbolPathType.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/UpgradeRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixActionRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixActionRowCollection.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixApprovedExeForElevationRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleCatalogRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleContainerRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleExePackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiFeatureRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPropertyRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMspPackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsuPackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageCommandLineRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageExitCodeRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePatchTargetCodeRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePayloadRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRelatedPackageRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRollbackBoundaryRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleSlipstreamMspRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleUpdateRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixBundleVariableRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixChainItemRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixChainRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixComplexReferenceRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchFileRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchSymbolPathsRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixFileRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixGroupRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixMediaRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixMediaTemplateRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixMergeRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixPayloadPropertiesRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixPropertyRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixRelatedBundleRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixSimpleReferenceRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Rows/WixUpdateRegistrationRow.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/SubStorage.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/Table.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/TableDefinition.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/TableDefinitionCollection.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/TableExtensions.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/TableIndexedCollection.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/TableOperation.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandard.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/WixInvalidIdtException.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/WixMissingTableDefinitionException.cs create mode 100644 src/WixToolset.Data.WindowsInstaller/WixToolset.Data.WindowsInstaller.csproj (limited to 'src/WixToolset.Data.WindowsInstaller') diff --git a/src/WixToolset.Data.WindowsInstaller/ColumnDefinition.cs b/src/WixToolset.Data.WindowsInstaller/ColumnDefinition.cs new file mode 100644 index 00000000..7e5a07c5 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/ColumnDefinition.cs @@ -0,0 +1,1032 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Globalization; + using System.Xml; + + /// + /// Defines MSI column types. + /// + public enum ColumnType + { + /// Unknown column type, default and invalid. + Unknown, + + /// Column is a string. + String, + + /// Column is a localizable string. + Localized, + + /// Column is a number. + Number, + + /// Column is a binary stream. + Object, + + /// Column is a string that is preserved in transforms (like Object). + Preserved, + } + + /// + /// Specifies if the column should be modularized. + /// + public enum ColumnModularizeType + { + /// Column should not be modularized. + None, + + /// Column should be modularized. + Column, + + /// When the column is an primary or foreign key to the Icon table it should be modularized special. + Icon, + + /// When the column is a companion file it should be modularized. + CompanionFile, + + /// Column is a condition and should be modularized. + Condition, + + /// Special modularization type for the ControlEvent table's Argument column. + ControlEventArgument, + + /// Special modularization type for the Control table's Text column. + ControlText, + + /// Any Properties in the column should be modularized. + Property, + + /// Semi-colon list of keys, all of which need to be modularized. + SemicolonDelimited, + } + + /// + /// Column validation category type + /// + public enum ColumnCategory + { + /// Unknown category, default and invalid. + Unknown, + + /// Text category. + Text, + + /// UpperCase category. + UpperCase, + + /// LowerCase category. + LowerCase, + + /// Integer category. + Integer, + + /// DoubleInteger category. + DoubleInteger, + + /// TimeDate category. + TimeDate, + + /// Identifier category. + Identifier, + + /// Property category. + Property, + + /// Filename category. + Filename, + + /// WildCardFilename category. + WildCardFilename, + + /// Path category. + Path, + + /// Paths category. + Paths, + + /// AnyPath category. + AnyPath, + + /// DefaultDir category. + DefaultDir, + + /// RegPath category. + RegPath, + + /// Formatted category. + Formatted, + + /// Template category. + Template, + + /// Condition category. + Condition, + + /// Guid category. + Guid, + + /// Version category. + Version, + + /// Language category. + Language, + + /// Binary category. + Binary, + + /// CustomSource category. + CustomSource, + + /// Cabinet category. + Cabinet, + + /// Shortcut category. + Shortcut, + + /// Formatted SDDL category. + FormattedSDDLText, + } + + /// + /// Definition of a table's column. + /// + public sealed class ColumnDefinition : IComparable + { + private string name; + private ColumnType type; + private int length; + private bool primaryKey; + private bool nullable; + private ColumnModularizeType modularize; + private bool localizable; + private bool added; + + private bool minValueSet; + private long minValue; + private bool maxValueSet; + private long maxValue; + private string keyTable; + private bool keyColumnSet; + private int keyColumn; + private ColumnCategory category; + private string possibilities; + private string description; + private bool escapeIdtCharacters; + private bool useCData; + + /// + /// Creates a new column definition. + /// + /// Name of column. + /// Type of column + /// Length of column. + /// If column is primary key. + /// If column is nullable. + /// Type of modularization for column + /// If the column is localizable. + /// If the minimum of the value was set. + /// Minimum value for the column. + /// If the maximum value was set. + /// Maximum value for the colum. + /// Optional name of table for foreign key. + /// If the key column was set. + /// Optional name of column for foreign key. + /// Validation category for column. + /// Set of possible values for column. + /// Description of column in vaidation table. + /// If characters should be escaped in IDT. + /// If whitespace should be preserved in a CDATA node. + public ColumnDefinition(string name, ColumnType type, int length, bool primaryKey, bool nullable, ColumnModularizeType modularizeType, bool localizable, bool minValueSet, long minValue, bool maxValueSet, long maxValue, string keyTable, bool keyColumnSet, int keyColumn, ColumnCategory category, string possibilities, string description, bool escapeIdtCharacters, bool useCData) + { + this.name = name; + this.type = type; + this.length = length; + this.primaryKey = primaryKey; + this.nullable = nullable; + this.modularize = modularizeType; + this.localizable = localizable; + this.minValueSet = minValueSet; + this.minValue = minValue; + this.maxValueSet = maxValueSet; + this.maxValue = maxValue; + this.keyTable = keyTable; + this.keyColumnSet = keyColumnSet; + this.keyColumn = keyColumn; + this.category = category; + this.possibilities = possibilities; + this.description = description; + this.escapeIdtCharacters = escapeIdtCharacters; + this.useCData = useCData; + } + + /// + /// Gets whether this column was added via a transform. + /// + /// Whether this column was added via a transform. + public bool Added + { + get { return this.added; } + set { this.added = value; } + } + + /// + /// Gets the name of the column. + /// + /// Name of column. + public string Name + { + get { return this.name; } + } + + /// + /// Gets the type of the column. + /// + /// Type of column. + public ColumnType Type + { + get { return this.type; } + } + + /// + /// Gets the length of the column. + /// + /// Length of column. + public int Length + { + get { return this.length; } + } + + /// + /// Gets if the column is a primary key. + /// + /// true if column is primary key. + public bool PrimaryKey + { + get { return this.primaryKey; } + } + + /// + /// Gets if the column is nullable. + /// + /// true if column is nullable. + public bool Nullable + { + get { return this.nullable; } + } + + /// + /// Gets the type of modularization for this column. + /// + /// Column's modularization type. + public ColumnModularizeType ModularizeType + { + get { return this.modularize; } + } + + /// + /// Gets if the column is localizable. Can be because the type is localizable, or because the column + /// was explicitly set to be so. + /// + /// true if column is localizable. + public bool IsLocalizable + { + get { return this.localizable || ColumnType.Localized == this.Type; } + } + + /// + /// Gets if the minimum value of the column is set. + /// + /// true if minimum value is set. + public bool IsMinValueSet + { + get { return this.minValueSet; } + } + + /// + /// Gets the minimum value for the column, only valid if IsMinValueSet returns true. + /// + /// Minimum value for the column. + public long MinValue + { + get { return this.minValue; } + } + + /// + /// Gets if the maximum value of the column is set. + /// + /// true if maximum value is set. + public bool IsMaxValueSet + { + get { return this.maxValueSet; } + } + + /// + /// Gets the maximum value for the column, only valid if IsMinValueSet returns true. + /// + /// Maximum value for the column. + public long MaxValue + { + get { return this.maxValue; } + } + + /// + /// Gets the table that has the foreign key for this column + /// + /// Foreign key table name. + public string KeyTable + { + get { return this.keyTable; } + } + + /// + /// Gets if the key column is set. + /// + /// True if the key column is set. + public bool IsKeyColumnSet + { + get { return this.keyColumnSet; } + } + + /// + /// Gets the foreign key column that this column refers to. + /// + /// Foreign key column. + public int KeyColumn + { + get { return this.keyColumn; } + } + + /// + /// Gets the validation category for this column. + /// + /// Validation category. + public ColumnCategory Category + { + get { return this.category; } + } + + /// + /// Gets the set of possibilities for this column. + /// + /// Set of possibilities for this column. + public string Possibilities + { + get { return this.possibilities; } + } + + /// + /// Gets the description for this column. + /// + /// Description of column. + public string Description + { + get { return this.description; } + } + + /// + /// Gets if characters should be escaped to fit into IDT. + /// + /// true if data should be escaped when adding to IDT. + public bool EscapeIdtCharacters + { + get { return this.escapeIdtCharacters; } + } + + /// + /// Gets if whitespace should be preserved in a CDATA node. + /// + /// true if whitespace should be preserved in a CDATA node. + public bool UseCData + { + get { return this.useCData; } + } + + /// + /// Gets the type of the column in IDT format. + /// + /// IDT format for column type. + public string IdtType + { + get + { + char typeCharacter; + switch (this.type) + { + case ColumnType.Number: + typeCharacter = this.nullable ? 'I' : 'i'; + break; + case ColumnType.Preserved: + case ColumnType.String: + typeCharacter = this.nullable ? 'S' : 's'; + break; + case ColumnType.Localized: + typeCharacter = this.nullable ? 'L' : 'l'; + break; + case ColumnType.Object: + typeCharacter = this.nullable ? 'V' : 'v'; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_UnknownColumnType, this.type)); + } + + return String.Concat(typeCharacter, this.length); + } + } + + /// + /// Parses a column definition in a table definition. + /// + /// Reader to get data from. + /// The ColumnDefintion represented by the Xml. + internal static ColumnDefinition Read(XmlReader reader) + { + if (!reader.LocalName.Equals("columnDefinition")) + { + throw new XmlException(); + } + + bool added = false; + ColumnCategory category = ColumnCategory.Unknown; + string description = null; + bool empty = reader.IsEmptyElement; + bool escapeIdtCharacters = false; + int keyColumn = -1; + bool keyColumnSet = false; + string keyTable = null; + int length = -1; + bool localizable = false; + long maxValue = 0; + bool maxValueSet = false; + long minValue = 0; + bool minValueSet = false; + ColumnModularizeType modularize = ColumnModularizeType.None; + string name = null; + bool nullable = false; + string possibilities = null; + bool primaryKey = false; + ColumnType type = ColumnType.Unknown; + bool useCData = false; + + // parse the attributes + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "added": + added = reader.Value.Equals("yes"); + break; + case "category": + switch (reader.Value) + { + case "anyPath": + category = ColumnCategory.AnyPath; + break; + case "binary": + category = ColumnCategory.Binary; + break; + case "cabinet": + category = ColumnCategory.Cabinet; + break; + case "condition": + category = ColumnCategory.Condition; + break; + case "customSource": + category = ColumnCategory.CustomSource; + break; + case "defaultDir": + category = ColumnCategory.DefaultDir; + break; + case "doubleInteger": + category = ColumnCategory.DoubleInteger; + break; + case "filename": + category = ColumnCategory.Filename; + break; + case "formatted": + category = ColumnCategory.Formatted; + break; + case "formattedSddl": + category = ColumnCategory.FormattedSDDLText; + break; + case "guid": + category = ColumnCategory.Guid; + break; + case "identifier": + category = ColumnCategory.Identifier; + break; + case "integer": + category = ColumnCategory.Integer; + break; + case "language": + category = ColumnCategory.Language; + break; + case "lowerCase": + category = ColumnCategory.LowerCase; + break; + case "path": + category = ColumnCategory.Path; + break; + case "paths": + category = ColumnCategory.Paths; + break; + case "property": + category = ColumnCategory.Property; + break; + case "regPath": + category = ColumnCategory.RegPath; + break; + case "shortcut": + category = ColumnCategory.Shortcut; + break; + case "template": + category = ColumnCategory.Template; + break; + case "text": + category = ColumnCategory.Text; + break; + case "timeDate": + category = ColumnCategory.TimeDate; + break; + case "upperCase": + category = ColumnCategory.UpperCase; + break; + case "version": + category = ColumnCategory.Version; + break; + case "wildCardFilename": + category = ColumnCategory.WildCardFilename; + break; + default: + throw new InvalidOperationException(); + } + break; + case "description": + description = reader.Value; + break; + case "escapeIdtCharacters": + escapeIdtCharacters = reader.Value.Equals("yes"); + break; + case "keyColumn": + keyColumnSet = true; + keyColumn = Convert.ToInt32(reader.Value, 10); + break; + case "keyTable": + keyTable = reader.Value; + break; + case "length": + length = Convert.ToInt32(reader.Value, 10); + break; + case "localizable": + localizable = reader.Value.Equals("yes"); + break; + case "maxValue": + maxValueSet = true; + maxValue = Convert.ToInt32(reader.Value, 10); + break; + case "minValue": + minValueSet = true; + minValue = Convert.ToInt32(reader.Value, 10); + break; + case "modularize": + switch (reader.Value) + { + case "column": + modularize = ColumnModularizeType.Column; + break; + case "companionFile": + modularize = ColumnModularizeType.CompanionFile; + break; + case "condition": + modularize = ColumnModularizeType.Condition; + break; + case "controlEventArgument": + modularize = ColumnModularizeType.ControlEventArgument; + break; + case "controlText": + modularize = ColumnModularizeType.ControlText; + break; + case "icon": + modularize = ColumnModularizeType.Icon; + break; + case "none": + modularize = ColumnModularizeType.None; + break; + case "property": + modularize = ColumnModularizeType.Property; + break; + case "semicolonDelimited": + modularize = ColumnModularizeType.SemicolonDelimited; + break; + default: + throw new XmlException(); + } + break; + case "name": + switch (reader.Value) + { + case "CREATE": + case "DELETE": + case "DROP": + case "INSERT": + throw new XmlException(); + default: + name = reader.Value; + break; + } + break; + case "nullable": + nullable = reader.Value.Equals("yes"); + break; + case "primaryKey": + primaryKey = reader.Value.Equals("yes"); + break; + case "set": + possibilities = reader.Value; + break; + case "type": + switch (reader.Value) + { + case "localized": + type = ColumnType.Localized; + break; + case "number": + type = ColumnType.Number; + break; + case "object": + type = ColumnType.Object; + break; + case "string": + type = ColumnType.String; + break; + case "preserved": + type = ColumnType.Preserved; + break; + default: + throw new XmlException(); + } + break; + case "useCData": + useCData = reader.Value.Equals("yes"); + break; + } + } + + // parse the child elements (there should be none) + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + throw new XmlException(); + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + ColumnDefinition columnDefinition = new ColumnDefinition(name, type, length, primaryKey, nullable, modularize, localizable, minValueSet, minValue, maxValueSet, maxValue, keyTable, keyColumnSet, keyColumn, category, possibilities, description, escapeIdtCharacters, useCData); + columnDefinition.Added = added; + + return columnDefinition; + } + + /// + /// Persists a ColumnDefinition in an XML format. + /// + /// XmlWriter where the Output should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("columnDefinition", TableDefinitionCollection.XmlNamespaceUri); + + writer.WriteAttributeString("name", this.name); + + switch (this.type) + { + case ColumnType.Localized: + writer.WriteAttributeString("type", "localized"); + break; + case ColumnType.Number: + writer.WriteAttributeString("type", "number"); + break; + case ColumnType.Object: + writer.WriteAttributeString("type", "object"); + break; + case ColumnType.String: + writer.WriteAttributeString("type", "string"); + break; + case ColumnType.Preserved: + writer.WriteAttributeString("type", "preserved"); + break; + } + + writer.WriteAttributeString("length", this.length.ToString(CultureInfo.InvariantCulture.NumberFormat)); + + if (this.primaryKey) + { + writer.WriteAttributeString("primaryKey", "yes"); + } + + if (this.nullable) + { + writer.WriteAttributeString("nullable", "yes"); + } + + if (this.localizable) + { + writer.WriteAttributeString("localizable", "yes"); + } + + if (this.added) + { + writer.WriteAttributeString("added", "yes"); + } + + switch (this.modularize) + { + case ColumnModularizeType.Column: + writer.WriteAttributeString("modularize", "column"); + break; + case ColumnModularizeType.CompanionFile: + writer.WriteAttributeString("modularize", "companionFile"); + break; + case ColumnModularizeType.Condition: + writer.WriteAttributeString("modularize", "condition"); + break; + case ColumnModularizeType.ControlEventArgument: + writer.WriteAttributeString("modularize", "controlEventArgument"); + break; + case ColumnModularizeType.ControlText: + writer.WriteAttributeString("modularize", "controlText"); + break; + case ColumnModularizeType.Icon: + writer.WriteAttributeString("modularize", "icon"); + break; + case ColumnModularizeType.None: + // this is the default value + break; + case ColumnModularizeType.Property: + writer.WriteAttributeString("modularize", "property"); + break; + case ColumnModularizeType.SemicolonDelimited: + writer.WriteAttributeString("modularize", "semicolonDelimited"); + break; + } + + if (this.minValueSet) + { + writer.WriteAttributeString("minValue", this.minValue.ToString(CultureInfo.InvariantCulture.NumberFormat)); + } + + if (this.maxValueSet) + { + writer.WriteAttributeString("maxValue", this.maxValue.ToString(CultureInfo.InvariantCulture.NumberFormat)); + } + + if (!String.IsNullOrEmpty(this.keyTable)) + { + writer.WriteAttributeString("keyTable", this.keyTable); + } + + if (this.keyColumnSet) + { + writer.WriteAttributeString("keyColumn", this.keyColumn.ToString(CultureInfo.InvariantCulture.NumberFormat)); + } + + switch (this.category) + { + case ColumnCategory.AnyPath: + writer.WriteAttributeString("category", "anyPath"); + break; + case ColumnCategory.Binary: + writer.WriteAttributeString("category", "binary"); + break; + case ColumnCategory.Cabinet: + writer.WriteAttributeString("category", "cabinet"); + break; + case ColumnCategory.Condition: + writer.WriteAttributeString("category", "condition"); + break; + case ColumnCategory.CustomSource: + writer.WriteAttributeString("category", "customSource"); + break; + case ColumnCategory.DefaultDir: + writer.WriteAttributeString("category", "defaultDir"); + break; + case ColumnCategory.DoubleInteger: + writer.WriteAttributeString("category", "doubleInteger"); + break; + case ColumnCategory.Filename: + writer.WriteAttributeString("category", "filename"); + break; + case ColumnCategory.Formatted: + writer.WriteAttributeString("category", "formatted"); + break; + case ColumnCategory.FormattedSDDLText: + writer.WriteAttributeString("category", "formattedSddl"); + break; + case ColumnCategory.Guid: + writer.WriteAttributeString("category", "guid"); + break; + case ColumnCategory.Identifier: + writer.WriteAttributeString("category", "identifier"); + break; + case ColumnCategory.Integer: + writer.WriteAttributeString("category", "integer"); + break; + case ColumnCategory.Language: + writer.WriteAttributeString("category", "language"); + break; + case ColumnCategory.LowerCase: + writer.WriteAttributeString("category", "lowerCase"); + break; + case ColumnCategory.Path: + writer.WriteAttributeString("category", "path"); + break; + case ColumnCategory.Paths: + writer.WriteAttributeString("category", "paths"); + break; + case ColumnCategory.Property: + writer.WriteAttributeString("category", "property"); + break; + case ColumnCategory.RegPath: + writer.WriteAttributeString("category", "regPath"); + break; + case ColumnCategory.Shortcut: + writer.WriteAttributeString("category", "shortcut"); + break; + case ColumnCategory.Template: + writer.WriteAttributeString("category", "template"); + break; + case ColumnCategory.Text: + writer.WriteAttributeString("category", "text"); + break; + case ColumnCategory.TimeDate: + writer.WriteAttributeString("category", "timeDate"); + break; + case ColumnCategory.UpperCase: + writer.WriteAttributeString("category", "upperCase"); + break; + case ColumnCategory.Version: + writer.WriteAttributeString("category", "version"); + break; + case ColumnCategory.WildCardFilename: + writer.WriteAttributeString("category", "wildCardFilename"); + break; + } + + if (!String.IsNullOrEmpty(this.possibilities)) + { + writer.WriteAttributeString("set", this.possibilities); + } + + if (!String.IsNullOrEmpty(this.description)) + { + writer.WriteAttributeString("description", this.description); + } + + if (this.escapeIdtCharacters) + { + writer.WriteAttributeString("escapeIdtCharacters", "yes"); + } + + if (this.useCData) + { + writer.WriteAttributeString("useCData", "yes"); + } + + writer.WriteEndElement(); + } + + /// + /// Validate a value for this column. + /// + /// The value to validate. + /// Validated value. + internal object ValidateValue(object value) + { + if (null == value) + { + if (!this.nullable) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with a null value because this is a required field.", this.name)); + } + } + else // check numerical values against their specified minimum and maximum values. + { + if (ColumnType.Number == this.type && !this.IsLocalizable) + { + // For now all enums in the tables can be represented by integers. This if statement would need to + // be enhanced if that ever changes. + if (value is int || value.GetType().IsEnum) + { + int intValue = (int)value; + + // validate the value against the minimum allowed value + if (this.minValueSet && this.minValue > intValue) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is less than the minimum allowed value for this column, {2}.", this.name, intValue, this.minValue)); + } + + // validate the value against the maximum allowed value + if (this.maxValueSet && this.maxValue < intValue) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is greater than the maximum allowed value for this column, {2}.", this.name, intValue, this.maxValue)); + } + + return intValue; + } + else if (value is long) + { + long longValue = (long)value; + + // validate the value against the minimum allowed value + if (this.minValueSet && this.minValue > longValue) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is less than the minimum allowed value for this column, {2}.", this.name, longValue, this.minValue)); + } + + // validate the value against the maximum allowed value + if (this.maxValueSet && this.maxValue < longValue) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is greater than the maximum allowed value for this column, {2}.", this.name, longValue, this.maxValue)); + } + + return longValue; + } + else + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set number column '{0}' with a value of type '{1}'.", this.name, value.GetType().ToString())); + } + } + else + { + if (!(value is string)) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set string column '{0}' with a value of type '{1}'.", this.name, value.GetType().ToString())); + } + } + } + + return value; + } + + /// + /// Compare this column definition to another column definition. + /// + /// + /// Only Windows Installer traits are compared, allowing for updates to WiX-specific table definitions. + /// + /// The to compare with this one. + /// 0 if the columns' core propeties are the same; otherwise, non-0. + public int CompareTo(ColumnDefinition other) + { + // by definition, this object is greater than null + if (null == other) + { + return 1; + } + + // compare column names + int ret = String.Compare(this.Name, other.Name, StringComparison.Ordinal); + + // compare column types + if (0 == ret) + { + ret = this.Type == other.Type ? 0 : -1; + + // compare column lengths + if (0 == ret) + { + ret = this.Length == other.Length ? 0 : -1; + + // compare whether both are primary keys + if (0 == ret) + { + ret = this.PrimaryKey == other.PrimaryKey ? 0 : -1; + + // compare nullability + if (0 == ret) + { + ret = this.Nullable == other.Nullable ? 0 : -1; + } + } + } + } + + return ret; + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Common.cs b/src/WixToolset.Data.WindowsInstaller/Common.cs new file mode 100644 index 00000000..a1e1e607 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Common.cs @@ -0,0 +1,25 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Text.RegularExpressions; + + internal static class Common + { + private static readonly Regex LegalIdentifierCharacters = new Regex(@"^[_A-Za-z][0-9A-Za-z_\.]*$", RegexOptions.Compiled); + + public static bool IsIdentifier(string value) + { + if (!String.IsNullOrEmpty(value)) + { + if (LegalIdentifierCharacters.IsMatch(value)) + { + return true; + } + } + + return false; + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Data/actions.xml b/src/WixToolset.Data.WindowsInstaller/Data/actions.xml new file mode 100644 index 00000000..f65b792d --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Data/actions.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.Data.WindowsInstaller/Data/tables.xml b/src/WixToolset.Data.WindowsInstaller/Data/tables.xml new file mode 100644 index 00000000..280d87a8 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Data/tables.xml @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.Data.WindowsInstaller/Field.cs b/src/WixToolset.Data.WindowsInstaller/Field.cs new file mode 100644 index 00000000..74b78229 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Field.cs @@ -0,0 +1,266 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Diagnostics; + using System.Globalization; + using System.Xml; + + /// + /// Field containing data for a column in a row. + /// + public class Field + { + private object data; + + /// + /// Instantiates a new Field. + /// + /// Column definition for this field. + protected Field(ColumnDefinition columnDefinition) + { + this.Column = columnDefinition; + } + + /// + /// Gets or sets the column definition for this field. + /// + /// Column definition. + public ColumnDefinition Column { get; private set; } + + /// + /// Gets or sets the data for this field. + /// + /// Data in the field. + public object Data + { + get + { + return this.data; + } + + set + { + // Validate the value before setting it. + this.data = this.Column.ValidateValue(value); + } + } + + /// + /// Gets or sets whether this field is modified. + /// + /// Whether this field is modified. + public bool Modified { get; set; } + + /// + /// Gets or sets the previous data. + /// + /// The previous data. + public string PreviousData { get; set; } + + /// + /// Instantiate a new Field object of the correct type. + /// + /// The column definition for the field. + /// The new Field object. + public static Field Create(ColumnDefinition columnDefinition) + { + return (ColumnType.Object == columnDefinition.Type) ? new ObjectField(columnDefinition) : new Field(columnDefinition); + } + + /// + /// Sets the value of a particular field in the row without validating. + /// + /// field index. + /// Value of a field in the row. + /// True if successful, false if validation failed. + public bool BestEffortSet(object value) + { + bool success = true; + object bestEffortValue = value; + + try + { + bestEffortValue = this.Column.ValidateValue(value); + } + catch (InvalidOperationException) + { + success = false; + } + + this.data = bestEffortValue; + return success; + } + + /// + /// Determine if this field is identical to another field. + /// + /// The other field to compare to. + /// true if they are equal; false otherwise. + public bool IsIdentical(Field field) + { + return (this.Column.Name == field.Column.Name && + ((null != this.data && this.data.Equals(field.data)) || (null == this.data && null == field.data))); + } + + /// + /// Overrides the built in object implementation to return the field's data as a string. + /// + /// Field's data as a string. + public override string ToString() + { + return this.AsString(); + } + + /// + /// Gets the field as an integer. + /// + /// Field's data as an integer. + public int AsInteger() + { + return (this.data is int) ? (int)this.data : Convert.ToInt32(this.data, CultureInfo.InvariantCulture); + } + + /// + /// Gets the field as an integer that could be null. + /// + /// Field's data as an integer that could be null. + public int? AsNullableInteger() + { + return (null == this.data) ? (int?)null : (this.data is int) ? (int)this.data : Convert.ToInt32(this.data, CultureInfo.InvariantCulture); + } + + /// + /// Gets the field as a string. + /// + /// Field's data as a string. + public string AsString() + { + return (null == this.data) ? null : Convert.ToString(this.data, CultureInfo.InvariantCulture); + } + + /// + /// Parse a field from the xml. + /// + /// XmlReader where the intermediate is persisted. + internal virtual void Read(XmlReader reader) + { + Debug.Assert("field" == reader.LocalName); + + bool empty = reader.IsEmptyElement; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "modified": + this.Modified = reader.Value.Equals("yes"); + break; + case "previousData": + this.PreviousData = reader.Value; + break; + } + } + + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + throw new XmlException(); + case XmlNodeType.CDATA: + case XmlNodeType.Text: + case XmlNodeType.SignificantWhitespace: + if (0 < reader.Value.Length) + { + if (ColumnType.Number == this.Column.Type && !this.Column.IsLocalizable) + { + // older wix files could persist data as a long value (which would overflow an int) + // since the Convert class always throws exceptions for overflows, read in integral + // values as a long to avoid the overflow, then cast it to an int (this operation can + // overflow without throwing an exception inside an unchecked block) + this.data = unchecked((int)Convert.ToInt64(reader.Value, CultureInfo.InvariantCulture)); + } + else + { + this.data = reader.Value; + } + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + } + + /// + /// Persists a field in an XML format. + /// + /// XmlWriter where the Field should persist itself as XML. + internal virtual void Write(XmlWriter writer) + { + writer.WriteStartElement("field", Intermediate.XmlNamespaceUri); + + if (this.Modified) + { + writer.WriteAttributeString("modified", "yes"); + } + + if (null != this.PreviousData) + { + writer.WriteAttributeString("previousData", this.PreviousData); + } + + // Convert the data to a string that will persist nicely (nulls as String.Empty). + string text = Convert.ToString(this.data, CultureInfo.InvariantCulture); + if (this.Column.UseCData) + { + writer.WriteCData(text); + } + else + { + writer.WriteString(text); + } + + writer.WriteEndElement(); + } + + /// + /// Returns the field data in a format usable in IDT files. + /// + /// Field data in string IDT format. + internal string ToIdtValue() + { + if (null == this.data) + { + return null; + } + else + { + string fieldData = Convert.ToString(this.data, CultureInfo.InvariantCulture); + + // special idt-specific escaping + if (this.Column.EscapeIdtCharacters) + { + fieldData = fieldData.Replace('\t', '\x10'); + fieldData = fieldData.Replace('\r', '\x11'); + fieldData = fieldData.Replace('\n', '\x19'); + } + + return fieldData; + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/ObjectField.cs b/src/WixToolset.Data.WindowsInstaller/ObjectField.cs new file mode 100644 index 00000000..42ef111b --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/ObjectField.cs @@ -0,0 +1,183 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Diagnostics; + using System.Globalization; + using System.Xml; + + /// + /// Field containing data for an object column in a row. + /// + public sealed class ObjectField : Field + { + /// + /// Instantiates a new Field. + /// + /// Column definition for this field. + internal ObjectField(ColumnDefinition columnDefinition) : + base(columnDefinition) + { + } + + /// + /// Gets or sets the index of the embedded file in a library. + /// + /// The index of the embedded file. + public int? EmbeddedFileIndex { get; set; } + + /// + /// Gets or sets the previous index of the embedded file in the library. + /// + /// The previous index of the embedded file. + public int? PreviousEmbeddedFileIndex { get; set; } + + /// + /// Gets or sets the path to the embedded cabinet of the previous file. + /// + /// The path of the cabinet containing the previous file. + public Uri PreviousBaseUri { get; set; } + + /// + /// Gets the base URI of the object field. + /// + /// The base URI of the object field. + public Uri BaseUri { get; private set; } + + /// + /// Gets or sets the unresolved data for this field. + /// + /// Unresolved Data in the field. + public string UnresolvedData { get; set; } + + /// + /// Gets or sets the unresolved previous data. + /// + /// The unresolved previous data. + public string UnresolvedPreviousData { get; set; } + + /// + /// Parse a field from the xml. + /// + /// XmlReader where the intermediate is persisted. + internal override void Read(XmlReader reader) + { + Debug.Assert("field" == reader.LocalName); + + bool empty = reader.IsEmptyElement; + + this.BaseUri = new Uri(reader.BaseURI); + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "cabinetFileId": + this.EmbeddedFileIndex = Convert.ToInt32(reader.Value); + break; + case "modified": + this.Modified = reader.Value.Equals("yes"); + break; + case "previousData": + this.PreviousData = reader.Value; + break; + case "unresolvedPreviousData": + this.UnresolvedPreviousData = reader.Value; + break; + case "unresolvedData": + this.UnresolvedData = reader.Value; + break; + case "previousCabinetFileId": + this.PreviousEmbeddedFileIndex = Convert.ToInt32(reader.Value); + break; + } + } + + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + throw new XmlException(); + case XmlNodeType.CDATA: + case XmlNodeType.Text: + if (0 < reader.Value.Length) + { + this.Data = reader.Value; + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + } + + /// + /// Persists a field in an XML format. + /// + /// XmlWriter where the Field should persist itself as XML. + internal override void Write(XmlWriter writer) + { + writer.WriteStartElement("field", Intermediate.XmlNamespaceUri); + + if (this.EmbeddedFileIndex.HasValue) + { + writer.WriteStartAttribute("cabinetFileId"); + writer.WriteValue(this.EmbeddedFileIndex); + writer.WriteEndAttribute(); + } + + if (this.Modified) + { + writer.WriteAttributeString("modified", "yes"); + } + + if (null != this.UnresolvedPreviousData) + { + writer.WriteAttributeString("unresolvedPreviousData", this.UnresolvedPreviousData); + } + + if (null != this.PreviousData) + { + writer.WriteAttributeString("previousData", this.PreviousData); + } + + if (null != this.UnresolvedData) + { + writer.WriteAttributeString("unresolvedData", this.UnresolvedData); + } + + if (this.PreviousEmbeddedFileIndex.HasValue) + { + writer.WriteStartAttribute("previousCabinetFileId"); + writer.WriteValue(this.PreviousEmbeddedFileIndex); + writer.WriteEndAttribute(); + } + + // Convert the data to a string that will persist nicely (nulls as String.Empty). + string text = Convert.ToString(this.Data, CultureInfo.InvariantCulture); + if (this.Column.UseCData) + { + writer.WriteCData(text); + } + else + { + writer.WriteString(text); + } + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Output.cs b/src/WixToolset.Data.WindowsInstaller/Output.cs new file mode 100644 index 00000000..71faeac7 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Output.cs @@ -0,0 +1,342 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.IO; + using System.Linq; + using System.Xml; + + /// + /// Output is generated by the linker. + /// + public sealed class Output + { + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wixout"; + private static readonly Version CurrentVersion = new Version("4.0.0.0"); + + /// + /// Creates a new empty output object. + /// + /// The source line information for the output. + public Output(SourceLineNumber sourceLineNumbers) + { + this.SourceLineNumbers = sourceLineNumbers; + this.SubStorages = new List(); + this.Tables = new TableIndexedCollection(); + } + + /// + /// Gets the type of the output. + /// + /// Type of the output. + public OutputType Type { get; set; } + + /// + /// Gets or sets the codepage for this output. + /// + /// Codepage of the output. + public int Codepage { get; set; } + + /// + /// Gets the source line information for this output. + /// + /// The source line information for this output. + public SourceLineNumber SourceLineNumbers { get; private set; } + + /// + /// Gets the substorages in this output. + /// + /// The substorages in this output. + public ICollection SubStorages { get; private set; } + + /// + /// Gets the tables contained in this output. + /// + /// Collection of tables. + public TableIndexedCollection Tables { get; private set; } + + /// + /// Gets the output type corresponding to a given output filename extension. + /// + /// Case-insensitive output filename extension. + /// Output type for the extension. + public static OutputType GetOutputType(string extension) + { + if (extension.Equals(".exe", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.Bundle; + } + if (extension.Equals(".msi", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.Product; + } + else if (extension.Equals(".msm", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.Module; + } + else if (extension.Equals(".msp", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.Patch; + } + else if (extension.Equals(".mst", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.Transform; + } + else if (extension.Equals(".pcp", StringComparison.OrdinalIgnoreCase)) + { + return OutputType.PatchCreation; + } + else + { + return OutputType.Unknown; + } + } + + /// + /// Gets the filename extension corresponding to a given output type. + /// + /// One of the WiX output types. + /// Filename extension for the output type, for example ".msi". + public static string GetExtension(OutputType type) + { + switch (type) + { + case OutputType.Bundle: + return ".exe"; + case OutputType.Product: + return ".msi"; + case OutputType.Module: + return ".msm"; + case OutputType.Patch: + return ".msp"; + case OutputType.Transform: + return ".mst"; + case OutputType.PatchCreation: + return ".pcp"; + default: + return ".wix"; + } + } + + /// + /// Loads an output from a path on disk. + /// + /// Path to output file saved on disk. + /// Suppresses wix.dll version mismatch check. + /// Output object. + public static Output Load(string path, bool suppressVersionCheck) + { + using (FileStream stream = File.OpenRead(path)) + using (FileStructure fs = FileStructure.Read(stream)) + { + if (FileFormat.Wixout != fs.FileFormat) + { + throw new WixUnexpectedFileFormatException(path, FileFormat.Wixout, fs.FileFormat); + } + + Uri uri = new Uri(Path.GetFullPath(path)); + using (XmlReader reader = XmlReader.Create(fs.GetDataStream(), null, uri.AbsoluteUri)) + { + try + { + reader.MoveToContent(); + return Output.Read(reader, suppressVersionCheck); + } + catch (XmlException xe) + { + throw new WixCorruptFileException(path, fs.FileFormat, xe); + } + } + } + } + + /// + /// Saves an output to a path on disk. + /// + /// Path to save output file to on disk. + public void Save(string path) + { + Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path))); + + using (FileStream stream = File.Create(path)) + using (FileStructure fs = FileStructure.Create(stream, FileFormat.Wixout, null)) + using (XmlWriter writer = XmlWriter.Create(fs.GetDataStream())) + { + writer.WriteStartDocument(); + this.Write(writer); + writer.WriteEndDocument(); + } + } + + /// + /// Processes an XmlReader and builds up the output object. + /// + /// Reader to get data from. + /// Suppresses wix.dll version mismatch check. + /// The Output represented by the Xml. + internal static Output Read(XmlReader reader, bool suppressVersionCheck) + { + if (!reader.LocalName.Equals("wixOutput")) + { + throw new XmlException(); + } + + bool empty = reader.IsEmptyElement; + Output output = new Output(SourceLineNumber.CreateFromUri(reader.BaseURI)); + SectionType sectionType = SectionType.Unknown; + Version version = null; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "codepage": + output.Codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture.NumberFormat); + break; + case "type": + switch (reader.Value) + { + case "Bundle": + output.Type = OutputType.Bundle; + sectionType = SectionType.Bundle; + break; + case "Module": + output.Type = OutputType.Module; + sectionType = SectionType.Module; + break; + case "Patch": + output.Type = OutputType.Patch; + break; + case "PatchCreation": + output.Type = OutputType.PatchCreation; + sectionType = SectionType.PatchCreation; + break; + case "Product": + output.Type = OutputType.Product; + sectionType = SectionType.Product; + break; + case "Transform": + output.Type = OutputType.Transform; + break; + default: + throw new XmlException(); + } + break; + case "version": + version = new Version(reader.Value); + break; + } + } + + if (!suppressVersionCheck && null != version && !Output.CurrentVersion.Equals(version)) + { + throw new WixException(WixDataErrors.VersionMismatch(SourceLineNumber.CreateFromUri(reader.BaseURI), "wixOutput", version.ToString(), Output.CurrentVersion.ToString())); + } + + // loop through the rest of the xml building up the Output object + TableDefinitionCollection tableDefinitions = null; + List tables = new List
(); + if (!empty) + { + bool done = false; + + // loop through all the fields in a row + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "subStorage": + output.SubStorages.Add(SubStorage.Read(reader)); + break; + case "table": + if (null == tableDefinitions) + { + throw new XmlException(); + } + tables.Add(Table.Read(reader, tableDefinitions)); + break; + case "tableDefinitions": + tableDefinitions = TableDefinitionCollection.Read(reader); + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + output.Tables = new TableIndexedCollection(tables); + return output; + } + + /// + /// Ensure this output contains a particular table. + /// + /// Definition of the table that should exist. + /// Optional section to use for the table. If one is not provided, the entry section will be used. + /// The table in this output. + public Table EnsureTable(TableDefinition tableDefinition) + { + if (!this.Tables.TryGetTable(tableDefinition.Name, out Table table)) + { + table = new Table(tableDefinition); + this.Tables.Add(table); + } + + return table; + } + + /// + /// Persists an output in an XML format. + /// + /// XmlWriter where the Output should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("wixOutput", XmlNamespaceUri); + + writer.WriteAttributeString("type", this.Type.ToString()); + + if (0 != this.Codepage) + { + writer.WriteAttributeString("codepage", this.Codepage.ToString(CultureInfo.InvariantCulture)); + } + + writer.WriteAttributeString("version", Output.CurrentVersion.ToString()); + + // Collect all the table definitions and write them. + TableDefinitionCollection tableDefinitions = new TableDefinitionCollection(); + foreach (Table table in this.Tables) + { + tableDefinitions.Add(table.Definition); + } + tableDefinitions.Write(writer); + + foreach (Table table in this.Tables.OrderBy(t => t.Name)) + { + table.Write(writer); + } + + foreach (SubStorage subStorage in this.SubStorages) + { + subStorage.Write(writer); + } + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Pdb.cs b/src/WixToolset.Data.WindowsInstaller/Pdb.cs new file mode 100644 index 00000000..03c3ddbb --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Pdb.cs @@ -0,0 +1,163 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.IO; + using System.Xml; + + /// + /// Pdb generated by the binder. + /// + public sealed class Pdb + { + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wixpdb"; + private static readonly Version CurrentVersion = new Version("4.0.0.0"); + + /// + /// Creates a new empty pdb object. + /// + /// The source line information for the pdb. + public Pdb() + { + } + + /// + /// Gets or sets the output that is a part of this pdb. + /// + /// Type of the output. + public Output Output { get; set; } + + /// + /// Loads a pdb from a path on disk. + /// + /// Path to pdb file saved on disk. + /// Suppresses wix.dll version mismatch check. + /// Pdb pdb. + public static Pdb Load(string path, bool suppressVersionCheck) + { + using (FileStream stream = File.OpenRead(path)) + using (FileStructure fs = FileStructure.Read(stream)) + { + if (FileFormat.Wixpdb != fs.FileFormat) + { + throw new WixUnexpectedFileFormatException(path, FileFormat.Wixpdb, fs.FileFormat); + } + + Uri uri = new Uri(Path.GetFullPath(path)); + using (XmlReader reader = XmlReader.Create(fs.GetDataStream(), null, uri.AbsoluteUri)) + { + try + { + reader.MoveToContent(); + return Pdb.Read(reader, suppressVersionCheck); + } + catch (XmlException xe) + { + throw new WixCorruptFileException(path, fs.FileFormat, xe); + } + } + } + } + + /// + /// Saves a pdb to a path on disk. + /// + /// Path to save pdb file to on disk. + public void Save(string path) + { + Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path))); + + using (FileStream stream = File.Create(path)) + using (FileStructure fs = FileStructure.Create(stream, FileFormat.Wixpdb, null)) + using (XmlWriter writer = XmlWriter.Create(fs.GetDataStream())) + { + writer.WriteStartDocument(); + this.Write(writer); + writer.WriteEndDocument(); + } + } + + /// + /// Processes an XmlReader and builds up the pdb object. + /// + /// Reader to get data from. + /// Suppresses wix.dll version mismatch check. + /// The Pdb represented by the Xml. + internal static Pdb Read(XmlReader reader, bool suppressVersionCheck) + { + if ("wixPdb" != reader.LocalName) + { + throw new XmlException(); + } + + bool empty = reader.IsEmptyElement; + Pdb pdb = new Pdb(); + Version version = null; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "version": + version = new Version(reader.Value); + break; + } + } + + if (!suppressVersionCheck && null != version && !Pdb.CurrentVersion.Equals(version)) + { + throw new WixException(WixDataErrors.VersionMismatch(SourceLineNumber.CreateFromUri(reader.BaseURI), "wixPdb", version.ToString(), Pdb.CurrentVersion.ToString())); + } + + // loop through the rest of the pdb building up the Output object + if (!empty) + { + bool done = false; + + // loop through all the fields in a row + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "wixOutput": + pdb.Output = Output.Read(reader, suppressVersionCheck); + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return pdb; + } + + /// + /// Persists a pdb in an XML format. + /// + /// XmlWriter where the Pdb should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("wixPdb", XmlNamespaceUri); + + writer.WriteAttributeString("version", Pdb.CurrentVersion.ToString()); + + this.Output.Write(writer); + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Row.cs b/src/WixToolset.Data.WindowsInstaller/Row.cs new file mode 100644 index 00000000..962ed0f4 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Row.cs @@ -0,0 +1,620 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; + using System.Globalization; + using System.Text; + using System.Text.RegularExpressions; + using System.Xml; + + /// + /// Row containing data for a table. + /// + public class Row + { + private static long rowCount; + + private Field[] fields; + + /// + /// Creates a row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + /// The compiler should use this constructor exclusively. + public Row(SourceLineNumber sourceLineNumbers, Table table) + : this(sourceLineNumbers, table.Definition) + { + this.Table = table; + } + + /// + /// Creates a row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row should get its column definitions from. + /// This constructor is used in cases where there isn't a clear owner of the row. The linker uses this constructor for the rows it generates. + public Row(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) + { + this.Number = rowCount++; + this.SourceLineNumbers = sourceLineNumbers; + this.fields = new Field[tableDefinition.Columns.Count]; + this.TableDefinition = tableDefinition; + + for (int i = 0; i < this.fields.Length; ++i) + { + this.fields[i] = Field.Create(this.TableDefinition.Columns[i]); + } + } + + /// + /// Creates a shallow copy of a row from another row. + /// + /// The row the data is copied from. + protected Row(Row source) + { + this.Table = source.Table; + this.TableDefinition = source.TableDefinition; + this.Number = source.Number; + this.Access = source.Access; + this.Operation = source.Operation; + this.Redundant = source.Redundant; + this.SectionId = source.SectionId; + this.SourceLineNumbers = source.SourceLineNumbers; + this.fields = source.fields; + } + + /// + /// Gets or sets the access to the row's primary key. + /// + /// The row access modifier. + public AccessModifier Access { get; set; } + + /// + /// Gets or sets the row transform operation. + /// + /// The row transform operation. + public RowOperation Operation { get; set; } + + /// + /// Gets or sets wether the row is a duplicate of another row thus redundant. + /// + public bool Redundant { get; set; } + + /// + /// Gets or sets the SectionId property on the row. + /// + /// The SectionId property on the row. + public string SectionId { get; set; } + + /// + /// Gets the source file and line number for the row. + /// + /// Source file and line number. + public SourceLineNumber SourceLineNumbers { get; private set; } + + /// + /// Gets the table this row belongs to. + /// + /// null if Row does not belong to a Table, or owner Table otherwise. + public Table Table { get; private set; } + + /// + /// Gets the table definition for this row. + /// + /// A Row always has a TableDefinition, even if the Row does not belong to a Table. + /// TableDefinition for Row. + public TableDefinition TableDefinition { get; private set; } + + /// + /// Gets the fields contained by this row. + /// + /// Array of field objects + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + public Field[] Fields + { + get { return this.fields; } + } + + /// + /// Gets the unique number for the row. + /// + /// Number for row. + public long Number { get; private set; } + + /// + /// Gets or sets the value of a particular field in the row. + /// + /// field index. + /// Value of a field in the row. + public object this[int field] + { + get { return this.fields[field].Data; } + set { this.fields[field].Data = value; } + } + + /// + /// Gets the field as an integer. + /// + /// Field's data as an integer. + public int FieldAsInteger(int field) + { + return this.fields[field].AsInteger(); + } + + /// + /// Gets the field as an integer that could be null. + /// + /// Field's data as an integer that could be null. + public int? FieldAsNullableInteger(int field) + { + return this.fields[field].AsNullableInteger(); + } + + /// + /// Gets the field as a string. + /// + /// Field's data as a string. + public string FieldAsString(int field) + { + return this.fields[field].AsString(); + } + + /// + /// Sets the value of a particular field in the row without validating. + /// + /// field index. + /// Value of a field in the row. + /// True if successful, false if validation failed. + public bool BestEffortSetField(int field, object value) + { + return this.fields[field].BestEffortSet(value); + } + + /// + /// Get the value used to represent the row in a keyed row collection. + /// + /// Primary key or row number if no primary key is available. + public string GetKey() + { + return this.GetPrimaryKey() ?? Convert.ToString(this.Number, CultureInfo.InvariantCulture); + } + + /// + /// Get the primary key of this row. + /// + /// Delimiter character for multiple column primary keys. + /// The primary key or null if the row's table has no primary key columns. + public string GetPrimaryKey(char delimiter = '/') + { + return this.GetPrimaryKey(delimiter, String.Empty); + } + + /// + /// Get the primary key of this row. + /// + /// Delimiter character for multiple column primary keys. + /// String to represent null values in the primary key. + /// The primary key or null if the row's table has no primary key columns. + public string GetPrimaryKey(char delimiter, string nullReplacement) + { + bool foundPrimaryKey = false; + StringBuilder primaryKey = new StringBuilder(); + + foreach (Field field in this.fields) + { + if (field.Column.PrimaryKey) + { + if (foundPrimaryKey) + { + primaryKey.Append(delimiter); + } + + primaryKey.Append((null == field.Data) ? nullReplacement : Convert.ToString(field.Data, CultureInfo.InvariantCulture)); + + foundPrimaryKey = true; + } + else // primary keys must be the first columns of a row so the first non-primary key means we can stop looking. + { + break; + } + } + + return foundPrimaryKey ? primaryKey.ToString() : null; + } + + /// + /// Returns true if the specified field is null or an empty string. + /// + /// Index of the field to check. + /// true if the specified field is null or an empty string, false otherwise. + public bool IsColumnEmpty(int field) + { + if (null == this.fields[field].Data) + { + return true; + } + + string dataString = this.fields[field].Data as string; + if (null != dataString && 0 == dataString.Length) + { + return true; + } + + return false; + } + + /// + /// Tests if the passed in row is identical. + /// + /// Row to compare against. + /// True if two rows are identical. + public bool IsIdentical(Row row) + { + bool identical = (this.TableDefinition.Name == row.TableDefinition.Name && this.fields.Length == row.fields.Length); + + for (int i = 0; identical && i < this.fields.Length; ++i) + { + if (!(this.fields[i].IsIdentical(row.fields[i]))) + { + identical = false; + } + } + + return identical; + } + + /// + /// Returns a string representation of the Row. + /// + /// A string representation of the Row. + public override string ToString() + { + return String.Join("/", (object[])this.fields); + } + + /// + /// Creates a Row from the XmlReader. + /// + /// Reader to get data from. + /// Table for this row. + /// New row object. + internal static Row Read(XmlReader reader, Table table) + { + Debug.Assert("row" == reader.LocalName); + + bool empty = reader.IsEmptyElement; + AccessModifier access = AccessModifier.Public; + RowOperation operation = RowOperation.None; + bool redundant = false; + string sectionId = null; + SourceLineNumber sourceLineNumbers = null; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "access": + access = (AccessModifier)Enum.Parse(typeof(AccessModifier), reader.Value, true); + break; + case "op": + operation = (RowOperation)Enum.Parse(typeof(RowOperation), reader.Value, true); + break; + case "redundant": + redundant = reader.Value.Equals("yes"); + break; + case "sectionId": + sectionId = reader.Value; + break; + case "sourceLineNumber": + sourceLineNumbers = SourceLineNumber.CreateFromEncoded(reader.Value); + break; + } + } + + Row row = table.CreateRow(sourceLineNumbers); + row.Access = access; + row.Operation = operation; + row.Redundant = redundant; + row.SectionId = sectionId; + + // loop through all the fields in a row + if (!empty) + { + bool done = false; + int field = 0; + + // loop through all the fields in a row + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "field": + if (row.Fields.Length <= field) + { + if (!reader.IsEmptyElement) + { + throw new XmlException(); + } + } + else + { + row.fields[field].Read(reader); + } + ++field; + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return row; + } + + /// + /// Returns the row in a format usable in IDT files. + /// + /// Whether to keep columns added in a transform. + /// String with tab delimited field values. + internal string ToIdtDefinition(bool keepAddedColumns) + { + bool first = true; + StringBuilder sb = new StringBuilder(); + + foreach (Field field in this.fields) + { + // Conditionally keep columns added in a transform; otherwise, + // break because columns can only be added at the end. + if (field.Column.Added && !keepAddedColumns) + { + break; + } + + if (first) + { + first = false; + } + else + { + sb.Append('\t'); + } + + sb.Append(field.ToIdtValue()); + } + sb.Append("\r\n"); + + return sb.ToString(); + } + + /// + /// Gets the modularized version of the field data. + /// + /// The field to modularize. + /// String containing the GUID of the Merge Module to append the the field value, if appropriate. + /// Optional collection of identifiers that should not be modularized. + /// moduleGuid is expected to be null when not being used to compile a Merge Module. + /// The modularized version of the field data. + internal string GetModularizedValue(Field field, string modularizationGuid, ISet suppressModularizationIdentifiers) + { + Debug.Assert(null != field.Data && 0 < ((string)field.Data).Length); + string fieldData = Convert.ToString(field.Data, CultureInfo.InvariantCulture); + + if (null != modularizationGuid && ColumnModularizeType.None != field.Column.ModularizeType && !(WindowsInstallerStandard.IsStandardAction(fieldData) || WindowsInstallerStandard.IsStandardProperty(fieldData))) + { + StringBuilder sb; + int start; + ColumnModularizeType modularizeType = field.Column.ModularizeType; + + // special logic for the ControlEvent table's Argument column + // this column requires different modularization methods depending upon the value of the Event column + if (ColumnModularizeType.ControlEventArgument == field.Column.ModularizeType) + { + switch (this[2].ToString()) + { + case "CheckExistingTargetPath": // redirectable property name + case "CheckTargetPath": + case "DoAction": // custom action name + case "NewDialog": // dialog name + case "SelectionBrowse": + case "SetTargetPath": + case "SpawnDialog": + case "SpawnWaitDialog": + if (Common.IsIdentifier(fieldData)) + { + modularizeType = ColumnModularizeType.Column; + } + else + { + modularizeType = ColumnModularizeType.Property; + } + break; + default: // formatted + modularizeType = ColumnModularizeType.Property; + break; + } + } + else if (ColumnModularizeType.ControlText == field.Column.ModularizeType) + { + // icons are stored in the Binary table, so they get column-type modularization + if (("Bitmap" == this[2].ToString() || "Icon" == this[2].ToString()) && Common.IsIdentifier(fieldData)) + { + modularizeType = ColumnModularizeType.Column; + } + else + { + modularizeType = ColumnModularizeType.Property; + } + } + + switch (modularizeType) + { + case ColumnModularizeType.Column: + // ensure the value is an identifier (otherwise it shouldn't be modularized this way) + if (!Common.IsIdentifier(fieldData)) + { + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_CannotModularizeIllegalID, fieldData)); + } + + // if we're not supposed to suppress modularization of this identifier + if (null == suppressModularizationIdentifiers || !suppressModularizationIdentifiers.Contains(fieldData)) + { + fieldData = String.Concat(fieldData, ".", modularizationGuid); + } + break; + + case ColumnModularizeType.Property: + case ColumnModularizeType.Condition: + Regex regex; + if (ColumnModularizeType.Property == modularizeType) + { + regex = new Regex(@"\[(?[#$!]?[a-zA-Z_][a-zA-Z0-9_\.]*)]", RegexOptions.Singleline | RegexOptions.ExplicitCapture); + } + else + { + Debug.Assert(ColumnModularizeType.Condition == modularizeType); + + // This heinous looking regular expression is actually quite an elegant way + // to shred the entire condition into the identifiers that need to be + // modularized. Let's break it down piece by piece: + // + // 1. Look for the operators: NOT, EQV, XOR, OR, AND, IMP (plus a space). Note that the + // regular expression is case insensitive so we don't have to worry about + // all the permutations of these strings. + // 2. Look for quoted strings. Quoted strings are just text and are ignored + // outright. + // 3. Look for environment variables. These look like identifiers we might + // otherwise be interested in but start with a percent sign. Like quoted + // strings these enviroment variable references are ignored outright. + // 4. Match all identifiers that are things that need to be modularized. Note + // the special characters (!, $, ?, &) that denote Component and Feature states. + regex = new Regex(@"NOT\s|EQV\s|XOR\s|OR\s|AND\s|IMP\s|"".*?""|%[a-zA-Z_][a-zA-Z0-9_\.]*|(?[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); + + // less performant version of the above with captures showing where everything lives + // regex = new Regex(@"(?NOT|EQV|XOR|OR|AND|IMP)|(?"".*?"")|(?%[a-zA-Z_][a-zA-Z0-9_\.]*)|(?[!$\?&]?[a-zA-Z_][a-zA-Z0-9_\.]*)",RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); + } + + MatchCollection matches = regex.Matches(fieldData); + + sb = new StringBuilder(fieldData); + + // notice how this code walks backward through the list + // because it modifies the string as we through it + for (int i = matches.Count - 1; 0 <= i; i--) + { + Group group = matches[i].Groups["identifier"]; + if (group.Success) + { + string identifier = group.Value; + if (!WindowsInstallerStandard.IsStandardProperty(identifier) && (null == suppressModularizationIdentifiers || !suppressModularizationIdentifiers.Contains(identifier))) + { + sb.Insert(group.Index + group.Length, '.'); + sb.Insert(group.Index + group.Length + 1, modularizationGuid); + } + } + } + + fieldData = sb.ToString(); + break; + + case ColumnModularizeType.CompanionFile: + // if we're not supposed to ignore this identifier and the value does not start with + // a digit, we must have a companion file so modularize it + if ((null == suppressModularizationIdentifiers || !suppressModularizationIdentifiers.Contains(fieldData)) && + 0 < fieldData.Length && !Char.IsDigit(fieldData, 0)) + { + fieldData = String.Concat(fieldData, ".", modularizationGuid); + } + break; + + case ColumnModularizeType.Icon: + if (null == suppressModularizationIdentifiers || !suppressModularizationIdentifiers.Contains(fieldData)) + { + start = fieldData.LastIndexOf(".", StringComparison.Ordinal); + if (-1 == start) + { + fieldData = String.Concat(fieldData, ".", modularizationGuid); + } + else + { + fieldData = String.Concat(fieldData.Substring(0, start), ".", modularizationGuid, fieldData.Substring(start)); + } + } + break; + + case ColumnModularizeType.SemicolonDelimited: + string[] keys = fieldData.Split(';'); + for (int i = 0; i < keys.Length; ++i) + { + keys[i] = String.Concat(keys[i], ".", modularizationGuid); + } + fieldData = String.Join(";", keys); + break; + } + } + + return fieldData; + } + + /// + /// Persists a row in an XML format. + /// + /// XmlWriter where the Row should persist itself as XML. + [SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Changing the way this string normalizes would result " + + "in a change to the way intermediate files are generated, potentially causing extra churn in patches on an MSI built from an older version of WiX. " + + "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("row", Intermediate.XmlNamespaceUri); + + if (AccessModifier.Public != this.Access) + { + writer.WriteAttributeString("access", this.Access.ToString().ToLowerInvariant()); + } + + if (RowOperation.None != this.Operation) + { + writer.WriteAttributeString("op", this.Operation.ToString().ToLowerInvariant()); + } + + if (this.Redundant) + { + writer.WriteAttributeString("redundant", "yes"); + } + + if (null != this.SectionId) + { + writer.WriteAttributeString("sectionId", this.SectionId); + } + + if (null != this.SourceLineNumbers) + { + writer.WriteAttributeString("sourceLineNumber", this.SourceLineNumbers.GetEncoded()); + } + + for (int i = 0; i < this.fields.Length; ++i) + { + this.fields[i].Write(writer); + } + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/RowDictionary.cs b/src/WixToolset.Data.WindowsInstaller/RowDictionary.cs new file mode 100644 index 00000000..a0cc5302 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/RowDictionary.cs @@ -0,0 +1,84 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + + /// + /// A dictionary of rows. Unlike the this + /// will throw when multiple rows with the same key are added. + /// + public sealed class RowDictionary : Dictionary where T : Row + { + /// + /// Creates an empty . + /// + public RowDictionary() + : base(StringComparer.InvariantCulture) + { + } + + /// + /// Creates and populates a with the rows from the given enumerator. + /// + /// Rows to add. + public RowDictionary(IEnumerable rows) + : this() + { + foreach (T row in rows) + { + this.Add(row); + } + } + + /// + /// Creates and populates a with the rows from the given . + /// + /// The table to index. + /// + /// Rows added to the index are not automatically added to the given . + /// + public RowDictionary(Table table) + : this() + { + if (null != table) + { + foreach (T row in table.Rows) + { + this.Add(row); + } + } + } + + /// + /// Adds a row to the dictionary using the row key. + /// + /// Row to add to the dictionary. + public void Add(T row) + { + this.Add(row.GetKey(), row); + } + + /// + /// Gets the row by integer key. + /// + /// Integer key to look up. + /// Row or null if key is not found. + public T Get(int key) + { + return this.Get(key.ToString()); + } + + /// + /// Gets the row by string key. + /// + /// String key to look up. + /// Row or null if key is not found. + public T Get(string key) + { + T result; + return this.TryGetValue(key, out result) ? result : null; + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/RowIndexedList.cs b/src/WixToolset.Data.WindowsInstaller/RowIndexedList.cs new file mode 100644 index 00000000..27c43a81 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/RowIndexedList.cs @@ -0,0 +1,301 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + + /// + /// A list of rows indexed by their primary key. Unlike a + /// this indexed list will track rows in their added order and will allow rows with + /// duplicate keys to be added to the list, although only the first row will be indexed. + /// + public sealed class RowIndexedList : IList where T : Row + { + private Dictionary index; + private List rows; + private List duplicates; + + /// + /// Creates an empty . + /// + public RowIndexedList() + { + this.index = new Dictionary(StringComparer.InvariantCulture); + this.rows = new List(); + this.duplicates = new List(); + } + + /// + /// Creates and populates a with the rows from the given enumerator. + /// + /// Rows to index. + public RowIndexedList(IEnumerable rows) + : this() + { + foreach (T row in rows) + { + this.Add(row); + } + } + + /// + /// Creates and populates a with the rows from the given . + /// + /// The table to index. + /// + /// Rows added to the index are not automatically added to the given . + /// + public RowIndexedList(Table table) + : this() + { + if (null != table) + { + foreach (T row in table.Rows) + { + this.Add(row); + } + } + } + + /// + /// Gets the duplicates in the list. + /// + public IEnumerable Duplicates { get { return this.duplicates; } } + + /// + /// Gets the row by integer key. + /// + /// Integer key to look up. + /// Row or null if key is not found. + public T Get(int key) + { + return this.Get(key.ToString()); + } + + /// + /// Gets the row by string key. + /// + /// String key to look up. + /// Row or null if key is not found. + public T Get(string key) + { + T result; + return this.TryGet(key, out result) ? result : null; + } + + /// + /// Gets the row by string key if it exists. + /// + /// Key of row to get. + /// Row found. + /// True if key was found otherwise false. + public bool TryGet(string key, out T row) + { + return this.index.TryGetValue(key, out row); + } + + /// + /// Tries to add a row as long as it would not create a duplicate. + /// + /// Row to add. + /// True if the row as added otherwise false. + public bool TryAdd(T row) + { + try + { + this.index.Add(row.GetKey(), row); + } + catch (ArgumentException) // if the key already exists, bail. + { + return false; + } + + this.rows.Add(row); + return true; + } + + /// + /// Adds a row to the list. If a row with the same key is already index, the row is + /// is not in the index but will still be part of the list and added to the duplicates + /// list. + /// + /// + public void Add(T row) + { + this.rows.Add(row); + try + { + this.index.Add(row.GetKey(), row); + } + catch (ArgumentException) // if the key already exists, we have a duplicate. + { + this.duplicates.Add(row); + } + } + + /// + /// Gets the index of a row. + /// + /// Iterates through the list of rows to find the index of a particular row. + /// Index of row or -1 if not found. + public int IndexOf(T row) + { + return this.rows.IndexOf(row); + } + + /// + /// Inserts a row at a particular index of the list. + /// + /// Index to insert the row after. + /// Row to insert. + public void Insert(int index, T row) + { + this.rows.Insert(index, row); + try + { + this.index.Add(row.GetKey(), row); + } + catch (ArgumentException) // if the key already exists, we have a duplicate. + { + this.duplicates.Add(row); + } + } + + /// + /// Removes a row from a particular index. + /// + /// Index to remove the row at. + public void RemoveAt(int index) + { + T row = this.rows[index]; + + this.rows.RemoveAt(index); + + T indexRow; + if (this.index.TryGetValue(row.GetKey(), out indexRow) && indexRow == row) + { + this.index.Remove(row.GetKey()); + } + else // only try to remove from duplicates if the row was not indexed (if it was indexed, it wasn't a dupe). + { + this.duplicates.Remove(row); + } + } + + /// + /// Gets or sets a row at the specified index. + /// + /// Index to get the row. + /// Row at specified index. + public T this[int index] + { + get + { + return this.rows[index]; + } + set + { + this.rows[index] = value; + try + { + this.index.Add(value.GetKey(), value); + } + catch (ArgumentException) // if the key already exists, we have a duplicate. + { + this.duplicates.Add(value); + } + } + } + + /// + /// Empties the list and it's index. + /// + public void Clear() + { + this.index.Clear(); + this.rows.Clear(); + this.duplicates.Clear(); + } + + /// + /// Searches the list for a row without using the index. + /// + /// Row to look for in the list. + /// True if the row is in the list, otherwise false. + public bool Contains(T row) + { + return this.rows.Contains(row); + } + + /// + /// Copies the rows of the list to an array. + /// + /// Array to copy the list into. + /// Index to start copying at. + public void CopyTo(T[] array, int arrayIndex) + { + this.rows.CopyTo(array, arrayIndex); + } + + /// + /// Number of rows in the list. + /// + public int Count + { + get { return this.rows.Count; } + } + + /// + /// Indicates whether the list is read-only. Always false. + /// + public bool IsReadOnly + { + get { return false; } + } + + /// + /// Removes a row from the list. Indexed rows will be removed but the colleciton will NOT + /// promote duplicates to the index automatically. The duplicate would also need to be removed + /// and re-added to be indexed. + /// + /// + /// + public bool Remove(T row) + { + bool removed = this.rows.Remove(row); + if (removed) + { + T indexRow; + if (this.index.TryGetValue(row.GetKey(), out indexRow) && indexRow == row) + { + this.index.Remove(row.GetKey()); + } + else // only try to remove from duplicates if the row was not indexed (if it was indexed, it wasn't a dupe). + { + this.duplicates.Remove(row); + } + } + + return removed; + } + + /// + /// Gets an enumerator over the whole list. + /// + /// List enumerator. + public IEnumerator GetEnumerator() + { + return this.rows.GetEnumerator(); + } + + /// + /// Gets an untyped enumerator over the whole list. + /// + /// Untyped list enumerator. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.rows.GetEnumerator(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/RowOperation.cs b/src/WixToolset.Data.WindowsInstaller/RowOperation.cs new file mode 100644 index 00000000..30dadd4e --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/RowOperation.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + /// + /// The row transform operations. + /// + public enum RowOperation + { + /// + /// No operation. + /// + None, + + /// + /// Added row. + /// + Add, + + /// + /// Deleted row. + /// + Delete, + + /// + /// Modified row. + /// + Modify + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/BBControlRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/BBControlRow.cs new file mode 100644 index 00000000..d0f08662 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/BBControlRow.cs @@ -0,0 +1,113 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System.Diagnostics.CodeAnalysis; + + /// + /// Specialization of a row for the Control table. + /// + public sealed class BBControlRow : Row + { + /// + /// Creates a Control row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Control row belongs to and should get its column definitions from. + public BBControlRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the dialog of the Control row. + /// + /// Primary key of the Control row. + public string Billboard + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the identifier for this Control row. + /// + /// Identifier for this Control row. + public string BBControl + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the type of the BBControl. + /// + /// Name of the BBControl. + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] + public string Type + { + get { return this.Fields[2].AsString(); } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the X location of the BBControl. + /// + /// X location of the BBControl. + public string X + { + get { return this.Fields[3].AsString(); } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the Y location of the BBControl. + /// + /// Y location of the BBControl. + public string Y + { + get { return this.Fields[4].AsString(); } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the width of the BBControl. + /// + /// Width of the BBControl. + public string Width + { + get { return this.Fields[5].AsString(); } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the height of the BBControl. + /// + /// Height of the BBControl. + public string Height + { + get { return this.Fields[6].AsString(); } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets the attributes for the BBControl. + /// + /// Attributes for the BBControl. + public int Attributes + { + get { return (int)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + /// + /// Gets or sets the text of the BBControl. + /// + /// Text of the BBControl. + public string Text + { + get { return (string)this.Fields[8].Data; } + set { this.Fields[8].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/ComponentRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/ComponentRow.cs new file mode 100644 index 00000000..3ff10175 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/ComponentRow.cs @@ -0,0 +1,245 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using WixToolset.Data.Msi; + + /// + /// Specialization of a row for the Component table. + /// + public sealed class ComponentRow : Row + { + private string sourceFile; + + /// + /// Creates a Control row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Component row belongs to and should get its column definitions from. + public ComponentRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the identifier for this Component row. + /// + /// Identifier for this Component row. + public string Component + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the ComponentId for this Component row. + /// + /// guid for this Component row. + public string Guid + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the Directory_ of the Component. + /// + /// Directory of the Component. + public string Directory + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the local only attribute of the Component. + /// + /// Local only attribute of the component. + public bool IsLocalOnly + { + get { return MsiInterop.MsidbComponentAttributesLocalOnly == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesLocalOnly); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesLocalOnly; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesLocalOnly; + } + } + } + + /// + /// Gets or sets the source only attribute of the Component. + /// + /// Source only attribute of the component. + public bool IsSourceOnly + { + get { return MsiInterop.MsidbComponentAttributesSourceOnly == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesSourceOnly); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesSourceOnly; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesSourceOnly; + } + } + } + + /// + /// Gets or sets the optional attribute of the Component. + /// + /// Optional attribute of the component. + public bool IsOptional + { + get { return MsiInterop.MsidbComponentAttributesOptional == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesOptional); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesOptional; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesOptional; + } + } + } + + /// + /// Gets or sets the registry key path attribute of the Component. + /// + /// Registry key path attribute of the component. + public bool IsRegistryKeyPath + { + get { return MsiInterop.MsidbComponentAttributesRegistryKeyPath == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesRegistryKeyPath); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesRegistryKeyPath; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesRegistryKeyPath; + } + } + } + + /// + /// Gets or sets the shared dll ref count attribute of the Component. + /// + /// Shared dll ref countattribute of the component. + public bool IsSharedDll + { + get { return MsiInterop.MsidbComponentAttributesSharedDllRefCount == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesSharedDllRefCount); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesSharedDllRefCount; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesSharedDllRefCount; + } + } + } + + /// + /// Gets or sets the permanent attribute of the Component. + /// + /// Permanent attribute of the component. + public bool IsPermanent + { + get { return MsiInterop.MsidbComponentAttributesPermanent == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesPermanent); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesPermanent; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesPermanent; + } + } + } + + /// + /// Gets or sets the ODBC data source key path attribute of the Component. + /// + /// ODBC data source key path attribute of the component. + public bool IsOdbcDataSourceKeyPath + { + get { return MsiInterop.MsidbComponentAttributesODBCDataSource == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesODBCDataSource); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesODBCDataSource; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesODBCDataSource; + } + } + } + + /// + /// Gets or sets the 64 bit attribute of the Component. + /// + /// 64-bitness of the component. + public bool Is64Bit + { + get { return MsiInterop.MsidbComponentAttributes64bit == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributes64bit); } + set + { + if (value) + { + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributes64bit; + } + else + { + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributes64bit; + } + } + } + + /// + /// Gets or sets the condition of the Component. + /// + /// Condition of the Component. + public string Condition + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the key path of the Component. + /// + /// Key path of the Component. + public string KeyPath + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the source location to the file to fill in the Text of the control. + /// + /// Source location to the file to fill in the Text of the control. + public string SourceFile + { + get { return this.sourceFile; } + set { this.sourceFile = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/ContainerType.cs b/src/WixToolset.Data.WindowsInstaller/Rows/ContainerType.cs new file mode 100644 index 00000000..55a74235 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/ContainerType.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Types of bundle packages. + /// + public enum ContainerType + { + Attached, + Detached, + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/ControlRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/ControlRow.cs new file mode 100644 index 00000000..8fa3f633 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/ControlRow.cs @@ -0,0 +1,143 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System.Diagnostics.CodeAnalysis; + + /// + /// Specialization of a row for the Control table. + /// + public sealed class ControlRow : Row + { + /// + /// Creates a Control row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Control row belongs to and should get its column definitions from. + public ControlRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the dialog of the Control row. + /// + /// Primary key of the Control row. + public string Dialog + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the identifier for this Control row. + /// + /// Identifier for this Control row. + public string Control + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the type of the control. + /// + /// Name of the control. + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] + public string Type + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the X location of the control. + /// + /// X location of the control. + public string X + { + get { return this.Fields[3].AsString(); } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the Y location of the control. + /// + /// Y location of the control. + public string Y + { + get { return this.Fields[4].AsString(); } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the width of the control. + /// + /// Width of the control. + public string Width + { + get { return this.Fields[5].AsString(); } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the height of the control. + /// + /// Height of the control. + public string Height + { + get { return this.Fields[6].AsString(); } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets the attributes for the control. + /// + /// Attributes for the control. + public int Attributes + { + get { return (int)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + /// + /// Gets or sets the Property associated with the control. + /// + /// Property associated with the control. + public string Property + { + get { return (string)this.Fields[8].Data; } + set { this.Fields[8].Data = value; } + } + + /// + /// Gets or sets the text of the control. + /// + /// Text of the control. + public string Text + { + get { return (string)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + + /// + /// Gets or sets the next control. + /// + /// Next control. + public string Next + { + get { return (string)this.Fields[10].Data; } + set { this.Fields[10].Data = value; } + } + + /// + /// Gets or sets the help for the control. + /// + /// Help for the control. + public string Help + { + get { return (string)this.Fields[11].Data; } + set { this.Fields[11].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/FileRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/FileRow.cs new file mode 100644 index 00000000..de5d5652 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/FileRow.cs @@ -0,0 +1,640 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Diagnostics; + using System.Globalization; + using WixToolset.Data.Msi; + + /// + /// Specialization of a row for the file table. + /// + public sealed class FileRow : Row //, IComparable + { + //private string assemblyApplication; + //private string assemblyManifest; + //private FileAssemblyType assemblyType; + //private string directory; + //private int diskId; + //private bool fromModule; + //private bool isGeneratedShortFileName; + //private int patchGroup; + //private string processorArchitecture; + //private string source; + //private Row hashRow; + //private List assemblyNameRows; + //private string[] previousSource; + //private string symbols; + //private string[] previousSymbols; + //private PatchAttributeType patchAttributes; + //private string retainOffsets; + //private string retainLengths; + //private string ignoreOffsets; + //private string ignoreLengths; + //private string[] previousRetainOffsets; + //private string[] previousRetainLengths; + //private string[] previousIgnoreOffsets; + //private string[] previousIgnoreLengths; + //private string patch; + + /// + /// Creates a File row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this File row belongs to and should get its column definitions from. + public FileRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + //this.assemblyType = FileAssemblyType.NotAnAssembly; + //this.previousSource = new string[1]; + //this.previousSymbols = new string[1]; + //this.previousRetainOffsets = new string[1]; + //this.previousRetainLengths = new string[1]; + //this.previousIgnoreOffsets = new string[1]; + //this.previousIgnoreLengths = new string[1]; + } + + /// + /// Creates a File row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public FileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) + : base(sourceLineNumbers, tableDefinition) + { + //this.assemblyType = FileAssemblyType.NotAnAssembly; + //this.previousSource = new string[1]; + //this.previousSymbols = new string[1]; + //this.previousRetainOffsets = new string[1]; + //this.previousRetainLengths = new string[1]; + //this.previousIgnoreOffsets = new string[1]; + //this.previousIgnoreLengths = new string[1]; + } + + /// + /// Gets or sets the primary key of the file row. + /// + /// Primary key of the file row. + public string File + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the component this file row belongs to. + /// + /// Component this file row belongs to. + public string Component + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the name of the file. + /// + /// Name of the file. + public string FileName + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the real filesystem name of the file (without a pipe). This is typically the long name of the file. + /// However, if no long name is available, falls back to the short name. + /// + /// Long Name of the file - or if no long name is available, falls back to the short name. + public string LongFileName + { + get + { + string fileName = this.FileName; + int index = fileName.IndexOf('|'); + + // If it doesn't contain a pipe, just return the whole string + if (-1 == index) + { + return fileName; + } + else // otherwise, extract the part of the string after the pipe + { + return fileName.Substring(index + 1); + } + } + } + + /// + /// Gets or sets the size of the file. + /// + /// Size of the file. + public int FileSize + { + get { return (int)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the version of the file. + /// + /// Version of the file. + public string Version + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the LCID of the file. + /// + /// LCID of the file. + public string Language + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the attributes on a file. + /// + /// Attributes on a file. + public int Attributes + { + get { return Convert.ToInt32(this.Fields[6].Data, CultureInfo.InvariantCulture); } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets whether this file should be compressed. + /// + /// Whether this file should be compressed. + public YesNoType Compressed + { + get + { + bool compressedFlag = (0 < (this.Attributes & MsiInterop.MsidbFileAttributesCompressed)); + bool noncompressedFlag = (0 < (this.Attributes & MsiInterop.MsidbFileAttributesNoncompressed)); + + if (compressedFlag && noncompressedFlag) + { + throw new WixException(WixDataErrors.IllegalFileCompressionAttributes(this.SourceLineNumbers)); + } + else if (compressedFlag) + { + return YesNoType.Yes; + } + else if (noncompressedFlag) + { + return YesNoType.No; + } + else + { + return YesNoType.NotSet; + } + } + + set + { + if (YesNoType.Yes == value) + { + // these are mutually exclusive + this.Attributes |= MsiInterop.MsidbFileAttributesCompressed; + this.Attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; + } + else if (YesNoType.No == value) + { + // these are mutually exclusive + this.Attributes |= MsiInterop.MsidbFileAttributesNoncompressed; + this.Attributes &= ~MsiInterop.MsidbFileAttributesCompressed; + } + else // not specified + { + Debug.Assert(YesNoType.NotSet == value); + + // clear any compression bits + this.Attributes &= ~MsiInterop.MsidbFileAttributesCompressed; + this.Attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; + } + } + } + + /// + /// Gets or sets the sequence of the file row. + /// + /// Sequence of the file row. + public int Sequence + { + get { return (int)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + /////// + /////// Gets or sets the type of assembly of file row. + /////// + /////// Assembly type for file row. + ////public FileAssemblyType AssemblyType + ////{ + //// get { return this.assemblyType; } + //// set { this.assemblyType = value; } + ////} + + /////// + /////// Gets or sets the identifier for the assembly application. + /////// + /////// Identifier for the assembly application. + ////public string AssemblyApplication + ////{ + //// get { return this.assemblyApplication; } + //// set { this.assemblyApplication = value; } + ////} + + /////// + /////// Gets or sets the identifier for the assembly manifest. + /////// + /////// Identifier for the assembly manifest. + ////public string AssemblyManifest + ////{ + //// get { return this.assemblyManifest; } + //// set { this.assemblyManifest = value; } + ////} + + /////// + /////// Gets or sets the directory of the file. + /////// + /////// Directory of the file. + ////public string Directory + ////{ + //// get { return this.directory; } + //// set { this.directory = value; } + ////} + + /////// + /////// Gets or sets the disk id for this file. + /////// + /////// Disk id for the file. + ////public int DiskId + ////{ + //// get { return this.diskId; } + //// set { this.diskId = value; } + ////} + + /////// + /////// Gets or sets the source location to the file. + /////// + /////// Source location to the file. + ////public string Source + ////{ + //// get { return this.source; } + //// set { this.source = value; } + ////} + + /////// + /////// Gets or sets the source location to the previous file. + /////// + /////// Source location to the previous file. + ////public string PreviousSource + ////{ + //// get { return this.previousSource[0]; } + //// set { this.previousSource[0] = value; } + ////} + + /////// + /////// Gets the source location to the previous files. + /////// + /////// Source location to the previous files. + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousSourceArray + ////{ + //// get { return this.previousSource; } + ////} + + /////// + /////// Gets or sets the architecture the file executes on. + /////// + /////// Architecture the file executes on. + ////public string ProcessorArchitecture + ////{ + //// get { return this.processorArchitecture; } + //// set { this.processorArchitecture = value; } + ////} + + /////// + /////// Gets of sets the patch group of a patch-added file. + /////// + /////// The patch group of a patch-added file. + ////public int PatchGroup + ////{ + //// get { return this.patchGroup; } + //// set { this.patchGroup = value; } + ////} + + /////// + /////// Gets or sets the patch header of the file. + /////// + /////// Patch header of the file. + ////public string Patch + ////{ + //// get { return this.patch; } + //// set { this.patch = value; } + ////} + + /////// + /////// Gets or sets the locations to find the file's symbols. + /////// + /////// Symbol paths for the file. + ////public string Symbols + ////{ + //// get { return this.symbols; } + //// set { this.symbols = value; } + ////} + + /////// + /////// Gets or sets the locations to find the file's previous symbols. + /////// + /////// Symbol paths for the previous file. + ////public string PreviousSymbols + ////{ + //// get { return this.previousSymbols[0]; } + //// set { this.previousSymbols[0] = value; } + ////} + + /////// + /////// Gets the locations to find the files' previous symbols. + /////// + /////// Symbol paths for the previous files. + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousSymbolsArray + ////{ + //// get { return this.previousSymbols; } + ////} + + /////// + /////// Gets or sets the generated short file name attribute. + /////// + /////// The generated short file name attribute. + ////public bool IsGeneratedShortFileName + ////{ + //// get { return this.isGeneratedShortFileName; } + + //// set { this.isGeneratedShortFileName = value; } + ////} + + /////// + /////// Gets or sets whether this row came from a merge module. + /////// + /////// Whether this row came from a merge module. + ////public bool FromModule + ////{ + //// get { return this.fromModule; } + //// set { this.fromModule = value; } + ////} + + /////// + /////// Gets or sets the MsiFileHash row created for this FileRow. + /////// + /////// Row for MsiFileHash table. + ////public Row HashRow + ////{ + //// get { return this.hashRow; } + //// set { this.hashRow = value; } + ////} + + /////// + /////// Gets or sets the set of MsiAssemblyName rows created for this FileRow. + /////// + /////// RowCollection of MsiAssemblyName table. + ////[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + ////public List AssemblyNameRows + ////{ + //// get { return this.assemblyNameRows; } + //// set { this.assemblyNameRows = value; } + ////} + + /////// + /////// Gets or sets the patching attributes to the file. + /////// + /////// Patching attributes of the file. + ////public PatchAttributeType PatchAttributes + ////{ + //// get { return this.patchAttributes; } + //// set { this.patchAttributes = value; } + ////} + + /////// + /////// Gets or sets the delta patch retain-length list for the file. + /////// + /////// RetainLength list for the file. + ////public string RetainLengths + ////{ + //// get { return this.retainLengths; } + //// set { this.retainLengths = value; } + ////} + + /////// + /////// Gets or sets the delta patch ignore-offset list for the file. + /////// + /////// IgnoreOffset list for the file. + ////public string IgnoreOffsets + ////{ + //// get { return this.ignoreOffsets; } + //// set { this.ignoreOffsets = value; } + ////} + + /////// + /////// Gets or sets the delta patch ignore-length list for the file. + /////// + /////// IgnoreLength list for the file. + ////public string IgnoreLengths + ////{ + //// get { return this.ignoreLengths; } + //// set { this.ignoreLengths = value; } + ////} + + /////// + /////// Gets or sets the delta patch retain-offset list for the file. + /////// + /////// RetainOffset list for the file. + ////public string RetainOffsets + ////{ + //// get { return this.retainOffsets; } + //// set { this.retainOffsets = value; } + ////} + + /////// + /////// Gets or sets the delta patch retain-length list for the previous file. + /////// + /////// RetainLength list for the previous file. + ////public string PreviousRetainLengths + ////{ + //// get { return this.previousRetainLengths[0]; } + //// set { this.previousRetainLengths[0] = value; } + ////} + + /////// + /////// Gets the delta patch retain-length list for the previous files. + /////// + /////// RetainLength list for the previous files. + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousRetainLengthsArray + ////{ + //// get { return this.previousRetainLengths; } + ////} + + /////// + /////// Gets or sets the delta patch ignore-offset list for the previous file. + /////// + /////// IgnoreOffset list for the previous file. + ////public string PreviousIgnoreOffsets + ////{ + //// get { return this.previousIgnoreOffsets[0]; } + //// set { this.previousIgnoreOffsets[0] = value; } + ////} + + /////// + /////// Gets the delta patch ignore-offset list for the previous files. + /////// + /////// IgnoreOffset list for the previous files. + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousIgnoreOffsetsArray + ////{ + //// get { return this.previousIgnoreOffsets; } + ////} + + /////// + /////// Gets or sets the delta patch ignore-length list for the previous file. + /////// + /////// IgnoreLength list for the previous file. + ////public string PreviousIgnoreLengths + ////{ + //// get { return this.previousIgnoreLengths[0]; } + //// set { this.previousIgnoreLengths[0] = value; } + ////} + + /////// + /////// Gets the delta patch ignore-length list for the previous files. + /////// + /////// IgnoreLength list for the previous files. + ////[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousIgnoreLengthsArray + ////{ + //// get { return this.previousIgnoreLengths; } + ////} + + /////// + /////// Gets or sets the delta patch retain-offset list for the previous file. + /////// + /////// RetainOffset list for the previous file. + ////public string PreviousRetainOffsets + ////{ + //// get { return this.previousRetainOffsets[0]; } + //// set { this.previousRetainOffsets[0] = value; } + ////} + + /////// + /////// Gets the delta patch retain-offset list for the previous files. + /////// + /////// RetainOffset list for the previous files. + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + ////public string[] PreviousRetainOffsetsArray + ////{ + //// get { return this.previousRetainOffsets; } + ////} + + /////// + /////// Compares the current FileRow with another object of the same type. + /////// + /////// An object to compare with this instance. + /////// An integer that indicates the relative order of the comparands. + ////[SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.ArgumentException.#ctor(System.String)")] + ////[SuppressMessage("Microsoft.Globalization", "CA1309:UseOrdinalStringComparison")] + ////public int CompareTo(object obj) + ////{ + //// if (this == obj) + //// { + //// return 0; + //// } + + //// FileRow fileRow = obj as FileRow; + //// if (null == fileRow) + //// { + //// throw new ArgumentException(WixDataStrings.EXP_OtherObjectIsNotFileRow); + //// } + + //// int compared = this.DiskId - fileRow.DiskId; + //// if (0 == compared) + //// { + //// compared = this.patchGroup - fileRow.patchGroup; + + //// if (0 == compared) + //// { + //// compared = String.Compare(this.File, fileRow.File, StringComparison.InvariantCulture); + //// } + //// } + + //// return compared; + ////} + + /////// + /////// Copies data from another FileRow object. + /////// + /////// An row to get data from. + ////public void CopyFrom(FileRow src) + ////{ + //// for (int i = 0; i < src.Fields.Length; i++) + //// { + //// this[i] = src[i]; + //// } + //// this.assemblyManifest = src.assemblyManifest; + //// this.assemblyType = src.assemblyType; + //// this.directory = src.directory; + //// this.diskId = src.diskId; + //// this.fromModule = src.fromModule; + //// this.isGeneratedShortFileName = src.isGeneratedShortFileName; + //// this.patchGroup = src.patchGroup; + //// this.processorArchitecture = src.processorArchitecture; + //// this.source = src.source; + //// this.PreviousSource = src.PreviousSource; + //// this.Operation = src.Operation; + //// this.symbols = src.symbols; + //// this.PreviousSymbols = src.PreviousSymbols; + //// this.patchAttributes = src.patchAttributes; + //// this.retainOffsets = src.retainOffsets; + //// this.retainLengths = src.retainLengths; + //// this.ignoreOffsets = src.ignoreOffsets; + //// this.ignoreLengths = src.ignoreLengths; + //// this.PreviousRetainOffsets = src.PreviousRetainOffsets; + //// this.PreviousRetainLengths = src.PreviousRetainLengths; + //// this.PreviousIgnoreOffsets = src.PreviousIgnoreOffsets; + //// this.PreviousIgnoreLengths = src.PreviousIgnoreLengths; + ////} + + /////// + /////// Appends previous data from another FileRow object. + /////// + /////// An row to get data from. + ////public void AppendPreviousDataFrom(FileRow src) + ////{ + //// AppendStringToArray(ref this.previousSource, src.previousSource[0]); + //// AppendStringToArray(ref this.previousSymbols, src.previousSymbols[0]); + //// AppendStringToArray(ref this.previousRetainOffsets, src.previousRetainOffsets[0]); + //// AppendStringToArray(ref this.previousRetainLengths, src.previousRetainLengths[0]); + //// AppendStringToArray(ref this.previousIgnoreOffsets, src.previousIgnoreOffsets[0]); + //// AppendStringToArray(ref this.previousIgnoreLengths, src.previousIgnoreLengths[0]); + ////} + + /////// + /////// Helper method for AppendPreviousDataFrom. + /////// + /////// Destination array. + /////// Source string. + ////private static void AppendStringToArray(ref string[] destination, string source) + ////{ + //// string[] result = new string[destination.Length + 1]; + //// destination.CopyTo(result, 0); + //// result[destination.Length] = source; + //// destination = result; + ////} + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/MediaRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/MediaRow.cs new file mode 100644 index 00000000..f387a8d2 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/MediaRow.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the Media table. + /// + public sealed class MediaRow : Row + { + /// + /// Creates a Media row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public MediaRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the disk id for this media row. + /// + /// Disk id. + public int DiskId + { + get { return (int)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the last sequence number for this media row. + /// + /// Last sequence number. + public int LastSequence + { + get { return (int)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the disk prompt for this media row. + /// + /// Disk prompt. + public string DiskPrompt + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the cabinet name for this media row. + /// + /// Cabinet name. + public string Cabinet + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the volume label for this media row. + /// + /// Volume label. + public string VolumeLabel + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the source for this media row. + /// + /// Source. + public string Source + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/PropertyRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/PropertyRow.cs new file mode 100644 index 00000000..558df760 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/PropertyRow.cs @@ -0,0 +1,42 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Specialization of a row for the upgrade table. + /// + public sealed class PropertyRow : Row + { + /// + /// Creates an Upgrade row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Upgrade row belongs to and should get its column definitions from. + public PropertyRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets and sets the upgrade code for the row. + /// + /// Property identifier for the row. + public string Property + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets and sets the value for the row. + /// + /// Property value for the row. + public string Value + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/SummaryInfoRowCollection.cs b/src/WixToolset.Data.WindowsInstaller/Rows/SummaryInfoRowCollection.cs new file mode 100644 index 00000000..bc931f15 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/SummaryInfoRowCollection.cs @@ -0,0 +1,42 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Collections; + using System.Collections.ObjectModel; + + /// + /// Indexed container class for summary information rows. + /// + public sealed class SummaryInfoRowCollection : KeyedCollection + { + /// + /// Creates the keyed collection from existing rows in a table. + /// + /// The summary information table to index. + public SummaryInfoRowCollection(Table table) + { + if (0 != String.CompareOrdinal("_SummaryInformation", table.Name)) + { + string message = string.Format(WixDataStrings.EXP_UnsupportedTable, table.Name); + throw new ArgumentException(message, "table"); + } + + foreach (Row row in table.Rows) + { + this.Add(row); + } + } + + /// + /// Gets the summary property ID for the . + /// + /// The row to index. + /// The summary property ID for the . + protected override int GetKeyForItem(Row row) + { + return (int)row[0]; + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/SymbolPathType.cs b/src/WixToolset.Data.WindowsInstaller/Rows/SymbolPathType.cs new file mode 100644 index 00000000..964e1caa --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/SymbolPathType.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// The types that the WixDeltaPatchSymbolPaths table can hold. + /// + /// The order of these values is important since WixDeltaPatchSymbolPaths are sorted by this type. + public enum SymbolPathType + { + File, + Component, + Directory, + Media, + Product + }; +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/UpgradeRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/UpgradeRow.cs new file mode 100644 index 00000000..807a9f93 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/UpgradeRow.cs @@ -0,0 +1,90 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the upgrade table. + /// + public sealed class UpgradeRow : Row + { + /// + /// Creates an Upgrade row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Upgrade row belongs to and should get its column definitions from. + public UpgradeRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets and sets the upgrade code for the row. + /// + /// Upgrade code for the row. + public string UpgradeCode + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets and sets the version minimum for the row. + /// + /// Version minimum for the row. + public string VersionMin + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets and sets the version maximum for the row. + /// + /// Version maximum for the row. + public string VersionMax + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets and sets the language for the row. + /// + /// Language for the row. + public string Language + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets and sets the attributes for the row. + /// + /// Attributes for the row. + public int Attributes + { + get { return (int)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets and sets the remove code for the row. + /// + /// Remove code for the row. + public string Remove + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets and sets the action property for the row. + /// + /// Action property for the row. + public string ActionProperty + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRow.cs new file mode 100644 index 00000000..3009e59d --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRow.cs @@ -0,0 +1,374 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Globalization; + using System.Xml; + using System.Xml.Schema; + + /// + /// The Sequence tables that actions may belong to. + /// + public enum SequenceTable + { + /// AdminUISequence + AdminUISequence, + + /// AdminExecuteSequence + AdminExecuteSequence, + + /// AdvtExecuteSequence + AdvtExecuteSequence, + + /// InstallUISequence + InstallUISequence, + + /// InstallExecuteSequence + InstallExecuteSequence + } + + /// + /// Specialization of a row for the sequence tables. + /// + public sealed class WixActionRow : Row, IComparable + { + private WixActionRowCollection previousActionRows; + private WixActionRowCollection nextActionRows; + + /// + /// Instantiates an ActionRow that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Action row belongs to and should get its column definitions from. + public WixActionRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Instantiates a standard ActionRow. + /// + /// The sequence table of the standard action. + /// The name of the standard action. + /// The condition of the standard action. + /// The suggested sequence number of the standard action. + private WixActionRow(SequenceTable sequenceTable, string action, string condition, int sequence) : + base(null, WindowsInstallerStandard.GetTableDefinitions()["WixAction"]) + { + this.SequenceTable = sequenceTable; + this.Action = action; + this.Condition = condition; + this.Sequence = sequence; + this.Overridable = true; // all standard actions are overridable by default + } + + /// + /// Instantiates an ActionRow by copying data from another ActionRow. + /// + /// The row the data is copied from. + /// The previous and next action collections are not copied. + private WixActionRow(WixActionRow source) + : base(source) + { + } + + /// + /// Gets or sets the name of the action. + /// + /// The name of the action. + public string Action + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets the name of the action this action should be scheduled after. + /// + /// The name of the action this action should be scheduled after. + public string After + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets the name of the action this action should be scheduled before. + /// + /// The name of the action this action should be scheduled before. + public string Before + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the condition of the action. + /// + /// The condition of the action. + public string Condition + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets whether this action is overridable. + /// + /// Whether this action is overridable. + public bool Overridable + { + get { return (1 == Convert.ToInt32(this.Fields[6].Data, CultureInfo.InvariantCulture)); } + set { this.Fields[6].Data = (value ? 1 : 0); } + } + + /// + /// Gets or sets the sequence number of this action. + /// + /// The sequence number of this action. + public int Sequence + { + get { return Convert.ToInt32(this.Fields[3].Data, CultureInfo.InvariantCulture); } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets of sets the sequence table of this action. + /// + /// The sequence table of this action. + public SequenceTable SequenceTable + { + get { return (SequenceTable)Enum.Parse(typeof(SequenceTable), (string)this.Fields[0].Data); } + set { this.Fields[0].Data = value.ToString(); } + } + + /// + /// Gets the actions that should be scheduled after this action. + /// + /// The actions that should be scheduled after this action. + public WixActionRowCollection NextActionRows + { + get + { + if (null == this.nextActionRows) + { + this.nextActionRows = new WixActionRowCollection(); + } + + return this.nextActionRows; + } + } + + /// + /// Gets the actions that should be scheduled before this action. + /// + /// The actions that should be scheduled before this action. + public WixActionRowCollection PreviousActionRows + { + get + { + if (null == this.previousActionRows) + { + this.previousActionRows = new WixActionRowCollection(); + } + + return this.previousActionRows; + } + } + + /// + /// Creates a clone of the action row. + /// + /// A shallow copy of the source object. + /// The previous and next action collections are not copied. + public WixActionRow Clone() + { + return new WixActionRow(this); + } + + /// + /// Compares the current instance with another object of the same type. + /// + /// Other reference to compare this one to. + /// Returns less than 0 for less than, 0 for equals, and greater than 0 for greater. + public int CompareTo(object obj) + { + WixActionRow otherActionRow = (WixActionRow)obj; + + return this.Sequence.CompareTo(otherActionRow.Sequence); + } + + /// + /// Parses ActionRows from the Xml reader. + /// + /// Xml reader that contains serialized ActionRows. + /// The parsed ActionRows. + internal static WixActionRow[] Parse(XmlReader reader) + { + Debug.Assert("action" == reader.LocalName); + + string id = null; + string condition = null; + bool empty = reader.IsEmptyElement; + int sequence = int.MinValue; + int sequenceCount = 0; + SequenceTable[] sequenceTables = new SequenceTable[Enum.GetValues(typeof(SequenceTable)).Length]; + + while (reader.MoveToNextAttribute()) + { + switch (reader.Name) + { + case "name": + id = reader.Value; + break; + case "AdminExecuteSequence": + if (reader.Value.Equals("yes")) + { + sequenceTables[sequenceCount] = SequenceTable.AdminExecuteSequence; + ++sequenceCount; + } + break; + case "AdminUISequence": + if (reader.Value.Equals("yes")) + { + sequenceTables[sequenceCount] = SequenceTable.AdminUISequence; + ++sequenceCount; + } + break; + case "AdvtExecuteSequence": + if (reader.Value.Equals("yes")) + { + sequenceTables[sequenceCount] = SequenceTable.AdvtExecuteSequence; + ++sequenceCount; + } + break; + case "condition": + condition = reader.Value; + break; + case "InstallExecuteSequence": + if (reader.Value.Equals("yes")) + { + sequenceTables[sequenceCount] = SequenceTable.InstallExecuteSequence; + ++sequenceCount; + } + break; + case "InstallUISequence": + if (reader.Value.Equals("yes")) + { + sequenceTables[sequenceCount] = SequenceTable.InstallUISequence; + ++sequenceCount; + } + break; + case "sequence": + sequence = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture); + break; + } + } + + if (null == id) + { + throw new XmlException(); + } + + if (int.MinValue == sequence) + { + throw new XmlException(); + } + else if (1 > sequence) + { + throw new XmlException(); + } + + if (0 == sequenceCount) + { + throw new XmlException(); + } + + if (!empty && reader.Read() && XmlNodeType.EndElement != reader.MoveToContent()) + { + throw new XmlException(); + } + + // create the actions + WixActionRow[] actionRows = new WixActionRow[sequenceCount]; + for (int i = 0; i < sequenceCount; i++) + { + WixActionRow actionRow = new WixActionRow(sequenceTables[i], id, condition, sequence); + actionRows[i] = actionRow; + } + + return actionRows; + } + + /// + /// Determines whether this ActionRow contains the specified ActionRow as a child in its dependency tree. + /// + /// The possible child ActionRow. + /// true if the ActionRow is a child of this ActionRow; false otherwise. + public bool ContainsChildActionRow(WixActionRow actionRow) + { + if (null != this.previousActionRows) + { + if (this.previousActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) + { + return true; + } + } + + if (null != this.nextActionRows) + { + if (this.nextActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) + { + return true; + } + } + + return false; + } + + /// + /// Get all the actions scheduled before this one in a particular sequence table. + /// + /// The sequence table. + /// A RowCollection which will contain all the previous actions. + public void GetAllPreviousActionRows(SequenceTable sequenceTable, IList allPreviousActionRows) + { + if (null != this.previousActionRows) + { + foreach (WixActionRow actionRow in this.previousActionRows) + { + if (sequenceTable == actionRow.SequenceTable) + { + actionRow.GetAllPreviousActionRows(sequenceTable, allPreviousActionRows); + allPreviousActionRows.Add(actionRow); + actionRow.GetAllNextActionRows(sequenceTable, allPreviousActionRows); + } + } + } + } + + /// + /// Get all the actions scheduled after this one in a particular sequence table. + /// + /// The sequence table. + /// A RowCollection which will contain all the next actions. + public void GetAllNextActionRows(SequenceTable sequenceTable, IList allNextActionRows) + { + if (null != this.nextActionRows) + { + foreach (WixActionRow actionRow in this.nextActionRows) + { + if (sequenceTable == actionRow.SequenceTable) + { + actionRow.GetAllPreviousActionRows(sequenceTable, allNextActionRows); + allNextActionRows.Add(actionRow); + actionRow.GetAllNextActionRows(sequenceTable, allNextActionRows); + } + } + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRowCollection.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRowCollection.cs new file mode 100644 index 00000000..513a104f --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixActionRowCollection.cs @@ -0,0 +1,222 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Collections; + using System.Diagnostics; + using System.Xml; + + /// + /// A collection of action rows sorted by their sequence table and action name. + /// + public sealed class WixActionRowCollection : ICollection + { + private SortedList collection; + + /// + /// Creates a new action table object. + /// + public WixActionRowCollection() + { + this.collection = new SortedList(); + } + + /// + /// Gets the number of items in the collection. + /// + /// Number of items in collection. + public int Count + { + get { return this.collection.Count; } + } + + /// + /// Gets if the collection has been synchronized. + /// + /// True if the collection has been synchronized. + public bool IsSynchronized + { + get { return this.collection.IsSynchronized; } + } + + /// + /// Gets the object used to synchronize the collection. + /// + /// Oject used the synchronize the collection. + public object SyncRoot + { + get { return this; } + } + + /// + /// Get an ActionRow by its sequence table and action name. + /// + /// The sequence table of the ActionRow. + /// The action name of the ActionRow. + public WixActionRow this[SequenceTable sequenceTable, string action] + { + get { return (WixActionRow)this.collection[GetKey(sequenceTable, action)]; } + } + + /// + /// Add an ActionRow to the collection. + /// + /// The ActionRow to add. + /// true to overwrite an existing ActionRow; false otherwise. + public void Add(WixActionRow actionRow, bool overwrite) + { + string key = GetKey(actionRow.SequenceTable, actionRow.Action); + + if (overwrite) + { + this.collection[key] = actionRow; + } + else + { + this.collection.Add(key, actionRow); + } + } + + /// + /// Add an ActionRow to the collection. + /// + /// The ActionRow to add. + public void Add(WixActionRow actionRow) + { + this.Add(actionRow, false); + } + + /// + /// Determines if the collection contains an ActionRow with a specific sequence table and name. + /// + /// The sequence table of the ActionRow. + /// The action name of the ActionRow. + /// true if the ActionRow was found; false otherwise. + public bool Contains(SequenceTable sequenceTable, string action) + { + return this.collection.Contains(GetKey(sequenceTable, action)); + } + + /// + /// Copies the collection into an array. + /// + /// Array to copy the collection into. + /// Index to start copying from. + public void CopyTo(System.Array array, int index) + { + this.collection.Values.CopyTo(array, index); + } + + /// + /// Gets the enumerator for the collection. + /// + /// The enumerator for the collection. + public IEnumerator GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + + /// + /// Remove an ActionRow from the collection. + /// + /// The sequence table of the ActionRow. + /// The action name of the ActionRow. + public void Remove(SequenceTable sequenceTable, string action) + { + this.collection.Remove(GetKey(sequenceTable, action)); + } + + /// + /// Load an action table from an XmlReader. + /// + /// Reader to get data from. + /// The ActionRowCollection represented by the xml. + internal static WixActionRowCollection Load(XmlReader reader) + { + reader.MoveToContent(); + + return Parse(reader); + } + + /// + /// Creates a new action table object and populates it from an Xml reader. + /// + /// Reader to get data from. + /// The parsed ActionTable. + private static WixActionRowCollection Parse(XmlReader reader) + { + if (!reader.LocalName.Equals("actions")) + { + throw new XmlException(); + } + + WixActionRowCollection actionRows = new WixActionRowCollection(); + bool empty = reader.IsEmptyElement; + + while (reader.MoveToNextAttribute()) + { + } + + if (!empty) + { + bool done = false; + + // loop through all the fields in a row + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "action": + WixActionRow[] parsedActionRows = WixActionRow.Parse(reader); + + foreach (WixActionRow actionRow in parsedActionRows) + { + actionRows.Add(actionRow); + } + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return actionRows; + } + + /// + /// Get the key for storing an ActionRow. + /// + /// The sequence table of the ActionRow. + /// The action name of the ActionRow. + /// The string key. + private static string GetKey(SequenceTable sequenceTable, string action) + { + return GetKey(sequenceTable.ToString(), action); + } + + /// + /// Get the key for storing an ActionRow. + /// + /// The sequence table of the ActionRow. + /// The action name of the ActionRow. + /// The string key. + private static string GetKey(string sequenceTable, string action) + { + return String.Concat(sequenceTable, '/', action); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixApprovedExeForElevationRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixApprovedExeForElevationRow.cs new file mode 100644 index 00000000..c10a39ab --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixApprovedExeForElevationRow.cs @@ -0,0 +1,79 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + + /// + /// Specialization of a row for the WixApprovedExeForElevation table. + /// + public class WixApprovedExeForElevationRow : Row + { + /// + /// Creates an ApprovedExeForElevation row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this ApprovedExeForElevation row belongs to and should get its column definitions from. + public WixApprovedExeForElevationRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates an ApprovedExeForElevation row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this ApprovedExeForElevation row belongs to and should get its column definitions from. + public WixApprovedExeForElevationRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the ApprovedExeForElevation identifier. + /// + /// The ApprovedExeForElevation identifier. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the Key path. + /// + /// The Key path. + public string Key + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the Value name. + /// + /// The Value name. + public string ValueName + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the attibutes. + /// + /// The BundleApprovedExeForElevationAttributes. + public BundleApprovedExeForElevationAttributes Attributes + { + get { return (BundleApprovedExeForElevationAttributes)this.Fields[3].Data; } + set { this.Fields[3].Data = (int)value; } + } + + /// + /// Gets whether this row is 64-bit. + /// + public bool Win64 + { + get { return BundleApprovedExeForElevationAttributes.Win64 == (this.Attributes & BundleApprovedExeForElevationAttributes.Win64); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleCatalogRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleCatalogRow.cs new file mode 100644 index 00000000..05c1e597 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleCatalogRow.cs @@ -0,0 +1,50 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixCatalog table. + /// + public sealed class WixBundleCatalogRow : Row + { + /// + /// Creates a Catalog row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Catalog row belongs to and should get its column definitions from. + public WixBundleCatalogRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a Catalog row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Catalog row belongs to and should get its column definitions from. + public WixBundleCatalogRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the catalog identifier. + /// + /// The catalog identifier. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the payload identifier. + /// + /// The payload identifier. + public string Payload + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleContainerRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleContainerRow.cs new file mode 100644 index 00000000..7b03dcc5 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleContainerRow.cs @@ -0,0 +1,78 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the Container table. + /// + public class WixBundleContainerRow : Row + { + /// + /// Creates a ContainerRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundleContainerRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a ContainerRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundleContainerRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public ContainerType Type + { + get { return (ContainerType)this.Fields[2].Data; } + set { this.Fields[2].Data = (int)value; } + } + + public string DownloadUrl + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public long Size + { + get { return (long)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + public string Hash + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + public int AttachedContainerIndex + { + get { return (null == this.Fields[6].Data) ? -1 : (int)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + public string WorkingPath + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleExePackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleExePackageRow.cs new file mode 100644 index 00000000..3bf06d49 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleExePackageRow.cs @@ -0,0 +1,103 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixBundleExePackage table. + /// + public sealed class WixBundleExePackageRow : Row + { + /// + /// Creates a WixBundleExePackage row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundleExePackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleExePackageRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundleExePackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the raw Exe attributes of a patch. + /// + public WixBundleExePackageAttributes Attributes + { + get { return (WixBundleExePackageAttributes)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the protcol for the executable package. + /// + public string DetectCondition + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the install command for the executable package. + /// + public string InstallCommand + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the repair command for the executable package. + /// + public string RepairCommand + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the uninstall command for the executable package. + /// + public string UninstallCommand + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the protcol for the executable package. + /// + public string ExeProtocol + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets whether the executable package is repairable. + /// + public bool Repairable + { + get { return 0 != (this.Attributes & WixBundleExePackageAttributes.Repairable); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiFeatureRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiFeatureRow.cs new file mode 100644 index 00000000..551eae20 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiFeatureRow.cs @@ -0,0 +1,93 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the MsiFeature table. + /// + public class WixBundleMsiFeatureRow : Row + { + /// + /// Creates a MsiFeatureRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundleMsiFeatureRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a MsiFeatureRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundleMsiFeatureRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public long Size + { + get { return (long)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string Parent + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public string Title + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + public string Description + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + public int Display + { + get { return (int)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + public int Level + { + get { return (int)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + public string Directory + { + get { return (string)this.Fields[8].Data; } + set { this.Fields[8].Data = value; } + } + + public int Attributes + { + get { return (int)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPackageRow.cs new file mode 100644 index 00000000..70d85e26 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPackageRow.cs @@ -0,0 +1,138 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Globalization; + using WixToolset.Data.Tuples; + + /// + /// Specialization of a row for the WixBundleMsiPackage table. + /// + public sealed class WixBundleMsiPackageRow : Row + { + /// + /// Creates a WixBundleMsiPackage row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundleMsiPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleMsiPackageRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundleMsiPackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the raw MSI attributes of a package. + /// + public WixBundleMsiPackageAttributes Attributes + { + get { return (WixBundleMsiPackageAttributes)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the MSI package's product code. + /// + public string ProductCode + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the MSI package's upgrade code. + /// + public string UpgradeCode + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the product version of the MSI package. + /// + public string ProductVersion + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the language of the MSI package. + /// + public int ProductLanguage + { + get { return Convert.ToInt32(this.Fields[5].Data, CultureInfo.InvariantCulture); } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the product name of the MSI package. + /// + public string ProductName + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets the MSI package's manufacturer. + /// + public string Manufacturer + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + /// + /// Gets the display internal UI of a package. + /// + public bool DisplayInternalUI + { + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.DisplayInternalUI); } + } + + /// + /// Gets the display internal UI of a package. + /// + public bool EnableFeatureSelection + { + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection); } + } + + /// + /// Gets the display internal UI of a package. + /// + public bool ForcePerMachine + { + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.ForcePerMachine); } + } + + /// + /// Gets the suppress loose file payload generation of a package. + /// + public bool SuppressLooseFilePayloadGeneration + { + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPropertyRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPropertyRow.cs new file mode 100644 index 00000000..524f7929 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsiPropertyRow.cs @@ -0,0 +1,58 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixBundleMsiProperty table. + /// + public sealed class WixBundleMsiPropertyRow : Row + { + /// + /// Creates an WixBundleMsiProperty row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixBundleMsiProperty row belongs to and should get its column definitions from. + public WixBundleMsiPropertyRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets and sets the property identity. + /// + public string Name + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets and sets the value for the row. + /// + /// MsiProperty value for the row. + public string Value + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets and sets the condition for the row. + /// + /// MsiProperty condition for the row. + public string Condition + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMspPackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMspPackageRow.cs new file mode 100644 index 00000000..053fc915 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMspPackageRow.cs @@ -0,0 +1,101 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the ChainMspPackage table. + /// + public sealed class WixBundleMspPackageRow : Row + { + /// + /// Creates a ChainMspPackage row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundleMspPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleMspPackage row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundleMspPackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the raw MSP attributes of a patch. + /// + public WixBundleMspPackageAttributes Attributes + { + get { return (WixBundleMspPackageAttributes)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the patch code. + /// + public string PatchCode + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the patch's manufacturer. + /// + public string Manufacturer + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the patch's xml. + /// + public string PatchXml + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets the display internal UI of a patch. + /// + public bool DisplayInternalUI + { + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.DisplayInternalUI); } + } + + /// + /// Gets whether to slipstream the patch. + /// + public bool Slipstream + { + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.Slipstream); } + } + + /// + /// Gets whether the patch targets an unspecified number of packages. + /// + public bool TargetUnspecified + { + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.TargetUnspecified); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsuPackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsuPackageRow.cs new file mode 100644 index 00000000..0df635c2 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleMsuPackageRow.cs @@ -0,0 +1,57 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixBundleMsuPackage table. + /// + public sealed class WixBundleMsuPackageRow : Row + { + /// + /// Creates a WixBundleMsuPackage row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundleMsuPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleMsuPackage row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundleMsuPackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the detection condition the package. + /// + public string DetectCondition + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the KB of the package. + /// + public string MsuKB + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageCommandLineRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageCommandLineRow.cs new file mode 100644 index 00000000..eba647d5 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageCommandLineRow.cs @@ -0,0 +1,82 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Specialization of a row for the WixBundlePackageCommandLine table. + /// + public class WixBundlePackageCommandLineRow : Row + { + /// + /// Creates a WixBundlePackageCommandLineRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this WixBundlePackageCommandLineRow row belongs to and should get its column definitions from. + public WixBundlePackageCommandLineRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates an WixBundlePackageCommandLineRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixBundlePackageCommandLineRow row belongs to and should get its column definitions from. + public WixBundlePackageCommandLineRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the package identifier. + /// + /// The package identifier. + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the command-line argument for installation. + /// + /// The command-line argument. + public string InstallArgument + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the command-line argument for uninstallation. + /// + /// The command-line argument. + public string UninstallArgument + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the command-line argument for repair. + /// + /// The command-line argument. + public string RepairArgument + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the condition. + /// + /// The condition. + public string Condition + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageExitCodeRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageExitCodeRow.cs new file mode 100644 index 00000000..2beed8da --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageExitCodeRow.cs @@ -0,0 +1,53 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the ExitCode table. + /// + public class WixBundlePackageExitCodeRow : Row + { + /// + /// Creates a ExitCodeRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundlePackageExitCodeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a ExitCodeRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundlePackageExitCodeRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public int? Code + { + get { return (null == this.Fields[1].Data) ? (int?)null : (int?)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public ExitCodeBehaviorType Behavior + { + get { return (ExitCodeBehaviorType)this.Fields[2].Data; } + set { this.Fields[2].Data = (int)value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageRow.cs new file mode 100644 index 00000000..973c43b9 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePackageRow.cs @@ -0,0 +1,228 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixBundlePackage table. + /// + public sealed class WixBundlePackageRow : Row + { + /// + /// Creates a WixBundlePackage row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundlePackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundlePackage row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundlePackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key to the WixChainItem. + /// + public string WixChainItemId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the item type. + /// + public WixBundlePackageType Type + { + get { return (WixBundlePackageType)this.Fields[1].Data; } + set { this.Fields[1].Data = (int)value; } + } + + /// + /// Gets or sets the indentifier of the package's payload. + /// + public string PackagePayload + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the raw attributes of a package. + /// + public WixBundlePackageAttributes Attributes + { + get { return (WixBundlePackageAttributes)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the install condition of the package. + /// + public string InstallCondition + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the language of the package. + /// + public YesNoAlwaysType Cache + { + get { return (null == this.Fields[5].Data) ? YesNoAlwaysType.NotSet : (YesNoAlwaysType)this.Fields[5].Data; } + set { this.Fields[5].Data = (int)value; } + } + + /// + /// Gets or sets the indentifier of the package's cache. + /// + public string CacheId + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets whether the package is vital. + /// + public YesNoType Vital + { + get { return (null == this.Fields[7].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[7].Data; } + set { this.Fields[7].Data = (int)value; } + } + + /// + /// Gets or sets whether the package is per-machine. + /// + public YesNoDefaultType PerMachine + { + get { return (null == this.Fields[8].Data) ? YesNoDefaultType.NotSet : (YesNoDefaultType)this.Fields[8].Data; } + set { this.Fields[8].Data = (int)value; } + } + + /// + /// Gets or sets the variable that points to the log for the package. + /// + public string LogPathVariable + { + get { return (string)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + + /// + /// Gets or sets the variable that points to the rollback log for the package. + /// + public string RollbackLogPathVariable + { + get { return (string)this.Fields[10].Data; } + set { this.Fields[10].Data = value; } + } + + /// + /// Gets or sets the size of the package. + /// + public long Size + { + get { return (long)this.Fields[11].Data; } + set { this.Fields[11].Data = value; } + } + + /// + /// Gets or sets the install size of the package. + /// + public long? InstallSize + { + get { return (long?)this.Fields[12].Data; } + set { this.Fields[12].Data = value; } + } + + /// + /// Gets or sets the version of the package. + /// + public string Version + { + get { return (string)this.Fields[13].Data; } + set { this.Fields[13].Data = value; } + } + + /// + /// Gets or sets the language of the package. + /// + public int Language + { + get { return (int)this.Fields[14].Data; } + set { this.Fields[14].Data = value; } + } + + /// + /// Gets or sets the display name of the package. + /// + public string DisplayName + { + get { return (string)this.Fields[15].Data; } + set { this.Fields[15].Data = value; } + } + + /// + /// Gets or sets the description of the package. + /// + public string Description + { + get { return (string)this.Fields[16].Data; } + set { this.Fields[16].Data = value; } + } + + /// + /// Gets or sets the rollback boundary identifier for the package. + /// + public string RollbackBoundary + { + get { return (string)this.Fields[17].Data; } + set { this.Fields[17].Data = value; } + } + + /// + /// Gets or sets the backward rollback boundary identifier for the package. + /// + public string RollbackBoundaryBackward + { + get { return (string)this.Fields[18].Data; } + set { this.Fields[18].Data = value; } + } + + /// + /// Gets or sets whether the package is x64. + /// + public YesNoType x64 + { + get { return (null == this.Fields[19].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[19].Data; } + set { this.Fields[19].Data = (int)value; } + } + + /// + /// Gets whether the package is permanent. + /// + public bool Permanent + { + get { return 0 != (this.Attributes & WixBundlePackageAttributes.Permanent); } + } + + /// + /// Gets whether the package is visible. + /// + public bool Visible + { + get { return 0 != (this.Attributes & WixBundlePackageAttributes.Visible); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePatchTargetCodeRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePatchTargetCodeRow.cs new file mode 100644 index 00000000..e25f4a55 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePatchTargetCodeRow.cs @@ -0,0 +1,81 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Collections.Generic; + using System.Text; + + /// + /// Attributes for the PatchTargetCode table. + /// + [Flags] + public enum WixBundlePatchTargetCodeAttributes : int + { + None = 0, + + /// + /// The transform targets a specific ProductCode. + /// + TargetsProductCode = 1, + + /// + /// The transform targets a specific UpgradeCode. + /// + TargetsUpgradeCode = 2, + } + + /// + /// Specialization of a row for the PatchTargetCode table. + /// + public class WixBundlePatchTargetCodeRow : Row + { + /// + /// Creates a PatchTargetCodeRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this PatchTargetCode row belongs to and should get its column definitions from. + public WixBundlePatchTargetCodeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a PatchTargetCodeRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this PatchTargetCode row belongs to and should get its column definitions from. + public WixBundlePatchTargetCodeRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string MspPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string TargetCode + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public WixBundlePatchTargetCodeAttributes Attributes + { + get { return (WixBundlePatchTargetCodeAttributes)this.Fields[2].Data; } + set { this.Fields[2].Data = (int)value; } + } + + public bool TargetsProductCode + { + get { return 0 != (WixBundlePatchTargetCodeAttributes.TargetsProductCode & this.Attributes); } + } + + public bool TargetsUpgradeCode + { + get { return 0 != (WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode & this.Attributes); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePayloadRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePayloadRow.cs new file mode 100644 index 00000000..8aac8aa0 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundlePayloadRow.cs @@ -0,0 +1,185 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.IO; + + /// + /// Specialization of a row for the PayloadInfo table. + /// + public class WixBundlePayloadRow : Row + { + /// + /// Creates a PayloadRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundlePayloadRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a PayloadRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundlePayloadRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public string SourceFile + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string DownloadUrl + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public YesNoDefaultType Compressed + { + get { return (YesNoDefaultType)this.Fields[4].Data; } + set { this.Fields[4].Data = (int)value; } + } + + public string UnresolvedSourceFile + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + public string DisplayName + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + public string Description + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + public bool EnableSignatureValidation + { + get { return (null != this.Fields[8].Data) && (1 == (int)this.Fields[8].Data); } + set { this.Fields[8].Data = value ? 1 : 0; } + } + + public int FileSize + { + get { return (int)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + + public string Version + { + get { return (string)this.Fields[10].Data; } + set { this.Fields[10].Data = value; } + } + + public string Hash + { + get { return (string)this.Fields[11].Data; } + set { this.Fields[11].Data = value; } + } + + public string PublicKey + { + get { return (string)this.Fields[12].Data; } + set { this.Fields[12].Data = value; } + } + + public string Thumbprint + { + get { return (string)this.Fields[13].Data; } + set { this.Fields[13].Data = value; } + } + + public string Catalog + { + get { return (string)this.Fields[14].Data; } + set { this.Fields[14].Data = value; } + } + + public string Container + { + get { return (string)this.Fields[15].Data; } + set { this.Fields[15].Data = value; } + } + + public string Package + { + get { return (string)this.Fields[16].Data; } + set { this.Fields[16].Data = value; } + } + + public bool ContentFile + { + get { return (null != this.Fields[17].Data) && (1 == (int)this.Fields[17].Data); } + set { this.Fields[17].Data = value ? 1 : 0; } + } + + public string EmbeddedId + { + get { return (string)this.Fields[18].Data; } + set { this.Fields[18].Data = value; } + } + + public bool LayoutOnly + { + get { return (null != this.Fields[19].Data) && (1 == (int)this.Fields[19].Data); } + set { this.Fields[19].Data = value ? 1 : 0; } + } + + public PackagingType Packaging + { + get + { + object data = this.Fields[20].Data; + return (null == data) ? PackagingType.Unknown : (PackagingType)data; + } + + set + { + if (PackagingType.Unknown == value) + { + this.Fields[20].Data = null; + } + else + { + this.Fields[20].Data = (int)value; + } + } + } + + public string ParentPackagePayload + { + get { return (string)this.Fields[21].Data; } + set { this.Fields[21].Data = value; } + } + + public string FullFileName + { + get { return String.IsNullOrEmpty(this.SourceFile) ? String.Empty : Path.GetFullPath(this.SourceFile); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRelatedPackageRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRelatedPackageRow.cs new file mode 100644 index 00000000..ea9ff99e --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRelatedPackageRow.cs @@ -0,0 +1,87 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the RelatedPackage table. + /// + public class WixBundleRelatedPackageRow : Row + { + /// + /// Creates a RelatedPackageRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundleRelatedPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a RelatedPackageRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundleRelatedPackageRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Id + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public string MinVersion + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string MaxVersion + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public string Languages + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + public bool MinInclusive + { + get { return 1 == (int)this.Fields[5].Data; } + set { this.Fields[5].Data = value ? 1 : 0; } + } + + public bool MaxInclusive + { + get { return 1 == (int)this.Fields[6].Data; } + set { this.Fields[6].Data = value ? 1 : 0; } + } + + public bool LangInclusive + { + get { return 1 == (int)this.Fields[7].Data; } + set { this.Fields[7].Data = value ? 1 : 0; } + } + + public bool OnlyDetect + { + get { return 1 == (int)this.Fields[8].Data; } + set { this.Fields[8].Data = value ? 1 : 0; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRollbackBoundaryRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRollbackBoundaryRow.cs new file mode 100644 index 00000000..d0a994c0 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRollbackBoundaryRow.cs @@ -0,0 +1,59 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixBundleRollbackBoundary table. + /// + public sealed class WixBundleRollbackBoundaryRow : Row + { + /// + /// Creates a WixBundleRollbackBoundary row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixBundleRollbackBoundaryRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a RollbackBoundaryRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixBundleRollbackBoundaryRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets whether the package is vital. + /// + /// Vitality of the package. + public YesNoType Vital + { + get { return (null == this.Fields[1].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[1].Data; } + set { this.Fields[1].Data = (int)value; } + } + + /// + /// Gets or sets whether the rollback-boundary should be installed as an MSI transaction. + /// + /// Vitality of the package. + public YesNoType Transaction + { + get { return (null == this.Fields[2].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[2].Data; } + set { this.Fields[2].Data = (int)value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRow.cs new file mode 100644 index 00000000..4c96d6cc --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleRow.cs @@ -0,0 +1,228 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Bundle info for binding Bundles. + /// + public class WixBundleRow : Row + { + /// + /// Creates a WixBundleRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this WixBundleRow row belongs to and should get its column definitions from. + public WixBundleRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixBundleRow row belongs to and should get its column definitions from. + public WixBundleRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Version + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Copyright + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string AboutUrl + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public int DisableModify + { + get { return (null == this.Fields[4].Data) ? 0 : (int)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + public bool DisableRemove + { + get { return (null != this.Fields[5].Data && 0 != (int)this.Fields[5].Data); } + set { this.Fields[5].Data = value ? 1 : 0; } + } + + // There is no 6. It used to be DisableRepair. + + public string HelpTelephone + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + public string HelpLink + { + get { return (string)this.Fields[8].Data; } + set { this.Fields[8].Data = value; } + } + + public string Publisher + { + get { return (string)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + + public string UpdateUrl + { + get { return (string)this.Fields[10].Data; } + set { this.Fields[10].Data = value; } + } + + public YesNoDefaultType Compressed + { + get { return (null == this.Fields[11].Data) ? YesNoDefaultType.Default : (0 == (int)this.Fields[11].Data) ? YesNoDefaultType.No : YesNoDefaultType.Yes; } + set { this.Fields[11].Data = (int)value; } + } + + public PackagingType DefaultPackagingType + { + get { return (YesNoDefaultType.No == this.Compressed) ? PackagingType.External : PackagingType.Embedded; } + } + + public string LogPathPrefixExtension + { + get { return (string)this.Fields[12].Data ?? String.Empty; } + set { this.Fields[12].Data = value; } + } + + public string LogPathVariable + { + get + { + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':'); + return logVariableAndPrefixExtension[0]; + } + } + + public string LogPrefix + { + get + { + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':'); + if (2 > logVariableAndPrefixExtension.Length) + { + return String.Empty; + } + string logPrefixAndExtension = logVariableAndPrefixExtension[1]; + int extensionIndex = logPrefixAndExtension.LastIndexOf('.'); + return logPrefixAndExtension.Substring(0, extensionIndex); + } + } + + public string LogExtension + { + get + { + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':'); + if (2 > logVariableAndPrefixExtension.Length) + { + return String.Empty; + } + string logPrefixAndExtension = logVariableAndPrefixExtension[1]; + int extensionIndex = logPrefixAndExtension.LastIndexOf('.'); + return logPrefixAndExtension.Substring(extensionIndex + 1); + } + } + + public string IconPath + { + get { return (string)this.Fields[13].Data; } + set { this.Fields[13].Data = value; } + } + + public string SplashScreenBitmapPath + { + get { return (string)this.Fields[14].Data; } + set { this.Fields[14].Data = value; } + } + + public string Condition + { + get { return (string)this.Fields[15].Data; } + set { this.Fields[15].Data = value; } + } + + public string Tag + { + get { return (string)this.Fields[16].Data; } + set { this.Fields[16].Data = value; } + } + + public Platform Platform + { + get { return (Platform)Enum.Parse(typeof(Platform), (string)this.Fields[17].Data); } + set { this.Fields[17].Data = value.ToString(); } + } + + public string ParentName + { + get { return (string)this.Fields[18].Data; } + set { this.Fields[18].Data = value; } + } + + public string UpgradeCode + { + get { return (string)this.Fields[19].Data; } + set { this.Fields[19].Data = value; } + } + + public Guid BundleId + { + get + { + if (null == this.Fields[20].Data) + { + this.Fields[20].Data = Guid.NewGuid().ToString("B"); + } + + return new Guid((string)this.Fields[20].Data); + } + + set { this.Fields[20].Data = value.ToString(); } + } + + public string ProviderKey + { + get + { + if (null == this.Fields[21].Data) + { + this.Fields[21].Data = this.BundleId.ToString("B"); + } + + return (string)this.Fields[21].Data; + } + + set { this.Fields[21].Data = value; } + } + + public bool PerMachine + { + get { return (null != this.Fields[22].Data && 0 != (int)this.Fields[22].Data); } + set { this.Fields[22].Data = value ? 1 : 0; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleSlipstreamMspRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleSlipstreamMspRow.cs new file mode 100644 index 00000000..d11b23ef --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleSlipstreamMspRow.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the SlipstreamMsp table. + /// + public class WixBundleSlipstreamMspRow : Row + { + /// + /// Creates a SlipstreamMspRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundleSlipstreamMspRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a SlipstreamMspRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundleSlipstreamMspRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row. + /// + public string ChainPackageId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the foreign key identifier to the ChainPackage row for the MSP package. + /// + public string MspPackageId + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleUpdateRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleUpdateRow.cs new file mode 100644 index 00000000..e0150685 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleUpdateRow.cs @@ -0,0 +1,38 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Bundle update info for binding Bundles. + /// + public class WixBundleUpdateRow : Row + { + /// + /// Creates a WixBundleUpdateRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this WixBundleUpdateRow row belongs to and should get its column definitions from. + public WixBundleUpdateRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixBundleUpdateRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixBundleUpdateRow row belongs to and should get its column definitions from. + public WixBundleUpdateRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Location + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleVariableRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleVariableRow.cs new file mode 100644 index 00000000..e7ff1a4d --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixBundleVariableRow.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the Variable table. + /// + public sealed class WixBundleVariableRow : Row + { + /// + /// Creates a Variable row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixBundleVariableRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a Variable row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixBundleVariableRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the variable identifier. + /// + /// The variable identifier. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the variable's value. + /// + /// The variable's value. + public string Value + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the variable's type. + /// + /// The variable's type. + public string Type + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets whether this variable is hidden. + /// + /// Whether this variable is hidden. + public bool Hidden + { + get { return (null == this.Fields[3].Data || 0 == ((int)this.Fields[3].Data)) ? false : true; } + set { this.Fields[3].Data = value ? 1 : 0; } + } + + /// + /// Gets or sets whether this variable is persisted. + /// + /// Whether this variable is persisted. + public bool Persisted + { + get { return (null == this.Fields[4].Data || 0 == ((int)this.Fields[4].Data)) ? false : true; } + set { this.Fields[4].Data = value ? 1 : 0; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixChainItemRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixChainItemRow.cs new file mode 100644 index 00000000..12538d71 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixChainItemRow.cs @@ -0,0 +1,39 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixChainItem table. + /// + public sealed class WixChainItemRow : Row + { + /// + /// Creates a WixChainItem row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this ChainItem row belongs to and should get its column definitions from. + public WixChainItemRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixChainItem row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this ChainItem row belongs to and should get its column definitions from. + public WixChainItemRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the WixChainItem identifier. + /// + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixChainRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixChainRow.cs new file mode 100644 index 00000000..54fff72c --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixChainRow.cs @@ -0,0 +1,65 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixChain table. + /// + public sealed class WixChainRow : Row + { + /// + /// Creates a WixChain row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixChainRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixChainRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixChainRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the raw chain attributes. + /// + public WixChainAttributes Attributes + { + get { return (WixChainAttributes)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets the disable rollback state of a chain. + /// + public bool DisableRollback + { + get { return 0 != (this.Attributes & WixChainAttributes.DisableRollback); } + } + + /// + /// Gets disable system restore state of a chain. + /// + public bool DisableSystemRestore + { + get { return 0 != (this.Attributes & WixChainAttributes.DisableSystemRestore); } + } + + /// + /// Gets parallel cache of a chain. + /// + public bool ParallelCache + { + get { return 0 != (this.Attributes & WixChainAttributes.ParallelCache); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixComplexReferenceRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixComplexReferenceRow.cs new file mode 100644 index 00000000..40ca4592 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixComplexReferenceRow.cs @@ -0,0 +1,204 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; + using System.Xml; + + /// + /// Specialization of a row for the WixComplexReference table. + /// + public sealed class WixComplexReferenceRow : Row, IComparable + { + /// + /// Creates a WixComplexReferenceRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixComplexReferenceRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets the parent type of the complex reference. + /// + /// Parent type of the complex reference. + public ComplexReferenceParentType ParentType + { + get { return (ComplexReferenceParentType)Enum.ToObject(typeof(ComplexReferenceParentType), (int)this.Fields[1].Data); } + set { this.Fields[1].Data = (int)value; } + } + + /// + /// Gets or sets the parent identifier of the complex reference. + /// + /// Parent identifier of the complex reference. + public string ParentId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets the parent language of the complex reference. + /// + /// Parent language of the complex reference. + public string ParentLanguage + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets the child type of the complex reference. + /// + /// Child type of the complex reference. + public ComplexReferenceChildType ChildType + { + get { return (ComplexReferenceChildType)Enum.ToObject(typeof(ComplexReferenceChildType), (int)this.Fields[4].Data); } + set { this.Fields[4].Data = (int)value; } + } + + /// + /// Gets the child identifier of the complex reference. + /// + /// Child identifier of the complex reference. + public string ChildId + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets if this is the primary complex reference. + /// + /// true if primary complex reference. + public bool IsPrimary + { + get + { + return (0x1 == ((int)this.Fields[5].Data & 0x1)); + } + + set + { + if (null == this.Fields[5].Data) + { + this.Fields[5].Data = 0; + } + + if (value) + { + this.Fields[5].Data = (int)this.Fields[5].Data | 0x1; + } + else + { + this.Fields[5].Data = (int)this.Fields[5].Data & ~0x1; + } + } + } + + /// + /// Determines if two complex references are equivalent. + /// + /// Complex reference to compare. + /// True if complex references are equivalent. + public override bool Equals(object obj) + { + return 0 == this.CompareTo(obj); + } + + /// + /// Gets the hash code for the complex reference. + /// + /// Hash code for the complex reference. + public override int GetHashCode() + { + return this.ChildType.GetHashCode() ^ this.ChildId.GetHashCode() ^ this.ParentType.GetHashCode() ^ this.ParentLanguage.GetHashCode() ^ this.ParentId.GetHashCode() ^ this.IsPrimary.GetHashCode(); + } + + /// + /// Compares two complex references. + /// + /// Complex reference to compare to. + /// Zero if the objects are equivalent, negative number if the provided object is less, positive if greater. + public int CompareTo(object obj) + { + int comparison = this.CompareToWithoutConsideringPrimary(obj); + if (0 == comparison) + { + comparison = ((WixComplexReferenceRow)obj).IsPrimary.CompareTo(this.IsPrimary); // Note: the order of these is purposely switched to ensure that "Yes" is lower than "No" and "NotSet" + } + return comparison; + } + + /// + /// Compares two complex references without considering the primary bit. + /// + /// Complex reference to compare to. + /// Zero if the objects are equivalent, negative number if the provided object is less, positive if greater. + [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.ArgumentException.#ctor(System.String,System.String)")] + public int CompareToWithoutConsideringPrimary(object obj) + { + var other = obj as WixComplexReferenceRow ?? throw new ArgumentNullException(nameof(obj)); + + int comparison = this.ChildType - other.ChildType; + if (0 == comparison) + { + comparison = String.Compare(this.ChildId, other.ChildId, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = this.ParentType - other.ParentType; + if (0 == comparison) + { + string thisParentLanguage = null == this.ParentLanguage ? String.Empty : this.ParentLanguage; + string otherParentLanguage = null == other.ParentLanguage ? String.Empty : other.ParentLanguage; + comparison = String.Compare(thisParentLanguage, otherParentLanguage, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = String.Compare(this.ParentId, other.ParentId, StringComparison.Ordinal); + } + } + } + } + + return comparison; + } + + /// + /// Creates a shallow copy of the ComplexReference. + /// + /// A shallow copy of the ComplexReference. + public WixComplexReferenceRow Clone() + { + WixComplexReferenceRow wixComplexReferenceRow = new WixComplexReferenceRow(this.SourceLineNumbers, this.Table); + wixComplexReferenceRow.ParentType = this.ParentType; + wixComplexReferenceRow.ParentId = this.ParentId; + wixComplexReferenceRow.ParentLanguage = this.ParentLanguage; + wixComplexReferenceRow.ChildType = this.ChildType; + wixComplexReferenceRow.ChildId = this.ChildId; + wixComplexReferenceRow.IsPrimary = this.IsPrimary; + + return wixComplexReferenceRow; + } + + /// + /// Changes all of the parent references to point to the passed in parent reference. + /// + /// New parent complex reference. + public void Reparent(WixComplexReferenceRow parent) + { + this.ParentId = parent.ParentId; + this.ParentLanguage = parent.ParentLanguage; + this.ParentType = parent.ParentType; + + if (!this.IsPrimary) + { + this.IsPrimary = parent.IsPrimary; + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchFileRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchFileRow.cs new file mode 100644 index 00000000..000779d9 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchFileRow.cs @@ -0,0 +1,142 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixDeltaPatchFile table. + /// + public sealed class WixDeltaPatchFileRow : Row + { + /// + /// Creates a WixDeltaPatchFile row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixDeltaPatchFileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixDeltaPatchFile row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this File row belongs to and should get its column definitions from. + public WixDeltaPatchFileRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the primary key of the file row. + /// + /// Primary key of the file row. + public string File + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the delta patch retain-length list for the file. + /// + /// RetainLength list for the file. + public string RetainLengths + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the previous delta patch retain-length list for the file. + /// + /// Previous RetainLength list for the file. + public string PreviousRetainLengths + { + get { return this.Fields[1].PreviousData; } + set { this.Fields[1].PreviousData = value; } + } + + /// + /// Gets or sets the delta patch ignore-offset list for the file. + /// + /// IgnoreOffset list for the file. + public string IgnoreOffsets + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the previous delta patch ignore-offset list for the file. + /// + /// Previous IgnoreOffset list for the file. + public string PreviousIgnoreOffsets + { + get { return this.Fields[2].PreviousData; } + set { this.Fields[2].PreviousData = value; } + } + + /// + /// Gets or sets the delta patch ignore-length list for the file. + /// + /// IgnoreLength list for the file. + public string IgnoreLengths + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the previous delta patch ignore-length list for the file. + /// + /// Previous IgnoreLength list for the file. + public string PreviousIgnoreLengths + { + get { return this.Fields[3].PreviousData; } + set { this.Fields[3].PreviousData = value; } + } + + /// + /// Gets or sets the delta patch retain-offset list for the file. + /// + /// RetainOffset list for the file. + public string RetainOffsets + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the previous delta patch retain-offset list for the file. + /// + /// PreviousRetainOffset list for the file. + public string PreviousRetainOffsets + { + get { return this.Fields[4].PreviousData; } + set { this.Fields[4].PreviousData = value; } + } + + /// + /// Gets or sets the symbol paths for the file. + /// + /// SymbolPath list for the file. + /// This is set during binding. + public string Symbols + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the previous symbol paths for the file. + /// + /// PreviousSymbolPath list for the file. + /// This is set during binding. + public string PreviousSymbols + { + get { return (string)this.Fields[5].PreviousData; } + set { this.Fields[5].PreviousData = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchSymbolPathsRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchSymbolPathsRow.cs new file mode 100644 index 00000000..b6c0b840 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixDeltaPatchSymbolPathsRow.cs @@ -0,0 +1,58 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixDeltaPatchSymbolPaths table. + /// + public sealed class WixDeltaPatchSymbolPathsRow : Row + { + /// + /// Creates a WixDeltaPatchSymbolPaths row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixDeltaPatchSymbolPathsRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixDeltaPatchSymbolPaths row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixDeltaPatchSymbolPathsRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the identifier the symbol paths apply to. + /// + /// RetainLength list for the file. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the type of the identifier. + /// + public SymbolPathType Type + { + get { return (SymbolPathType)this.Fields[1].AsInteger(); } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the delta patch symbol paths. + /// + public string SymbolPaths + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixFileRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixFileRow.cs new file mode 100644 index 00000000..c006355a --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixFileRow.cs @@ -0,0 +1,163 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +using WixToolset.Data.Tuples; + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixFile table. + /// + public sealed class WixFileRow : Row + { + /// + /// Creates a WixFile row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this row belongs to and should get its column definitions from. + public WixFileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixFile row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixFileRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the primary key of the file row. + /// + /// Primary key of the file row. + public string File + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the assembly type of the file row. + /// + /// Assembly type of the file row. + public FileAssemblyType AssemblyType + { + get { return (null == this.Fields[1]) ? FileAssemblyType.NotAnAssembly : (FileAssemblyType)this.Fields[1].AsInteger(); } + set { this.Fields[1].Data = (int)value; } + } + + /// + /// Gets or sets the identifier for the assembly manifest. + /// + /// Identifier for the assembly manifest. + public string AssemblyManifest + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets or sets the application for the assembly. + /// + /// Application for the assembly. + public string AssemblyApplication + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the directory of the file. + /// + /// Directory of the file. + public string Directory + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the disk id for this file. + /// + /// Disk id for the file. + public int DiskId + { + get { return (int)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + /// + /// Gets or sets the source location to the file. + /// + /// Source location to the file. + public string Source + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets or sets the source location to the file. + /// + /// Source location to the file. + public string PreviousSource + { + get { return (string)this.Fields[6].PreviousData; } + set { this.Fields[6].PreviousData = value; } + } + + /// + /// Gets or sets the architecture the file executes on. + /// + /// Architecture the file executes on. + public string ProcessorArchitecture + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + + /// + /// Gets or sets the patch group of a patch-added file. + /// + /// The patch group of a patch-added file. + public int PatchGroup + { + get { return (null == this.Fields[8].Data) ? 0 : (int)this.Fields[8].Data; } + set { this.Fields[8].Data = value; } + } + + /// + /// Gets or sets the attributes on a file. + /// + /// Attributes on a file. + public int Attributes + { + get { return (int)this.Fields[9].Data; } + set { this.Fields[9].Data = value; } + } + + /// + /// Gets or sets the patching attributes to the file. + /// + /// Patching attributes of the file. + public PatchAttributeType PatchAttributes + { + get { return (PatchAttributeType)this.Fields[10].AsInteger(); } + set { this.Fields[10].Data = (int)value; } + } + + /// + /// Gets or sets the path to the delta patch header. + /// + /// Patch header path. + /// Set by the binder only when doing delta patching. + public string DeltaPatchHeaderSource + { + get { return (string)this.Fields[11].Data; } + set { this.Fields[11].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixGroupRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixGroupRow.cs new file mode 100644 index 00000000..d36338d1 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixGroupRow.cs @@ -0,0 +1,62 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Specialization of a row for the WixGroup table. + /// + public sealed class WixGroupRow : Row + { + /// + /// Creates a WixGroupRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixGroupRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the parent identifier of the complex reference. + /// + /// Parent identifier of the complex reference. + public string ParentId + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets the parent type of the complex reference. + /// + /// Parent type of the complex reference. + public ComplexReferenceParentType ParentType + { + get { return (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), (string)this.Fields[1].Data); } + set { this.Fields[1].Data = value.ToString(); } + } + + /// + /// Gets the child identifier of the complex reference. + /// + /// Child identifier of the complex reference. + public string ChildId + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets the child type of the complex reference. + /// + /// Child type of the complex reference. + public ComplexReferenceChildType ChildType + { + get { return (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), (string)this.Fields[3].Data); } + set { this.Fields[3].Data = value.ToString(); } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaRow.cs new file mode 100644 index 00000000..c1b3e155 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaRow.cs @@ -0,0 +1,60 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the WixMedia table. + /// + public sealed class WixMediaRow : Row + { + /// + /// Creates a WixMedia row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Media row belongs to and should get its column definitions from. + public WixMediaRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixMedia row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this Media row belongs to and should get its column definitions from. + public WixMediaRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the disk id for this media. + /// + /// Disk id for the media. + public int DiskId + { + get { return (int)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the compression level for this media row. + /// + /// Compression level. + public CompressionLevel? CompressionLevel + { + get { return (CompressionLevel?)this.Fields[1].AsNullableInteger(); } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the layout location for this media row. + /// + /// Layout location to the root of the media. + public string Layout + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaTemplateRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaTemplateRow.cs new file mode 100644 index 00000000..27c5ccce --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixMediaTemplateRow.cs @@ -0,0 +1,81 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + /// + /// Specialization of a row for the MediaTemplate table. + /// + public sealed class WixMediaTemplateRow : Row + { + /// + /// Creates a MediaTemplate row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this MediaTeplate row belongs to and should get its column definitions from. + public WixMediaTemplateRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the cabinet template name for this media template row. + /// + /// Cabinet name. + public string CabinetTemplate + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the compression level for this media template row. + /// + /// Compression level. + public CompressionLevel? CompressionLevel + { + get { return (CompressionLevel?)this.Fields[1].AsNullableInteger(); } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets or sets the disk prompt for this media template row. + /// + /// Disk prompt. + public string DiskPrompt + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + + /// + /// Gets or sets the volume label for this media template row. + /// + /// Volume label. + public string VolumeLabel + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets or sets the maximum uncompressed media size for this media template row. + /// + /// Disk id. + public int MaximumUncompressedMediaSize + { + get { return (int)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets or sets the Maximum Cabinet Size For Large File Splitting for this media template row. + /// + /// Disk id. + public int MaximumCabinetSizeForLargeFileSplitting + { + get { return (int)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixMergeRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixMergeRow.cs new file mode 100644 index 00000000..54f2125c --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixMergeRow.cs @@ -0,0 +1,149 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Globalization; + using System.Text; + using System.Xml; + + /// + /// Specialization of a row for tracking merge statements. + /// + public sealed class WixMergeRow : Row + { + /// + /// Creates a Merge row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this Merge row belongs to and should get its column definitions from. + public WixMergeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// Creates a Merge row that belongs to a table. + /// Original source lines for this row. + /// Table this Merge row belongs to and should get its column definitions from. + public WixMergeRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets and sets the id for a merge row. + /// + /// Id for the row. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets and sets the language for a merge row. + /// + /// Language for the row. + public string Language + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets and sets the directory for a merge row. + /// + /// Direcotory for the row. + public string Directory + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + /// + /// Gets and sets the path to the merge module for a merge row. + /// + /// Source path for the row. + public string SourceFile + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + /// + /// Gets and sets the disk id the merge module should be placed on for a merge row. + /// + /// Disk identifier for row. + public int DiskId + { + get { return (int)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + /// + /// Gets and sets the compression value for a merge row. + /// + /// Compression for a merge row. + public YesNoType FileCompression + { + get + { + if (null == this.Fields[5].Data) + { + return YesNoType.NotSet; + } + else if (1 == (int)this.Fields[5].Data) + { + return YesNoType.Yes; + } + else if (0 == (int)this.Fields[5].Data) + { + return YesNoType.No; + } + else + { + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_MergeTableFileCompressionColumnContainsInvalidValue, this.Fields[5].Data)); + } + } + set + { + if (YesNoType.Yes == value) + { + this.Fields[5].Data = 1; + } + else if (YesNoType.No == value) + { + this.Fields[5].Data = 0; + } + else if (YesNoType.NotSet == value) + { + this.Fields[5].Data = null; + } + else + { + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_CannotSetMergeTableFileCompressionColumnToInvalidValue, value)); + } + } + } + + /// + /// Gets and sets the configuration data for a merge row. + /// + /// Comma delimited string of "name=value" pairs. + public string ConfigurationData + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + + /// + /// Gets and sets the primary feature for a merge row. + /// + /// The primary feature for a merge row. + public string Feature + { + get { return (string)this.Fields[7].Data; } + set { this.Fields[7].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixPayloadPropertiesRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixPayloadPropertiesRow.cs new file mode 100644 index 00000000..2e5f53ad --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixPayloadPropertiesRow.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2004, Outercurve Foundation. +// This software is released under Microsoft Reciprocal License (MS-RL). +// The license and further copyright text can be found in the file +// LICENSE.TXT at the root directory of the distribution. +// +//------------------------------------------------------------------------------------------------- + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Specialization of a row for the WixPayloadProperties table. + /// + public class WixPayloadPropertiesRow : Row + { + /// + /// Creates a WixPayloadProperties row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this WixPayloadProperties row belongs to and should get its column definitions from. + public WixPayloadPropertiesRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixPayloadProperties row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixPayloadProperties row belongs to and should get its column definitions from. + public WixPayloadPropertiesRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Package + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public string Container + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public string Size + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + + public string DownloadUrl + { + get { return (string)this.Fields[5].Data; } + set { this.Fields[5].Data = value; } + } + + public string LayoutOnly + { + get { return (string)this.Fields[6].Data; } + set { this.Fields[6].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixPropertyRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixPropertyRow.cs new file mode 100644 index 00000000..5285195c --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixPropertyRow.cs @@ -0,0 +1,118 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Globalization; + + /// + /// Specialization of a row for the WixProperty table. + /// + public sealed class WixPropertyRow : Row + { + /// Creates a WixProperty row that belongs to a table. + /// Original source lines for this row. + /// Table this WixProperty row belongs to and should get its column definitions from. + public WixPropertyRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + /// + /// Gets and sets the id for this property row. + /// + /// Id for the property. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets and sets if this is an admin property row. + /// + /// Flag if this is an admin property. + public bool Admin + { + get + { + return (0x1 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x1)); + } + + set + { + if (null == this.Fields[1].Data) + { + this.Fields[1].Data = 0; + } + + if (value) + { + this.Fields[1].Data = (int)this.Fields[1].Data | 0x1; + } + else + { + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x1; + } + } + } + + /// + /// Gets and sets if this is a hidden property row. + /// + /// Flag if this is a hidden property. + public bool Hidden + { + get + { + return (0x2 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x2)); + } + + set + { + if (null == this.Fields[1].Data) + { + this.Fields[1].Data = 0; + } + + if (value) + { + this.Fields[1].Data = (int)this.Fields[1].Data | 0x2; + } + else + { + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x2; + } + } + } + + /// + /// Gets and sets if this is a secure property row. + /// + /// Flag if this is a secure property. + public bool Secure + { + get + { + return (0x4 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x4)); + } + + set + { + if (null == this.Fields[1].Data) + { + this.Fields[1].Data = 0; + } + + if (value) + { + this.Fields[1].Data = (int)this.Fields[1].Data | 0x4; + } + else + { + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x4; + } + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixRelatedBundleRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixRelatedBundleRow.cs new file mode 100644 index 00000000..95fffde5 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixRelatedBundleRow.cs @@ -0,0 +1,52 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using Serialize = WixToolset.Data.Serialize; + + /// + /// Specialization of a row for the RelatedBundle table. + /// + public sealed class WixRelatedBundleRow : Row + { + /// + /// Creates a RelatedBundle row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this RelatedBundle row belongs to and should get its column definitions from. + public WixRelatedBundleRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a RelatedBundle row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this RelatedBundle row belongs to and should get its column definitions from. + public WixRelatedBundleRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Gets or sets the related bundle identifier. + /// + /// The related bundle identifier. + public string Id + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + /// + /// Gets or sets the related bundle action. + /// + /// The related bundle action. + public Serialize.RelatedBundle.ActionType Action + { + get { return (Serialize.RelatedBundle.ActionType)this.Fields[1].Data; } + set { this.Fields[1].Data = (int)value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixSimpleReferenceRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixSimpleReferenceRow.cs new file mode 100644 index 00000000..3a2cf8f1 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixSimpleReferenceRow.cs @@ -0,0 +1,63 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + using System.Diagnostics; + using System.Xml; + + /// + /// Specialization of a row for the WixSimpleReference table. + /// + public sealed class WixSimpleReferenceRow : Row + { + /// + /// Creates a WixSimpleReferenceRow that belongs to a table. + /// + /// Original source lines for this row. + /// Table this row belongs to and should get its column definitions from. + public WixSimpleReferenceRow(SourceLineNumber sourceLineNumbers, Table table) + : base(sourceLineNumbers, table) + { + } + + /// + /// Creates a WixSimpleReferenceRow that belongs to a table. + /// + /// Original source lines for this row. + /// Table definitions for this row. + public WixSimpleReferenceRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinitions) + : base(sourceLineNumbers, tableDefinitions) + { + } + + /// + /// Gets or sets the primary keys of the simple reference. + /// + /// The primary keys of the simple reference. + public string PrimaryKeys + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + /// + /// Gets the symbolic name. + /// + /// Symbolic name. + public string SymbolicName + { + get { return String.Concat(this.TableName, ":", this.PrimaryKeys); } + } + + /// + /// Gets or sets the table name of the simple reference. + /// + /// The table name of the simple reference. + public string TableName + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Rows/WixUpdateRegistrationRow.cs b/src/WixToolset.Data.WindowsInstaller/Rows/WixUpdateRegistrationRow.cs new file mode 100644 index 00000000..8d86f970 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Rows/WixUpdateRegistrationRow.cs @@ -0,0 +1,62 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data.Rows +{ + using System; + + /// + /// Update registration information for Binding. + /// + public class WixUpdateRegistrationRow : Row + { + /// + /// Creates a WixUpdateRegistrationRow row that does not belong to a table. + /// + /// Original source lines for this row. + /// TableDefinition this WixUpdateRegistrationRow row belongs to and should get its column definitions from. + public WixUpdateRegistrationRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) : + base(sourceLineNumbers, tableDef) + { + } + + /// + /// Creates a WixUpdateRegistrationRow row that belongs to a table. + /// + /// Original source lines for this row. + /// Table this WixUpdateRegistrationRow row belongs to and should get its column definitions from. + public WixUpdateRegistrationRow(SourceLineNumber sourceLineNumbers, Table table) : + base(sourceLineNumbers, table) + { + } + + public string Manufacturer + { + get { return (string)this.Fields[0].Data; } + set { this.Fields[0].Data = value; } + } + + public string Department + { + get { return (string)this.Fields[1].Data; } + set { this.Fields[1].Data = value; } + } + + public string ProductFamily + { + get { return (string)this.Fields[2].Data; } + set { this.Fields[2].Data = value; } + } + + public string Name + { + get { return (string)this.Fields[3].Data; } + set { this.Fields[3].Data = value; } + } + + public string Classification + { + get { return (string)this.Fields[4].Data; } + set { this.Fields[4].Data = value; } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/SubStorage.cs b/src/WixToolset.Data.WindowsInstaller/SubStorage.cs new file mode 100644 index 00000000..e136bfe9 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/SubStorage.cs @@ -0,0 +1,109 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System.Xml; + + /// + /// Substorage inside an output. + /// + public sealed class SubStorage + { + /// + /// Instantiate a new substorage. + /// + /// The substorage name. + /// The substorage data. + public SubStorage(string name, Output data) + { + this.Name = name; + this.Data = data; + } + + /// + /// Gets the substorage name. + /// + /// The substorage name. + public string Name { get; private set; } + + /// + /// Gets the substorage data. + /// + /// The substorage data. + public Output Data { get; private set; } + + /// + /// Creates a SubStorage from the XmlReader. + /// + /// Reader to get data from. + /// New SubStorage object. + internal static SubStorage Read(XmlReader reader) + { + if (!reader.LocalName.Equals("subStorage" == reader.LocalName)) + { + throw new XmlException(); + } + + Output data = null; + bool empty = reader.IsEmptyElement; + string name = null; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "name": + name = reader.Value; + break; + } + } + + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "wixOutput": + data = Output.Read(reader, true); + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return new SubStorage(name, data); + } + + /// + /// Persists a SubStorage in an XML format. + /// + /// XmlWriter where the SubStorage should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("subStorage", Output.XmlNamespaceUri); + + writer.WriteAttributeString("name", this.Name); + + this.Data.Write(writer); + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/Table.cs b/src/WixToolset.Data.WindowsInstaller/Table.cs new file mode 100644 index 00000000..4c0df0ad --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/Table.cs @@ -0,0 +1,435 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; + using System.Globalization; + using System.IO; + using System.Text; + using System.Xml; + using WixToolset.Data.Rows; + + /// + /// Object that represents a table in a database. + /// + public sealed class Table + { + /// + /// Creates a table in a section. + /// + /// Section to add table to. + /// Definition of the table. + public Table(TableDefinition tableDefinition) + { + this.Definition = tableDefinition; + this.Rows = new List(); + } + + /// + /// Gets the table definition. + /// + /// Definition of the table. + public TableDefinition Definition { get; private set; } + + /// + /// Gets the name of the table. + /// + /// Name of the table. + public string Name + { + get { return this.Definition.Name; } + } + + /// + /// Gets or sets the table transform operation. + /// + /// The table transform operation. + public TableOperation Operation { get; set; } + + /// + /// Gets the rows contained in the table. + /// + /// Rows contained in the table. + public IList Rows { get; private set; } + + /// + /// Creates a new row in the table. + /// + /// Original source lines for this row. + /// Specifies whether to only create the row or add it to the table automatically. + /// Row created in table. + public Row CreateRow(SourceLineNumber sourceLineNumbers, bool add = true) + { + Row row; + + switch (this.Name) + { + case "BBControl": + row = new BBControlRow(sourceLineNumbers, this); + break; + case "WixBundlePackage": + row = new WixBundlePackageRow(sourceLineNumbers, this); + break; + case "WixBundleExePackage": + row = new WixBundleExePackageRow(sourceLineNumbers, this); + break; + case "WixBundleMsiPackage": + row = new WixBundleMsiPackageRow(sourceLineNumbers, this); + break; + case "WixBundleMspPackage": + row = new WixBundleMspPackageRow(sourceLineNumbers, this); + break; + case "WixBundleMsuPackage": + row = new WixBundleMsuPackageRow(sourceLineNumbers, this); + break; + case "Component": + row = new ComponentRow(sourceLineNumbers, this); + break; + case "WixBundleContainer": + row = new WixBundleContainerRow(sourceLineNumbers, this); + break; + case "Control": + row = new ControlRow(sourceLineNumbers, this); + break; + case "File": + row = new FileRow(sourceLineNumbers, this); + break; + case "WixBundleMsiFeature": + row = new WixBundleMsiFeatureRow(sourceLineNumbers, this); + break; + case "WixBundleMsiProperty": + row = new WixBundleMsiPropertyRow(sourceLineNumbers, this); + break; + case "Media": + row = new MediaRow(sourceLineNumbers, this); + break; + case "WixBundlePayload": + row = new WixBundlePayloadRow(sourceLineNumbers, this); + break; + case "Property": + row = new PropertyRow(sourceLineNumbers, this); + break; + case "WixRelatedBundle": + row = new WixRelatedBundleRow(sourceLineNumbers, this); + break; + case "WixBundleRelatedPackage": + row = new WixBundleRelatedPackageRow(sourceLineNumbers, this); + break; + case "WixBundleRollbackBoundary": + row = new WixBundleRollbackBoundaryRow(sourceLineNumbers, this); + break; + case "Upgrade": + row = new UpgradeRow(sourceLineNumbers, this); + break; + case "WixBundleVariable": + row = new WixBundleVariableRow(sourceLineNumbers, this); + break; + case "WixAction": + row = new WixActionRow(sourceLineNumbers, this); + break; + case "WixApprovedExeForElevation": + row = new WixApprovedExeForElevationRow(sourceLineNumbers, this); + break; + case "WixBundle": + row = new WixBundleRow(sourceLineNumbers, this); + break; + case "WixBundlePackageExitCode": + row = new WixBundlePackageExitCodeRow(sourceLineNumbers, this); + break; + case "WixBundlePatchTargetCode": + row = new WixBundlePatchTargetCodeRow(sourceLineNumbers, this); + break; + case "WixBundleSlipstreamMsp": + row = new WixBundleSlipstreamMspRow(sourceLineNumbers, this); + break; + case "WixBundleUpdate": + row = new WixBundleUpdateRow(sourceLineNumbers, this); + break; + case "WixBundleCatalog": + row = new WixBundleCatalogRow(sourceLineNumbers, this); + break; + case "WixChain": + row = new WixChainRow(sourceLineNumbers, this); + break; + case "WixChainItem": + row = new WixChainItemRow(sourceLineNumbers, this); + break; + case "WixBundlePackageCommandLine": + row = new WixBundlePackageCommandLineRow(sourceLineNumbers, this); + break; + case "WixComplexReference": + row = new WixComplexReferenceRow(sourceLineNumbers, this); + break; + case "WixDeltaPatchFile": + row = new WixDeltaPatchFileRow(sourceLineNumbers, this); + break; + case "WixDeltaPatchSymbolPaths": + row = new WixDeltaPatchSymbolPathsRow(sourceLineNumbers, this); + break; + case "WixFile": + row = new WixFileRow(sourceLineNumbers, this); + break; + case "WixGroup": + row = new WixGroupRow(sourceLineNumbers, this); + break; + case "WixMedia": + row = new WixMediaRow(sourceLineNumbers, this); + break; + case "WixMediaTemplate": + row = new WixMediaTemplateRow(sourceLineNumbers, this); + break; + case "WixMerge": + row = new WixMergeRow(sourceLineNumbers, this); + break; + case "WixPayloadProperties": + row = new WixPayloadPropertiesRow(sourceLineNumbers, this); + break; + case "WixProperty": + row = new WixPropertyRow(sourceLineNumbers, this); + break; + case "WixSimpleReference": + row = new WixSimpleReferenceRow(sourceLineNumbers, this); + break; + case "WixUpdateRegistration": + row = new WixUpdateRegistrationRow(sourceLineNumbers, this); + break; + + default: + row = new Row(sourceLineNumbers, this); + break; + } + + if (add) + { + this.Rows.Add(row); + } + + return row; + } + + /// + /// Parse a table from the xml. + /// + /// XmlReader where the intermediate is persisted. + /// Section to populate with persisted data. + /// TableDefinitions to use in the intermediate. + /// The parsed table. + internal static Table Read(XmlReader reader, TableDefinitionCollection tableDefinitions) + { + Debug.Assert("table" == reader.LocalName); + + bool empty = reader.IsEmptyElement; + TableOperation operation = TableOperation.None; + string name = null; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "name": + name = reader.Value; + break; + case "op": + switch (reader.Value) + { + case "add": + operation = TableOperation.Add; + break; + case "drop": + operation = TableOperation.Drop; + break; + default: + throw new XmlException(); + } + break; + } + } + + if (null == name) + { + throw new XmlException(); + } + + TableDefinition tableDefinition = tableDefinitions[name]; + Table table = new Table(tableDefinition); + table.Operation = operation; + + if (!empty) + { + bool done = false; + + // loop through all the rows in a table + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "row": + Row.Read(reader, table); + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return table; + } + + /// + /// Modularize the table. + /// + /// String containing the GUID of the Merge Module, if appropriate. + /// Optional collection of identifiers that should not be modularized. + public void Modularize(string modularizationGuid, ISet suppressModularizationIdentifiers) + { + List modularizedColumns = new List(); + + // find the modularized columns + for (int i = 0; i < this.Definition.Columns.Count; i++) + { + if (ColumnModularizeType.None != this.Definition.Columns[i].ModularizeType) + { + modularizedColumns.Add(i); + } + } + + if (0 < modularizedColumns.Count) + { + foreach (Row row in this.Rows) + { + foreach (int modularizedColumn in modularizedColumns) + { + Field field = row.Fields[modularizedColumn]; + + if (null != field.Data) + { + field.Data = row.GetModularizedValue(field, modularizationGuid, suppressModularizationIdentifiers); + } + } + } + } + } + + /// + /// Persists a row in an XML format. + /// + /// XmlWriter where the Row should persist itself as XML. + [SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Changing the way this string normalizes would result " + + "in a change to the way the intermediate files are generated, potentially causing extra churn in patches on an MSI built from an older version of WiX. " + + "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] + internal void Write(XmlWriter writer) + { + if (null == writer) + { + throw new ArgumentNullException("writer"); + } + + writer.WriteStartElement("table", Intermediate.XmlNamespaceUri); + writer.WriteAttributeString("name", this.Name); + + if (TableOperation.None != this.Operation) + { + writer.WriteAttributeString("op", this.Operation.ToString().ToLowerInvariant()); + } + + foreach (Row row in this.Rows) + { + row.Write(writer); + } + + writer.WriteEndElement(); + } + + /// + /// Writes the table in IDT format to the provided stream. + /// + /// Stream to write the table to. + /// Whether to keep columns added in a transform. + public void ToIdtDefinition(StreamWriter writer, bool keepAddedColumns) + { + if (this.Definition.Unreal) + { + return; + } + + if (TableDefinition.MaxColumnsInRealTable < this.Definition.Columns.Count) + { + throw new WixException(WixDataErrors.TooManyColumnsInRealTable(this.Definition.Name, this.Definition.Columns.Count, TableDefinition.MaxColumnsInRealTable)); + } + + // Tack on the table header, and flush before we start writing bytes directly to the stream. + writer.Write(this.Definition.ToIdtDefinition(keepAddedColumns)); + writer.Flush(); + + using (var binary = new BinaryWriter(writer.BaseStream, writer.Encoding, true)) + { + // Create an encoding that replaces characters with question marks, and doesn't throw. We'll + // use this in case of errors + Encoding convertEncoding = Encoding.GetEncoding(writer.Encoding.CodePage); + + foreach (Row row in this.Rows) + { + if (row.Redundant) + { + continue; + } + + string rowString = row.ToIdtDefinition(keepAddedColumns); + byte[] rowBytes; + + try + { + // GetBytes will throw an exception if any character doesn't match our current encoding + rowBytes = writer.Encoding.GetBytes(rowString); + } + catch (EncoderFallbackException) + { + Messaging.Instance.OnMessage(WixDataErrors.InvalidStringForCodepage(row.SourceLineNumbers, Convert.ToString(writer.Encoding.WindowsCodePage, CultureInfo.InvariantCulture))); + + rowBytes = convertEncoding.GetBytes(rowString); + } + + binary.Write(rowBytes, 0, rowBytes.Length); + } + } + } + + /// + /// Validates the rows of this OutputTable and throws if it collides on + /// primary keys. + /// + public void ValidateRows() + { + Dictionary primaryKeys = new Dictionary(); + + foreach (Row row in this.Rows) + { + string primaryKey = row.GetPrimaryKey(); + + SourceLineNumber collisionSourceLineNumber; + if (primaryKeys.TryGetValue(primaryKey, out collisionSourceLineNumber)) + { + throw new WixException(WixDataErrors.DuplicatePrimaryKey(collisionSourceLineNumber, primaryKey, this.Definition.Name)); + } + + primaryKeys.Add(primaryKey, row.SourceLineNumbers); + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/TableDefinition.cs b/src/WixToolset.Data.WindowsInstaller/TableDefinition.cs new file mode 100644 index 00000000..40aaac84 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/TableDefinition.cs @@ -0,0 +1,334 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Text; + using System.Xml; + + /// + /// Definition of a table in a database. + /// + public sealed class TableDefinition : IComparable + { + /// + /// Tracks the maximum number of columns supported in a real table. + /// This is a Windows Installer limitation. + /// + public const int MaxColumnsInRealTable = 32; + + /// + /// Creates a table definition. + /// + /// Name of table to create. + /// Flag if rows in this table create symbols. + /// Flag if table is unreal. + /// Flag if table is part of UX Manifest. + public TableDefinition(string name, IList columns, bool createSymbols, bool unreal, bool bootstrapperApplicationData = false) + { + this.Name = name; + this.CreateSymbols = createSymbols; + this.Unreal = unreal; + this.BootstrapperApplicationData = bootstrapperApplicationData; + + this.Columns = new ReadOnlyCollection(columns); + } + + /// + /// Gets if rows in this table create symbols. + /// + /// Flag if rows in this table create symbols. + public bool CreateSymbols { get; private set; } + + /// + /// Gets the name of the table. + /// + /// Name of the table. + public string Name { get; private set; } + + /// + /// Gets if the table is unreal. + /// + /// Flag if table is unreal. + public bool Unreal { get; private set; } + + /// + /// Gets if the table is a part of the bootstrapper application data manifest. + /// + /// Flag if table is a part of the bootstrapper application data manifest. + public bool BootstrapperApplicationData { get; private set; } + + /// + /// Gets the collection of column definitions for this table. + /// + /// Collection of column definitions for this table. + public IList Columns { get; private set; } + + /// + /// Gets the column definition in the table by index. + /// + /// Index of column to locate. + /// Column definition in the table by index. + public ColumnDefinition this[int columnIndex] + { + get { return this.Columns[columnIndex]; } + } + + /// + /// Gets the table definition in IDT format. + /// + /// Whether to keep columns added in a transform. + /// Table definition in IDT format. + public string ToIdtDefinition(bool keepAddedColumns) + { + bool first = true; + StringBuilder columnString = new StringBuilder(); + StringBuilder dataString = new StringBuilder(); + StringBuilder tableString = new StringBuilder(); + + tableString.Append(this.Name); + foreach (ColumnDefinition column in this.Columns) + { + // conditionally keep columns added in a transform; otherwise, + // break because columns can only be added at the end + if (column.Added && !keepAddedColumns) + { + break; + } + + if (!first) + { + columnString.Append('\t'); + dataString.Append('\t'); + } + + columnString.Append(column.Name); + dataString.Append(column.IdtType); + + if (column.PrimaryKey) + { + tableString.AppendFormat("\t{0}", column.Name); + } + + first = false; + } + columnString.Append("\r\n"); + columnString.Append(dataString); + columnString.Append("\r\n"); + columnString.Append(tableString); + columnString.Append("\r\n"); + + return columnString.ToString(); + } + + /// + /// Adds the validation rows to the _Validation table. + /// + /// The _Validation table. + public void AddValidationRows(Table validationTable) + { + foreach (ColumnDefinition columnDef in this.Columns) + { + Row row = validationTable.CreateRow(null); + + row[0] = this.Name; + + row[1] = columnDef.Name; + + if (columnDef.Nullable) + { + row[2] = "Y"; + } + else + { + row[2] = "N"; + } + + if (columnDef.IsMinValueSet) + { + row[3] = columnDef.MinValue; + } + + if (columnDef.IsMaxValueSet) + { + row[4] = columnDef.MaxValue; + } + + row[5] = columnDef.KeyTable; + + if (columnDef.IsKeyColumnSet) + { + row[6] = columnDef.KeyColumn; + } + + if (ColumnCategory.Unknown != columnDef.Category) + { + row[7] = columnDef.Category.ToString(); + } + + row[8] = columnDef.Possibilities; + + row[9] = columnDef.Description; + } + } + + /// + /// Compares this table definition to another table definition. + /// + /// + /// Only Windows Installer traits are compared, allowing for updates to WiX-specific table definitions. + /// + /// The updated to compare with this target definition. + /// 0 if the tables' core properties are the same; otherwise, non-0. + public int CompareTo(TableDefinition updated) + { + // by definition, this object is greater than null + if (null == updated) + { + return 1; + } + + // compare the table names + int ret = String.Compare(this.Name, updated.Name, StringComparison.Ordinal); + + // compare the column count + if (0 == ret) + { + // transforms can only add columns + ret = Math.Min(0, updated.Columns.Count - this.Columns.Count); + + // compare name, type, and length of each column + for (int i = 0; 0 == ret && this.Columns.Count > i; i++) + { + ColumnDefinition thisColumnDef = this.Columns[i]; + ColumnDefinition updatedColumnDef = updated.Columns[i]; + + ret = thisColumnDef.CompareTo(updatedColumnDef); + } + } + + return ret; + } + + /// + /// Parses table definition from xml reader. + /// + /// Reader to get data from. + /// The TableDefintion represented by the Xml. + internal static TableDefinition Read(XmlReader reader) + { + bool empty = reader.IsEmptyElement; + bool createSymbols = false; + string name = null; + bool unreal = false; + bool bootstrapperApplicationData = false; + + while (reader.MoveToNextAttribute()) + { + switch (reader.LocalName) + { + case "createSymbols": + createSymbols = reader.Value.Equals("yes"); + break; + case "name": + name = reader.Value; + break; + case "unreal": + unreal = reader.Value.Equals("yes"); + break; + case "bootstrapperApplicationData": + bootstrapperApplicationData = reader.Value.Equals("yes"); + break; + } + } + + if (null == name) + { + throw new XmlException(); + } + + List columns = new List(); + bool hasPrimaryKeyColumn = false; + + // parse the child elements + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "columnDefinition": + ColumnDefinition columnDefinition = ColumnDefinition.Read(reader); + columns.Add(columnDefinition); + + if (columnDefinition.PrimaryKey) + { + hasPrimaryKeyColumn = true; + } + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!unreal && !bootstrapperApplicationData && !hasPrimaryKeyColumn) + { + throw new WixException(WixDataErrors.RealTableMissingPrimaryKeyColumn(SourceLineNumber.CreateFromUri(reader.BaseURI), name)); + } + + if (!done) + { + throw new XmlException(); + } + } + + TableDefinition tableDefinition = new TableDefinition(name, columns, createSymbols, unreal, bootstrapperApplicationData); + return tableDefinition; + } + + /// + /// Persists an output in an XML format. + /// + /// XmlWriter where the Output should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("tableDefinition", TableDefinitionCollection.XmlNamespaceUri); + + writer.WriteAttributeString("name", this.Name); + + if (this.CreateSymbols) + { + writer.WriteAttributeString("createSymbols", "yes"); + } + + if (this.Unreal) + { + writer.WriteAttributeString("unreal", "yes"); + } + + if (this.BootstrapperApplicationData) + { + writer.WriteAttributeString("bootstrapperApplicationData", "yes"); + } + + foreach (ColumnDefinition columnDefinition in this.Columns) + { + columnDefinition.Write(writer); + } + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/TableDefinitionCollection.cs b/src/WixToolset.Data.WindowsInstaller/TableDefinitionCollection.cs new file mode 100644 index 00000000..553f0eaa --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/TableDefinitionCollection.cs @@ -0,0 +1,229 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Xml; + + /// + /// Collection for table definitions indexed by table name. + /// + public sealed class TableDefinitionCollection : ICollection + { + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wi/tables"; + + private Dictionary collection; + + /// + /// Instantiate a new TableDefinitionCollection class. + /// + public TableDefinitionCollection() + { + this.collection = new Dictionary(); + } + + /// + /// Creates a shallow copy of the provided table definition collection. + /// + public TableDefinitionCollection(TableDefinitionCollection tableDefinitions) + { + this.collection = new Dictionary(tableDefinitions.collection); + } + + /// + /// Gets the number of items in the collection. + /// + /// Number of items in collection. + public int Count + { + get { return this.collection.Count; } + } + + /// + /// Table definition collections are never read-only. + /// + public bool IsReadOnly + { + get { return false; } + } + + /// + /// Gets a table definition by name. + /// + /// Name of table to locate. + public TableDefinition this[string tableName] + { + get + { + TableDefinition table; + if (!this.collection.TryGetValue(tableName, out table)) + { + throw new WixMissingTableDefinitionException(WixDataErrors.MissingTableDefinition(tableName)); + } + + return table; + } + } + + /// + /// Load a table definition collection from an XmlReader. + /// + /// Reader to get data from. + /// Suppress xml schema validation while loading. + /// The TableDefinitionCollection represented by the xml. + public static TableDefinitionCollection Load(XmlReader reader) + { + reader.MoveToContent(); + + return Read(reader); + } + + /// + /// Adds a table definition to the collection. + /// + /// Table definition to add to the collection. + /// Indexes by table definition name. + public void Add(TableDefinition tableDefinition) + { + this.collection.Add(tableDefinition.Name, tableDefinition); + } + + /// + /// Removes all table definitions from the collection. + /// + public void Clear() + { + this.collection.Clear(); + } + + /// + /// Checks if the collection contains a table name. + /// + /// The table to check in the collection. + /// True if collection contains the table. + public bool Contains(string tableName) + { + return this.collection.ContainsKey(tableName); + } + + /// + /// Checks if the collection contains a table. + /// + /// The table to check in the collection. + /// True if collection contains the table. + public bool Contains(TableDefinition table) + { + return this.collection.ContainsKey(table.Name); + } + + /// + /// Copies table definitions to an arry. + /// + /// Array to copy the table definitions to. + /// Index in the array to start copying at. + public void CopyTo(TableDefinition[] array, int index) + { + this.collection.Values.CopyTo(array, index); + } + + /// + /// Removes a table definition from the collection. + /// + /// Table to remove from the collection. + /// True if the table definition existed in the collection and was removed. + public bool Remove(TableDefinition table) + { + return this.collection.Remove(table.Name); + } + + /// + /// Gets enumerator for the collection. + /// + /// Enumerator for the collection. + public IEnumerator GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + + /// + /// Gets the untyped enumerator for the collection. + /// + /// Untyped enumerator for the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + + /// + /// Loads a collection of table definitions from a XmlReader in memory. + /// + /// Reader to get data from. + /// The TableDefinitionCollection represented by the xml. + internal static TableDefinitionCollection Read(XmlReader reader) + { + if ("tableDefinitions" != reader.LocalName) + { + throw new XmlException(); + } + + bool empty = reader.IsEmptyElement; + TableDefinitionCollection tableDefinitionCollection = new TableDefinitionCollection(); + + while (reader.MoveToNextAttribute()) + { + } + + // parse the child elements + if (!empty) + { + bool done = false; + + while (!done && reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + switch (reader.LocalName) + { + case "tableDefinition": + tableDefinitionCollection.Add(TableDefinition.Read(reader)); + break; + default: + throw new XmlException(); + } + break; + case XmlNodeType.EndElement: + done = true; + break; + } + } + + if (!done) + { + throw new XmlException(); + } + } + + return tableDefinitionCollection; + } + + /// + /// Persists a TableDefinitionCollection in an XML format. + /// + /// XmlWriter where the TableDefinitionCollection should persist itself as XML. + internal void Write(XmlWriter writer) + { + writer.WriteStartElement("tableDefinitions", XmlNamespaceUri); + + foreach (TableDefinition tableDefinition in this.collection.Values.OrderBy(t => t.Name)) + { + tableDefinition.Write(writer); + } + + writer.WriteEndElement(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/TableExtensions.cs b/src/WixToolset.Data.WindowsInstaller/TableExtensions.cs new file mode 100644 index 00000000..1be64ffe --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/TableExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System.Collections.Generic; + using System.Linq; + + /// + /// Methods that extend . + /// + public static class TableExtensions + { + /// + /// Gets the rows contained in the table as a particular row type. + /// + /// Table to get rows from. + /// If the is null, an empty enumerable will be returned. + public static IEnumerable RowsAs(this Table table) where T : Row + { + return (null == table) ? Enumerable.Empty() : table.Rows.Cast(); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/TableIndexedCollection.cs b/src/WixToolset.Data.WindowsInstaller/TableIndexedCollection.cs new file mode 100644 index 00000000..9f85efff --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/TableIndexedCollection.cs @@ -0,0 +1,153 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection for tables. + /// + public sealed class TableIndexedCollection : ICollection
+ { + private Dictionary collection; + + /// + /// Instantiate a new empty collection. + /// + public TableIndexedCollection() + { + this.collection = new Dictionary(); + } + + /// + /// Instantiate a new collection populated with a set of tables. + /// + /// Set of tables. + public TableIndexedCollection(IEnumerable
tables) + { + this.collection = tables.ToDictionary(t => t.Name); + } + + /// + /// Gets the number of items in the collection. + /// + /// Number of items in collection. + public int Count + { + get { return this.collection.Count; } + } + + /// + /// Table indexed collection is never read only. + /// + public bool IsReadOnly + { + get { return false; } + } + + /// + /// Adds a table to the collection. + /// + /// Table to add to the collection. + /// Indexes the table by name. + public void Add(Table table) + { + this.collection.Add(table.Name, table); + } + + /// + /// Clear the tables from the collection. + /// + public void Clear() + { + this.collection.Clear(); + } + + /// + /// Determines if a table is in the collection. + /// + /// Table to check if it is in the collection. + /// True if the table name is in the collection, otherwise false. + public bool Contains(Table table) + { + return this.collection.ContainsKey(table.Name); + } + + /// + /// Copies the collection into an array. + /// + /// Array to copy the collection into. + /// Index to start copying from. + public void CopyTo(Table[] array, int arrayIndex) + { + this.collection.Values.CopyTo(array, arrayIndex); + } + + /// + /// Remove a table from the collection by name. + /// + /// Table name to remove from the collection. + public void Remove(string tableName) + { + this.collection.Remove(tableName); + } + + /// + /// Remove a table from the collection. + /// + /// Table with matching name to remove from the collection. + public bool Remove(Table table) + { + return this.collection.Remove(table.Name); + } + + /// + /// Gets an enumerator over the whole collection. + /// + /// Collection enumerator. + public IEnumerator
GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + + /// + /// Gets an untyped enumerator over the whole collection. + /// + /// Untyped collection enumerator. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + + /// + /// Gets a table by name. + /// + /// Name of table to locate. + public Table this[string tableName] + { + get + { + Table table; + return this.collection.TryGetValue(tableName, out table) ? table : null; + } + + set + { + this.collection[tableName] = value; + } + } + + /// + /// Tries to find a table by name. + /// + /// Table name to locate. + /// Found table. + /// True if table with table name was found, otherwise false. + public bool TryGetTable(string tableName, out Table table) + { + return this.collection.TryGetValue(tableName, out table); + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/TableOperation.cs b/src/WixToolset.Data.WindowsInstaller/TableOperation.cs new file mode 100644 index 00000000..8df44e73 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/TableOperation.cs @@ -0,0 +1,25 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + /// + /// The table transform operations. + /// + public enum TableOperation + { + /// + /// No operation. + /// + None, + + /// + /// Added table. + /// + Add, + + /// + /// Dropped table. + /// + Drop, + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandard.cs b/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandard.cs new file mode 100644 index 00000000..ee4a5103 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandard.cs @@ -0,0 +1,442 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System.Collections.Generic; + using System.Reflection; + using System.Xml; + using WixToolset.Data.Rows; + + /// + /// Represents the Windows Installer standard objects. + /// + public static class WindowsInstallerStandard + { + private static readonly object lockObject = new object(); + + private static TableDefinitionCollection tableDefinitions; + private static WixActionRowCollection standardActions; + + private static HashSet standardActionNames; + private static HashSet standardDirectories; + private static HashSet standardProperties; + + /// + /// Gets the table definitions stored in this assembly. + /// + /// Table definition collection for tables stored in this assembly. + public static TableDefinitionCollection GetTableDefinitions() + { + lock (lockObject) + { + if (null == WindowsInstallerStandard.tableDefinitions) + { + using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Data.WindowsInstaller.Data.tables.xml"))) + { + tableDefinitions = TableDefinitionCollection.Load(reader); + } + } + } + + return WindowsInstallerStandard.tableDefinitions; + } + + /// + /// Gets the standard actions stored in this assembly. + /// + /// Collection of standard actions in this assembly. + public static WixActionRowCollection GetStandardActions() + { + lock (lockObject) + { + if (null == standardActions) + { + using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Data.WindowsInstaller.Data.actions.xml"))) + { + standardActions = WixActionRowCollection.Load(reader); + } + } + } + + return standardActions; + } + + /// + /// Gets (and loads if not yet loaded) the list of standard MSI directories. + /// + /// The list of standard MSI directories. + public static HashSet GetStandardDirectories() + { + lock (lockObject) + { + if (null == standardDirectories) + { + LoadStandardDirectories(); + } + } + + return standardDirectories; + } + + /// + /// Find out if an action is a standard action. + /// + /// Name of the action. + /// true if the action is standard, false otherwise. + public static bool IsStandardAction(string actionName) + { + lock (lockObject) + { + if (null == standardActionNames) + { + standardActionNames = new HashSet(); + standardActionNames.Add("AllocateRegistrySpace"); + standardActionNames.Add("AppSearch"); + standardActionNames.Add("BindImage"); + standardActionNames.Add("CCPSearch"); + standardActionNames.Add("CostFinalize"); + standardActionNames.Add("CostInitialize"); + standardActionNames.Add("CreateFolders"); + standardActionNames.Add("CreateShortcuts"); + standardActionNames.Add("DeleteServices"); + standardActionNames.Add("DisableRollback"); + standardActionNames.Add("DuplicateFiles"); + standardActionNames.Add("ExecuteAction"); + standardActionNames.Add("FileCost"); + standardActionNames.Add("FindRelatedProducts"); + standardActionNames.Add("ForceReboot"); + standardActionNames.Add("InstallAdminPackage"); + standardActionNames.Add("InstallExecute"); + standardActionNames.Add("InstallExecuteAgain"); + standardActionNames.Add("InstallFiles"); + standardActionNames.Add("InstallFinalize"); + standardActionNames.Add("InstallInitialize"); + standardActionNames.Add("InstallODBC"); + standardActionNames.Add("InstallServices"); + standardActionNames.Add("InstallSFPCatalogFile"); + standardActionNames.Add("InstallValidate"); + standardActionNames.Add("IsolateComponents"); + standardActionNames.Add("LaunchConditions"); + standardActionNames.Add("MigrateFeatureStates"); + standardActionNames.Add("MoveFiles"); + standardActionNames.Add("MsiConfigureServices"); + standardActionNames.Add("MsiPublishAssemblies"); + standardActionNames.Add("MsiUnpublishAssemblies"); + standardActionNames.Add("PatchFiles"); + standardActionNames.Add("ProcessComponents"); + standardActionNames.Add("PublishComponents"); + standardActionNames.Add("PublishFeatures"); + standardActionNames.Add("PublishProduct"); + standardActionNames.Add("RegisterClassInfo"); + standardActionNames.Add("RegisterComPlus"); + standardActionNames.Add("RegisterExtensionInfo"); + standardActionNames.Add("RegisterFonts"); + standardActionNames.Add("RegisterMIMEInfo"); + standardActionNames.Add("RegisterProduct"); + standardActionNames.Add("RegisterProgIdInfo"); + standardActionNames.Add("RegisterTypeLibraries"); + standardActionNames.Add("RegisterUser"); + standardActionNames.Add("RemoveDuplicateFiles"); + standardActionNames.Add("RemoveEnvironmentStrings"); + standardActionNames.Add("RemoveExistingProducts"); + standardActionNames.Add("RemoveFiles"); + standardActionNames.Add("RemoveFolders"); + standardActionNames.Add("RemoveIniValues"); + standardActionNames.Add("RemoveODBC"); + standardActionNames.Add("RemoveRegistryValues"); + standardActionNames.Add("RemoveShortcuts"); + standardActionNames.Add("ResolveSource"); + standardActionNames.Add("RMCCPSearch"); + standardActionNames.Add("ScheduleReboot"); + standardActionNames.Add("SelfRegModules"); + standardActionNames.Add("SelfUnregModules"); + standardActionNames.Add("SetODBCFolders"); + standardActionNames.Add("StartServices"); + standardActionNames.Add("StopServices"); + standardActionNames.Add("UnpublishComponents"); + standardActionNames.Add("UnpublishFeatures"); + standardActionNames.Add("UnregisterClassInfo"); + standardActionNames.Add("UnregisterComPlus"); + standardActionNames.Add("UnregisterExtensionInfo"); + standardActionNames.Add("UnregisterFonts"); + standardActionNames.Add("UnregisterMIMEInfo"); + standardActionNames.Add("UnregisterProgIdInfo"); + standardActionNames.Add("UnregisterTypeLibraries"); + standardActionNames.Add("ValidateProductID"); + standardActionNames.Add("WriteEnvironmentStrings"); + standardActionNames.Add("WriteIniValues"); + standardActionNames.Add("WriteRegistryValues"); + } + } + + return standardActionNames.Contains(actionName); + } + + /// + /// Find out if a directory is a standard directory. + /// + /// Name of the directory. + /// true if the directory is standard, false otherwise. + public static bool IsStandardDirectory(string directoryName) + { + lock (lockObject) + { + if (null == standardDirectories) + { + LoadStandardDirectories(); + } + } + + return standardDirectories.Contains(directoryName); + } + + /// + /// Find out if a property is a standard property. + /// References: + /// Title: Property Reference [Windows Installer]: + /// URL: http://msdn.microsoft.com/library/en-us/msi/setup/property_reference.asp + /// + /// Name of the property. + /// true if a property is standard, false otherwise. + public static bool IsStandardProperty(string propertyName) + { + lock (lockObject) + { + if (null == standardProperties) + { + standardProperties = new HashSet(); + standardProperties.Add("~"); // REG_MULTI_SZ/NULL marker + standardProperties.Add("ACTION"); + standardProperties.Add("ADDDEFAULT"); + standardProperties.Add("ADDLOCAL"); + standardProperties.Add("ADDDSOURCE"); + standardProperties.Add("AdminProperties"); + standardProperties.Add("AdminUser"); + standardProperties.Add("ADVERTISE"); + standardProperties.Add("AFTERREBOOT"); + standardProperties.Add("AllowProductCodeMismatches"); + standardProperties.Add("AllowProductVersionMajorMismatches"); + standardProperties.Add("ALLUSERS"); + standardProperties.Add("Alpha"); + standardProperties.Add("ApiPatchingSymbolFlags"); + standardProperties.Add("ARPAUTHORIZEDCDFPREFIX"); + standardProperties.Add("ARPCOMMENTS"); + standardProperties.Add("ARPCONTACT"); + standardProperties.Add("ARPHELPLINK"); + standardProperties.Add("ARPHELPTELEPHONE"); + standardProperties.Add("ARPINSTALLLOCATION"); + standardProperties.Add("ARPNOMODIFY"); + standardProperties.Add("ARPNOREMOVE"); + standardProperties.Add("ARPNOREPAIR"); + standardProperties.Add("ARPPRODUCTIONICON"); + standardProperties.Add("ARPREADME"); + standardProperties.Add("ARPSIZE"); + standardProperties.Add("ARPSYSTEMCOMPONENT"); + standardProperties.Add("ARPULRINFOABOUT"); + standardProperties.Add("ARPURLUPDATEINFO"); + standardProperties.Add("AVAILABLEFREEREG"); + standardProperties.Add("BorderSize"); + standardProperties.Add("BorderTop"); + standardProperties.Add("CaptionHeight"); + standardProperties.Add("CCP_DRIVE"); + standardProperties.Add("ColorBits"); + standardProperties.Add("COMPADDLOCAL"); + standardProperties.Add("COMPADDSOURCE"); + standardProperties.Add("COMPANYNAME"); + standardProperties.Add("ComputerName"); + standardProperties.Add("CostingComplete"); + standardProperties.Add("Date"); + standardProperties.Add("DefaultUIFont"); + standardProperties.Add("DISABLEADVTSHORTCUTS"); + standardProperties.Add("DISABLEMEDIA"); + standardProperties.Add("DISABLEROLLBACK"); + standardProperties.Add("DiskPrompt"); + standardProperties.Add("DontRemoveTempFolderWhenFinished"); + standardProperties.Add("EnableUserControl"); + standardProperties.Add("EXECUTEACTION"); + standardProperties.Add("EXECUTEMODE"); + standardProperties.Add("FASTOEM"); + standardProperties.Add("FILEADDDEFAULT"); + standardProperties.Add("FILEADDLOCAL"); + standardProperties.Add("FILEADDSOURCE"); + standardProperties.Add("IncludeWholeFilesOnly"); + standardProperties.Add("Installed"); + standardProperties.Add("INSTALLLEVEL"); + standardProperties.Add("Intel"); + standardProperties.Add("Intel64"); + standardProperties.Add("IsAdminPackage"); + standardProperties.Add("LeftUnit"); + standardProperties.Add("LIMITUI"); + standardProperties.Add("ListOfPatchGUIDsToReplace"); + standardProperties.Add("ListOfTargetProductCode"); + standardProperties.Add("LOGACTION"); + standardProperties.Add("LogonUser"); + standardProperties.Add("Manufacturer"); + standardProperties.Add("MEDIAPACKAGEPATH"); + standardProperties.Add("MediaSourceDir"); + standardProperties.Add("MinimumRequiredMsiVersion"); + standardProperties.Add("MsiAMD64"); + standardProperties.Add("MSIAPRSETTINGSIDENTIFIER"); + standardProperties.Add("MSICHECKCRCS"); + standardProperties.Add("MSIDISABLERMRESTART"); + standardProperties.Add("MSIENFORCEUPGRADECOMPONENTRULES"); + standardProperties.Add("MSIFASTINSTALL"); + standardProperties.Add("MsiFileToUseToCreatePatchTables"); + standardProperties.Add("MsiHiddenProperties"); + standardProperties.Add("MSIINSTALLPERUSER"); + standardProperties.Add("MSIINSTANCEGUID"); + standardProperties.Add("MsiLogFileLocation"); + standardProperties.Add("MsiLogging"); + standardProperties.Add("MsiNetAssemblySupport"); + standardProperties.Add("MSINEWINSTANCE"); + standardProperties.Add("MSINODISABLEMEDIA"); + standardProperties.Add("MsiNTProductType"); + standardProperties.Add("MsiNTSuiteBackOffice"); + standardProperties.Add("MsiNTSuiteDataCenter"); + standardProperties.Add("MsiNTSuiteEnterprise"); + standardProperties.Add("MsiNTSuiteSmallBusiness"); + standardProperties.Add("MsiNTSuiteSmallBusinessRestricted"); + standardProperties.Add("MsiNTSuiteWebServer"); + standardProperties.Add("MsiNTSuitePersonal"); + standardProperties.Add("MsiPatchRemovalList"); + standardProperties.Add("MSIPATCHREMOVE"); + standardProperties.Add("MSIRESTARTMANAGERCONTROL"); + standardProperties.Add("MsiRestartManagerSessionKey"); + standardProperties.Add("MSIRMSHUTDOWN"); + standardProperties.Add("MsiRunningElevated"); + standardProperties.Add("MsiUIHideCancel"); + standardProperties.Add("MsiUIProgressOnly"); + standardProperties.Add("MsiUISourceResOnly"); + standardProperties.Add("MsiSystemRebootPending"); + standardProperties.Add("MsiWin32AssemblySupport"); + standardProperties.Add("NOCOMPANYNAME"); + standardProperties.Add("NOUSERNAME"); + standardProperties.Add("OLEAdvtSupport"); + standardProperties.Add("OptimizePatchSizeForLargeFiles"); + standardProperties.Add("OriginalDatabase"); + standardProperties.Add("OutOfDiskSpace"); + standardProperties.Add("OutOfNoRbDiskSpace"); + standardProperties.Add("ParentOriginalDatabase"); + standardProperties.Add("ParentProductCode"); + standardProperties.Add("PATCH"); + standardProperties.Add("PATCH_CACHE_DIR"); + standardProperties.Add("PATCH_CACHE_ENABLED"); + standardProperties.Add("PatchGUID"); + standardProperties.Add("PATCHNEWPACKAGECODE"); + standardProperties.Add("PATCHNEWSUMMARYCOMMENTS"); + standardProperties.Add("PATCHNEWSUMMARYSUBJECT"); + standardProperties.Add("PatchOutputPath"); + standardProperties.Add("PatchSourceList"); + standardProperties.Add("PhysicalMemory"); + standardProperties.Add("PIDKEY"); + standardProperties.Add("PIDTemplate"); + standardProperties.Add("Preselected"); + standardProperties.Add("PRIMARYFOLDER"); + standardProperties.Add("PrimaryVolumePath"); + standardProperties.Add("PrimaryVolumeSpaceAvailable"); + standardProperties.Add("PrimaryVolumeSpaceRemaining"); + standardProperties.Add("PrimaryVolumeSpaceRequired"); + standardProperties.Add("Privileged"); + standardProperties.Add("ProductCode"); + standardProperties.Add("ProductID"); + standardProperties.Add("ProductLanguage"); + standardProperties.Add("ProductName"); + standardProperties.Add("ProductState"); + standardProperties.Add("ProductVersion"); + standardProperties.Add("PROMPTROLLBACKCOST"); + standardProperties.Add("REBOOT"); + standardProperties.Add("REBOOTPROMPT"); + standardProperties.Add("RedirectedDllSupport"); + standardProperties.Add("REINSTALL"); + standardProperties.Add("REINSTALLMODE"); + standardProperties.Add("RemoveAdminTS"); + standardProperties.Add("REMOVE"); + standardProperties.Add("ReplacedInUseFiles"); + standardProperties.Add("RestrictedUserControl"); + standardProperties.Add("RESUME"); + standardProperties.Add("RollbackDisabled"); + standardProperties.Add("ROOTDRIVE"); + standardProperties.Add("ScreenX"); + standardProperties.Add("ScreenY"); + standardProperties.Add("SecureCustomProperties"); + standardProperties.Add("ServicePackLevel"); + standardProperties.Add("ServicePackLevelMinor"); + standardProperties.Add("SEQUENCE"); + standardProperties.Add("SharedWindows"); + standardProperties.Add("ShellAdvtSupport"); + standardProperties.Add("SHORTFILENAMES"); + standardProperties.Add("SourceDir"); + standardProperties.Add("SOURCELIST"); + standardProperties.Add("SystemLanguageID"); + standardProperties.Add("TARGETDIR"); + standardProperties.Add("TerminalServer"); + standardProperties.Add("TextHeight"); + standardProperties.Add("Time"); + standardProperties.Add("TRANSFORMS"); + standardProperties.Add("TRANSFORMSATSOURCE"); + standardProperties.Add("TRANSFORMSSECURE"); + standardProperties.Add("TTCSupport"); + standardProperties.Add("UILevel"); + standardProperties.Add("UpdateStarted"); + standardProperties.Add("UpgradeCode"); + standardProperties.Add("UPGRADINGPRODUCTCODE"); + standardProperties.Add("UserLanguageID"); + standardProperties.Add("USERNAME"); + standardProperties.Add("UserSID"); + standardProperties.Add("Version9X"); + standardProperties.Add("VersionDatabase"); + standardProperties.Add("VersionMsi"); + standardProperties.Add("VersionNT"); + standardProperties.Add("VersionNT64"); + standardProperties.Add("VirtualMemory"); + standardProperties.Add("WindowsBuild"); + standardProperties.Add("WindowsVolume"); + } + } + + return standardProperties.Contains(propertyName); + } + + /// + /// Sets up a hashtable with the set of standard MSI directories + /// + private static void LoadStandardDirectories() + { + lock (lockObject) + { + if (null == standardDirectories) + { + standardDirectories = new HashSet(); + standardDirectories.Add("TARGETDIR"); + standardDirectories.Add("AdminToolsFolder"); + standardDirectories.Add("AppDataFolder"); + standardDirectories.Add("CommonAppDataFolder"); + standardDirectories.Add("CommonFilesFolder"); + standardDirectories.Add("DesktopFolder"); + standardDirectories.Add("FavoritesFolder"); + standardDirectories.Add("FontsFolder"); + standardDirectories.Add("LocalAppDataFolder"); + standardDirectories.Add("MyPicturesFolder"); + standardDirectories.Add("PersonalFolder"); + standardDirectories.Add("ProgramFilesFolder"); + standardDirectories.Add("ProgramMenuFolder"); + standardDirectories.Add("SendToFolder"); + standardDirectories.Add("StartMenuFolder"); + standardDirectories.Add("StartupFolder"); + standardDirectories.Add("System16Folder"); + standardDirectories.Add("SystemFolder"); + standardDirectories.Add("TempFolder"); + standardDirectories.Add("TemplateFolder"); + standardDirectories.Add("WindowsFolder"); + standardDirectories.Add("CommonFiles64Folder"); + standardDirectories.Add("ProgramFiles64Folder"); + standardDirectories.Add("System64Folder"); + standardDirectories.Add("NetHoodFolder"); + standardDirectories.Add("PrintHoodFolder"); + standardDirectories.Add("RecentFolder"); + standardDirectories.Add("WindowsVolume"); + } + } + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/WixInvalidIdtException.cs b/src/WixToolset.Data.WindowsInstaller/WixInvalidIdtException.cs new file mode 100644 index 00000000..33fd0591 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/WixInvalidIdtException.cs @@ -0,0 +1,32 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + + /// + /// WiX invalid idt exception. + /// + [Serializable] + public sealed class WixInvalidIdtException : WixException + { + /// + /// Instantiate a new WixInvalidIdtException. + /// + /// The invalid idt file. + public WixInvalidIdtException(string idtFile) : + base(WixDataErrors.InvalidIdt(new SourceLineNumber(idtFile), idtFile)) + { + } + + /// + /// Instantiate a new WixInvalidIdtException. + /// + /// The invalid idt file. + /// The table name of the invalid idt file. + public WixInvalidIdtException(string idtFile, string tableName) : + base(WixDataErrors.InvalidIdt(new SourceLineNumber(idtFile), idtFile, tableName)) + { + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/WixMissingTableDefinitionException.cs b/src/WixToolset.Data.WindowsInstaller/WixMissingTableDefinitionException.cs new file mode 100644 index 00000000..6295813b --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/WixMissingTableDefinitionException.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Data +{ + using System; + + /// + /// Exception thrown when a table definition is missing. + /// + [Serializable] + public class WixMissingTableDefinitionException : WixException + { + /// + /// Instantiate new WixMissingTableDefinitionException. + /// + /// Localized error information. + public WixMissingTableDefinitionException(MessageEventArgs error) + : base(error) + { + } + } +} diff --git a/src/WixToolset.Data.WindowsInstaller/WixToolset.Data.WindowsInstaller.csproj b/src/WixToolset.Data.WindowsInstaller/WixToolset.Data.WindowsInstaller.csproj new file mode 100644 index 00000000..bd8140c3 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/WixToolset.Data.WindowsInstaller.csproj @@ -0,0 +1,27 @@ + + + + + + netstandard2.0 + Data for Windows Installer + WiX Toolset Data Windows Installer + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb