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 --- src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 12 +- .../Bind/ProvidesDependency.cs | 2 + .../Bind/WixComponentSearchInfo.cs | 3 +- src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs | 2 + .../Bind/WixProductSearchInfo.cs | 2 + .../Bind/WixRegistrySearchInfo.cs | 3 +- src/WixToolset.Core.Burn/Bind/WixSearchInfo.cs | 2 + src/WixToolset.Core.Burn/BundleBackend.cs | 2 +- .../AutomaticallySlipstreamPatchesCommand.cs | 2 + ...CreateBootstrapperApplicationManifestCommand.cs | 2 + .../Bundles/CreateBurnManifestCommand.cs | 2 + .../Bundles/CreateContainerCommand.cs | 2 + .../Bundles/GetPackageFacadesCommand.cs | 2 + .../OrderPackagesAndRollbackBoundariesCommand.cs | 2 + src/WixToolset.Core.Burn/Bundles/PackageFacade.cs | 2 + .../Bundles/ProcessExePackageCommand.cs | 2 + .../Bundles/ProcessMsiPackageCommand.cs | 2 + .../Bundles/ProcessMspPackageCommand.cs | 2 + .../Bundles/ProcessMsuPackageCommand.cs | 4 +- .../Bundles/ProcessPayloadsCommand.cs | 2 + .../Bundles/VerifyPayloadsWithCatalogCommand.cs | 2 + .../Bind/AssignMediaCommand.cs | 10 +- .../Bind/BindDatabaseCommand.cs | 11 +- .../Bind/CreateDeltaPatchesCommand.cs | 3 + .../Bind/ExtractMergeModuleFilesCommand.cs | 31 +- .../Bind/GenerateDatabaseCommand.cs | 2 +- .../Bind/GetFileFacadesCommand.cs | 7 +- .../Bind/MergeModulesCommand.cs | 22 +- .../Bind/UpdateFileFacadesCommand.cs | 41 +- src/WixToolset.Core.WindowsInstaller/Decompiler.cs | 9357 ++++++++++++++++++++ .../DecompilerCore.cs | 154 + .../Inscribe/InscribeMsiPackageCommand.cs | 4 +- src/WixToolset.Core.WindowsInstaller/Melter.cs | 400 + src/WixToolset.Core.WindowsInstaller/MelterCore.cs | 30 + src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | 2 +- src/WixToolset.Core.WindowsInstaller/MsmBackend.cs | 2 +- src/WixToolset.Core.WindowsInstaller/MspBackend.cs | 7 +- src/WixToolset.Core.WindowsInstaller/MstBackend.cs | 5 +- src/WixToolset.Core.WindowsInstaller/Patch.cs | 3 + .../PatchTransform.cs | 277 + .../Unbind/UnbindDatabaseCommand.cs | 4 +- .../Unbind/UnbindMsiOrMsmCommand.cs | 5 +- .../UnbindContext.cs | 24 + src/WixToolset.Core.WindowsInstaller/Unbinder.cs | 88 + .../WixToolset.Core.WindowsInstaller.csproj | 2 + src/WixToolset.Core/Bind/DelayedField.cs | 6 +- src/WixToolset.Core/Bind/FileFacade.cs | 17 +- .../Bind/ResolveDelayedFieldsCommand.cs | 15 +- src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 67 +- src/WixToolset.Core/BindContext.cs | 2 +- src/WixToolset.Core/Binder.cs | 54 +- src/WixToolset.Core/BinderCore.cs | 14 - src/WixToolset.Core/BinderFileManagerCore.cs | 4 +- src/WixToolset.Core/CommandLine/BuildCommand.cs | 92 +- src/WixToolset.Core/CommandLine/CommandLine.cs | 2 +- src/WixToolset.Core/CommandLine/CompileCommand.cs | 27 +- src/WixToolset.Core/CompileContext.cs | 32 + src/WixToolset.Core/Compiler.cs | 7157 ++++++++------- src/WixToolset.Core/CompilerCore.cs | 134 +- src/WixToolset.Core/Decompiler.cs | 9356 ------------------- src/WixToolset.Core/DecompilerCore.cs | 152 - src/WixToolset.Core/Inscriber.cs | 8 - src/WixToolset.Core/Librarian.cs | 70 +- src/WixToolset.Core/LibraryContext.cs | 9 +- src/WixToolset.Core/Link/ConnectToFeature.cs | 50 +- .../Link/FindEntrySectionAndLoadSymbolsCommand.cs | 81 +- .../Link/IntermediateTupleExtensions.cs | 26 + .../Link/ReportConflictingSymbolsCommand.cs | 20 +- .../Link/ResolveReferencesCommand.cs | 99 +- .../Link/WixComplexReferenceTupleExtensions.cs | 73 + src/WixToolset.Core/Link/WixGroupingOrdering.cs | 140 +- src/WixToolset.Core/LinkContext.cs | 28 + src/WixToolset.Core/Linker.cs | 1164 ++- src/WixToolset.Core/Localizer.cs | 35 +- src/WixToolset.Core/Melter.cs | 398 - src/WixToolset.Core/MelterCore.cs | 30 - src/WixToolset.Core/PatchTransform.cs | 274 - src/WixToolset.Core/Preprocessor.cs | 24 +- src/WixToolset.Core/TupleDefinitionCreator.cs | 52 + src/WixToolset.Core/UnbindContext.cs | 24 - src/WixToolset.Core/Unbinder.cs | 132 - src/WixToolset.Core/WindowsInstallerStandard.cs | 260 + src/WixToolset.Core/WixToolsetServiceProvider.cs | 19 +- src/WixToolset.Core/WixVariableResolver.cs | 8 +- .../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 + .../ProgramFixture.cs | 12 + 155 files changed, 27848 insertions(+), 15127 deletions(-) create mode 100644 src/WixToolset.Core.WindowsInstaller/Decompiler.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/Melter.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/MelterCore.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/PatchTransform.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/UnbindContext.cs create mode 100644 src/WixToolset.Core.WindowsInstaller/Unbinder.cs create mode 100644 src/WixToolset.Core/CompileContext.cs delete mode 100644 src/WixToolset.Core/Decompiler.cs delete mode 100644 src/WixToolset.Core/DecompilerCore.cs create mode 100644 src/WixToolset.Core/Link/IntermediateTupleExtensions.cs create mode 100644 src/WixToolset.Core/Link/WixComplexReferenceTupleExtensions.cs create mode 100644 src/WixToolset.Core/LinkContext.cs delete mode 100644 src/WixToolset.Core/Melter.cs delete mode 100644 src/WixToolset.Core/MelterCore.cs delete mode 100644 src/WixToolset.Core/PatchTransform.cs create mode 100644 src/WixToolset.Core/TupleDefinitionCreator.cs delete mode 100644 src/WixToolset.Core/UnbindContext.cs delete mode 100644 src/WixToolset.Core/Unbinder.cs create mode 100644 src/WixToolset.Core/WindowsInstallerStandard.cs 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 diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index c9bd85b6..5e04e722 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -69,7 +69,7 @@ namespace WixToolset.Core.Burn { public BindBundleCommand(IBindContext context) { - this.TableDefinitions = WindowsInstallerStandard.GetTableDefinitions(); + //this.TableDefinitions = WindowsInstallerStandard.GetTableDefinitions(); this.DelayedFields = context.DelayedFields; this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles; @@ -87,13 +87,13 @@ namespace WixToolset.Core.Burn public IEnumerable Extensions { private get; set; } - public Output Output { private get; set; } + public Intermediate Output { private get; set; } public string OutputPath { private get; set; } public string PdbFile { private get; set; } - public TableDefinitionCollection TableDefinitions { private get; set; } + //public TableDefinitionCollection TableDefinitions { private get; set; } public string IntermediateFolder { private get; set; } @@ -105,6 +105,8 @@ namespace WixToolset.Core.Burn public void Execute() { + throw new NotImplementedException(); +#if TODO this.FileTransfers = Enumerable.Empty(); this.ContentFilePaths = Enumerable.Empty(); @@ -822,7 +824,7 @@ namespace WixToolset.Core.Burn resources.Save(bundleTempPath); } - #region DependencyExtension +//#region DependencyExtension /// /// Imports authored dependency providers for each package in the manifest, /// and generates dependency providers for certain package types that do not @@ -936,7 +938,7 @@ namespace WixToolset.Core.Burn } // Defaults to the bundle ID as the provider key. +#endif } - #endregion } } diff --git a/src/WixToolset.Core.Burn/Bind/ProvidesDependency.cs b/src/WixToolset.Core.Burn/Bind/ProvidesDependency.cs index e64773b4..c7eba01c 100644 --- a/src/WixToolset.Core.Burn/Bind/ProvidesDependency.cs +++ b/src/WixToolset.Core.Burn/Bind/ProvidesDependency.cs @@ -11,6 +11,7 @@ namespace WixToolset.Core.Burn /// internal sealed class ProvidesDependency { +#if TODO /// /// Creates a new instance of the class from a . /// @@ -19,6 +20,7 @@ namespace WixToolset.Core.Burn : this((string)row[2], (string)row[3], (string)row[4], (int?)row[5]) { } +#endif /// /// Creates a new instance of the class. diff --git a/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs index f605d7c7..b9c29df0 100644 --- a/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs +++ b/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs @@ -11,10 +11,12 @@ namespace WixToolset.Core.Burn /// internal class WixComponentSearchInfo : WixSearchInfo { +#if TODO public WixComponentSearchInfo(Row row) : this((string)row[0], (string)row[1], (string)row[2], (int)row[3]) { } +#endif public WixComponentSearchInfo(string id, string guid, string productCode, int attributes) : base(id) @@ -60,5 +62,4 @@ namespace WixToolset.Core.Burn writer.WriteEndElement(); } } - } diff --git a/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs index ea955db4..41393f6b 100644 --- a/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs +++ b/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs @@ -11,10 +11,12 @@ namespace WixToolset.Core.Burn /// internal class WixFileSearchInfo : WixSearchInfo { +#if TODO public WixFileSearchInfo(Row row) : this((string)row[0], (string)row[1], (int)row[9]) { } +#endif public WixFileSearchInfo(string id, string path, int attributes) : base(id) diff --git a/src/WixToolset.Core.Burn/Bind/WixProductSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixProductSearchInfo.cs index b3bf5fee..cd4a70b3 100644 --- a/src/WixToolset.Core.Burn/Bind/WixProductSearchInfo.cs +++ b/src/WixToolset.Core.Burn/Bind/WixProductSearchInfo.cs @@ -11,10 +11,12 @@ namespace WixToolset.Core.Burn /// internal class WixProductSearchInfo : WixSearchInfo { +#if TODO public WixProductSearchInfo(Row row) : this((string)row[0], (string)row[1], (int)row[2]) { } +#endif public WixProductSearchInfo(string id, string guid, int attributes) : base(id) diff --git a/src/WixToolset.Core.Burn/Bind/WixRegistrySearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixRegistrySearchInfo.cs index e25f25f4..e5227be5 100644 --- a/src/WixToolset.Core.Burn/Bind/WixRegistrySearchInfo.cs +++ b/src/WixToolset.Core.Burn/Bind/WixRegistrySearchInfo.cs @@ -11,10 +11,12 @@ namespace WixToolset.Core.Burn /// internal class WixRegistrySearchInfo : WixSearchInfo { +#if TODO public WixRegistrySearchInfo(Row row) : this((string)row[0], (int)row[1], (string)row[2], (string)row[3], (int)row[4]) { } +#endif public WixRegistrySearchInfo(string id, int root, string key, string value, int attributes) : base(id) @@ -88,5 +90,4 @@ namespace WixToolset.Core.Burn writer.WriteEndElement(); } } - } diff --git a/src/WixToolset.Core.Burn/Bind/WixSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixSearchInfo.cs index 9ebca4ae..04347583 100644 --- a/src/WixToolset.Core.Burn/Bind/WixSearchInfo.cs +++ b/src/WixToolset.Core.Burn/Bind/WixSearchInfo.cs @@ -17,12 +17,14 @@ namespace WixToolset.Core.Burn this.Id = id; } +#if TODO public void AddWixSearchRowInfo(Row row) { Debug.Assert((string)row[0] == Id); Variable = (string)row[1]; Condition = (string)row[2]; } +#endif public string Id { get; private set; } public string Variable { get; private set; } diff --git a/src/WixToolset.Core.Burn/BundleBackend.cs b/src/WixToolset.Core.Burn/BundleBackend.cs index 0c7f2e8b..f66a3fbe 100644 --- a/src/WixToolset.Core.Burn/BundleBackend.cs +++ b/src/WixToolset.Core.Burn/BundleBackend.cs @@ -42,7 +42,7 @@ namespace WixToolset.Core.Burn } } - public Output Unbind(IUnbindContext context) + public Intermediate Unbind(IUnbindContext context) { string uxExtractPath = Path.Combine(context.ExportBasePath, "UX"); string acExtractPath = Path.Combine(context.ExportBasePath, "AttachedContainer"); diff --git a/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs b/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs index bac8633b..d06cf4a8 100644 --- a/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs @@ -11,6 +11,7 @@ namespace WixToolset.Core.Burn.Bundles internal class AutomaticallySlipstreamPatchesCommand { +#if TODO public IEnumerable PackageFacades { private get; set; } public Table WixBundlePatchTargetCodeTable { private get; set; } @@ -108,5 +109,6 @@ namespace WixToolset.Core.Burn.Bundles } } } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs index 58814efc..b1f1f0cd 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs @@ -14,6 +14,7 @@ namespace WixToolset.Core.Burn.Bundles internal class CreateBootstrapperApplicationManifestCommand { +#if TODO public WixBundleRow BundleRow { private get; set; } public IEnumerable ChainPackages { private get; set; } @@ -237,5 +238,6 @@ namespace WixToolset.Core.Burn.Bundles return row; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs index 772265a0..788c7296 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs @@ -15,6 +15,7 @@ namespace WixToolset.Core.Burn.Bundles internal class CreateBurnManifestCommand { +#if TODO public IEnumerable BackendExtensions { private get; set; } public Output Output { private get; set; } @@ -682,5 +683,6 @@ namespace WixToolset.Core.Burn.Bundles return resolved; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/CreateContainerCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateContainerCommand.cs index 75379713..cde6d8f3 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateContainerCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateContainerCommand.cs @@ -16,6 +16,7 @@ namespace WixToolset.Core.Burn.Bundles /// internal class CreateContainerCommand { +#if TODO public CompressionLevel DefaultCompressionLevel { private get; set; } public IEnumerable Payloads { private get; set; } @@ -64,5 +65,6 @@ namespace WixToolset.Core.Burn.Bundles this.Size = fileInfo.Length; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs b/src/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs index 7485758c..056f6eb7 100644 --- a/src/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs @@ -8,6 +8,7 @@ namespace WixToolset.Core.Burn.Bundles internal class GetPackageFacadesCommand { +#if TODO public Table PackageTable { private get; set; } public Table ExePackageTable { private get; set; } @@ -58,5 +59,6 @@ namespace WixToolset.Core.Burn.Bundles this.PackageFacades = facades; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs b/src/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs index cb6e2748..4266ca40 100644 --- a/src/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs @@ -9,6 +9,7 @@ namespace WixToolset.Core.Burn.Bundles internal class OrderPackagesAndRollbackBoundariesCommand { +#if TODO public Table WixGroupTable { private get; set; } public RowDictionary Boundaries { private get; set; } @@ -141,5 +142,6 @@ namespace WixToolset.Core.Burn.Bundles this.OrderedPackageFacades = orderedFacades; this.UsedRollbackBoundaries = usedBoundaries; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/PackageFacade.cs b/src/WixToolset.Core.Burn/Bundles/PackageFacade.cs index 3f2e184d..ff5c2e2e 100644 --- a/src/WixToolset.Core.Burn/Bundles/PackageFacade.cs +++ b/src/WixToolset.Core.Burn/Bundles/PackageFacade.cs @@ -6,6 +6,7 @@ namespace WixToolset.Core.Burn.Bundles internal class PackageFacade { +#if TODO private PackageFacade(WixBundlePackageRow package) { this.Package = package; @@ -54,5 +55,6 @@ namespace WixToolset.Core.Burn.Bundles /// the relationship with the extension makes it much trickier to pull off. /// public ProvidesDependencyCollection Provides { get; private set; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessExePackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessExePackageCommand.cs index 11512c39..75bb5bb1 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessExePackageCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessExePackageCommand.cs @@ -11,6 +11,7 @@ namespace WixToolset.Core.Burn.Bundles /// internal class ProcessExePackageCommand { +#if TODO public RowDictionary AuthoredPayloads { private get; set; } public PackageFacade Facade { private get; set; } @@ -29,5 +30,6 @@ namespace WixToolset.Core.Burn.Bundles this.Facade.Package.Version = packagePayload.Version; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs index 322187f9..2ee58514 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs @@ -22,6 +22,7 @@ namespace WixToolset.Core.Burn.Bundles /// internal class ProcessMsiPackageCommand { +#if TODO private const string PropertySqlFormat = "SELECT `Value` FROM `Property` WHERE `Property` = '{0}'"; public RowDictionary AuthoredPayloads { private get; set; } @@ -572,5 +573,6 @@ namespace WixToolset.Core.Burn.Bundles return String.Format(CultureInfo.InvariantCulture, ProcessMsiPackageCommand.PropertySqlFormat, property); } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs index 2d849d03..37e08634 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs @@ -18,6 +18,7 @@ namespace WixToolset.Core.Burn.Bundles /// internal class ProcessMspPackageCommand { +#if TODO private const string PatchMetadataFormat = "SELECT `Value` FROM `MsiPatchMetadata` WHERE `Property` = '{0}'"; private static readonly Encoding XmlOutputEncoding = new UTF8Encoding(false); @@ -185,5 +186,6 @@ namespace WixToolset.Core.Burn.Bundles return false; } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs index fcfc780c..1380385d 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs @@ -11,7 +11,8 @@ namespace WixToolset.Core.Burn.Bundles /// internal class ProcessMsuPackageCommand { - public RowDictionary AuthoredPayloads { private get; set; } +#if TODO + public RowDictionary AuthoredPayloads { private get; set; } public PackageFacade Facade { private get; set; } @@ -26,5 +27,6 @@ namespace WixToolset.Core.Burn.Bundles this.Facade.Package.PerMachine = YesNoDefaultType.Yes; // MSUs are always per-machine. } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs index 5dbd6aaa..7900fcd1 100644 --- a/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs @@ -16,6 +16,7 @@ namespace WixToolset.Core.Burn.Bundles internal class ProcessPayloadsCommand { +#if TODO private static readonly Version EmptyVersion = new Version(0, 0, 0, 0); public IEnumerable Payloads { private get; set; } @@ -157,5 +158,6 @@ namespace WixToolset.Core.Burn.Bundles payload.DisplayName = versionInfo.ProductName; } } +#endif } } diff --git a/src/WixToolset.Core.Burn/Bundles/VerifyPayloadsWithCatalogCommand.cs b/src/WixToolset.Core.Burn/Bundles/VerifyPayloadsWithCatalogCommand.cs index 9919f777..f22a8f2b 100644 --- a/src/WixToolset.Core.Burn/Bundles/VerifyPayloadsWithCatalogCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/VerifyPayloadsWithCatalogCommand.cs @@ -13,6 +13,7 @@ namespace WixToolset.Core.Burn.Bundles internal class VerifyPayloadsWithCatalogCommand { +#if TODO public IEnumerable Catalogs { private get; set; } public IEnumerable Payloads { private get; set; } @@ -144,5 +145,6 @@ namespace WixToolset.Core.Burn.Bundles public string FullPath { get; set; } } +#endif } } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs index 23c481b7..74e2cdb5 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs @@ -66,7 +66,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases // When building merge module, all the files go to "#MergeModule.CABinet". if (OutputType.Module == this.Output.Type) { - Table mergeModuleMediaTable = new Table(null, this.TableDefinitions["Media"]); + Table mergeModuleMediaTable = new Table(this.TableDefinitions["Media"]); mergeModuleMediaRow = (MediaRow)mergeModuleMediaTable.CreateRow(null); mergeModuleMediaRow.Cabinet = "#MergeModule.CABinet"; @@ -150,8 +150,8 @@ namespace WixToolset.Core.WindowsInstaller.Databases // When building a product, if the current file is not to be compressed or if // the package set not to be compressed, don't cab it. if (OutputType.Product == this.Output.Type && - (YesNoType.No == facade.File.Compressed || - (YesNoType.NotSet == facade.File.Compressed && !this.FilesCompressed))) + (!facade.File.Compressed.Value || + (!facade.File.Compressed.HasValue && !this.FilesCompressed))) { uncompressedFiles.Add(facade); continue; @@ -270,8 +270,8 @@ namespace WixToolset.Core.WindowsInstaller.Databases // When building a product, if the current file is not to be compressed or if // the package set not to be compressed, don't cab it. if (OutputType.Product == this.Output.Type && - (YesNoType.No == facade.File.Compressed || - (YesNoType.NotSet == facade.File.Compressed && !this.FilesCompressed))) + (!facade.File.Compressed.Value || + (!facade.File.Compressed.HasValue && !this.FilesCompressed))) { uncompressedFiles.Add(facade); } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 21fbb022..5a61b63c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -39,7 +39,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.DelayedFields = context.DelayedFields; this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles; this.Extensions = context.Extensions; - this.Output = context.IntermediateRepresentation; + this.Intermediate = context.IntermediateRepresentation; this.OutputPath = context.OutputPath; this.PdbFile = context.OutputPdbPath; this.IntermediateFolder = context.IntermediateFolder; @@ -69,10 +69,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind private IEnumerable Extensions { get; } - private IEnumerable InspectorExtensions { get; } - private string PdbFile { get; } + private Intermediate Intermediate { get; } + private Output Output { get; } private string OutputPath { get; } @@ -95,6 +95,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind public void Execute() { + this.Intermediate.Save(this.OutputPath); +#if FINISH List fileTransfers = new List(); HashSet suppressedTableNames = new HashSet(); @@ -108,6 +110,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.LocalizeUI(this.Output.Tables); + this.Output = CreateOutputFromIR(this.Intermediate); + // Process the summary information table before the other tables. bool compressed; bool longNames; @@ -1278,6 +1282,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind command.TempFilesLocation = this.IntermediateFolder; command.Codepage = this.Codepage; command.Execute(); +#endif } } } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs index 767671b8..42a69310 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs @@ -23,6 +23,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases public void Execute() { +#if REVISIT_FOR_PATCHING bool optimizePatchSizeForLargeFiles = false; PatchSymbolFlagsType apiPatchingSymbolFlags = 0; @@ -82,6 +83,8 @@ namespace WixToolset.Core.WindowsInstaller.Databases } } } +#endif + throw new NotImplementedException(); } } } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs index ae76037d..0d3e7bd1 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs @@ -16,6 +16,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases using WixToolset.Core.Native; using WixToolset.Core.Bind; using WixToolset.Core.Cab; + using WixToolset.Data.Tuples; /// /// Retrieve files information and extract them from merge modules. @@ -34,7 +35,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases public bool SuppressLayout { private get; set; } - public string TempFilesLocation { private get; set; } + public string IntermediateFolder { private get; set; } public IEnumerable MergeModulesFileFacades { get; private set; } @@ -95,22 +96,28 @@ namespace WixToolset.Core.WindowsInstaller.Databases // NOTE: this is very tricky - the merge module file rows are not added to the // file table because they should not be created via idt import. Instead, these // rows are created by merging in the actual modules. - FileRow fileRow = (FileRow)this.FileTable.CreateRow(wixMergeRow.SourceLineNumbers, false); + var fileRow = new FileTuple(wixMergeRow.SourceLineNumbers, new Identifier(record[1], AccessModifier.Private)); fileRow.File = record[1]; - fileRow.Compressed = wixMergeRow.FileCompression; + fileRow.Compressed = (wixMergeRow.FileCompression == YesNoType.Yes) ? true : (wixMergeRow.FileCompression == YesNoType.No) ? (bool?)false : null; + //FileRow fileRow = (FileRow)this.FileTable.CreateRow(wixMergeRow.SourceLineNumbers, false); + //fileRow.File = record[1]; + //fileRow.Compressed = wixMergeRow.FileCompression; - WixFileRow wixFileRow = (WixFileRow)this.WixFileTable.CreateRow(wixMergeRow.SourceLineNumbers, false); - wixFileRow.Directory = record[2]; + var wixFileRow = new WixFileTuple(wixMergeRow.SourceLineNumbers); + wixFileRow.Directory_ = record[2]; wixFileRow.DiskId = wixMergeRow.DiskId; wixFileRow.PatchGroup = -1; - wixFileRow.Source = String.Concat(this.TempFilesLocation, Path.DirectorySeparatorChar, "MergeId.", wixMergeRow.Number.ToString(CultureInfo.InvariantCulture), Path.DirectorySeparatorChar, record[1]); + wixFileRow.Source = Path.Combine(this.IntermediateFolder, "MergeId.", wixMergeRow.Number.ToString(CultureInfo.InvariantCulture), record[1]); + //WixFileRow wixFileRow = (WixFileRow)this.WixFileTable.CreateRow(wixMergeRow.SourceLineNumbers, false); + //wixFileRow.Directory = record[2]; + //wixFileRow.DiskId = wixMergeRow.DiskId; + //wixFileRow.PatchGroup = -1; + //wixFileRow.Source = Path.Combine(this.IntermediateFolder, "MergeId.", wixMergeRow.Number.ToString(CultureInfo.InvariantCulture), record[1]); - FileFacade mergeModuleFileFacade = new FileFacade(true, fileRow, wixFileRow); - - FileFacade collidingFacade; + var mergeModuleFileFacade = new FileFacade(true, fileRow, wixFileRow); // If case-sensitive collision with another merge module or a user-authored file identifier. - if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.File, out collidingFacade)) + if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.File, out var collidingFacade)) { Messaging.Instance.OnMessage(WixErrors.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, collidingFacade.File.File)); } @@ -188,10 +195,10 @@ namespace WixToolset.Core.WindowsInstaller.Databases string safeMergeId = wixMergeRow.Number.ToString(CultureInfo.InvariantCulture.NumberFormat); // extract the module cabinet, then explode all of the files to a temp directory - string moduleCabPath = String.Concat(this.TempFilesLocation, Path.DirectorySeparatorChar, safeMergeId, ".module.cab"); + string moduleCabPath = String.Concat(this.IntermediateFolder, Path.DirectorySeparatorChar, safeMergeId, ".module.cab"); merge.ExtractCAB(moduleCabPath); - string mergeIdPath = String.Concat(this.TempFilesLocation, Path.DirectorySeparatorChar, "MergeId.", safeMergeId); + string mergeIdPath = String.Concat(this.IntermediateFolder, Path.DirectorySeparatorChar, "MergeId.", safeMergeId); Directory.CreateDirectory(mergeIdPath); using (var extractCab = new WixExtractCab()) diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs index 26d254f2..47b58058 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs @@ -122,7 +122,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases { if (ColumnType.Object == columnDefinition.Type) { - importTable = new Table(table.Section, table.Definition); + importTable = new Table(table.Definition); hasBinaryColumn = true; break; } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs index caf8b7a7..9bbb4763 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs @@ -24,6 +24,8 @@ namespace WixToolset.Core.WindowsInstaller.Databases public void Execute() { + throw new NotImplementedException(); +#if TODO List facades = new List(this.FileTable.Rows.Count); RowDictionary wixFiles = new RowDictionary(this.WixFileTable); @@ -44,6 +46,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases } this.FileFacades = facades; +#endif } /// @@ -66,7 +69,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases case SymbolPathType.Component: if (null == filesByComponent) { - filesByComponent = facades.ToLookup(f => f.File.Component); + filesByComponent = facades.ToLookup(f => f.File.Component_); } foreach (FileFacade facade in filesByComponent[row.Id]) @@ -78,7 +81,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases case SymbolPathType.Directory: if (null == filesByDirectory) { - filesByDirectory = facades.ToLookup(f => f.WixFile.Directory); + filesByDirectory = facades.ToLookup(f => f.WixFile.Directory_); } foreach (FileFacade facade in filesByDirectory[row.Id]) diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs index 624cbb43..f1605eca 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs @@ -304,7 +304,8 @@ namespace WixToolset.Core.WindowsInstaller.Databases throw new InvalidOperationException("Failed to fetch a File row from the database that was merged in from a module."); } - recordUpdate.SetInteger(1, file.File.Sequence); + //recordUpdate.SetInteger(1, file.File.Sequence); + throw new NotImplementedException(); // update the file attributes to match the compression specified // on the Merge element or on the Package element @@ -316,26 +317,25 @@ namespace WixToolset.Core.WindowsInstaller.Databases attributes = recordUpdate.GetInteger(2); } - if (YesNoType.Yes == file.File.Compressed) + // not specified + if (!file.File.Compressed.HasValue) + { + // clear any compression bits + attributes &= ~MsiInterop.MsidbFileAttributesCompressed; + attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; + } + else if (file.File.Compressed.Value) { // these are mutually exclusive attributes |= MsiInterop.MsidbFileAttributesCompressed; attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; } - else if (YesNoType.No == file.File.Compressed) + else if (!file.File.Compressed.Value) { // these are mutually exclusive attributes |= MsiInterop.MsidbFileAttributesNoncompressed; attributes &= ~MsiInterop.MsidbFileAttributesCompressed; } - else // not specified - { - Debug.Assert(YesNoType.NotSet == file.File.Compressed); - - // clear any compression bits - attributes &= ~MsiInterop.MsidbFileAttributesCompressed; - attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; - } recordUpdate.SetInteger(2, attributes); diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs index cd9444ee..20058597 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs @@ -15,6 +15,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases using WixToolset.Core.Bind; using WixToolset.Data; using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Msi; /// @@ -69,7 +70,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases if (!fileInfo.Exists) { - Messaging.Instance.OnMessage(WixErrors.CannotFindFile(file.File.SourceLineNumbers, file.File.File, file.File.FileName, file.WixFile.Source)); + Messaging.Instance.OnMessage(WixErrors.CannotFindFile(file.File.SourceLineNumbers, file.File.File, file.File.LongFileName, file.WixFile.Source)); return; } @@ -148,16 +149,17 @@ namespace WixToolset.Core.WindowsInstaller.Databases if (null == file.Hash) { - Table msiFileHashTable = this.Output.EnsureTable(this.TableDefinitions["MsiFileHash"]); - file.Hash = msiFileHashTable.CreateRow(file.File.SourceLineNumbers); + //Table msiFileHashTable = this.Output.EnsureTable(this.TableDefinitions["MsiFileHash"]); + //file.Hash = msiFileHashTable.CreateRow(file.File.SourceLineNumbers); + throw new NotImplementedException(); } - file.Hash[0] = file.File.File; - file.Hash[1] = 0; - file.Hash[2] = hash[0]; - file.Hash[3] = hash[1]; - file.Hash[4] = hash[2]; - file.Hash[5] = hash[3]; + file.Hash.File_ = file.File.File; + file.Hash.Options = 0; + file.Hash.HashPart1 = hash[0]; + file.Hash.HashPart2 = hash[1]; + file.Hash.HashPart3 = hash[2]; + file.Hash.HashPart4 = hash[3]; } } else // update the file row with the version and language information. @@ -250,9 +252,9 @@ namespace WixToolset.Core.WindowsInstaller.Databases assemblyNameValues.Add("publicKeyToken", publicKeyIsNeutral ? "null" : publicKeyToken.ToUpperInvariant()); assemblyNameValues.Add("publicKeyTokenPreservedCase", publicKeyIsNeutral ? "null" : publicKeyToken); } - else if (file.WixFile.AssemblyApplication == null) + else if (file.WixFile.File_AssemblyApplication == null) { - throw new WixException(WixErrors.GacAssemblyNoStrongName(file.File.SourceLineNumbers, fileInfo.FullName, file.File.Component)); + throw new WixException(WixErrors.GacAssemblyNoStrongName(file.File.SourceLineNumbers, fileInfo.FullName, file.File.Component_)); } string assemblyVersion = referenceIdentity.GetAttribute(null, "Version"); @@ -350,10 +352,10 @@ namespace WixToolset.Core.WindowsInstaller.Databases // TODO: Consider passing in the this.FileFacades as an indexed collection instead of searching through // all files like this. Even though this is a rare case it looks like we might be able to index the // file earlier. - FileFacade fileManifest = this.FileFacades.SingleOrDefault(r => r.File.File.Equals(file.WixFile.AssemblyManifest, StringComparison.Ordinal)); + FileFacade fileManifest = this.FileFacades.SingleOrDefault(r => r.File.File.Equals(file.WixFile.File_AssemblyManifest, StringComparison.Ordinal)); if (null == fileManifest) { - Messaging.Instance.OnMessage(WixErrors.MissingManifestForWin32Assembly(file.File.SourceLineNumbers, file.File.File, file.WixFile.AssemblyManifest)); + Messaging.Instance.OnMessage(WixErrors.MissingManifestForWin32Assembly(file.File.SourceLineNumbers, file.File.File, file.WixFile.File_AssemblyManifest)); } string win32Type = null; @@ -476,7 +478,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases // check for null value (this can occur when grabbing the file version from an assembly without one) if (String.IsNullOrEmpty(value)) { - Messaging.Instance.OnMessage(WixWarnings.NullMsiAssemblyNameValue(file.File.SourceLineNumbers, file.File.Component, name)); + Messaging.Instance.OnMessage(WixWarnings.NullMsiAssemblyNameValue(file.File.SourceLineNumbers, file.File.Component_, name)); } else { @@ -485,7 +487,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases // override directly authored value foreach (Row row in assemblyNameTable.Rows) { - if ((string)row[0] == file.File.Component && (string)row[1] == name) + if ((string)row[0] == file.File.Component_ && (string)row[1] == name) { assemblyNameRow = row; break; @@ -494,7 +496,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases // if the assembly will be GAC'd and the name in the file table doesn't match the name in the MsiAssemblyName table, error because the install will fail. if ("name" == name && FileAssemblyType.DotNetAssembly == file.WixFile.AssemblyType && - String.IsNullOrEmpty(file.WixFile.AssemblyApplication) && + String.IsNullOrEmpty(file.WixFile.File_AssemblyApplication) && !String.Equals(Path.GetFileNameWithoutExtension(file.File.LongFileName), value, StringComparison.OrdinalIgnoreCase)) { Messaging.Instance.OnMessage(WixErrors.GACAssemblyIdentityWarning(file.File.SourceLineNumbers, Path.GetFileNameWithoutExtension(file.File.LongFileName), value)); @@ -502,8 +504,10 @@ namespace WixToolset.Core.WindowsInstaller.Databases if (null == assemblyNameRow) { + throw new NotImplementedException(); +#if TODO assemblyNameRow = assemblyNameTable.CreateRow(file.File.SourceLineNumbers); - assemblyNameRow[0] = file.File.Component; + assemblyNameRow[0] = file.File.Component_; assemblyNameRow[1] = name; assemblyNameRow[2] = value; @@ -512,10 +516,11 @@ namespace WixToolset.Core.WindowsInstaller.Databases if (null == file.AssemblyNames) { - file.AssemblyNames = new List(); + file.AssemblyNames = new List(); } file.AssemblyNames.Add(assemblyNameRow); +#endif } else { diff --git a/src/WixToolset.Core.WindowsInstaller/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompiler.cs new file mode 100644 index 00000000..d353cc16 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Decompiler.cs @@ -0,0 +1,9357 @@ +// 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 +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Collections.Specialized; + using System.Diagnostics.CodeAnalysis; + using System.Globalization; + using System.IO; + using System.Text; + using System.Text.RegularExpressions; + using WixToolset.Data; + using WixToolset.Data.Rows; + using WixToolset.Extensibility; + using WixToolset.Core.Native; + using Wix = WixToolset.Data.Serialize; + using WixToolset.Core; + + /// + /// Decompiles an msi database into WiX source. + /// + public class Decompiler + { + private static readonly Regex NullSplitter = new Regex(@"\[~]"); +#if TODO + private int codepage; + private bool compressed; + private bool shortNames; + private DecompilerCore core; + private string exportFilePath; + private List extensions; + private Dictionary extensionsByTableName; + private string modularizationGuid; + private OutputType outputType; + private Hashtable patchTargetFiles; + private Hashtable sequenceElements; + private bool showPedanticMessages; + private WixActionRowCollection standardActions; + private bool suppressCustomTables; + private bool suppressDroppingEmptyTables; + private bool suppressRelativeActionSequencing; + private bool suppressUI; + private TableDefinitionCollection tableDefinitions; + // private TempFileCollection tempFiles; + private bool treatProductAsModule; + + /// + /// Creates a new decompiler object with a default set of table definitions. + /// + public Decompiler() + { + this.standardActions = WindowsInstallerStandard.GetStandardActions(); + + this.extensions = new List(); + this.extensionsByTableName = new Dictionary(); + this.patchTargetFiles = new Hashtable(); + this.sequenceElements = new Hashtable(); + this.tableDefinitions = new TableDefinitionCollection(); + this.exportFilePath = "SourceDir"; + } + + /// + /// Gets or sets the base source file path. + /// + /// Base source file path. + public string ExportFilePath + { + get { return this.exportFilePath; } + set { this.exportFilePath = value; } + } + + /// + /// Gets or sets the option to show pedantic messages. + /// + /// The option to show pedantic messages. + public bool ShowPedanticMessages + { + get { return this.showPedanticMessages; } + set { this.showPedanticMessages = value; } + } + + /// + /// Gets or sets the option to suppress custom tables. + /// + /// The option to suppress dropping empty tables. + public bool SuppressCustomTables + { + get { return this.suppressCustomTables; } + set { this.suppressCustomTables = value; } + } + + /// + /// Gets or sets the option to suppress dropping empty tables. + /// + /// The option to suppress dropping empty tables. + public bool SuppressDroppingEmptyTables + { + get { return this.suppressDroppingEmptyTables; } + set { this.suppressDroppingEmptyTables = value; } + } + + /// + /// Gets or sets the option to suppress decompiling with relative action sequencing (uses sequence numbers). + /// + /// The option to suppress decompiling with relative action sequencing (uses sequence numbers). + public bool SuppressRelativeActionSequencing + { + get { return this.suppressRelativeActionSequencing; } + set { this.suppressRelativeActionSequencing = value; } + } + + /// + /// Gets or sets the option to suppress decompiling UI-related tables. + /// + /// The option to suppress decompiling UI-related tables. + public bool SuppressUI + { + get { return this.suppressUI; } + set { this.suppressUI = value; } + } + + /// + /// Gets or sets the temporary path for the Decompiler. If left null, the decompiler + /// will use %TEMP% environment variable. + /// + /// Path to temp files. + public string TempFilesLocation + { + get + { + // return null == this.tempFiles ? String.Empty : this.tempFiles.BasePath; + return Path.GetTempPath(); + } + + // set + // { + // if (null == value) + // { + // this.tempFiles = new TempFileCollection(); + // } + // else + // { + // this.tempFiles = new TempFileCollection(value); + // } + // } + } + + /// + /// Gets or sets whether the decompiler should use module logic on a product output. + /// + /// The option to treat a product like a module + public bool TreatProductAsModule + { + get { return this.treatProductAsModule; } + set { this.treatProductAsModule = value; } + } + + /// + /// Decompile the database file. + /// + /// The output to decompile. + /// The serialized WiX source code. + [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] + public Wix.Wix Decompile(Output output) + { + if (null == output) + { + throw new ArgumentNullException("output"); + } + + this.codepage = output.Codepage; + this.outputType = output.Type; + + // collect the table definitions from the output + this.tableDefinitions.Clear(); + foreach (Table table in output.Tables) + { + this.tableDefinitions.Add(table.Definition); + } + + // add any missing standard and wix-specific table definitions + foreach (TableDefinition tableDefinition in WindowsInstallerStandard.GetTableDefinitions()) + { + if (!this.tableDefinitions.Contains(tableDefinition.Name)) + { + this.tableDefinitions.Add(tableDefinition); + } + } + + // add any missing extension table definitions + foreach (IDecompilerExtension extension in this.extensions) + { + if (null != extension.TableDefinitions) + { + foreach (TableDefinition tableDefinition in extension.TableDefinitions) + { + if (!this.tableDefinitions.Contains(tableDefinition.Name)) + { + this.tableDefinitions.Add(tableDefinition); + } + } + } + } + + // if we don't have the temporary files object yet, get one +#if REDO_IN_NETCORE + if (null == this.tempFiles) + { + this.TempFilesLocation = null; + } +#endif + Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there + + bool encounteredError = false; + Wix.IParentElement rootElement; + Wix.Wix wixElement = new Wix.Wix(); + + switch (this.outputType) + { + case OutputType.Module: + rootElement = new Wix.Module(); + break; + case OutputType.PatchCreation: + rootElement = new Wix.PatchCreation(); + break; + case OutputType.Product: + rootElement = new Wix.Product(); + break; + default: + throw new InvalidOperationException(WixStrings.EXP_UnknownOutputType); + } + wixElement.AddChild((Wix.ISchemaElement)rootElement); + + // try to decompile the database file + try + { + this.core = new DecompilerCore(rootElement); + this.core.ShowPedanticMessages = this.showPedanticMessages; + + // stop processing if an error previously occurred + if (this.core.EncounteredError) + { + return null; + } + + // initialize the decompiler and its extensions + foreach (IDecompilerExtension extension in this.extensions) + { + extension.Core = this.core; + extension.Initialize(output.Tables); + } + this.InitializeDecompile(output.Tables); + + // stop processing if an error previously occurred + if (this.core.EncounteredError) + { + return null; + } + + // decompile the tables + this.DecompileTables(output); + + // finalize the decompiler and its extensions + this.FinalizeDecompile(output.Tables); + foreach (IDecompilerExtension extension in this.extensions) + { + extension.Finish(output.Tables); + } + } + finally + { + encounteredError = this.core.EncounteredError; + + this.core = null; + foreach (IDecompilerExtension extension in this.extensions) + { + extension.Core = null; + } + } + + // return the root element only if decompilation completed successfully + return (encounteredError ? null : wixElement); + } + + /// + /// Adds an extension. + /// + /// The extension to add. + public void AddExtension(IDecompilerExtension extension) + { + this.extensions.Add(extension); + + if (null != extension.TableDefinitions) + { + foreach (TableDefinition tableDefinition in extension.TableDefinitions) + { + if (!this.extensionsByTableName.ContainsKey(tableDefinition.Name)) + { + this.extensionsByTableName.Add(tableDefinition.Name, extension); + } + else + { + Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); + } + } + } + } + + /// + /// Cleans up the temp files used by the Decompiler. + /// + /// True if all files were deleted, false otherwise. + /// + /// This should be called after every call to Decompile to ensure there + /// are no conflicts between each decompiled database. + /// + public bool DeleteTempFiles() + { +#if REDO_IN_NETCORE + if (null == this.tempFiles) + { + return true; // no work to do + } + else + { + bool deleted = Common.DeleteTempFiles(this.tempFiles.BasePath, this.core); + + if (deleted) + { + this.tempFiles = null; // temp files have been deleted, no need to remember this now + } + + return deleted; + } +#endif + return true; + } + + /// + /// Set the common control attributes in a control element. + /// + /// The control attributes. + /// The control element. + private static void SetControlAttributes(int attributes, Wix.Control control) + { + if (0 == (attributes & MsiInterop.MsidbControlAttributesEnabled)) + { + control.Disabled = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesIndirect == (attributes & MsiInterop.MsidbControlAttributesIndirect)) + { + control.Indirect = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesInteger == (attributes & MsiInterop.MsidbControlAttributesInteger)) + { + control.Integer = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesLeftScroll == (attributes & MsiInterop.MsidbControlAttributesLeftScroll)) + { + control.LeftScroll = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesRightAligned == (attributes & MsiInterop.MsidbControlAttributesRightAligned)) + { + control.RightAligned = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesRTLRO == (attributes & MsiInterop.MsidbControlAttributesRTLRO)) + { + control.RightToLeft = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbControlAttributesSunken == (attributes & MsiInterop.MsidbControlAttributesSunken)) + { + control.Sunken = Wix.YesNoType.yes; + } + + if (0 == (attributes & MsiInterop.MsidbControlAttributesVisible)) + { + control.Hidden = Wix.YesNoType.yes; + } + } + + /// + /// Creates an action element. + /// + /// The action row from which the element should be created. + private void CreateActionElement(WixActionRow actionRow) + { + Wix.ISchemaElement actionElement = null; + + if (null != this.core.GetIndexedElement("CustomAction", actionRow.Action)) // custom action + { + Wix.Custom custom = new Wix.Custom(); + + custom.Action = actionRow.Action; + + if (null != actionRow.Condition) + { + custom.Content = actionRow.Condition; + } + + switch (actionRow.Sequence) + { + case (-4): + custom.OnExit = Wix.ExitType.suspend; + break; + case (-3): + custom.OnExit = Wix.ExitType.error; + break; + case (-2): + custom.OnExit = Wix.ExitType.cancel; + break; + case (-1): + custom.OnExit = Wix.ExitType.success; + break; + default: + if (null != actionRow.Before) + { + custom.Before = actionRow.Before; + } + else if (null != actionRow.After) + { + custom.After = actionRow.After; + } + else if (0 < actionRow.Sequence) + { + custom.Sequence = actionRow.Sequence; + } + break; + } + + actionElement = custom; + } + else if (null != this.core.GetIndexedElement("Dialog", actionRow.Action)) // dialog + { + Wix.Show show = new Wix.Show(); + + show.Dialog = actionRow.Action; + + if (null != actionRow.Condition) + { + show.Content = actionRow.Condition; + } + + switch (actionRow.Sequence) + { + case (-4): + show.OnExit = Wix.ExitType.suspend; + break; + case (-3): + show.OnExit = Wix.ExitType.error; + break; + case (-2): + show.OnExit = Wix.ExitType.cancel; + break; + case (-1): + show.OnExit = Wix.ExitType.success; + break; + default: + if (null != actionRow.Before) + { + show.Before = actionRow.Before; + } + else if (null != actionRow.After) + { + show.After = actionRow.After; + } + else if (0 < actionRow.Sequence) + { + show.Sequence = actionRow.Sequence; + } + break; + } + + actionElement = show; + } + else // possibly a standard action without suggested sequence information + { + actionElement = this.CreateStandardActionElement(actionRow); + } + + // add the action element to the appropriate sequence element + if (null != actionElement) + { + string sequenceTable = actionRow.SequenceTable.ToString(); + Wix.IParentElement sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable]; + + if (null == sequenceElement) + { + switch (actionRow.SequenceTable) + { + case SequenceTable.AdminExecuteSequence: + sequenceElement = new Wix.AdminExecuteSequence(); + break; + case SequenceTable.AdminUISequence: + sequenceElement = new Wix.AdminUISequence(); + break; + case SequenceTable.AdvtExecuteSequence: + sequenceElement = new Wix.AdvertiseExecuteSequence(); + break; + case SequenceTable.InstallExecuteSequence: + sequenceElement = new Wix.InstallExecuteSequence(); + break; + case SequenceTable.InstallUISequence: + sequenceElement = new Wix.InstallUISequence(); + break; + default: + throw new InvalidOperationException(WixStrings.EXP_UnknowSequenceTable); + } + + this.core.RootElement.AddChild((Wix.ISchemaElement)sequenceElement); + this.sequenceElements.Add(sequenceTable, sequenceElement); + } + + try + { + sequenceElement.AddChild(actionElement); + } + catch (System.ArgumentException) // action/dialog is not valid for this sequence + { + this.core.OnMessage(WixWarnings.IllegalActionInSequence(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); + } + } + } + + /// + /// Creates a standard action element. + /// + /// The action row from which the element should be created. + /// The created element. + private Wix.ISchemaElement CreateStandardActionElement(WixActionRow actionRow) + { + Wix.ActionSequenceType actionElement = null; + + switch (actionRow.Action) + { + case "AllocateRegistrySpace": + actionElement = new Wix.AllocateRegistrySpace(); + break; + case "AppSearch": + WixActionRow appSearchActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; + + if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence)) + { + Wix.AppSearch appSearch = new Wix.AppSearch(); + + if (null != actionRow.Condition) + { + appSearch.Content = actionRow.Condition; + } + + if (null != actionRow.Before) + { + appSearch.Before = actionRow.Before; + } + else if (null != actionRow.After) + { + appSearch.After = actionRow.After; + } + else if (0 < actionRow.Sequence) + { + appSearch.Sequence = actionRow.Sequence; + } + + return appSearch; + } + break; + case "BindImage": + actionElement = new Wix.BindImage(); + break; + case "CCPSearch": + Wix.CCPSearch ccpSearch = new Wix.CCPSearch(); + Decompiler.SequenceRelativeAction(actionRow, ccpSearch); + return ccpSearch; + case "CostFinalize": + actionElement = new Wix.CostFinalize(); + break; + case "CostInitialize": + actionElement = new Wix.CostInitialize(); + break; + case "CreateFolders": + actionElement = new Wix.CreateFolders(); + break; + case "CreateShortcuts": + actionElement = new Wix.CreateShortcuts(); + break; + case "DeleteServices": + actionElement = new Wix.DeleteServices(); + break; + case "DisableRollback": + Wix.DisableRollback disableRollback = new Wix.DisableRollback(); + Decompiler.SequenceRelativeAction(actionRow, disableRollback); + return disableRollback; + case "DuplicateFiles": + actionElement = new Wix.DuplicateFiles(); + break; + case "ExecuteAction": + actionElement = new Wix.ExecuteAction(); + break; + case "FileCost": + actionElement = new Wix.FileCost(); + break; + case "FindRelatedProducts": + Wix.FindRelatedProducts findRelatedProducts = new Wix.FindRelatedProducts(); + Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts); + return findRelatedProducts; + case "ForceReboot": + Wix.ForceReboot forceReboot = new Wix.ForceReboot(); + Decompiler.SequenceRelativeAction(actionRow, forceReboot); + return forceReboot; + case "InstallAdminPackage": + actionElement = new Wix.InstallAdminPackage(); + break; + case "InstallExecute": + Wix.InstallExecute installExecute = new Wix.InstallExecute(); + Decompiler.SequenceRelativeAction(actionRow, installExecute); + return installExecute; + case "InstallExecuteAgain": + Wix.InstallExecuteAgain installExecuteAgain = new Wix.InstallExecuteAgain(); + Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain); + return installExecuteAgain; + case "InstallFiles": + actionElement = new Wix.InstallFiles(); + break; + case "InstallFinalize": + actionElement = new Wix.InstallFinalize(); + break; + case "InstallInitialize": + actionElement = new Wix.InstallInitialize(); + break; + case "InstallODBC": + actionElement = new Wix.InstallODBC(); + break; + case "InstallServices": + actionElement = new Wix.InstallServices(); + break; + case "InstallValidate": + actionElement = new Wix.InstallValidate(); + break; + case "IsolateComponents": + actionElement = new Wix.IsolateComponents(); + break; + case "LaunchConditions": + Wix.LaunchConditions launchConditions = new Wix.LaunchConditions(); + Decompiler.SequenceRelativeAction(actionRow, launchConditions); + return launchConditions; + case "MigrateFeatureStates": + actionElement = new Wix.MigrateFeatureStates(); + break; + case "MoveFiles": + actionElement = new Wix.MoveFiles(); + break; + case "MsiPublishAssemblies": + actionElement = new Wix.MsiPublishAssemblies(); + break; + case "MsiUnpublishAssemblies": + actionElement = new Wix.MsiUnpublishAssemblies(); + break; + case "PatchFiles": + actionElement = new Wix.PatchFiles(); + break; + case "ProcessComponents": + actionElement = new Wix.ProcessComponents(); + break; + case "PublishComponents": + actionElement = new Wix.PublishComponents(); + break; + case "PublishFeatures": + actionElement = new Wix.PublishFeatures(); + break; + case "PublishProduct": + actionElement = new Wix.PublishProduct(); + break; + case "RegisterClassInfo": + actionElement = new Wix.RegisterClassInfo(); + break; + case "RegisterComPlus": + actionElement = new Wix.RegisterComPlus(); + break; + case "RegisterExtensionInfo": + actionElement = new Wix.RegisterExtensionInfo(); + break; + case "RegisterFonts": + actionElement = new Wix.RegisterFonts(); + break; + case "RegisterMIMEInfo": + actionElement = new Wix.RegisterMIMEInfo(); + break; + case "RegisterProduct": + actionElement = new Wix.RegisterProduct(); + break; + case "RegisterProgIdInfo": + actionElement = new Wix.RegisterProgIdInfo(); + break; + case "RegisterTypeLibraries": + actionElement = new Wix.RegisterTypeLibraries(); + break; + case "RegisterUser": + actionElement = new Wix.RegisterUser(); + break; + case "RemoveDuplicateFiles": + actionElement = new Wix.RemoveDuplicateFiles(); + break; + case "RemoveEnvironmentStrings": + actionElement = new Wix.RemoveEnvironmentStrings(); + break; + case "RemoveExistingProducts": + Wix.RemoveExistingProducts removeExistingProducts = new Wix.RemoveExistingProducts(); + Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts); + return removeExistingProducts; + case "RemoveFiles": + actionElement = new Wix.RemoveFiles(); + break; + case "RemoveFolders": + actionElement = new Wix.RemoveFolders(); + break; + case "RemoveIniValues": + actionElement = new Wix.RemoveIniValues(); + break; + case "RemoveODBC": + actionElement = new Wix.RemoveODBC(); + break; + case "RemoveRegistryValues": + actionElement = new Wix.RemoveRegistryValues(); + break; + case "RemoveShortcuts": + actionElement = new Wix.RemoveShortcuts(); + break; + case "ResolveSource": + Wix.ResolveSource resolveSource = new Wix.ResolveSource(); + Decompiler.SequenceRelativeAction(actionRow, resolveSource); + return resolveSource; + case "RMCCPSearch": + Wix.RMCCPSearch rmccpSearch = new Wix.RMCCPSearch(); + Decompiler.SequenceRelativeAction(actionRow, rmccpSearch); + return rmccpSearch; + case "ScheduleReboot": + Wix.ScheduleReboot scheduleReboot = new Wix.ScheduleReboot(); + Decompiler.SequenceRelativeAction(actionRow, scheduleReboot); + return scheduleReboot; + case "SelfRegModules": + actionElement = new Wix.SelfRegModules(); + break; + case "SelfUnregModules": + actionElement = new Wix.SelfUnregModules(); + break; + case "SetODBCFolders": + actionElement = new Wix.SetODBCFolders(); + break; + case "StartServices": + actionElement = new Wix.StartServices(); + break; + case "StopServices": + actionElement = new Wix.StopServices(); + break; + case "UnpublishComponents": + actionElement = new Wix.UnpublishComponents(); + break; + case "UnpublishFeatures": + actionElement = new Wix.UnpublishFeatures(); + break; + case "UnregisterClassInfo": + actionElement = new Wix.UnregisterClassInfo(); + break; + case "UnregisterComPlus": + actionElement = new Wix.UnregisterComPlus(); + break; + case "UnregisterExtensionInfo": + actionElement = new Wix.UnregisterExtensionInfo(); + break; + case "UnregisterFonts": + actionElement = new Wix.UnregisterFonts(); + break; + case "UnregisterMIMEInfo": + actionElement = new Wix.UnregisterMIMEInfo(); + break; + case "UnregisterProgIdInfo": + actionElement = new Wix.UnregisterProgIdInfo(); + break; + case "UnregisterTypeLibraries": + actionElement = new Wix.UnregisterTypeLibraries(); + break; + case "ValidateProductID": + actionElement = new Wix.ValidateProductID(); + break; + case "WriteEnvironmentStrings": + actionElement = new Wix.WriteEnvironmentStrings(); + break; + case "WriteIniValues": + actionElement = new Wix.WriteIniValues(); + break; + case "WriteRegistryValues": + actionElement = new Wix.WriteRegistryValues(); + break; + default: + this.core.OnMessage(WixWarnings.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); + return null; + } + + if (actionElement != null) + { + this.SequenceStandardAction(actionRow, actionElement); + } + + return actionElement; + } + + /// + /// Applies the condition and sequence to a standard action element based on the action row data. + /// + /// Action row data from the database. + /// Element to be sequenced. + private void SequenceStandardAction(WixActionRow actionRow, Wix.ActionSequenceType actionElement) + { + if (null != actionRow.Condition) + { + actionElement.Content = actionRow.Condition; + } + + if ((null != actionRow.Before || null != actionRow.After) && 0 == actionRow.Sequence) + { + this.core.OnMessage(WixWarnings.DecompiledStandardActionRelativelyScheduledInModule(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); + } + else if (0 < actionRow.Sequence) + { + actionElement.Sequence = actionRow.Sequence; + } + } + + /// + /// Applies the condition and relative sequence to an action element based on the action row data. + /// + /// Action row data from the database. + /// Element to be sequenced. + private static void SequenceRelativeAction(WixActionRow actionRow, Wix.ActionModuleSequenceType actionElement) + { + if (null != actionRow.Condition) + { + actionElement.Content = actionRow.Condition; + } + + if (null != actionRow.Before) + { + actionElement.Before = actionRow.Before; + } + else if (null != actionRow.After) + { + actionElement.After = actionRow.After; + } + else if (0 < actionRow.Sequence) + { + actionElement.Sequence = actionRow.Sequence; + } + } + + /// + /// Ensure that a particular property exists in the decompiled output. + /// + /// The identifier of the property. + /// The property element. + private Wix.Property EnsureProperty(string id) + { + Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", id); + + if (null == property) + { + property = new Wix.Property(); + property.Id = id; + + // create a dummy row for indexing + Row row = new Row(null, this.tableDefinitions["Property"]); + row[0] = id; + + this.core.RootElement.AddChild(property); + this.core.IndexElement(row, property); + } + + return property; + } + + /// + /// Finalize decompilation. + /// + /// The collection of all tables. + private void FinalizeDecompile(TableIndexedCollection tables) + { + if (OutputType.PatchCreation == this.outputType) + { + this.FinalizeFamilyFileRangesTable(tables); + } + else + { + this.FinalizeCheckBoxTable(tables); + this.FinalizeComponentTable(tables); + this.FinalizeDialogTable(tables); + this.FinalizeDuplicateMoveFileTables(tables); + this.FinalizeFeatureComponentsTable(tables); + this.FinalizeFileTable(tables); + this.FinalizeMIMETable(tables); + this.FinalizeMsiLockPermissionsExTable(tables); + this.FinalizeLockPermissionsTable(tables); + this.FinalizeProgIdTable(tables); + this.FinalizePropertyTable(tables); + this.FinalizeRemoveFileTable(tables); + this.FinalizeSearchTables(tables); + this.FinalizeUpgradeTable(tables); + this.FinalizeSequenceTables(tables); + this.FinalizeVerbTable(tables); + } + } + + /// + /// Finalize the CheckBox table. + /// + /// The collection of all tables. + /// + /// Enumerates through all the Control rows, looking for controls of type "CheckBox" with + /// a value in the Property column. This is then possibly matched up with a CheckBox row + /// to retrieve a CheckBoxValue. There is no foreign key from the Control to CheckBox table. + /// + private void FinalizeCheckBoxTable(TableIndexedCollection tables) + { + // if the user has requested to suppress the UI elements, we have nothing to do + if (this.suppressUI) + { + return; + } + + Table checkBoxTable = tables["CheckBox"]; + Table controlTable = tables["Control"]; + + Hashtable checkBoxes = new Hashtable(); + Hashtable checkBoxProperties = new Hashtable(); + + // index the CheckBox table + if (null != checkBoxTable) + { + foreach (Row row in checkBoxTable.Rows) + { + checkBoxes.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); + checkBoxProperties.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), false); + } + } + + // enumerate through the Control table, adding CheckBox values where appropriate + if (null != controlTable) + { + foreach (Row row in controlTable.Rows) + { + Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); + + if ("CheckBox" == Convert.ToString(row[2]) && null != row[8]) + { + Row checkBoxRow = (Row)checkBoxes[row[8]]; + + if (null == checkBoxRow) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Property", Convert.ToString(row[8]), "CheckBox")); + } + else + { + // if we've seen this property already, create a reference to it + if (Convert.ToBoolean(checkBoxProperties[row[8]])) + { + control.CheckBoxPropertyRef = Convert.ToString(row[8]); + } + else + { + control.Property = Convert.ToString(row[8]); + checkBoxProperties[row[8]] = true; + } + + if (null != checkBoxRow[1]) + { + control.CheckBoxValue = Convert.ToString(checkBoxRow[1]); + } + } + } + } + } + } + + /// + /// Finalize the Component table. + /// + /// The collection of all tables. + /// + /// Set the keypaths for each component. + /// + private void FinalizeComponentTable(TableIndexedCollection tables) + { + Table componentTable = tables["Component"]; + Table fileTable = tables["File"]; + Table odbcDataSourceTable = tables["ODBCDataSource"]; + Table registryTable = tables["Registry"]; + + // set the component keypaths + if (null != componentTable) + { + foreach (Row row in componentTable.Rows) + { + int attributes = Convert.ToInt32(row[3]); + + if (null == row[5]) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); + + component.KeyPath = Wix.YesNoType.yes; + } + else if (MsiInterop.MsidbComponentAttributesRegistryKeyPath == (attributes & MsiInterop.MsidbComponentAttributesRegistryKeyPath)) + { + object registryObject = this.core.GetIndexedElement("Registry", Convert.ToString(row[5])); + + if (null != registryObject) + { + Wix.RegistryValue registryValue = registryObject as Wix.RegistryValue; + + if (null != registryValue) + { + registryValue.KeyPath = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.IllegalRegistryKeyPath(row.SourceLineNumbers, "Component", Convert.ToString(row[5]))); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry")); + } + } + else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource)) + { + Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5])); + + if (null != odbcDataSource) + { + odbcDataSource.KeyPath = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "ODBCDataSource")); + } + } + else + { + Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[5])); + + if (null != file) + { + file.KeyPath = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "File")); + } + } + } + } + + // add the File children elements + if (null != fileTable) + { + foreach (FileRow fileRow in fileTable.Rows) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component); + Wix.File file = (Wix.File)this.core.GetIndexedElement(fileRow); + + if (null != component) + { + component.AddChild(file); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(fileRow.SourceLineNumbers, "File", fileRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", fileRow.Component, "Component")); + } + } + } + + // add the ODBCDataSource children elements + if (null != odbcDataSourceTable) + { + foreach (Row row in odbcDataSourceTable.Rows) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row); + + if (null != component) + { + component.AddChild(odbcDataSource); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ODBCDataSource", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + } + + // add the Registry children elements + if (null != registryTable) + { + foreach (Row row in registryTable.Rows) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); + Wix.ISchemaElement registryElement = (Wix.ISchemaElement)this.core.GetIndexedElement(row); + + if (null != component) + { + component.AddChild(registryElement); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Registry", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); + } + } + } + } + + /// + /// Finalize the Dialog table. + /// + /// The collection of all tables. + /// + /// Sets the first, default, and cancel control for each dialog and adds all child control + /// elements to the dialog. + /// + private void FinalizeDialogTable(TableIndexedCollection tables) + { + // if the user has requested to suppress the UI elements, we have nothing to do + if (this.suppressUI) + { + return; + } + + Table controlTable = tables["Control"]; + Table dialogTable = tables["Dialog"]; + + Hashtable addedControls = new Hashtable(); + Hashtable controlRows = new Hashtable(); + + // index the rows in the control rows (because we need the Control_Next value) + if (null != controlTable) + { + foreach (Row row in controlTable.Rows) + { + controlRows.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); + } + } + + if (null != dialogTable) + { + foreach (Row row in dialogTable.Rows) + { + Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement(row); + string dialogId = Convert.ToString(row[0]); + + Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[7])); + if (null == control) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_First", Convert.ToString(row[7]), "Control")); + } + + // add tabbable controls + while (null != control) + { + Row controlRow = (Row)controlRows[String.Concat(dialogId, DecompilerConstants.PrimaryKeyDelimiter, control.Id)]; + + control.TabSkip = Wix.YesNoType.no; + dialog.AddChild(control); + addedControls.Add(control, null); + + if (null != controlRow[10]) + { + control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(controlRow[10])); + if (null != control) + { + // looped back to the first control in the dialog + if (addedControls.Contains(control)) + { + control = null; + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(controlRow.SourceLineNumbers, "Control", controlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", dialogId, "Control_Next", Convert.ToString(controlRow[10]), "Control")); + } + } + else + { + control = null; + } + } + + // set default control + if (null != row[8]) + { + Wix.Control defaultControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[8])); + + if (null != defaultControl) + { + defaultControl.Default = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Default", Convert.ToString(row[8]), "Control")); + } + } + + // set cancel control + if (null != row[9]) + { + Wix.Control cancelControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[9])); + + if (null != cancelControl) + { + cancelControl.Cancel = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Cancel", Convert.ToString(row[9]), "Control")); + } + } + } + } + + // add the non-tabbable controls to the dialog + if (null != controlTable) + { + foreach (Row row in controlTable.Rows) + { + Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); + Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0])); + + if (null == dialog) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Dialog")); + continue; + } + + if (!addedControls.Contains(control)) + { + control.TabSkip = Wix.YesNoType.yes; + dialog.AddChild(control); + } + } + } + } + + /// + /// Finalize the DuplicateFile and MoveFile tables. + /// + /// The collection of all tables. + /// + /// Sets the source/destination property/directory for each DuplicateFile or + /// MoveFile row. + /// + private void FinalizeDuplicateMoveFileTables(TableIndexedCollection tables) + { + Table duplicateFileTable = tables["DuplicateFile"]; + Table moveFileTable = tables["MoveFile"]; + + if (null != duplicateFileTable) + { + foreach (Row row in duplicateFileTable.Rows) + { + Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); + + if (null != row[4]) + { + if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[4]))) + { + copyFile.DestinationDirectory = Convert.ToString(row[4]); + } + else + { + copyFile.DestinationProperty = Convert.ToString(row[4]); + } + } + } + } + + if (null != moveFileTable) + { + foreach (Row row in moveFileTable.Rows) + { + Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); + + if (null != row[4]) + { + if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[4]))) + { + copyFile.SourceDirectory = Convert.ToString(row[4]); + } + else + { + copyFile.SourceProperty = Convert.ToString(row[4]); + } + } + + if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[5]))) + { + copyFile.DestinationDirectory = Convert.ToString(row[5]); + } + else + { + copyFile.DestinationProperty = Convert.ToString(row[5]); + } + } + } + } + + /// + /// Finalize the FamilyFileRanges table. + /// + /// The collection of all tables. + private void FinalizeFamilyFileRangesTable(TableIndexedCollection tables) + { + Table externalFilesTable = tables["ExternalFiles"]; + Table familyFileRangesTable = tables["FamilyFileRanges"]; + Table targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"]; + + Hashtable usedProtectRanges = new Hashtable(); + + if (null != familyFileRangesTable) + { + foreach (Row row in familyFileRangesTable.Rows) + { + Wix.ProtectRange protectRange = new Wix.ProtectRange(); + + if (null != row[2] && null != row[3]) + { + string[] retainOffsets = (Convert.ToString(row[2])).Split(','); + string[] retainLengths = (Convert.ToString(row[3])).Split(','); + + if (retainOffsets.Length == retainLengths.Length) + { + for (int i = 0; i < retainOffsets.Length; i++) + { + if (retainOffsets[i].StartsWith("0x", StringComparison.Ordinal)) + { + protectRange.Offset = Convert.ToInt32(retainOffsets[i].Substring(2), 16); + } + else + { + protectRange.Offset = Convert.ToInt32(retainOffsets[i], CultureInfo.InvariantCulture); + } + + if (retainLengths[i].StartsWith("0x", StringComparison.Ordinal)) + { + protectRange.Length = Convert.ToInt32(retainLengths[i].Substring(2), 16); + } + else + { + protectRange.Length = Convert.ToInt32(retainLengths[i], CultureInfo.InvariantCulture); + } + } + } + else + { + // TODO: warn + } + } + else if (null != row[2] || null != row[3]) + { + // TODO: warn about mismatch between columns + } + + this.core.IndexElement(row, protectRange); + } + } + + if (null != externalFilesTable) + { + foreach (Row row in externalFilesTable.Rows) + { + Wix.ExternalFile externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row); + + Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(row[0]), Convert.ToString(row[1])); + if (null != protectRange) + { + externalFile.AddChild(protectRange); + usedProtectRanges[protectRange] = null; + } + } + } + + if (null != targetFiles_OptionalDataTable) + { + Table targetImagesTable = tables["TargetImages"]; + Table upgradedImagesTable = tables["UpgradedImages"]; + + Hashtable targetImageRows = new Hashtable(); + Hashtable upgradedImagesRows = new Hashtable(); + + // index the TargetImages table + if (null != targetImagesTable) + { + foreach (Row row in targetImagesTable.Rows) + { + targetImageRows.Add(row[0], row); + } + } + + // index the UpgradedImages table + if (null != upgradedImagesTable) + { + foreach (Row row in upgradedImagesTable.Rows) + { + upgradedImagesRows.Add(row[0], row); + } + } + + foreach (Row row in targetFiles_OptionalDataTable.Rows) + { + Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)]; + + Row targetImageRow = (Row)targetImageRows[row[0]]; + if (null == targetImageRow) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, targetFiles_OptionalDataTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); + continue; + } + + Row upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]]; + if (null == upgradedImagesRow) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(targetImageRow.SourceLineNumbers, targetImageRow.Table.Name, targetImageRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); + continue; + } + + Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(upgradedImagesRow[4]), Convert.ToString(row[1])); + if (null != protectRange) + { + targetFile.AddChild(protectRange); + usedProtectRanges[protectRange] = null; + } + } + } + + if (null != familyFileRangesTable) + { + foreach (Row row in familyFileRangesTable.Rows) + { + Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row); + + if (!usedProtectRanges.Contains(protectRange)) + { + Wix.ProtectFile protectFile = new Wix.ProtectFile(); + + protectFile.File = Convert.ToString(row[1]); + + protectFile.AddChild(protectRange); + + Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); + if (null != family) + { + family.AddChild(protectFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, familyFileRangesTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); + } + } + } + } + } + + /// + /// Finalize the FeatureComponents table. + /// + /// The collection of all tables. + /// + /// Since tables specifying references to the FeatureComponents table have references to + /// the Feature and Component table separately, but not the FeatureComponents table specifically, + /// the FeatureComponents table and primary features must be decompiled during finalization. + /// + private void FinalizeFeatureComponentsTable(TableIndexedCollection tables) + { + Table classTable = tables["Class"]; + Table extensionTable = tables["Extension"]; + Table msiAssemblyTable = tables["MsiAssembly"]; + Table publishComponentTable = tables["PublishComponent"]; + Table shortcutTable = tables["Shortcut"]; + Table typeLibTable = tables["TypeLib"]; + + if (null != classTable) + { + foreach (Row row in classTable.Rows) + { + this.SetPrimaryFeature(row, 11, 2); + } + } + + if (null != extensionTable) + { + foreach (Row row in extensionTable.Rows) + { + this.SetPrimaryFeature(row, 4, 1); + } + } + + if (null != msiAssemblyTable) + { + foreach (Row row in msiAssemblyTable.Rows) + { + this.SetPrimaryFeature(row, 1, 0); + } + } + + if (null != publishComponentTable) + { + foreach (Row row in publishComponentTable.Rows) + { + this.SetPrimaryFeature(row, 4, 2); + } + } + + if (null != shortcutTable) + { + foreach (Row row in shortcutTable.Rows) + { + string target = Convert.ToString(row[4]); + + if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal)) + { + this.SetPrimaryFeature(row, 4, 3); + } + } + } + + if (null != typeLibTable) + { + foreach (Row row in typeLibTable.Rows) + { + this.SetPrimaryFeature(row, 6, 2); + } + } + } + + /// + /// Finalize the File table. + /// + /// The collection of all tables. + /// + /// Sets the source, diskId, and assembly information for each file. + /// + private void FinalizeFileTable(TableIndexedCollection tables) + { + Table fileTable = tables["File"]; + Table mediaTable = tables["Media"]; + Table msiAssemblyTable = tables["MsiAssembly"]; + Table typeLibTable = tables["TypeLib"]; + + // index the media table by media id + RowDictionary mediaRows; + if (null != mediaTable) + { + mediaRows = new RowDictionary(mediaTable); + } + + // set the disk identifiers and sources for files + if (null != fileTable) + { + foreach (FileRow fileRow in fileTable.Rows) + { + Wix.File file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File); + + // Don't bother processing files that are orphaned (and won't show up in the output anyway) + if (null != file.ParentElement) + { + // set the diskid + if (null != mediaTable) + { + foreach (MediaRow mediaRow in mediaTable.Rows) + { + if (fileRow.Sequence <= mediaRow.LastSequence) + { + file.DiskId = Convert.ToString(mediaRow.DiskId); + break; + } + } + } + + // set the source (done here because it requires information from the Directory table) + if (OutputType.Module == this.outputType) + { + file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id, '.', this.modularizationGuid.Substring(1, 36).Replace('-', '_')); + } + else if (Wix.YesNoDefaultType.yes == file.Compressed || (Wix.YesNoDefaultType.no != file.Compressed && this.compressed)) + { + file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id); + } + else // uncompressed + { + string fileName = (null != file.ShortName ? file.ShortName : file.Name); + + if (!this.shortNames && null != file.Name) + { + fileName = file.Name; + } + + if (this.compressed) // uncompressed at the root of the source image + { + file.Source = String.Concat("SourceDir", Path.DirectorySeparatorChar, fileName); + } + else + { + string sourcePath = this.GetSourcePath(file); + + file.Source = Path.Combine(sourcePath, fileName); + } + } + } + } + } + + // set the file assemblies and manifests + if (null != msiAssemblyTable) + { + foreach (Row row in msiAssemblyTable.Rows) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); + + if (null == component) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiAssembly", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); + } + else + { + foreach (Wix.ISchemaElement element in component.Children) + { + Wix.File file = element as Wix.File; + + if (null != file && Wix.YesNoType.yes == file.KeyPath) + { + if (null != row[2]) + { + file.AssemblyManifest = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + file.AssemblyApplication = Convert.ToString(row[3]); + } + + if (null == row[4] || 0 == Convert.ToInt32(row[4])) + { + file.Assembly = Wix.File.AssemblyType.net; + } + else + { + file.Assembly = Wix.File.AssemblyType.win32; + } + } + } + } + } + } + + // nest the TypeLib elements + if (null != typeLibTable) + { + foreach (Row row in typeLibTable.Rows) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); + Wix.TypeLib typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row); + + foreach (Wix.ISchemaElement element in component.Children) + { + Wix.File file = element as Wix.File; + + if (null != file && Wix.YesNoType.yes == file.KeyPath) + { + file.AddChild(typeLib); + } + } + } + } + } + + /// + /// Finalize the MIME table. + /// + /// The collection of all tables. + /// + /// There is a foreign key shared between the MIME and Extension + /// tables so either one would be valid to be decompiled first, so + /// the only safe way to nest the MIME elements is to do it during finalize. + /// + private void FinalizeMIMETable(TableIndexedCollection tables) + { + Table extensionTable = tables["Extension"]; + Table mimeTable = tables["MIME"]; + + Hashtable comExtensions = new Hashtable(); + + if (null != extensionTable) + { + foreach (Row row in extensionTable.Rows) + { + Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); + + // index the extension + if (!comExtensions.Contains(row[0])) + { + comExtensions.Add(row[0], new ArrayList()); + } + ((ArrayList)comExtensions[row[0]]).Add(extension); + + // set the default MIME element for this extension + if (null != row[3]) + { + Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); + + if (null != mime) + { + mime.Default = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); + } + } + } + } + + if (null != mimeTable) + { + foreach (Row row in mimeTable.Rows) + { + Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement(row); + + if (comExtensions.Contains(row[1])) + { + ArrayList extensionElements = (ArrayList)comExtensions[row[1]]; + + foreach (Wix.Extension extension in extensionElements) + { + extension.AddChild(mime); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MIME", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[1]), "Extension")); + } + } + } + } + + /// + /// Finalize the ProgId table. + /// + /// The collection of all tables. + /// + /// Enumerates through all the Class rows, looking for child ProgIds (these are the + /// default ProgIds for a given Class). Then go through the ProgId table and add any + /// remaining ProgIds for each Class. This happens during finalize because there is + /// a circular dependency between the Class and ProgId tables. + /// + private void FinalizeProgIdTable(TableIndexedCollection tables) + { + Table classTable = tables["Class"]; + Table progIdTable = tables["ProgId"]; + Table extensionTable = tables["Extension"]; + Table componentTable = tables["Component"]; + + Hashtable addedProgIds = new Hashtable(); + Hashtable classes = new Hashtable(); + Hashtable components = new Hashtable(); + + // add the default ProgIds for each class (and index the class table) + if (null != classTable) + { + foreach (Row row in classTable.Rows) + { + Wix.Class wixClass = (Wix.Class)this.core.GetIndexedElement(row); + + if (null != row[3]) + { + Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[3])); + + if (null != progId) + { + if (addedProgIds.Contains(progId)) + { + this.core.OnMessage(WixWarnings.TooManyProgIds(row.SourceLineNumbers, Convert.ToString(row[0]), Convert.ToString(row[3]), Convert.ToString(addedProgIds[progId]))); + } + else + { + wixClass.AddChild(progId); + addedProgIds.Add(progId, wixClass.Id); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Class", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Default", Convert.ToString(row[3]), "ProgId")); + } + } + + // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key) + if (!classes.Contains(wixClass.Id)) + { + classes.Add(wixClass.Id, new ArrayList()); + } + ((ArrayList)classes[wixClass.Id]).Add(wixClass); + } + } + + // add the remaining non-default ProgId entries for each class + if (null != progIdTable) + { + foreach (Row row in progIdTable.Rows) + { + Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); + + if (!addedProgIds.Contains(progId) && null != row[2] && null == progId.ParentElement) + { + ArrayList classElements = (ArrayList)classes[row[2]]; + + if (null != classElements) + { + foreach (Wix.Class wixClass in classElements) + { + wixClass.AddChild(progId); + addedProgIds.Add(progId, wixClass.Id); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ProgId", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Class_", Convert.ToString(row[2]), "Class")); + } + } + } + } + + if (null != componentTable) + { + foreach (Row row in componentTable.Rows) + { + Wix.Component wixComponent = (Wix.Component)this.core.GetIndexedElement(row); + + // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key) + if (!components.Contains(wixComponent.Id)) + { + components.Add(wixComponent.Id, new ArrayList()); + } + ((ArrayList)components[wixComponent.Id]).Add(wixComponent); + } + } + + // Check for any progIds that are not hooked up to a class and hook them up to the component specified by the extension + if (null != extensionTable) + { + foreach (Row row in extensionTable.Rows) + { + // ignore the extension if it isn't associated with a progId + if (null == row[2]) + { + continue; + } + + Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); + + // Haven't added the progId yet and it doesn't have a parent progId + if (!addedProgIds.Contains(progId) && null == progId.ParentElement) + { + ArrayList componentElements = (ArrayList)components[row[1]]; + + if (null != componentElements) + { + foreach (Wix.Component wixComponent in componentElements) + { + wixComponent.AddChild(progId); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + } + } + } + + /// + /// Finalize the Property table. + /// + /// The collection of all tables. + /// + /// Removes properties that are generated from other entries. + /// + private void FinalizePropertyTable(TableIndexedCollection tables) + { + Table propertyTable = tables["Property"]; + Table customActionTable = tables["CustomAction"]; + + if (null != propertyTable && null != customActionTable) + { + foreach (Row row in customActionTable.Rows) + { + int bits = Convert.ToInt32(row[1]); + if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) && + MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript)) + { + Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0])); + + // If no other fields on the property are set we must have created it during link + if (null != property && null == property.Value && Wix.YesNoType.yes != property.Secure && Wix.YesNoType.yes != property.SuppressModularization) + { + this.core.RootElement.RemoveChild(property); + } + } + } + } + } + + /// + /// Finalize the RemoveFile table. + /// + /// The collection of all tables. + /// + /// Sets the directory/property for each RemoveFile row. + /// + private void FinalizeRemoveFileTable(TableIndexedCollection tables) + { + Table removeFileTable = tables["RemoveFile"]; + + if (null != removeFileTable) + { + foreach (Row row in removeFileTable.Rows) + { + bool isDirectory = false; + string property = Convert.ToString(row[3]); + + // determine if the property is actually authored as a directory + if (null != this.core.GetIndexedElement("Directory", property)) + { + isDirectory = true; + } + + Wix.ISchemaElement element = this.core.GetIndexedElement(row); + + Wix.RemoveFile removeFile = element as Wix.RemoveFile; + if (null != removeFile) + { + if (isDirectory) + { + removeFile.Directory = property; + } + else + { + removeFile.Property = property; + } + } + else + { + Wix.RemoveFolder removeFolder = (Wix.RemoveFolder)element; + + if (isDirectory) + { + removeFolder.Directory = property; + } + else + { + removeFolder.Property = property; + } + } + } + } + } + + /// + /// Finalize the LockPermissions table. + /// + /// The collection of all tables. + /// + /// Nests the Permission elements below their parent elements. There are no declared foreign + /// keys for the parents of the LockPermissions table. + /// + private void FinalizeLockPermissionsTable(TableIndexedCollection tables) + { + Table createFolderTable = tables["CreateFolder"]; + Table lockPermissionsTable = tables["LockPermissions"]; + + Hashtable createFolders = new Hashtable(); + + // index the CreateFolder table because the foreign key to this table from the + // LockPermissions table is only part of the primary key of this table + if (null != createFolderTable) + { + foreach (Row row in createFolderTable.Rows) + { + Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); + string directoryId = Convert.ToString(row[0]); + + if (!createFolders.Contains(directoryId)) + { + createFolders.Add(directoryId, new ArrayList()); + } + ((ArrayList)createFolders[directoryId]).Add(createFolder); + } + } + + if (null != lockPermissionsTable) + { + foreach (Row row in lockPermissionsTable.Rows) + { + string id = Convert.ToString(row[0]); + string table = Convert.ToString(row[1]); + + Wix.Permission permission = (Wix.Permission)this.core.GetIndexedElement(row); + + if ("CreateFolder" == table) + { + ArrayList createFolderElements = (ArrayList)createFolders[id]; + + if (null != createFolderElements) + { + foreach (Wix.CreateFolder createFolder in createFolderElements) + { + createFolder.AddChild(permission); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); + } + } + else + { + Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); + + if (null != parentElement) + { + parentElement.AddChild(permission); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); + } + } + } + } + } + + /// + /// Finalize the MsiLockPermissionsEx table. + /// + /// The collection of all tables. + /// + /// Nests the PermissionEx elements below their parent elements. There are no declared foreign + /// keys for the parents of the MsiLockPermissionsEx table. + /// + private void FinalizeMsiLockPermissionsExTable(TableIndexedCollection tables) + { + Table createFolderTable = tables["CreateFolder"]; + Table msiLockPermissionsExTable = tables["MsiLockPermissionsEx"]; + + Hashtable createFolders = new Hashtable(); + + // index the CreateFolder table because the foreign key to this table from the + // MsiLockPermissionsEx table is only part of the primary key of this table + if (null != createFolderTable) + { + foreach (Row row in createFolderTable.Rows) + { + Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); + string directoryId = Convert.ToString(row[0]); + + if (!createFolders.Contains(directoryId)) + { + createFolders.Add(directoryId, new ArrayList()); + } + ((ArrayList)createFolders[directoryId]).Add(createFolder); + } + } + + if (null != msiLockPermissionsExTable) + { + foreach (Row row in msiLockPermissionsExTable.Rows) + { + string id = Convert.ToString(row[1]); + string table = Convert.ToString(row[2]); + + Wix.PermissionEx permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row); + + if ("CreateFolder" == table) + { + ArrayList createFolderElements = (ArrayList)createFolders[id]; + + if (null != createFolderElements) + { + foreach (Wix.CreateFolder createFolder in createFolderElements) + { + createFolder.AddChild(permissionEx); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); + } + } + else + { + Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); + + if (null != parentElement) + { + parentElement.AddChild(permissionEx); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); + } + } + } + } + } + + /// + /// Finalize the search tables. + /// + /// The collection of all tables. + /// Does all the complex linking required for the search tables. + private void FinalizeSearchTables(TableIndexedCollection tables) + { + Table appSearchTable = tables["AppSearch"]; + Table ccpSearchTable = tables["CCPSearch"]; + Table drLocatorTable = tables["DrLocator"]; + + Hashtable appSearches = new Hashtable(); + Hashtable ccpSearches = new Hashtable(); + Hashtable drLocators = new Hashtable(); + Hashtable locators = new Hashtable(); + Hashtable usedSearchElements = new Hashtable(); + ArrayList unusedSearchElements = new ArrayList(); + + Wix.ComplianceCheck complianceCheck = null; + + // index the AppSearch table by signatures + if (null != appSearchTable) + { + foreach (Row row in appSearchTable.Rows) + { + string property = Convert.ToString(row[0]); + string signature = Convert.ToString(row[1]); + + if (!appSearches.Contains(signature)) + { + appSearches.Add(signature, new StringCollection()); + } + + ((StringCollection)appSearches[signature]).Add(property); + } + } + + // index the CCPSearch table by signatures + if (null != ccpSearchTable) + { + foreach (Row row in ccpSearchTable.Rows) + { + string signature = Convert.ToString(row[0]); + + if (!ccpSearches.Contains(signature)) + { + ccpSearches.Add(signature, new StringCollection()); + } + + ((StringCollection)ccpSearches[signature]).Add(null); + + if (null == complianceCheck && !appSearches.Contains(signature)) + { + complianceCheck = new Wix.ComplianceCheck(); + this.core.RootElement.AddChild(complianceCheck); + } + } + } + + // index the directory searches by their search elements (to get back the original row) + if (null != drLocatorTable) + { + foreach (Row row in drLocatorTable.Rows) + { + drLocators.Add(this.core.GetIndexedElement(row), row); + } + } + + // index the locator tables by their signatures + string[] locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" }; + foreach (string locatorTableName in locatorTableNames) + { + Table locatorTable = tables[locatorTableName]; + + if (null != locatorTable) + { + foreach (Row row in locatorTable.Rows) + { + string signature = Convert.ToString(row[0]); + + if (!locators.Contains(signature)) + { + locators.Add(signature, new ArrayList()); + } + + ((ArrayList)locators[signature]).Add(row); + } + } + } + + // move the DrLocator rows with a parent of CCP_DRIVE first to ensure they get FileSearch children (not FileSearchRef) + foreach (ArrayList locatorRows in locators.Values) + { + int firstDrLocator = -1; + + for (int i = 0; i < locatorRows.Count; i++) + { + Row locatorRow = (Row)locatorRows[i]; + + if ("DrLocator" == locatorRow.TableDefinition.Name) + { + if (-1 == firstDrLocator) + { + firstDrLocator = i; + } + + if ("CCP_DRIVE" == Convert.ToString(locatorRow[1])) + { + locatorRows.RemoveAt(i); + locatorRows.Insert(firstDrLocator, locatorRow); + break; + } + } + } + } + + foreach (string signature in locators.Keys) + { + ArrayList locatorRows = (ArrayList)locators[signature]; + ArrayList signatureSearchElements = new ArrayList(); + + foreach (Row locatorRow in locatorRows) + { + bool used = true; + Wix.ISchemaElement searchElement = this.core.GetIndexedElement(locatorRow); + + if ("Signature" == locatorRow.TableDefinition.Name && 0 < signatureSearchElements.Count) + { + foreach (Wix.IParentElement searchParentElement in signatureSearchElements) + { + if (!usedSearchElements.Contains(searchElement)) + { + searchParentElement.AddChild(searchElement); + usedSearchElements[searchElement] = null; + } + else + { + Wix.FileSearchRef fileSearchRef = new Wix.FileSearchRef(); + + fileSearchRef.Id = signature; + + searchParentElement.AddChild(fileSearchRef); + } + } + } + else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1]) + { + string parentSignature = Convert.ToString(locatorRow[1]); + + if ("CCP_DRIVE" == parentSignature) + { + if (appSearches.Contains(signature)) + { + StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; + + foreach (string propertyId in appSearchPropertyIds) + { + Wix.Property property = this.EnsureProperty(propertyId); + Wix.ComplianceDrive complianceDrive = null; + + if (ccpSearches.Contains(signature)) + { + property.ComplianceCheck = Wix.YesNoType.yes; + } + + foreach (Wix.ISchemaElement element in property.Children) + { + complianceDrive = element as Wix.ComplianceDrive; + if (null != complianceDrive) + { + break; + } + } + + if (null == complianceDrive) + { + complianceDrive = new Wix.ComplianceDrive(); + property.AddChild(complianceDrive); + } + + if (!usedSearchElements.Contains(searchElement)) + { + complianceDrive.AddChild(searchElement); + usedSearchElements[searchElement] = null; + } + else + { + Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); + + directorySearchRef.Id = signature; + + if (null != locatorRow[1]) + { + directorySearchRef.Parent = Convert.ToString(locatorRow[1]); + } + + if (null != locatorRow[2]) + { + directorySearchRef.Path = Convert.ToString(locatorRow[2]); + } + + complianceDrive.AddChild(directorySearchRef); + signatureSearchElements.Add(directorySearchRef); + } + } + } + else if (ccpSearches.Contains(signature)) + { + Wix.ComplianceDrive complianceDrive = null; + + foreach (Wix.ISchemaElement element in complianceCheck.Children) + { + complianceDrive = element as Wix.ComplianceDrive; + if (null != complianceDrive) + { + break; + } + } + + if (null == complianceDrive) + { + complianceDrive = new Wix.ComplianceDrive(); + complianceCheck.AddChild(complianceDrive); + } + + if (!usedSearchElements.Contains(searchElement)) + { + complianceDrive.AddChild(searchElement); + usedSearchElements[searchElement] = null; + } + else + { + Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); + + directorySearchRef.Id = signature; + + if (null != locatorRow[1]) + { + directorySearchRef.Parent = Convert.ToString(locatorRow[1]); + } + + if (null != locatorRow[2]) + { + directorySearchRef.Path = Convert.ToString(locatorRow[2]); + } + + complianceDrive.AddChild(directorySearchRef); + signatureSearchElements.Add(directorySearchRef); + } + } + } + else + { + bool usedDrLocator = false; + ArrayList parentLocatorRows = (ArrayList)locators[parentSignature]; + + if (null != parentLocatorRows) + { + foreach (Row parentLocatorRow in parentLocatorRows) + { + if ("DrLocator" == parentLocatorRow.TableDefinition.Name) + { + Wix.IParentElement parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow); + + if (parentSearchElement.Children.GetEnumerator().MoveNext()) + { + Row parentDrLocatorRow = (Row)drLocators[parentSearchElement]; + Wix.DirectorySearchRef directorySeachRef = new Wix.DirectorySearchRef(); + + directorySeachRef.Id = parentSignature; + + if (null != parentDrLocatorRow[1]) + { + directorySeachRef.Parent = Convert.ToString(parentDrLocatorRow[1]); + } + + if (null != parentDrLocatorRow[2]) + { + directorySeachRef.Path = Convert.ToString(parentDrLocatorRow[2]); + } + + parentSearchElement = directorySeachRef; + unusedSearchElements.Add(directorySeachRef); + } + + if (!usedSearchElements.Contains(searchElement)) + { + parentSearchElement.AddChild(searchElement); + usedSearchElements[searchElement] = null; + usedDrLocator = true; + } + else + { + Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); + + directorySearchRef.Id = signature; + + directorySearchRef.Parent = parentSignature; + + if (null != locatorRow[2]) + { + directorySearchRef.Path = Convert.ToString(locatorRow[2]); + } + + parentSearchElement.AddChild(searchElement); + usedDrLocator = true; + } + } + } + + // keep track of unused DrLocator rows + if (!usedDrLocator) + { + unusedSearchElements.Add(searchElement); + } + } + else + { + // TODO: warn + } + } + } + else if (appSearches.Contains(signature)) + { + StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; + + foreach (string propertyId in appSearchPropertyIds) + { + Wix.Property property = this.EnsureProperty(propertyId); + + if (ccpSearches.Contains(signature)) + { + property.ComplianceCheck = Wix.YesNoType.yes; + } + + if (!usedSearchElements.Contains(searchElement)) + { + property.AddChild(searchElement); + usedSearchElements[searchElement] = null; + } + else if ("RegLocator" == locatorRow.TableDefinition.Name) + { + Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); + + registrySearchRef.Id = signature; + + property.AddChild(registrySearchRef); + signatureSearchElements.Add(registrySearchRef); + } + else + { + // TODO: warn about unavailable Ref element + } + } + } + else if (ccpSearches.Contains(signature)) + { + if (!usedSearchElements.Contains(searchElement)) + { + complianceCheck.AddChild(searchElement); + usedSearchElements[searchElement] = null; + } + else if ("RegLocator" == locatorRow.TableDefinition.Name) + { + Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); + + registrySearchRef.Id = signature; + + complianceCheck.AddChild(registrySearchRef); + signatureSearchElements.Add(registrySearchRef); + } + else + { + // TODO: warn about unavailable Ref element + } + } + else + { + if ("DrLocator" == locatorRow.TableDefinition.Name) + { + unusedSearchElements.Add(searchElement); + } + else + { + // TODO: warn + used = false; + } + } + + // keep track of the search elements for this signature so that nested searches go in the proper parents + if (used) + { + signatureSearchElements.Add(searchElement); + } + } + } + + foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements) + { + bool used = false; + + foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children) + { + Wix.DirectorySearch directorySearch = schemaElement as Wix.DirectorySearch; + if (null != directorySearch) + { + StringCollection appSearchProperties = (StringCollection)appSearches[directorySearch.Id]; + + Wix.ISchemaElement unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement; + if (null != appSearchProperties) + { + Wix.Property property = this.EnsureProperty(appSearchProperties[0]); + + property.AddChild(unusedSearchSchemaElement); + used = true; + break; + } + else if (ccpSearches.Contains(directorySearch.Id)) + { + complianceCheck.AddChild(unusedSearchSchemaElement); + used = true; + break; + } + else + { + // TODO: warn + } + } + } + + if (!used) + { + // TODO: warn + } + } + } + + /// + /// Finalize the sequence tables. + /// + /// The collection of all tables. + /// + /// Creates the sequence elements. Occurs during finalization because its + /// not known if sequences refer to custom actions or dialogs during decompilation. + /// + private void FinalizeSequenceTables(TableIndexedCollection tables) + { + // finalize the normal sequence tables + if (OutputType.Product == this.outputType && !this.treatProductAsModule) + { + foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) + { + // if suppressing UI elements, skip UI-related sequence tables + if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) + { + continue; + } + + Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); + Table table = tables[sequenceTable.ToString()]; + + if (null != table) + { + ArrayList actionRows = new ArrayList(); + bool needAbsoluteScheduling = this.suppressRelativeActionSequencing; + WixActionRowCollection nonSequencedActionRows = new WixActionRowCollection(); + WixActionRowCollection suppressedRelativeActionRows = new WixActionRowCollection(); + + // create a sorted array of actions in this table + foreach (Row row in table.Rows) + { + WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); + + actionRow.Action = Convert.ToString(row[0]); + + if (null != row[1]) + { + actionRow.Condition = Convert.ToString(row[1]); + } + + actionRow.Sequence = Convert.ToInt32(row[2]); + + actionRow.SequenceTable = sequenceTable; + + actionRows.Add(actionRow); + } + actionRows.Sort(); + + for (int i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++) + { + WixActionRow actionRow = (WixActionRow)actionRows[i]; + WixActionRow standardActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; + + // create actions for custom actions, dialogs, AppSearch when its moved, and standard actions with non-standard conditions + if ("AppSearch" == actionRow.Action || null == standardActionRow || actionRow.Condition != standardActionRow.Condition) + { + WixActionRow previousActionRow = null; + WixActionRow nextActionRow = null; + + // find the previous action row if there is one + if (0 <= i - 1) + { + previousActionRow = (WixActionRow)actionRows[i - 1]; + } + + // find the next action row if there is one + if (actionRows.Count > i + 1) + { + nextActionRow = (WixActionRow)actionRows[i + 1]; + } + + // the logic for setting the before or after attribute for an action: + // 1. If more than one action shares the same sequence number, everything must be absolutely sequenced. + // 2. If the next action is a standard action and is 1 sequence number higher, this action occurs before it. + // 3. If the previous action is a standard action and is 1 sequence number lower, this action occurs after it. + // 4. If this action is not standard and the previous action is 1 sequence number lower and does not occur before this action, this action occurs after it. + // 5. If this action is not standard and the previous action does not have the same sequence number and the next action is 1 sequence number higher, this action occurs before it. + // 6. If this action is AppSearch and has all standard information, ignore it. + // 7. If this action is standard and has a non-standard condition, create the action without any scheduling information. + // 8. Everything must be absolutely sequenced. + if ((null != previousActionRow && actionRow.Sequence == previousActionRow.Sequence) || (null != nextActionRow && actionRow.Sequence == nextActionRow.Sequence)) + { + needAbsoluteScheduling = true; + } + else if (null != nextActionRow && null != this.standardActions[sequenceTable, nextActionRow.Action] && actionRow.Sequence + 1 == nextActionRow.Sequence) + { + actionRow.Before = nextActionRow.Action; + } + else if (null != previousActionRow && null != this.standardActions[sequenceTable, previousActionRow.Action] && actionRow.Sequence - 1 == previousActionRow.Sequence) + { + actionRow.After = previousActionRow.Action; + } + else if (null == standardActionRow && null != previousActionRow && actionRow.Sequence - 1 == previousActionRow.Sequence && previousActionRow.Before != actionRow.Action) + { + actionRow.After = previousActionRow.Action; + } + else if (null == standardActionRow && null != previousActionRow && actionRow.Sequence != previousActionRow.Sequence && null != nextActionRow && actionRow.Sequence + 1 == nextActionRow.Sequence) + { + actionRow.Before = nextActionRow.Action; + } + else if ("AppSearch" == actionRow.Action && null != standardActionRow && actionRow.Sequence == standardActionRow.Sequence && actionRow.Condition == standardActionRow.Condition) + { + // ignore an AppSearch row which has the WiX standard sequence and a standard condition + } + else if (null != standardActionRow && actionRow.Condition != standardActionRow.Condition) // standard actions get their standard sequence numbers + { + nonSequencedActionRows.Add(actionRow); + } + else if (0 < actionRow.Sequence) + { + needAbsoluteScheduling = true; + } + } + else + { + suppressedRelativeActionRows.Add(actionRow); + } + } + + // create the actions now that we know if they must be absolutely or relatively scheduled + foreach (WixActionRow actionRow in actionRows) + { + if (needAbsoluteScheduling) + { + // remove any before/after information to ensure this is absolutely sequenced + actionRow.Before = null; + actionRow.After = null; + } + else if (nonSequencedActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) + { + // clear the sequence attribute to ensure this action is scheduled without a sequence number (or before/after) + actionRow.Sequence = 0; + } + else if (suppressedRelativeActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) + { + // skip the suppressed relatively scheduled action rows + continue; + } + + // create the action element + this.CreateActionElement(actionRow); + } + } + } + } + else if (OutputType.Module == this.outputType || this.treatProductAsModule) // finalize the Module sequence tables + { + foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) + { + // if suppressing UI elements, skip UI-related sequence tables + if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) + { + continue; + } + + Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); + Table table = tables[String.Concat("Module", sequenceTable.ToString())]; + + if (null != table) + { + foreach (Row row in table.Rows) + { + WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); + + actionRow.Action = Convert.ToString(row[0]); + + if (null != row[1]) + { + actionRow.Sequence = Convert.ToInt32(row[1]); + } + + if (null != row[2] && null != row[3]) + { + switch (Convert.ToInt32(row[3])) + { + case 0: + actionRow.Before = Convert.ToString(row[2]); + break; + case 1: + actionRow.After = Convert.ToString(row[2]); + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3])); + break; + } + } + + if (null != row[4]) + { + actionRow.Condition = Convert.ToString(row[4]); + } + + actionRow.SequenceTable = sequenceTable; + + // create action elements for non-standard actions + if (null == this.standardActions[actionRow.SequenceTable, actionRow.Action] || null != actionRow.After || null != actionRow.Before) + { + this.CreateActionElement(actionRow); + } + } + } + } + } + } + + /// + /// Finalize the Upgrade table. + /// + /// The collection of all tables. + /// + /// Decompile the rows from the Upgrade and LaunchCondition tables + /// created by the MajorUpgrade element. + /// + private void FinalizeUpgradeTable(TableIndexedCollection tables) + { + Table launchConditionTable = tables["LaunchCondition"]; + Table upgradeTable = tables["Upgrade"]; + string downgradeErrorMessage = null; + string disallowUpgradeErrorMessage = null; + Wix.MajorUpgrade majorUpgrade = new Wix.MajorUpgrade(); + + // find the DowngradePreventedCondition launch condition message + if (null != launchConditionTable && 0 < launchConditionTable.Rows.Count) + { + foreach (Row launchRow in launchConditionTable.Rows) + { + if (Compiler.DowngradePreventedCondition == Convert.ToString(launchRow[0])) + { + downgradeErrorMessage = Convert.ToString(launchRow[1]); + } + else if (Compiler.UpgradePreventedCondition == Convert.ToString(launchRow[0])) + { + disallowUpgradeErrorMessage = Convert.ToString(launchRow[1]); + } + } + } + + if (null != upgradeTable && 0 < upgradeTable.Rows.Count) + { + bool hasMajorUpgrade = false; + + foreach (Row row in upgradeTable.Rows) + { + UpgradeRow upgradeRow = (UpgradeRow)row; + + if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty) + { + hasMajorUpgrade = true; + int attr = upgradeRow.Attributes; + string removeFeatures = upgradeRow.Remove; + + if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) + { + majorUpgrade.AllowSameVersionUpgrades = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures != (attr & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) + { + majorUpgrade.MigrateFeatures = Wix.YesNoType.no; + } + + if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (attr & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) + { + majorUpgrade.IgnoreRemoveFailure = Wix.YesNoType.yes; + } + + if (!String.IsNullOrEmpty(removeFeatures)) + { + majorUpgrade.RemoveFeatures = removeFeatures; + } + } + else if (Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) + { + hasMajorUpgrade = true; + majorUpgrade.DowngradeErrorMessage = downgradeErrorMessage; + } + } + + if (hasMajorUpgrade) + { + if (String.IsNullOrEmpty(downgradeErrorMessage)) + { + majorUpgrade.AllowDowngrades = Wix.YesNoType.yes; + } + + if (!String.IsNullOrEmpty(disallowUpgradeErrorMessage)) + { + majorUpgrade.Disallow = Wix.YesNoType.yes; + majorUpgrade.DisallowUpgradeErrorMessage = disallowUpgradeErrorMessage; + } + + majorUpgrade.Schedule = DetermineMajorUpgradeScheduling(tables); + this.core.RootElement.AddChild(majorUpgrade); + } + } + } + + /// + /// Finalize the Verb table. + /// + /// The collection of all tables. + /// + /// The Extension table is a foreign table for the Verb table, but the + /// foreign key is only part of the primary key of the Extension table, + /// so it needs special logic to be nested properly. + /// + private void FinalizeVerbTable(TableIndexedCollection tables) + { + Table extensionTable = tables["Extension"]; + Table verbTable = tables["Verb"]; + + Hashtable extensionElements = new Hashtable(); + + if (null != extensionTable) + { + foreach (Row row in extensionTable.Rows) + { + Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); + + if (!extensionElements.Contains(row[0])) + { + extensionElements.Add(row[0], new ArrayList()); + } + + ((ArrayList)extensionElements[row[0]]).Add(extension); + } + } + + if (null != verbTable) + { + foreach (Row row in verbTable.Rows) + { + Wix.Verb verb = (Wix.Verb)this.core.GetIndexedElement(row); + + ArrayList extensionsArray = (ArrayList)extensionElements[row[0]]; + if (null != extensionsArray) + { + foreach (Wix.Extension extension in extensionsArray) + { + extension.AddChild(verb); + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, verbTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[0]), "Extension")); + } + } + } + } + + /// + /// Get the path to a file in the source image. + /// + /// The file. + /// The path to the file in the source image. + private string GetSourcePath(Wix.File file) + { + StringBuilder sourcePath = new StringBuilder(); + + Wix.Component component = (Wix.Component)file.ParentElement; + + for (Wix.Directory directory = (Wix.Directory)component.ParentElement; null != directory; directory = directory.ParentElement as Wix.Directory) + { + string name; + + if (!this.shortNames && null != directory.SourceName) + { + name = directory.SourceName; + } + else if (null != directory.ShortSourceName) + { + name = directory.ShortSourceName; + } + else if (!this.shortNames || null == directory.ShortName) + { + name = directory.Name; + } + else + { + name = directory.ShortName; + } + + if (0 == sourcePath.Length) + { + sourcePath.Append(name); + } + else + { + sourcePath.Insert(0, Path.DirectorySeparatorChar); + sourcePath.Insert(0, name); + } + } + + return sourcePath.ToString(); + } + + /// + /// Resolve the dependencies for a table (this is a helper method for GetSortedTableNames). + /// + /// The name of the table to resolve. + /// The unsorted table names. + /// The sorted table names. + private void ResolveTableDependencies(string tableName, SortedList unsortedTableNames, StringCollection sortedTableNames) + { + unsortedTableNames.Remove(tableName); + + foreach (ColumnDefinition columnDefinition in this.tableDefinitions[tableName].Columns) + { + // no dependency to resolve because this column doesn't reference another table + if (null == columnDefinition.KeyTable) + { + continue; + } + + foreach (string keyTable in columnDefinition.KeyTable.Split(';')) + { + if (tableName == keyTable) + { + continue; // self-referencing dependency + } + else if (sortedTableNames.Contains(keyTable)) + { + continue; // dependent table has already been sorted + } + else if (!this.tableDefinitions.Contains(keyTable)) + { + this.core.OnMessage(WixErrors.MissingTableDefinition(keyTable)); + } + else if (unsortedTableNames.Contains(keyTable)) + { + this.ResolveTableDependencies(keyTable, unsortedTableNames, sortedTableNames); + } + else + { + // found a circular dependency, so ignore it (this assumes that the tables will + // use a finalize method to nest their elements since the ordering will not be + // deterministic + } + } + } + + sortedTableNames.Add(tableName); + } + + /// + /// Get the names of the tables to process in the order they should be processed, according to their dependencies. + /// + /// A StringCollection containing the ordered table names. + private StringCollection GetSortedTableNames() + { + StringCollection sortedTableNames = new StringCollection(); + SortedList unsortedTableNames = new SortedList(); + + // index the table names + foreach (TableDefinition tableDefinition in this.tableDefinitions) + { + unsortedTableNames.Add(tableDefinition.Name, tableDefinition.Name); + } + + // resolve the dependencies for each table + while (0 < unsortedTableNames.Count) + { + this.ResolveTableDependencies(Convert.ToString(unsortedTableNames.GetByIndex(0)), unsortedTableNames, sortedTableNames); + } + + return sortedTableNames; + } + + /// + /// Initialize decompilation. + /// + /// The collection of all tables. + private void InitializeDecompile(TableIndexedCollection tables) + { + // reset all the state information + this.compressed = false; + this.patchTargetFiles.Clear(); + this.sequenceElements.Clear(); + this.shortNames = false; + + // set the codepage if its not neutral (0) + if (0 != this.codepage) + { + switch (this.outputType) + { + case OutputType.Module: + ((Wix.Module)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); + break; + case OutputType.PatchCreation: + ((Wix.PatchCreation)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); + break; + case OutputType.Product: + ((Wix.Product)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); + break; + } + } + + // index the rows from the extension libraries + Dictionary> indexedExtensionTables = new Dictionary>(); + foreach (IDecompilerExtension extension in this.extensions) + { + // Get the optional library from the extension with the rows to be removed. + Library library = extension.GetLibraryToRemove(this.tableDefinitions); + if (null != library) + { + foreach (Section section in library.Sections) + { + foreach (Table table in section.Tables) + { + foreach (Row row in table.Rows) + { + string primaryKey; + string tableName; + + // the Actions table needs to be handled specially + if ("WixAction" == table.Name) + { + primaryKey = Convert.ToString(row[1]); + + if (OutputType.Module == this.outputType) + { + tableName = String.Concat("Module", Convert.ToString(row[0])); + } + else + { + tableName = Convert.ToString(row[0]); + } + } + else + { + primaryKey = row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter); + tableName = table.Name; + } + + if (null != primaryKey) + { + HashSet indexedExtensionRows; + if (!indexedExtensionTables.TryGetValue(tableName, out indexedExtensionRows)) + { + indexedExtensionRows = new HashSet(); + indexedExtensionTables.Add(tableName, indexedExtensionRows); + } + + indexedExtensionRows.Add(primaryKey); + } + } + } + } + } + } + + // remove the rows from the extension libraries (to allow full round-tripping) + foreach (var kvp in indexedExtensionTables) + { + string tableName = kvp.Key; + HashSet indexedExtensionRows = kvp.Value; + + Table table = tables[tableName]; + if (null != table) + { + RowDictionary originalRows = new RowDictionary(table); + + // remove the original rows so that they can be added back if they should remain + table.Rows.Clear(); + + foreach (Row row in originalRows.Values) + { + if (!indexedExtensionRows.Contains(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter))) + { + table.Rows.Add(row); + } + } + } + } + } + + /// + /// Decompile the tables. + /// + /// The output being decompiled. + private void DecompileTables(Output output) + { + StringCollection sortedTableNames = this.GetSortedTableNames(); + + foreach (string tableName in sortedTableNames) + { + Table table = output.Tables[tableName]; + + // table does not exist in this database or should not be decompiled + if (null == table || !this.DecompilableTable(output, tableName)) + { + continue; + } + + this.core.OnMessage(WixVerboses.DecompilingTable(table.Name)); + + // empty tables may be kept with EnsureTable if the user set the proper option + if (0 == table.Rows.Count && this.suppressDroppingEmptyTables) + { + Wix.EnsureTable ensureTable = new Wix.EnsureTable(); + ensureTable.Id = table.Name; + this.core.RootElement.AddChild(ensureTable); + } + + switch (table.Name) + { + case "_SummaryInformation": + this.Decompile_SummaryInformationTable(table); + break; + case "AdminExecuteSequence": + case "AdminUISequence": + case "AdvtExecuteSequence": + case "InstallExecuteSequence": + case "InstallUISequence": + case "ModuleAdminExecuteSequence": + case "ModuleAdminUISequence": + case "ModuleAdvtExecuteSequence": + case "ModuleInstallExecuteSequence": + case "ModuleInstallUISequence": + // handled in FinalizeSequenceTables + break; + case "ActionText": + this.DecompileActionTextTable(table); + break; + case "AdvtUISequence": + this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name)); + break; + case "AppId": + this.DecompileAppIdTable(table); + break; + case "AppSearch": + // handled in FinalizeSearchTables + break; + case "BBControl": + this.DecompileBBControlTable(table); + break; + case "Billboard": + this.DecompileBillboardTable(table); + break; + case "Binary": + this.DecompileBinaryTable(table); + break; + case "BindImage": + this.DecompileBindImageTable(table); + break; + case "CCPSearch": + // handled in FinalizeSearchTables + break; + case "CheckBox": + // handled in FinalizeCheckBoxTable + break; + case "Class": + this.DecompileClassTable(table); + break; + case "ComboBox": + this.DecompileComboBoxTable(table); + break; + case "Control": + this.DecompileControlTable(table); + break; + case "ControlCondition": + this.DecompileControlConditionTable(table); + break; + case "ControlEvent": + this.DecompileControlEventTable(table); + break; + case "CreateFolder": + this.DecompileCreateFolderTable(table); + break; + case "CustomAction": + this.DecompileCustomActionTable(table); + break; + case "CompLocator": + this.DecompileCompLocatorTable(table); + break; + case "Complus": + this.DecompileComplusTable(table); + break; + case "Component": + this.DecompileComponentTable(table); + break; + case "Condition": + this.DecompileConditionTable(table); + break; + case "Dialog": + this.DecompileDialogTable(table); + break; + case "Directory": + this.DecompileDirectoryTable(table); + break; + case "DrLocator": + this.DecompileDrLocatorTable(table); + break; + case "DuplicateFile": + this.DecompileDuplicateFileTable(table); + break; + case "Environment": + this.DecompileEnvironmentTable(table); + break; + case "Error": + this.DecompileErrorTable(table); + break; + case "EventMapping": + this.DecompileEventMappingTable(table); + break; + case "Extension": + this.DecompileExtensionTable(table); + break; + case "ExternalFiles": + this.DecompileExternalFilesTable(table); + break; + case "FamilyFileRanges": + // handled in FinalizeFamilyFileRangesTable + break; + case "Feature": + this.DecompileFeatureTable(table); + break; + case "FeatureComponents": + this.DecompileFeatureComponentsTable(table); + break; + case "File": + this.DecompileFileTable(table); + break; + case "FileSFPCatalog": + this.DecompileFileSFPCatalogTable(table); + break; + case "Font": + this.DecompileFontTable(table); + break; + case "Icon": + this.DecompileIconTable(table); + break; + case "ImageFamilies": + this.DecompileImageFamiliesTable(table); + break; + case "IniFile": + this.DecompileIniFileTable(table); + break; + case "IniLocator": + this.DecompileIniLocatorTable(table); + break; + case "IsolatedComponent": + this.DecompileIsolatedComponentTable(table); + break; + case "LaunchCondition": + this.DecompileLaunchConditionTable(table); + break; + case "ListBox": + this.DecompileListBoxTable(table); + break; + case "ListView": + this.DecompileListViewTable(table); + break; + case "LockPermissions": + this.DecompileLockPermissionsTable(table); + break; + case "Media": + this.DecompileMediaTable(table); + break; + case "MIME": + this.DecompileMIMETable(table); + break; + case "ModuleAdvtUISequence": + this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name)); + break; + case "ModuleComponents": + // handled by DecompileComponentTable (since the ModuleComponents table + // rows are created by nesting components under the Module element) + break; + case "ModuleConfiguration": + this.DecompileModuleConfigurationTable(table); + break; + case "ModuleDependency": + this.DecompileModuleDependencyTable(table); + break; + case "ModuleExclusion": + this.DecompileModuleExclusionTable(table); + break; + case "ModuleIgnoreTable": + this.DecompileModuleIgnoreTableTable(table); + break; + case "ModuleSignature": + this.DecompileModuleSignatureTable(table); + break; + case "ModuleSubstitution": + this.DecompileModuleSubstitutionTable(table); + break; + case "MoveFile": + this.DecompileMoveFileTable(table); + break; + case "MsiAssembly": + // handled in FinalizeFileTable + break; + case "MsiDigitalCertificate": + this.DecompileMsiDigitalCertificateTable(table); + break; + case "MsiDigitalSignature": + this.DecompileMsiDigitalSignatureTable(table); + break; + case "MsiEmbeddedChainer": + this.DecompileMsiEmbeddedChainerTable(table); + break; + case "MsiEmbeddedUI": + this.DecompileMsiEmbeddedUITable(table); + break; + case "MsiLockPermissionsEx": + this.DecompileMsiLockPermissionsExTable(table); + break; + case "MsiPackageCertificate": + this.DecompileMsiPackageCertificateTable(table); + break; + case "MsiPatchCertificate": + this.DecompileMsiPatchCertificateTable(table); + break; + case "MsiShortcutProperty": + this.DecompileMsiShortcutPropertyTable(table); + break; + case "ODBCAttribute": + this.DecompileODBCAttributeTable(table); + break; + case "ODBCDataSource": + this.DecompileODBCDataSourceTable(table); + break; + case "ODBCDriver": + this.DecompileODBCDriverTable(table); + break; + case "ODBCSourceAttribute": + this.DecompileODBCSourceAttributeTable(table); + break; + case "ODBCTranslator": + this.DecompileODBCTranslatorTable(table); + break; + case "PatchMetadata": + this.DecompilePatchMetadataTable(table); + break; + case "PatchSequence": + this.DecompilePatchSequenceTable(table); + break; + case "ProgId": + this.DecompileProgIdTable(table); + break; + case "Properties": + this.DecompilePropertiesTable(table); + break; + case "Property": + this.DecompilePropertyTable(table); + break; + case "PublishComponent": + this.DecompilePublishComponentTable(table); + break; + case "RadioButton": + this.DecompileRadioButtonTable(table); + break; + case "Registry": + this.DecompileRegistryTable(table); + break; + case "RegLocator": + this.DecompileRegLocatorTable(table); + break; + case "RemoveFile": + this.DecompileRemoveFileTable(table); + break; + case "RemoveIniFile": + this.DecompileRemoveIniFileTable(table); + break; + case "RemoveRegistry": + this.DecompileRemoveRegistryTable(table); + break; + case "ReserveCost": + this.DecompileReserveCostTable(table); + break; + case "SelfReg": + this.DecompileSelfRegTable(table); + break; + case "ServiceControl": + this.DecompileServiceControlTable(table); + break; + case "ServiceInstall": + this.DecompileServiceInstallTable(table); + break; + case "SFPCatalog": + this.DecompileSFPCatalogTable(table); + break; + case "Shortcut": + this.DecompileShortcutTable(table); + break; + case "Signature": + this.DecompileSignatureTable(table); + break; + case "TargetFiles_OptionalData": + this.DecompileTargetFiles_OptionalDataTable(table); + break; + case "TargetImages": + this.DecompileTargetImagesTable(table); + break; + case "TextStyle": + this.DecompileTextStyleTable(table); + break; + case "TypeLib": + this.DecompileTypeLibTable(table); + break; + case "Upgrade": + this.DecompileUpgradeTable(table); + break; + case "UpgradedFiles_OptionalData": + this.DecompileUpgradedFiles_OptionalDataTable(table); + break; + case "UpgradedFilesToIgnore": + this.DecompileUpgradedFilesToIgnoreTable(table); + break; + case "UpgradedImages": + this.DecompileUpgradedImagesTable(table); + break; + case "UIText": + this.DecompileUITextTable(table); + break; + case "Verb": + this.DecompileVerbTable(table); + break; + default: + DecompilerExtension extension = (DecompilerExtension)this.extensionsByTableName[table.Name]; + + if (null != extension) + { + extension.DecompileTable(table); + } + else if (!this.suppressCustomTables) + { + this.DecompileCustomTable(table); + } + break; + } + } + } + + /// + /// Determine if a particular table should be decompiled with the current settings. + /// + /// The output being decompiled. + /// The name of a table. + /// true if the table should be decompiled; false otherwise. + private bool DecompilableTable(Output output, string tableName) + { + switch (tableName) + { + case "ActionText": + case "BBControl": + case "Billboard": + case "CheckBox": + case "Control": + case "ControlCondition": + case "ControlEvent": + case "Dialog": + case "Error": + case "EventMapping": + case "RadioButton": + case "TextStyle": + case "UIText": + return !this.suppressUI; + case "ModuleAdminExecuteSequence": + case "ModuleAdminUISequence": + case "ModuleAdvtExecuteSequence": + case "ModuleAdvtUISequence": + case "ModuleComponents": + case "ModuleConfiguration": + case "ModuleDependency": + case "ModuleIgnoreTable": + case "ModuleInstallExecuteSequence": + case "ModuleInstallUISequence": + case "ModuleExclusion": + case "ModuleSignature": + case "ModuleSubstitution": + if (OutputType.Module != output.Type) + { + this.core.OnMessage(WixWarnings.SkippingMergeModuleTable(output.SourceLineNumbers, tableName)); + return false; + } + else + { + return true; + } + case "ExternalFiles": + case "FamilyFileRanges": + case "ImageFamilies": + case "PatchMetadata": + case "PatchSequence": + case "Properties": + case "TargetFiles_OptionalData": + case "TargetImages": + case "UpgradedFiles_OptionalData": + case "UpgradedFilesToIgnore": + case "UpgradedImages": + if (OutputType.PatchCreation != output.Type) + { + this.core.OnMessage(WixWarnings.SkippingPatchCreationTable(output.SourceLineNumbers, tableName)); + return false; + } + else + { + return true; + } + case "MsiPatchHeaders": + case "MsiPatchMetadata": + case "MsiPatchOldAssemblyName": + case "MsiPatchOldAssemblyFile": + case "MsiPatchSequence": + case "Patch": + case "PatchPackage": + this.core.OnMessage(WixWarnings.PatchTable(output.SourceLineNumbers, tableName)); + return false; + case "_SummaryInformation": + return true; + case "_Validation": + case "MsiAssemblyName": + case "MsiFileHash": + return false; + default: // all other tables are allowed in any output except for a patch creation package + if (OutputType.PatchCreation == output.Type) + { + this.core.OnMessage(WixWarnings.IllegalPatchCreationTable(output.SourceLineNumbers, tableName)); + return false; + } + else + { + return true; + } + } + } + + /// + /// Decompile the _SummaryInformation table. + /// + /// The table to decompile. + private void Decompile_SummaryInformationTable(Table table) + { + if (OutputType.Module == this.outputType || OutputType.Product == this.outputType) + { + Wix.Package package = new Wix.Package(); + + foreach (Row row in table.Rows) + { + string value = Convert.ToString(row[1]); + + if (null != value && 0 < value.Length) + { + switch (Convert.ToInt32(row[0])) + { + case 1: + if ("1252" != value) + { + package.SummaryCodepage = value; + } + break; + case 3: + package.Description = value; + break; + case 4: + package.Manufacturer = value; + break; + case 5: + if ("Installer" != value) + { + package.Keywords = value; + } + break; + case 6: + package.Comments = value; + break; + case 7: + string[] template = value.Split(';'); + if (0 < template.Length && 0 < template[template.Length - 1].Length) + { + package.Languages = template[template.Length - 1]; + } + + if (1 < template.Length && null != template[0] && 0 < template[0].Length) + { + switch (template[0]) + { + case "Intel": + package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x86; + break; + case "Intel64": + package.Platform = WixToolset.Data.Serialize.Package.PlatformType.ia64; + break; + case "x64": + package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x64; + break; + } + } + break; + case 9: + if (OutputType.Module == this.outputType) + { + this.modularizationGuid = value; + package.Id = value; + } + break; + case 14: + package.InstallerVersion = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); + break; + case 15: + int wordCount = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); + if (0x1 == (wordCount & 0x1)) + { + this.shortNames = true; + package.ShortNames = Wix.YesNoType.yes; + } + + if (0x2 == (wordCount & 0x2)) + { + this.compressed = true; + + if (OutputType.Product == this.outputType) + { + package.Compressed = Wix.YesNoType.yes; + } + } + + if (0x4 == (wordCount & 0x4)) + { + package.AdminImage = Wix.YesNoType.yes; + } + + if (0x8 == (wordCount & 0x8)) + { + package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited; + } + + break; + case 19: + int security = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); + switch (security) + { + case 0: + package.ReadOnly = Wix.YesNoDefaultType.no; + break; + case 4: + package.ReadOnly = Wix.YesNoDefaultType.yes; + break; + } + break; + } + } + } + + this.core.RootElement.AddChild(package); + } + else + { + Wix.PatchInformation patchInformation = new Wix.PatchInformation(); + + foreach (Row row in table.Rows) + { + int propertyId = Convert.ToInt32(row[0]); + string value = Convert.ToString(row[1]); + + if (null != row[1] && 0 < value.Length) + { + switch (propertyId) + { + case 1: + if ("1252" != value) + { + patchInformation.SummaryCodepage = value; + } + break; + case 3: + patchInformation.Description = value; + break; + case 4: + patchInformation.Manufacturer = value; + break; + case 5: + if ("Installer,Patching,PCP,Database" != value) + { + patchInformation.Keywords = value; + } + break; + case 6: + patchInformation.Comments = value; + break; + case 7: + string[] template = value.Split(';'); + if (0 < template.Length && 0 < template[template.Length - 1].Length) + { + patchInformation.Languages = template[template.Length - 1]; + } + + if (1 < template.Length && null != template[0] && 0 < template[0].Length) + { + patchInformation.Platforms = template[0]; + } + break; + case 15: + int wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture); + if (0x1 == (wordCount & 0x1)) + { + patchInformation.ShortNames = Wix.YesNoType.yes; + } + + if (0x2 == (wordCount & 0x2)) + { + patchInformation.Compressed = Wix.YesNoType.yes; + } + + if (0x4 == (wordCount & 0x4)) + { + patchInformation.AdminImage = Wix.YesNoType.yes; + } + break; + case 19: + int security = Convert.ToInt32(value, CultureInfo.InvariantCulture); + switch (security) + { + case 0: + patchInformation.ReadOnly = Wix.YesNoDefaultType.no; + break; + case 4: + patchInformation.ReadOnly = Wix.YesNoDefaultType.yes; + break; + } + break; + } + } + } + + this.core.RootElement.AddChild(patchInformation); + } + } + + /// + /// Decompile the ActionText table. + /// + /// The table to decompile. + private void DecompileActionTextTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ProgressText progressText = new Wix.ProgressText(); + + progressText.Action = Convert.ToString(row[0]); + + if (null != row[1]) + { + progressText.Content = Convert.ToString(row[1]); + } + + if (null != row[2]) + { + progressText.Template = Convert.ToString(row[2]); + } + + this.core.UIElement.AddChild(progressText); + } + } + + /// + /// Decompile the AppId table. + /// + /// The table to decompile. + private void DecompileAppIdTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.AppId appId = new Wix.AppId(); + + appId.Advertise = Wix.YesNoType.yes; + + appId.Id = Convert.ToString(row[0]); + + if (null != row[1]) + { + appId.RemoteServerName = Convert.ToString(row[1]); + } + + if (null != row[2]) + { + appId.LocalService = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + appId.ServiceParameters = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + appId.DllSurrogate = Convert.ToString(row[4]); + } + + if (null != row[5] && Int32.Equals(row[5], 1)) + { + appId.ActivateAtStorage = Wix.YesNoType.yes; + } + + if (null != row[6] && Int32.Equals(row[6], 1)) + { + appId.RunAsInteractiveUser = Wix.YesNoType.yes; + } + + this.core.RootElement.AddChild(appId); + this.core.IndexElement(row, appId); + } + } + + /// + /// Decompile the BBControl table. + /// + /// The table to decompile. + private void DecompileBBControlTable(Table table) + { + foreach (BBControlRow bbControlRow in table.Rows) + { + Wix.Control control = new Wix.Control(); + + control.Id = bbControlRow.BBControl; + + control.Type = bbControlRow.Type; + + control.X = bbControlRow.X; + + control.Y = bbControlRow.Y; + + control.Width = bbControlRow.Width; + + control.Height = bbControlRow.Height; + + if (null != bbControlRow[7]) + { + SetControlAttributes(bbControlRow.Attributes, control); + } + + if (null != bbControlRow.Text) + { + control.Text = bbControlRow.Text; + } + + Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard); + if (null != billboard) + { + billboard.AddChild(control); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(bbControlRow.SourceLineNumbers, table.Name, bbControlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Billboard_", bbControlRow.Billboard, "Billboard")); + } + } + } + + /// + /// Decompile the Billboard table. + /// + /// The table to decompile. + private void DecompileBillboardTable(Table table) + { + Hashtable billboardActions = new Hashtable(); + SortedList billboards = new SortedList(); + + foreach (Row row in table.Rows) + { + Wix.Billboard billboard = new Wix.Billboard(); + + billboard.Id = Convert.ToString(row[0]); + + billboard.Feature = Convert.ToString(row[1]); + + this.core.IndexElement(row, billboard); + billboards.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1:0000000000}", row[0], row[3]), row); + } + + foreach (Row row in billboards.Values) + { + Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement(row); + Wix.BillboardAction billboardAction = (Wix.BillboardAction)billboardActions[row[2]]; + + if (null == billboardAction) + { + billboardAction = new Wix.BillboardAction(); + + billboardAction.Id = Convert.ToString(row[2]); + + this.core.UIElement.AddChild(billboardAction); + billboardActions.Add(row[2], billboardAction); + } + + billboardAction.AddChild(billboard); + } + } + + /// + /// Decompile the Binary table. + /// + /// The table to decompile. + private void DecompileBinaryTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Binary binary = new Wix.Binary(); + + binary.Id = Convert.ToString(row[0]); + + binary.SourceFile = Convert.ToString(row[1]); + + this.core.RootElement.AddChild(binary); + } + } + + /// + /// Decompile the BindImage table. + /// + /// The table to decompile. + private void DecompileBindImageTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); + + if (null != file) + { + file.BindPath = Convert.ToString(row[1]); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); + } + } + } + + /// + /// Decompile the Class table. + /// + /// The table to decompile. + private void DecompileClassTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Class wixClass = new Wix.Class(); + + wixClass.Advertise = Wix.YesNoType.yes; + + wixClass.Id = Convert.ToString(row[0]); + + switch (Convert.ToString(row[1])) + { + case "LocalServer": + wixClass.Context = Wix.Class.ContextType.LocalServer; + break; + case "LocalServer32": + wixClass.Context = Wix.Class.ContextType.LocalServer32; + break; + case "InprocServer": + wixClass.Context = Wix.Class.ContextType.InprocServer; + break; + case "InprocServer32": + wixClass.Context = Wix.Class.ContextType.InprocServer32; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + // ProgId children are handled in FinalizeProgIdTable + + if (null != row[4]) + { + wixClass.Description = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + wixClass.AppId = Convert.ToString(row[5]); + } + + if (null != row[6]) + { + string[] fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';'); + + try + { + foreach (string fileTypeMaskString in fileTypeMaskStrings) + { + string[] fileTypeMaskParts = fileTypeMaskString.Split(','); + + if (4 == fileTypeMaskParts.Length) + { + Wix.FileTypeMask fileTypeMask = new Wix.FileTypeMask(); + + fileTypeMask.Offset = Convert.ToInt32(fileTypeMaskParts[0], CultureInfo.InvariantCulture); + + fileTypeMask.Mask = fileTypeMaskParts[2]; + + fileTypeMask.Value = fileTypeMaskParts[3]; + + wixClass.AddChild(fileTypeMask); + } + else + { + // TODO: warn + } + } + } + catch (FormatException) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); + } + catch (OverflowException) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); + } + } + + if (null != row[7]) + { + wixClass.Icon = Convert.ToString(row[7]); + } + + if (null != row[8]) + { + wixClass.IconIndex = Convert.ToInt32(row[8]); + } + + if (null != row[9]) + { + wixClass.Handler = Convert.ToString(row[9]); + } + + if (null != row[10]) + { + wixClass.Argument = Convert.ToString(row[10]); + } + + if (null != row[12]) + { + if (1 == Convert.ToInt32(row[12])) + { + wixClass.RelativePath = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[12].Column.Name, row[12])); + } + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); + if (null != component) + { + component.AddChild(wixClass); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); + } + + this.core.IndexElement(row, wixClass); + } + } + + /// + /// Decompile the ComboBox table. + /// + /// The table to decompile. + private void DecompileComboBoxTable(Table table) + { + Wix.ComboBox comboBox = null; + SortedList comboBoxRows = new SortedList(); + + // sort the combo boxes by their property and order + foreach (Row row in table.Rows) + { + comboBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); + } + + foreach (Row row in comboBoxRows.Values) + { + if (null == comboBox || Convert.ToString(row[0]) != comboBox.Property) + { + comboBox = new Wix.ComboBox(); + + comboBox.Property = Convert.ToString(row[0]); + + this.core.UIElement.AddChild(comboBox); + } + + Wix.ListItem listItem = new Wix.ListItem(); + + listItem.Value = Convert.ToString(row[2]); + + if (null != row[3]) + { + listItem.Text = Convert.ToString(row[3]); + } + + comboBox.AddChild(listItem); + } + } + + /// + /// Decompile the Control table. + /// + /// The table to decompile. + private void DecompileControlTable(Table table) + { + foreach (ControlRow controlRow in table.Rows) + { + Wix.Control control = new Wix.Control(); + + control.Id = controlRow.Control; + + control.Type = controlRow.Type; + + control.X = controlRow.X; + + control.Y = controlRow.Y; + + control.Width = controlRow.Width; + + control.Height = controlRow.Height; + + if (null != controlRow[7]) + { + string[] specialAttributes; + + // sets various common attributes like Disabled, Indirect, Integer, ... + SetControlAttributes(controlRow.Attributes, control); + + switch (control.Type) + { + case "Bitmap": + specialAttributes = MsiInterop.BitmapControlAttributes; + break; + case "CheckBox": + specialAttributes = MsiInterop.CheckboxControlAttributes; + break; + case "ComboBox": + specialAttributes = MsiInterop.ComboboxControlAttributes; + break; + case "DirectoryCombo": + specialAttributes = MsiInterop.VolumeControlAttributes; + break; + case "Edit": + specialAttributes = MsiInterop.EditControlAttributes; + break; + case "Icon": + specialAttributes = MsiInterop.IconControlAttributes; + break; + case "ListBox": + specialAttributes = MsiInterop.ListboxControlAttributes; + break; + case "ListView": + specialAttributes = MsiInterop.ListviewControlAttributes; + break; + case "MaskedEdit": + specialAttributes = MsiInterop.EditControlAttributes; + break; + case "PathEdit": + specialAttributes = MsiInterop.EditControlAttributes; + break; + case "ProgressBar": + specialAttributes = MsiInterop.ProgressControlAttributes; + break; + case "PushButton": + specialAttributes = MsiInterop.ButtonControlAttributes; + break; + case "RadioButtonGroup": + specialAttributes = MsiInterop.RadioControlAttributes; + break; + case "Text": + specialAttributes = MsiInterop.TextControlAttributes; + break; + case "VolumeCostList": + specialAttributes = MsiInterop.VolumeControlAttributes; + break; + case "VolumeSelectCombo": + specialAttributes = MsiInterop.VolumeControlAttributes; + break; + default: + specialAttributes = null; + break; + } + + if (null != specialAttributes) + { + bool iconSizeSet = false; + + for (int i = 16; 32 > i; i++) + { + if (1 == ((controlRow.Attributes >> i) & 1)) + { + string attribute = null; + + if (specialAttributes.Length > (i - 16)) + { + attribute = specialAttributes[i - 16]; + } + + // unknown attribute + if (null == attribute) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); + continue; + } + + switch (attribute) + { + case "Bitmap": + control.Bitmap = Wix.YesNoType.yes; + break; + case "CDROM": + control.CDROM = Wix.YesNoType.yes; + break; + case "ComboList": + control.ComboList = Wix.YesNoType.yes; + break; + case "ElevationShield": + control.ElevationShield = Wix.YesNoType.yes; + break; + case "Fixed": + control.Fixed = Wix.YesNoType.yes; + break; + case "FixedSize": + control.FixedSize = Wix.YesNoType.yes; + break; + case "Floppy": + control.Floppy = Wix.YesNoType.yes; + break; + case "FormatSize": + control.FormatSize = Wix.YesNoType.yes; + break; + case "HasBorder": + control.HasBorder = Wix.YesNoType.yes; + break; + case "Icon": + control.Icon = Wix.YesNoType.yes; + break; + case "Icon16": + if (iconSizeSet) + { + control.IconSize = Wix.Control.IconSizeType.Item48; + } + else + { + iconSizeSet = true; + control.IconSize = Wix.Control.IconSizeType.Item16; + } + break; + case "Icon32": + if (iconSizeSet) + { + control.IconSize = Wix.Control.IconSizeType.Item48; + } + else + { + iconSizeSet = true; + control.IconSize = Wix.Control.IconSizeType.Item32; + } + break; + case "Image": + control.Image = Wix.YesNoType.yes; + break; + case "Multiline": + control.Multiline = Wix.YesNoType.yes; + break; + case "NoPrefix": + control.NoPrefix = Wix.YesNoType.yes; + break; + case "NoWrap": + control.NoWrap = Wix.YesNoType.yes; + break; + case "Password": + control.Password = Wix.YesNoType.yes; + break; + case "ProgressBlocks": + control.ProgressBlocks = Wix.YesNoType.yes; + break; + case "PushLike": + control.PushLike = Wix.YesNoType.yes; + break; + case "RAMDisk": + control.RAMDisk = Wix.YesNoType.yes; + break; + case "Remote": + control.Remote = Wix.YesNoType.yes; + break; + case "Removable": + control.Removable = Wix.YesNoType.yes; + break; + case "ShowRollbackCost": + control.ShowRollbackCost = Wix.YesNoType.yes; + break; + case "Sorted": + control.Sorted = Wix.YesNoType.yes; + break; + case "Transparent": + control.Transparent = Wix.YesNoType.yes; + break; + case "UserLanguage": + control.UserLanguage = Wix.YesNoType.yes; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknowControlAttribute, attribute)); + } + } + } + } + else if (0 < (controlRow.Attributes & 0xFFFF0000)) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); + } + } + + // FinalizeCheckBoxTable adds Control/@Property|@CheckBoxPropertyRef + if (null != controlRow.Property && 0 != String.CompareOrdinal("CheckBox", control.Type)) + { + control.Property = controlRow.Property; + } + + if (null != controlRow.Text) + { + control.Text = controlRow.Text; + } + + if (null != controlRow.Help) + { + string[] help = controlRow.Help.Split('|'); + + if (2 == help.Length) + { + if (0 < help[0].Length) + { + control.ToolTip = help[0]; + } + + if (0 < help[1].Length) + { + control.Help = help[1]; + } + } + } + + this.core.IndexElement(controlRow, control); + } + } + + /// + /// Decompile the ControlCondition table. + /// + /// The table to decompile. + private void DecompileControlConditionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Condition condition = new Wix.Condition(); + + switch (Convert.ToString(row[2])) + { + case "Default": + condition.Action = Wix.Condition.ActionType.@default; + break; + case "Disable": + condition.Action = Wix.Condition.ActionType.disable; + break; + case "Enable": + condition.Action = Wix.Condition.ActionType.enable; + break; + case "Hide": + condition.Action = Wix.Condition.ActionType.hide; + break; + case "Show": + condition.Action = Wix.Condition.ActionType.show; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); + break; + } + + condition.Content = Convert.ToString(row[3]); + + Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); + if (null != control) + { + control.AddChild(condition); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); + } + } + } + + /// + /// Decompile the ControlEvent table. + /// + /// The table to decompile. + private void DecompileControlEventTable(Table table) + { + SortedList controlEvents = new SortedList(); + + foreach (Row row in table.Rows) + { + Wix.Publish publish = new Wix.Publish(); + + string publishEvent = Convert.ToString(row[2]); + if (publishEvent.StartsWith("[", StringComparison.Ordinal) && publishEvent.EndsWith("]", StringComparison.Ordinal)) + { + publish.Property = publishEvent.Substring(1, publishEvent.Length - 2); + + if ("{}" != Convert.ToString(row[3])) + { + publish.Value = Convert.ToString(row[3]); + } + } + else + { + publish.Event = publishEvent; + publish.Value = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + publish.Content = Convert.ToString(row[4]); + } + + controlEvents.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2:0000000000}|{3}|{4}|{5}", row[0], row[1], (null == row[5] ? 0 : Convert.ToInt32(row[5])), row[2], row[3], row[4]), row); + + this.core.IndexElement(row, publish); + } + + foreach (Row row in controlEvents.Values) + { + Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); + Wix.Publish publish = (Wix.Publish)this.core.GetIndexedElement(row); + + if (null != control) + { + control.AddChild(publish); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); + } + } + } + + /// + /// Decompile a custom table. + /// + /// The table to decompile. + private void DecompileCustomTable(Table table) + { + if (0 < table.Rows.Count || this.suppressDroppingEmptyTables) + { + Wix.CustomTable customTable = new Wix.CustomTable(); + + this.core.OnMessage(WixWarnings.DecompilingAsCustomTable(table.Rows[0].SourceLineNumbers, table.Name)); + + customTable.Id = table.Name; + + foreach (ColumnDefinition columnDefinition in table.Definition.Columns) + { + Wix.Column column = new Wix.Column(); + + column.Id = columnDefinition.Name; + + if (ColumnCategory.Unknown != columnDefinition.Category) + { + switch (columnDefinition.Category) + { + case ColumnCategory.Text: + column.Category = Wix.Column.CategoryType.Text; + break; + case ColumnCategory.UpperCase: + column.Category = Wix.Column.CategoryType.UpperCase; + break; + case ColumnCategory.LowerCase: + column.Category = Wix.Column.CategoryType.LowerCase; + break; + case ColumnCategory.Integer: + column.Category = Wix.Column.CategoryType.Integer; + break; + case ColumnCategory.DoubleInteger: + column.Category = Wix.Column.CategoryType.DoubleInteger; + break; + case ColumnCategory.TimeDate: + column.Category = Wix.Column.CategoryType.TimeDate; + break; + case ColumnCategory.Identifier: + column.Category = Wix.Column.CategoryType.Identifier; + break; + case ColumnCategory.Property: + column.Category = Wix.Column.CategoryType.Property; + break; + case ColumnCategory.Filename: + column.Category = Wix.Column.CategoryType.Filename; + break; + case ColumnCategory.WildCardFilename: + column.Category = Wix.Column.CategoryType.WildCardFilename; + break; + case ColumnCategory.Path: + column.Category = Wix.Column.CategoryType.Path; + break; + case ColumnCategory.Paths: + column.Category = Wix.Column.CategoryType.Paths; + break; + case ColumnCategory.AnyPath: + column.Category = Wix.Column.CategoryType.AnyPath; + break; + case ColumnCategory.DefaultDir: + column.Category = Wix.Column.CategoryType.DefaultDir; + break; + case ColumnCategory.RegPath: + column.Category = Wix.Column.CategoryType.RegPath; + break; + case ColumnCategory.Formatted: + column.Category = Wix.Column.CategoryType.Formatted; + break; + case ColumnCategory.FormattedSDDLText: + column.Category = Wix.Column.CategoryType.FormattedSddl; + break; + case ColumnCategory.Template: + column.Category = Wix.Column.CategoryType.Template; + break; + case ColumnCategory.Condition: + column.Category = Wix.Column.CategoryType.Condition; + break; + case ColumnCategory.Guid: + column.Category = Wix.Column.CategoryType.Guid; + break; + case ColumnCategory.Version: + column.Category = Wix.Column.CategoryType.Version; + break; + case ColumnCategory.Language: + column.Category = Wix.Column.CategoryType.Language; + break; + case ColumnCategory.Binary: + column.Category = Wix.Column.CategoryType.Binary; + break; + case ColumnCategory.CustomSource: + column.Category = Wix.Column.CategoryType.CustomSource; + break; + case ColumnCategory.Cabinet: + column.Category = Wix.Column.CategoryType.Cabinet; + break; + case ColumnCategory.Shortcut: + column.Category = Wix.Column.CategoryType.Shortcut; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnCategory, columnDefinition.Category.ToString())); + } + } + + if (null != columnDefinition.Description) + { + column.Description = columnDefinition.Description; + } + + if (columnDefinition.IsKeyColumnSet) + { + column.KeyColumn = columnDefinition.KeyColumn; + } + + if (null != columnDefinition.KeyTable) + { + column.KeyTable = columnDefinition.KeyTable; + } + + if (columnDefinition.IsLocalizable) + { + column.Localizable = Wix.YesNoType.yes; + } + + if (columnDefinition.IsMaxValueSet) + { + column.MaxValue = columnDefinition.MaxValue; + } + + if (columnDefinition.IsMinValueSet) + { + column.MinValue = columnDefinition.MinValue; + } + + if (ColumnModularizeType.None != columnDefinition.ModularizeType) + { + switch (columnDefinition.ModularizeType) + { + case ColumnModularizeType.Column: + column.Modularize = Wix.Column.ModularizeType.Column; + break; + case ColumnModularizeType.Condition: + column.Modularize = Wix.Column.ModularizeType.Condition; + break; + case ColumnModularizeType.Icon: + column.Modularize = Wix.Column.ModularizeType.Icon; + break; + case ColumnModularizeType.Property: + column.Modularize = Wix.Column.ModularizeType.Property; + break; + case ColumnModularizeType.SemicolonDelimited: + column.Modularize = Wix.Column.ModularizeType.SemicolonDelimited; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnModularizationType, columnDefinition.ModularizeType.ToString())); + } + } + + if (columnDefinition.Nullable) + { + column.Nullable = Wix.YesNoType.yes; + } + + if (columnDefinition.PrimaryKey) + { + column.PrimaryKey = Wix.YesNoType.yes; + } + + if (null != columnDefinition.Possibilities) + { + column.Set = columnDefinition.Possibilities; + } + + if (ColumnType.Unknown != columnDefinition.Type) + { + switch (columnDefinition.Type) + { + case ColumnType.Localized: + column.Localizable = Wix.YesNoType.yes; + column.Type = Wix.Column.TypeType.@string; + break; + case ColumnType.Number: + column.Type = Wix.Column.TypeType.@int; + break; + case ColumnType.Object: + column.Type = Wix.Column.TypeType.binary; + break; + case ColumnType.Preserved: + case ColumnType.String: + column.Type = Wix.Column.TypeType.@string; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnType, columnDefinition.Type.ToString())); + } + } + + column.Width = columnDefinition.Length; + + customTable.AddChild(column); + } + + foreach (Row row in table.Rows) + { + Wix.Row wixRow = new Wix.Row(); + + foreach (Field field in row.Fields) + { + Wix.Data data = new Wix.Data(); + + data.Column = field.Column.Name; + + data.Content = Convert.ToString(field.Data, CultureInfo.InvariantCulture); + + wixRow.AddChild(data); + } + + customTable.AddChild(wixRow); + } + + this.core.RootElement.AddChild(customTable); + } + } + + /// + /// Decompile the CreateFolder table. + /// + /// The table to decompile. + private void DecompileCreateFolderTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.CreateFolder createFolder = new Wix.CreateFolder(); + + createFolder.Directory = Convert.ToString(row[0]); + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(createFolder); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, createFolder); + } + } + + /// + /// Decompile the CustomAction table. + /// + /// The table to decompile. + private void DecompileCustomActionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.CustomAction customAction = new Wix.CustomAction(); + + customAction.Id = Convert.ToString(row[0]); + + int type = Convert.ToInt32(row[1]); + + if (MsiInterop.MsidbCustomActionTypeHideTarget == (type & MsiInterop.MsidbCustomActionTypeHideTarget)) + { + customAction.HideTarget = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbCustomActionTypeNoImpersonate == (type & MsiInterop.MsidbCustomActionTypeNoImpersonate)) + { + customAction.Impersonate = Wix.YesNoType.no; + } + + if (MsiInterop.MsidbCustomActionTypeTSAware == (type & MsiInterop.MsidbCustomActionTypeTSAware)) + { + customAction.TerminalServerAware = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbCustomActionType64BitScript == (type & MsiInterop.MsidbCustomActionType64BitScript)) + { + customAction.Win64 = Wix.YesNoType.yes; + } + + switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits) + { + case 0: + // this is the default value + break; + case MsiInterop.MsidbCustomActionTypeFirstSequence: + customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence; + break; + case MsiInterop.MsidbCustomActionTypeOncePerProcess: + customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess; + break; + case MsiInterop.MsidbCustomActionTypeClientRepeat: + customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence; + break; + case MsiInterop.MsidbCustomActionTypeInScript: + customAction.Execute = Wix.CustomAction.ExecuteType.deferred; + break; + case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeRollback: + customAction.Execute = Wix.CustomAction.ExecuteType.rollback; + break; + case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeCommit: + customAction.Execute = Wix.CustomAction.ExecuteType.commit; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + switch (type & MsiInterop.MsidbCustomActionTypeReturnBits) + { + case 0: + // this is the default value + break; + case MsiInterop.MsidbCustomActionTypeContinue: + customAction.Return = Wix.CustomAction.ReturnType.ignore; + break; + case MsiInterop.MsidbCustomActionTypeAsync: + customAction.Return = Wix.CustomAction.ReturnType.asyncWait; + break; + case MsiInterop.MsidbCustomActionTypeAsync + MsiInterop.MsidbCustomActionTypeContinue: + customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + int source = type & MsiInterop.MsidbCustomActionTypeSourceBits; + switch (source) + { + case MsiInterop.MsidbCustomActionTypeBinaryData: + customAction.BinaryKey = Convert.ToString(row[2]); + break; + case MsiInterop.MsidbCustomActionTypeSourceFile: + if (null != row[2]) + { + customAction.FileKey = Convert.ToString(row[2]); + } + break; + case MsiInterop.MsidbCustomActionTypeDirectory: + if (null != row[2]) + { + customAction.Directory = Convert.ToString(row[2]); + } + break; + case MsiInterop.MsidbCustomActionTypeProperty: + customAction.Property = Convert.ToString(row[2]); + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + switch (type & MsiInterop.MsidbCustomActionTypeTargetBits) + { + case MsiInterop.MsidbCustomActionTypeDll: + customAction.DllEntry = Convert.ToString(row[3]); + break; + case MsiInterop.MsidbCustomActionTypeExe: + customAction.ExeCommand = Convert.ToString(row[3]); + break; + case MsiInterop.MsidbCustomActionTypeTextData: + if (MsiInterop.MsidbCustomActionTypeSourceFile == source) + { + customAction.Error = Convert.ToString(row[3]); + } + else + { + customAction.Value = Convert.ToString(row[3]); + } + break; + case MsiInterop.MsidbCustomActionTypeJScript: + if (MsiInterop.MsidbCustomActionTypeDirectory == source) + { + customAction.Script = Wix.CustomAction.ScriptType.jscript; + customAction.Content = Convert.ToString(row[3]); + } + else + { + customAction.JScriptCall = Convert.ToString(row[3]); + } + break; + case MsiInterop.MsidbCustomActionTypeVBScript: + if (MsiInterop.MsidbCustomActionTypeDirectory == source) + { + customAction.Script = Wix.CustomAction.ScriptType.vbscript; + customAction.Content = Convert.ToString(row[3]); + } + else + { + customAction.VBScriptCall = Convert.ToString(row[3]); + } + break; + case MsiInterop.MsidbCustomActionTypeInstall: + this.core.OnMessage(WixWarnings.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + continue; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + int extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0; + if (MsiInterop.MsidbCustomActionTypePatchUninstall == (extype & MsiInterop.MsidbCustomActionTypePatchUninstall)) + { + customAction.PatchUninstall = Wix.YesNoType.yes; + } + + this.core.RootElement.AddChild(customAction); + this.core.IndexElement(row, customAction); + } + } + + /// + /// Decompile the CompLocator table. + /// + /// The table to decompile. + private void DecompileCompLocatorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ComponentSearch componentSearch = new Wix.ComponentSearch(); + + componentSearch.Id = Convert.ToString(row[0]); + + componentSearch.Guid = Convert.ToString(row[1]); + + if (null != row[2]) + { + switch (Convert.ToInt32(row[2])) + { + case MsiInterop.MsidbLocatorTypeDirectory: + componentSearch.Type = Wix.ComponentSearch.TypeType.directory; + break; + case MsiInterop.MsidbLocatorTypeFileName: + // this is the default value + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); + break; + } + } + + this.core.IndexElement(row, componentSearch); + } + } + + /// + /// Decompile the Complus table. + /// + /// The table to decompile. + private void DecompileComplusTable(Table table) + { + foreach (Row row in table.Rows) + { + if (null != row[1]) + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); + + if (null != component) + { + component.ComPlusFlags = Convert.ToInt32(row[1]); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); + } + } + } + } + + /// + /// Decompile the Component table. + /// + /// The table to decompile. + private void DecompileComponentTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Component component = new Wix.Component(); + + component.Id = Convert.ToString(row[0]); + + component.Guid = Convert.ToString(row[1]); + + int attributes = Convert.ToInt32(row[3]); + + if (MsiInterop.MsidbComponentAttributesSourceOnly == (attributes & MsiInterop.MsidbComponentAttributesSourceOnly)) + { + component.Location = Wix.Component.LocationType.source; + } + else if (MsiInterop.MsidbComponentAttributesOptional == (attributes & MsiInterop.MsidbComponentAttributesOptional)) + { + component.Location = Wix.Component.LocationType.either; + } + + if (MsiInterop.MsidbComponentAttributesSharedDllRefCount == (attributes & MsiInterop.MsidbComponentAttributesSharedDllRefCount)) + { + component.SharedDllRefCount = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesPermanent == (attributes & MsiInterop.MsidbComponentAttributesPermanent)) + { + component.Permanent = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesTransitive == (attributes & MsiInterop.MsidbComponentAttributesTransitive)) + { + component.Transitive = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesNeverOverwrite == (attributes & MsiInterop.MsidbComponentAttributesNeverOverwrite)) + { + component.NeverOverwrite = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributes64bit == (attributes & MsiInterop.MsidbComponentAttributes64bit)) + { + component.Win64 = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesDisableRegistryReflection == (attributes & MsiInterop.MsidbComponentAttributesDisableRegistryReflection)) + { + component.DisableRegistryReflection = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesUninstallOnSupersedence == (attributes & MsiInterop.MsidbComponentAttributesUninstallOnSupersedence)) + { + component.UninstallWhenSuperseded = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbComponentAttributesShared == (attributes & MsiInterop.MsidbComponentAttributesShared)) + { + component.Shared = Wix.YesNoType.yes; + } + + if (null != row[4]) + { + Wix.Condition condition = new Wix.Condition(); + + condition.Content = Convert.ToString(row[4]); + + component.AddChild(condition); + } + + Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[2])); + if (null != directory) + { + directory.AddChild(component); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_", Convert.ToString(row[2]), "Directory")); + } + this.core.IndexElement(row, component); + } + } + + /// + /// Decompile the Condition table. + /// + /// The table to decompile. + private void DecompileConditionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Condition condition = new Wix.Condition(); + + condition.Level = Convert.ToInt32(row[1]); + + if (null != row[2]) + { + condition.Content = Convert.ToString(row[2]); + } + + Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); + if (null != feature) + { + feature.AddChild(condition); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); + } + } + } + + /// + /// Decompile the Dialog table. + /// + /// The table to decompile. + private void DecompileDialogTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Dialog dialog = new Wix.Dialog(); + + dialog.Id = Convert.ToString(row[0]); + + dialog.X = Convert.ToInt32(row[1]); + + dialog.Y = Convert.ToInt32(row[2]); + + dialog.Width = Convert.ToInt32(row[3]); + + dialog.Height = Convert.ToInt32(row[4]); + + if (null != row[5]) + { + int attributes = Convert.ToInt32(row[5]); + + if (0 == (attributes & MsiInterop.MsidbDialogAttributesVisible)) + { + dialog.Hidden = Wix.YesNoType.yes; + } + + if (0 == (attributes & MsiInterop.MsidbDialogAttributesModal)) + { + dialog.Modeless = Wix.YesNoType.yes; + } + + if (0 == (attributes & MsiInterop.MsidbDialogAttributesMinimize)) + { + dialog.NoMinimize = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesSysModal == (attributes & MsiInterop.MsidbDialogAttributesSysModal)) + { + dialog.SystemModal = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesKeepModeless == (attributes & MsiInterop.MsidbDialogAttributesKeepModeless)) + { + dialog.KeepModeless = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesTrackDiskSpace == (attributes & MsiInterop.MsidbDialogAttributesTrackDiskSpace)) + { + dialog.TrackDiskSpace = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesUseCustomPalette == (attributes & MsiInterop.MsidbDialogAttributesUseCustomPalette)) + { + dialog.CustomPalette = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesRTLRO == (attributes & MsiInterop.MsidbDialogAttributesRTLRO)) + { + dialog.RightToLeft = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesRightAligned == (attributes & MsiInterop.MsidbDialogAttributesRightAligned)) + { + dialog.RightAligned = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesLeftScroll == (attributes & MsiInterop.MsidbDialogAttributesLeftScroll)) + { + dialog.LeftScroll = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbDialogAttributesError == (attributes & MsiInterop.MsidbDialogAttributesError)) + { + dialog.ErrorDialog = Wix.YesNoType.yes; + } + } + + if (null != row[6]) + { + dialog.Title = Convert.ToString(row[6]); + } + + this.core.UIElement.AddChild(dialog); + this.core.IndexElement(row, dialog); + } + } + + /// + /// Decompile the Directory table. + /// + /// The table to decompile. + private void DecompileDirectoryTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Directory directory = new Wix.Directory(); + + directory.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[2])); + + if (String.Equals(directory.Id, "TARGETDIR", StringComparison.Ordinal) && !String.Equals(names[0], "SourceDir", StringComparison.Ordinal)) + { + this.core.OnMessage(WixWarnings.TargetDirCorrectedDefaultDir()); + directory.Name = "SourceDir"; + } + else + { + if (null != names[0] && "." != names[0]) + { + if (null != names[1]) + { + directory.ShortName = names[0]; + } + else + { + directory.Name = names[0]; + } + } + + if (null != names[1]) + { + directory.Name = names[1]; + } + } + + if (null != names[2]) + { + if (null != names[3]) + { + directory.ShortSourceName = names[2]; + } + else + { + directory.SourceName = names[2]; + } + } + + if (null != names[3]) + { + directory.SourceName = names[3]; + } + + this.core.IndexElement(row, directory); + } + + // nest the directories + foreach (Row row in table.Rows) + { + Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement(row); + + if (null == row[1]) + { + this.core.RootElement.AddChild(directory); + } + else + { + Wix.Directory parentDirectory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[1])); + + if (null == parentDirectory) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_Parent", Convert.ToString(row[1]), "Directory")); + } + else if (parentDirectory == directory) // another way to specify a root directory + { + this.core.RootElement.AddChild(directory); + } + else + { + parentDirectory.AddChild(directory); + } + } + } + } + + /// + /// Decompile the DrLocator table. + /// + /// The table to decompile. + private void DecompileDrLocatorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.DirectorySearch directorySearch = new Wix.DirectorySearch(); + + directorySearch.Id = Convert.ToString(row[0]); + + if (null != row[2]) + { + directorySearch.Path = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + directorySearch.Depth = Convert.ToInt32(row[3]); + } + + this.core.IndexElement(row, directorySearch); + } + } + + /// + /// Decompile the DuplicateFile table. + /// + /// The table to decompile. + private void DecompileDuplicateFileTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.CopyFile copyFile = new Wix.CopyFile(); + + copyFile.Id = Convert.ToString(row[0]); + + copyFile.FileId = Convert.ToString(row[2]); + + if (null != row[3]) + { + string[] names = Common.GetNames(Convert.ToString(row[3])); + if (null != names[0] && null != names[1]) + { + copyFile.DestinationShortName = names[0]; + copyFile.DestinationName = names[1]; + } + else if (null != names[0]) + { + copyFile.DestinationName = names[0]; + } + } + + // destination directory/property is set in FinalizeDuplicateMoveFileTables + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(copyFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, copyFile); + } + } + + /// + /// Decompile the Environment table. + /// + /// The table to decompile. + private void DecompileEnvironmentTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Environment environment = new Wix.Environment(); + + environment.Id = Convert.ToString(row[0]); + + bool done = false; + bool permanent = true; + string name = Convert.ToString(row[1]); + for (int i = 0; i < name.Length && !done; i++) + { + switch (name[i]) + { + case '=': + environment.Action = Wix.Environment.ActionType.set; + break; + case '+': + environment.Action = Wix.Environment.ActionType.create; + break; + case '-': + permanent = false; + break; + case '!': + environment.Action = Wix.Environment.ActionType.remove; + break; + case '*': + environment.System = Wix.YesNoType.yes; + break; + default: + environment.Name = name.Substring(i); + done = true; + break; + } + } + + if (permanent) + { + environment.Permanent = Wix.YesNoType.yes; + } + + if (null != row[2]) + { + string value = Convert.ToString(row[2]); + + if (value.StartsWith("[~]", StringComparison.Ordinal)) + { + environment.Part = Wix.Environment.PartType.last; + + if (3 < value.Length) + { + environment.Separator = value.Substring(3, 1); + environment.Value = value.Substring(4); + } + } + else if (value.EndsWith("[~]", StringComparison.Ordinal)) + { + environment.Part = Wix.Environment.PartType.first; + + if (3 < value.Length) + { + environment.Separator = value.Substring(value.Length - 4, 1); + environment.Value = value.Substring(0, value.Length - 4); + } + } + else + { + environment.Value = value; + } + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); + if (null != component) + { + component.AddChild(environment); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); + } + } + } + + /// + /// Decompile the Error table. + /// + /// The table to decompile. + private void DecompileErrorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Error error = new Wix.Error(); + + error.Id = Convert.ToInt32(row[0]); + + error.Content = Convert.ToString(row[1]); + + this.core.UIElement.AddChild(error); + } + } + + /// + /// Decompile the EventMapping table. + /// + /// The table to decompile. + private void DecompileEventMappingTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Subscribe subscribe = new Wix.Subscribe(); + + subscribe.Event = Convert.ToString(row[2]); + + subscribe.Attribute = Convert.ToString(row[3]); + + Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); + if (null != control) + { + control.AddChild(subscribe); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); + } + } + } + + /// + /// Decompile the Extension table. + /// + /// The table to decompile. + private void DecompileExtensionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Extension extension = new Wix.Extension(); + + extension.Advertise = Wix.YesNoType.yes; + + extension.Id = Convert.ToString(row[0]); + + if (null != row[3]) + { + Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); + + if (null != mime) + { + mime.Default = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); + } + } + + if (null != row[2]) + { + Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); + + if (null != progId) + { + progId.AddChild(extension); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_", Convert.ToString(row[2]), "ProgId")); + } + } + else + { + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + + if (null != component) + { + component.AddChild(extension); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + + this.core.IndexElement(row, extension); + } + } + + /// + /// Decompile the ExternalFiles table. + /// + /// The table to decompile. + private void DecompileExternalFilesTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ExternalFile externalFile = new Wix.ExternalFile(); + + externalFile.File = Convert.ToString(row[1]); + + externalFile.Source = Convert.ToString(row[2]); + + if (null != row[3]) + { + string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); + + foreach (string symbolPathString in symbolPaths) + { + Wix.SymbolPath symbolPath = new Wix.SymbolPath(); + + symbolPath.Path = symbolPathString; + + externalFile.AddChild(symbolPath); + } + } + + if (null != row[4] && null != row[5]) + { + string[] ignoreOffsets = (Convert.ToString(row[4])).Split(','); + string[] ignoreLengths = (Convert.ToString(row[5])).Split(','); + + if (ignoreOffsets.Length == ignoreLengths.Length) + { + for (int i = 0; i < ignoreOffsets.Length; i++) + { + Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); + + if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) + { + ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i].Substring(2), 16); + } + else + { + ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i], CultureInfo.InvariantCulture); + } + + if (ignoreLengths[i].StartsWith("0x", StringComparison.Ordinal)) + { + ignoreRange.Length = Convert.ToInt32(ignoreLengths[i].Substring(2), 16); + } + else + { + ignoreRange.Length = Convert.ToInt32(ignoreLengths[i], CultureInfo.InvariantCulture); + } + + externalFile.AddChild(ignoreRange); + } + } + else + { + // TODO: warn + } + } + else if (null != row[4] || null != row[5]) + { + // TODO: warn about mismatch between columns + } + + // the RetainOffsets column is handled in FinalizeFamilyFileRangesTable + + if (null != row[7]) + { + externalFile.Order = Convert.ToInt32(row[7]); + } + + Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); + if (null != family) + { + family.AddChild(externalFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); + } + this.core.IndexElement(row, externalFile); + } + } + + /// + /// Decompile the Feature table. + /// + /// The table to decompile. + private void DecompileFeatureTable(Table table) + { + SortedList sortedFeatures = new SortedList(); + + foreach (Row row in table.Rows) + { + Wix.Feature feature = new Wix.Feature(); + + feature.Id = Convert.ToString(row[0]); + + if (null != row[2]) + { + feature.Title = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + feature.Description = Convert.ToString(row[3]); + } + + if (null == row[4]) + { + feature.Display = "hidden"; + } + else + { + int display = Convert.ToInt32(row[4]); + + if (0 == display) + { + feature.Display = "hidden"; + } + else if (1 == display % 2) + { + feature.Display = "expand"; + } + } + + feature.Level = Convert.ToInt32(row[5]); + + if (null != row[6]) + { + feature.ConfigurableDirectory = Convert.ToString(row[6]); + } + + int attributes = Convert.ToInt32(row[7]); + + if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource) && MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) + { + // TODO: display a warning for setting favor local and follow parent together + } + else if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource)) + { + feature.InstallDefault = Wix.Feature.InstallDefaultType.source; + } + else if (MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) + { + feature.InstallDefault = Wix.Feature.InstallDefaultType.followParent; + } + + if (MsiInterop.MsidbFeatureAttributesFavorAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesFavorAdvertise)) + { + feature.TypicalDefault = Wix.Feature.TypicalDefaultType.advertise; + } + + if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise) && + MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) + { + this.core.OnMessage(WixWarnings.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no")); + feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; + } + else if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise)) + { + feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; + } + else if (MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) + { + feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.system; + } + + if (MsiInterop.MsidbFeatureAttributesUIDisallowAbsent == (attributes & MsiInterop.MsidbFeatureAttributesUIDisallowAbsent)) + { + feature.Absent = Wix.Feature.AbsentType.disallow; + } + + this.core.IndexElement(row, feature); + + // sort the features by their display column (and append the identifier to ensure unique keys) + sortedFeatures.Add(String.Format(CultureInfo.InvariantCulture, "{0:00000}|{1}", Convert.ToInt32(row[4], CultureInfo.InvariantCulture), row[0]), row); + } + + // nest the features + foreach (Row row in sortedFeatures.Values) + { + Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); + + if (null == row[1]) + { + this.core.RootElement.AddChild(feature); + } + else + { + Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[1])); + + if (null == parentFeature) + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_Parent", Convert.ToString(row[1]), "Feature")); + } + else if (parentFeature == feature) + { + // TODO: display a warning about self-nesting + } + else + { + parentFeature.AddChild(feature); + } + } + } + } + + /// + /// Decompile the FeatureComponents table. + /// + /// The table to decompile. + private void DecompileFeatureComponentsTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ComponentRef componentRef = new Wix.ComponentRef(); + + componentRef.Id = Convert.ToString(row[1]); + + Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); + if (null != parentFeature) + { + parentFeature.AddChild(componentRef); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); + } + this.core.IndexElement(row, componentRef); + } + } + + /// + /// Decompile the File table. + /// + /// The table to decompile. + private void DecompileFileTable(Table table) + { + foreach (FileRow fileRow in table.Rows) + { + Wix.File file = new Wix.File(); + + file.Id = fileRow.File; + + string[] names = Common.GetNames(fileRow.FileName); + if (null != names[0] && null != names[1]) + { + file.ShortName = names[0]; + file.Name = names[1]; + } + else if (null != names[0]) + { + file.Name = names[0]; + } + + if (null != fileRow.Version && 0 < fileRow.Version.Length) + { + if (!Char.IsDigit(fileRow.Version[0])) + { + file.CompanionFile = fileRow.Version; + } + } + + if (MsiInterop.MsidbFileAttributesReadOnly == (fileRow.Attributes & MsiInterop.MsidbFileAttributesReadOnly)) + { + file.ReadOnly = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbFileAttributesHidden == (fileRow.Attributes & MsiInterop.MsidbFileAttributesHidden)) + { + file.Hidden = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbFileAttributesSystem == (fileRow.Attributes & MsiInterop.MsidbFileAttributesSystem)) + { + file.System = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbFileAttributesVital != (fileRow.Attributes & MsiInterop.MsidbFileAttributesVital)) + { + file.Vital = Wix.YesNoType.no; + } + + if (MsiInterop.MsidbFileAttributesChecksum == (fileRow.Attributes & MsiInterop.MsidbFileAttributesChecksum)) + { + file.Checksum = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed) && + MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) + { + // TODO: error + } + else if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed)) + { + file.Compressed = Wix.YesNoDefaultType.no; + } + else if (MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) + { + file.Compressed = Wix.YesNoDefaultType.yes; + } + + this.core.IndexElement(fileRow, file); + } + } + + /// + /// Decompile the FileSFPCatalog table. + /// + /// The table to decompile. + private void DecompileFileSFPCatalogTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.SFPFile sfpFile = new Wix.SFPFile(); + + sfpFile.Id = Convert.ToString(row[0]); + + Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[1])); + if (null != sfpCatalog) + { + sfpCatalog.AddChild(sfpFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SFPCatalog_", Convert.ToString(row[1]), "SFPCatalog")); + } + } + } + + /// + /// Decompile the Font table. + /// + /// The table to decompile. + private void DecompileFontTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); + + if (null != file) + { + if (null != row[1]) + { + file.FontTitle = Convert.ToString(row[1]); + } + else + { + file.TrueType = Wix.YesNoType.yes; + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); + } + } + } + + /// + /// Decompile the Icon table. + /// + /// The table to decompile. + private void DecompileIconTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Icon icon = new Wix.Icon(); + + icon.Id = Convert.ToString(row[0]); + + icon.SourceFile = Convert.ToString(row[1]); + + this.core.RootElement.AddChild(icon); + } + } + + /// + /// Decompile the ImageFamilies table. + /// + /// The table to decompile. + private void DecompileImageFamiliesTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Family family = new Wix.Family(); + + family.Name = Convert.ToString(row[0]); + + if (null != row[1]) + { + family.MediaSrcProp = Convert.ToString(row[1]); + } + + if (null != row[2]) + { + family.DiskId = Convert.ToString(Convert.ToInt32(row[2])); + } + + if (null != row[3]) + { + family.SequenceStart = Convert.ToInt32(row[3]); + } + + if (null != row[4]) + { + family.DiskPrompt = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + family.VolumeLabel = Convert.ToString(row[5]); + } + + this.core.RootElement.AddChild(family); + this.core.IndexElement(row, family); + } + } + + /// + /// Decompile the IniFile table. + /// + /// The table to decompile. + private void DecompileIniFileTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.IniFile iniFile = new Wix.IniFile(); + + iniFile.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[1])); + + if (null != names[0]) + { + if (null == names[1]) + { + iniFile.Name = names[0]; + } + else + { + iniFile.ShortName = names[0]; + } + } + + if (null != names[1]) + { + iniFile.Name = names[1]; + } + + if (null != row[2]) + { + iniFile.Directory = Convert.ToString(row[2]); + } + + iniFile.Section = Convert.ToString(row[3]); + + iniFile.Key = Convert.ToString(row[4]); + + iniFile.Value = Convert.ToString(row[5]); + + switch (Convert.ToInt32(row[6])) + { + case MsiInterop.MsidbIniFileActionAddLine: + iniFile.Action = Wix.IniFile.ActionType.addLine; + break; + case MsiInterop.MsidbIniFileActionCreateLine: + iniFile.Action = Wix.IniFile.ActionType.createLine; + break; + case MsiInterop.MsidbIniFileActionAddTag: + iniFile.Action = Wix.IniFile.ActionType.addTag; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); + break; + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); + if (null != component) + { + component.AddChild(iniFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); + } + } + } + + /// + /// Decompile the IniLocator table. + /// + /// The table to decompile. + private void DecompileIniLocatorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.IniFileSearch iniFileSearch = new Wix.IniFileSearch(); + + iniFileSearch.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[1])); + if (null != names[0] && null != names[1]) + { + iniFileSearch.ShortName = names[0]; + iniFileSearch.Name = names[1]; + } + else if (null != names[0]) + { + iniFileSearch.Name = names[0]; + } + + iniFileSearch.Section = Convert.ToString(row[2]); + + iniFileSearch.Key = Convert.ToString(row[3]); + + if (null != row[4]) + { + int field = Convert.ToInt32(row[4]); + + if (0 != field) + { + iniFileSearch.Field = field; + } + } + + if (null != row[5]) + { + switch (Convert.ToInt32(row[5])) + { + case MsiInterop.MsidbLocatorTypeDirectory: + iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory; + break; + case MsiInterop.MsidbLocatorTypeFileName: + // this is the default value + break; + case MsiInterop.MsidbLocatorTypeRawValue: + iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); + break; + } + } + + this.core.IndexElement(row, iniFileSearch); + } + } + + /// + /// Decompile the IsolatedComponent table. + /// + /// The table to decompile. + private void DecompileIsolatedComponentTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.IsolateComponent isolateComponent = new Wix.IsolateComponent(); + + isolateComponent.Shared = Convert.ToString(row[0]); + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(isolateComponent); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + } + + /// + /// Decompile the LaunchCondition table. + /// + /// The table to decompile. + private void DecompileLaunchConditionTable(Table table) + { + foreach (Row row in table.Rows) + { + if (Compiler.DowngradePreventedCondition == Convert.ToString(row[0]) || Compiler.UpgradePreventedCondition == Convert.ToString(row[0])) + { + continue; // MajorUpgrade rows processed in FinalizeUpgradeTable + } + + Wix.Condition condition = new Wix.Condition(); + + condition.Content = Convert.ToString(row[0]); + + condition.Message = Convert.ToString(row[1]); + + this.core.RootElement.AddChild(condition); + } + } + + /// + /// Decompile the ListBox table. + /// + /// The table to decompile. + private void DecompileListBoxTable(Table table) + { + Wix.ListBox listBox = null; + SortedList listBoxRows = new SortedList(); + + // sort the list boxes by their property and order + foreach (Row row in table.Rows) + { + listBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); + } + + foreach (Row row in listBoxRows.Values) + { + if (null == listBox || Convert.ToString(row[0]) != listBox.Property) + { + listBox = new Wix.ListBox(); + + listBox.Property = Convert.ToString(row[0]); + + this.core.UIElement.AddChild(listBox); + } + + Wix.ListItem listItem = new Wix.ListItem(); + + listItem.Value = Convert.ToString(row[2]); + + if (null != row[3]) + { + listItem.Text = Convert.ToString(row[3]); + } + + listBox.AddChild(listItem); + } + } + + /// + /// Decompile the ListView table. + /// + /// The table to decompile. + private void DecompileListViewTable(Table table) + { + Wix.ListView listView = null; + SortedList listViewRows = new SortedList(); + + // sort the list views by their property and order + foreach (Row row in table.Rows) + { + listViewRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); + } + + foreach (Row row in listViewRows.Values) + { + if (null == listView || Convert.ToString(row[0]) != listView.Property) + { + listView = new Wix.ListView(); + + listView.Property = Convert.ToString(row[0]); + + this.core.UIElement.AddChild(listView); + } + + Wix.ListItem listItem = new Wix.ListItem(); + + listItem.Value = Convert.ToString(row[2]); + + if (null != row[3]) + { + listItem.Text = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + listItem.Icon = Convert.ToString(row[4]); + } + + listView.AddChild(listItem); + } + } + + /// + /// Decompile the LockPermissions table. + /// + /// The table to decompile. + private void DecompileLockPermissionsTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Permission permission = new Wix.Permission(); + string[] specialPermissions; + + switch (Convert.ToString(row[1])) + { + case "CreateFolder": + specialPermissions = Common.FolderPermissions; + break; + case "File": + specialPermissions = Common.FilePermissions; + break; + case "Registry": + specialPermissions = Common.RegistryPermissions; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); + return; + } + + int permissionBits = Convert.ToInt32(row[4]); + for (int i = 0; i < 32; i++) + { + if (0 != ((permissionBits >> i) & 1)) + { + string name = null; + + if (specialPermissions.Length > i) + { + name = specialPermissions[i]; + } + else if (16 > i && specialPermissions.Length <= i) + { + name = "SpecificRightsAll"; + } + else if (28 > i && Common.StandardPermissions.Length > (i - 16)) + { + name = Common.StandardPermissions[i - 16]; + } + else if (0 <= (i - 28) && Common.GenericPermissions.Length > (i - 28)) + { + name = Common.GenericPermissions[i - 28]; + } + + if (null == name) + { + this.core.OnMessage(WixWarnings.UnknownPermission(row.SourceLineNumbers, row.Table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), i)); + } + else + { + switch (name) + { + case "Append": + permission.Append = Wix.YesNoType.yes; + break; + case "ChangePermission": + permission.ChangePermission = Wix.YesNoType.yes; + break; + case "CreateChild": + permission.CreateChild = Wix.YesNoType.yes; + break; + case "CreateFile": + permission.CreateFile = Wix.YesNoType.yes; + break; + case "CreateLink": + permission.CreateLink = Wix.YesNoType.yes; + break; + case "CreateSubkeys": + permission.CreateSubkeys = Wix.YesNoType.yes; + break; + case "Delete": + permission.Delete = Wix.YesNoType.yes; + break; + case "DeleteChild": + permission.DeleteChild = Wix.YesNoType.yes; + break; + case "EnumerateSubkeys": + permission.EnumerateSubkeys = Wix.YesNoType.yes; + break; + case "Execute": + permission.Execute = Wix.YesNoType.yes; + break; + case "FileAllRights": + permission.FileAllRights = Wix.YesNoType.yes; + break; + case "GenericAll": + permission.GenericAll = Wix.YesNoType.yes; + break; + case "GenericExecute": + permission.GenericExecute = Wix.YesNoType.yes; + break; + case "GenericRead": + permission.GenericRead = Wix.YesNoType.yes; + break; + case "GenericWrite": + permission.GenericWrite = Wix.YesNoType.yes; + break; + case "Notify": + permission.Notify = Wix.YesNoType.yes; + break; + case "Read": + permission.Read = Wix.YesNoType.yes; + break; + case "ReadAttributes": + permission.ReadAttributes = Wix.YesNoType.yes; + break; + case "ReadExtendedAttributes": + permission.ReadExtendedAttributes = Wix.YesNoType.yes; + break; + case "ReadPermission": + permission.ReadPermission = Wix.YesNoType.yes; + break; + case "SpecificRightsAll": + permission.SpecificRightsAll = Wix.YesNoType.yes; + break; + case "Synchronize": + permission.Synchronize = Wix.YesNoType.yes; + break; + case "TakeOwnership": + permission.TakeOwnership = Wix.YesNoType.yes; + break; + case "Traverse": + permission.Traverse = Wix.YesNoType.yes; + break; + case "Write": + permission.Write = Wix.YesNoType.yes; + break; + case "WriteAttributes": + permission.WriteAttributes = Wix.YesNoType.yes; + break; + case "WriteExtendedAttributes": + permission.WriteExtendedAttributes = Wix.YesNoType.yes; + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownPermissionAttribute, name)); + } + } + } + } + + if (null != row[2]) + { + permission.Domain = Convert.ToString(row[2]); + } + + permission.User = Convert.ToString(row[3]); + + this.core.IndexElement(row, permission); + } + } + + /// + /// Decompile the Media table. + /// + /// The table to decompile. + private void DecompileMediaTable(Table table) + { + foreach (MediaRow mediaRow in table.Rows) + { + Wix.Media media = new Wix.Media(); + + media.Id = Convert.ToString(mediaRow.DiskId); + + if (null != mediaRow.DiskPrompt) + { + media.DiskPrompt = mediaRow.DiskPrompt; + } + + if (null != mediaRow.Cabinet) + { + string cabinet = mediaRow.Cabinet; + + if (cabinet.StartsWith("#", StringComparison.Ordinal)) + { + media.EmbedCab = Wix.YesNoType.yes; + cabinet = cabinet.Substring(1); + } + + media.Cabinet = cabinet; + } + + if (null != mediaRow.VolumeLabel) + { + media.VolumeLabel = mediaRow.VolumeLabel; + } + + this.core.RootElement.AddChild(media); + this.core.IndexElement(mediaRow, media); + } + } + + /// + /// Decompile the MIME table. + /// + /// The table to decompile. + private void DecompileMIMETable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.MIME mime = new Wix.MIME(); + + mime.ContentType = Convert.ToString(row[0]); + + if (null != row[2]) + { + mime.Class = Convert.ToString(row[2]); + } + + this.core.IndexElement(row, mime); + } + } + + /// + /// Decompile the ModuleConfiguration table. + /// + /// The table to decompile. + private void DecompileModuleConfigurationTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Configuration configuration = new Wix.Configuration(); + + configuration.Name = Convert.ToString(row[0]); + + switch (Convert.ToInt32(row[1])) + { + case 0: + configuration.Format = Wix.Configuration.FormatType.Text; + break; + case 1: + configuration.Format = Wix.Configuration.FormatType.Key; + break; + case 2: + configuration.Format = Wix.Configuration.FormatType.Integer; + break; + case 3: + configuration.Format = Wix.Configuration.FormatType.Bitfield; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + if (null != row[2]) + { + configuration.Type = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + configuration.ContextData = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + configuration.DefaultValue = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + int attributes = Convert.ToInt32(row[5]); + + if (MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan)) + { + configuration.KeyNoOrphan = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbMsmConfigurableOptionNonNullable == (attributes & MsiInterop.MsidbMsmConfigurableOptionNonNullable)) + { + configuration.NonNullable = Wix.YesNoType.yes; + } + + if (3 < attributes) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); + } + } + + if (null != row[6]) + { + configuration.DisplayName = Convert.ToString(row[6]); + } + + if (null != row[7]) + { + configuration.Description = Convert.ToString(row[7]); + } + + if (null != row[8]) + { + configuration.HelpLocation = Convert.ToString(row[8]); + } + + if (null != row[9]) + { + configuration.HelpKeyword = Convert.ToString(row[9]); + } + + this.core.RootElement.AddChild(configuration); + } + } + + /// + /// Decompile the ModuleDependency table. + /// + /// The table to decompile. + private void DecompileModuleDependencyTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Dependency dependency = new Wix.Dependency(); + + dependency.RequiredId = Convert.ToString(row[2]); + + dependency.RequiredLanguage = Convert.ToInt32(row[3], CultureInfo.InvariantCulture); + + if (null != row[4]) + { + dependency.RequiredVersion = Convert.ToString(row[4]); + } + + this.core.RootElement.AddChild(dependency); + } + } + + /// + /// Decompile the ModuleExclusion table. + /// + /// The table to decompile. + private void DecompileModuleExclusionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Exclusion exclusion = new Wix.Exclusion(); + + exclusion.ExcludedId = Convert.ToString(row[2]); + + int excludedLanguage = Convert.ToInt32(Convert.ToString(row[3]), CultureInfo.InvariantCulture); + if (0 < excludedLanguage) + { + exclusion.ExcludeLanguage = excludedLanguage; + } + else if (0 > excludedLanguage) + { + exclusion.ExcludeExceptLanguage = -excludedLanguage; + } + + if (null != row[4]) + { + exclusion.ExcludedMinVersion = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + exclusion.ExcludedMinVersion = Convert.ToString(row[5]); + } + + this.core.RootElement.AddChild(exclusion); + } + } + + /// + /// Decompile the ModuleIgnoreTable table. + /// + /// The table to decompile. + private void DecompileModuleIgnoreTableTable(Table table) + { + foreach (Row row in table.Rows) + { + string tableName = Convert.ToString(row[0]); + + // the linker automatically adds a ModuleIgnoreTable row for some tables + if ("ModuleConfiguration" != tableName && "ModuleSubstitution" != tableName) + { + Wix.IgnoreTable ignoreTable = new Wix.IgnoreTable(); + + ignoreTable.Id = tableName; + + this.core.RootElement.AddChild(ignoreTable); + } + } + } + + /// + /// Decompile the ModuleSignature table. + /// + /// The table to decompile. + private void DecompileModuleSignatureTable(Table table) + { + if (1 == table.Rows.Count) + { + Row row = table.Rows[0]; + + Wix.Module module = (Wix.Module)this.core.RootElement; + + module.Id = Convert.ToString(row[0]); + + // support Language columns that are treated as integers as well as strings (the WiX default, to support localizability) + module.Language = Convert.ToString(row[1], CultureInfo.InvariantCulture); + + module.Version = Convert.ToString(row[2]); + } + else + { + // TODO: warn + } + } + + /// + /// Decompile the ModuleSubstitution table. + /// + /// The table to decompile. + private void DecompileModuleSubstitutionTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Substitution substitution = new Wix.Substitution(); + + substitution.Table = Convert.ToString(row[0]); + + substitution.Row = Convert.ToString(row[1]); + + substitution.Column = Convert.ToString(row[2]); + + if (null != row[3]) + { + substitution.Value = Convert.ToString(row[3]); + } + + this.core.RootElement.AddChild(substitution); + } + } + + /// + /// Decompile the MoveFile table. + /// + /// The table to decompile. + private void DecompileMoveFileTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.CopyFile copyFile = new Wix.CopyFile(); + + copyFile.Id = Convert.ToString(row[0]); + + if (null != row[2]) + { + copyFile.SourceName = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + string[] names = Common.GetNames(Convert.ToString(row[3])); + if (null != names[0] && null != names[1]) + { + copyFile.DestinationShortName = names[0]; + copyFile.DestinationName = names[1]; + } + else if (null != names[0]) + { + copyFile.DestinationName = names[0]; + } + } + + // source/destination directory/property is set in FinalizeDuplicateMoveFileTables + + switch (Convert.ToInt32(row[6])) + { + case 0: + break; + case MsiInterop.MsidbMoveFileOptionsMove: + copyFile.Delete = Wix.YesNoType.yes; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); + break; + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(copyFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, copyFile); + } + } + + /// + /// Decompile the MsiDigitalCertificate table. + /// + /// The table to decompile. + private void DecompileMsiDigitalCertificateTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.DigitalCertificate digitalCertificate = new Wix.DigitalCertificate(); + + digitalCertificate.Id = Convert.ToString(row[0]); + + digitalCertificate.SourceFile = Convert.ToString(row[1]); + + this.core.IndexElement(row, digitalCertificate); + } + } + + /// + /// Decompile the MsiDigitalSignature table. + /// + /// The table to decompile. + private void DecompileMsiDigitalSignatureTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.DigitalSignature digitalSignature = new Wix.DigitalSignature(); + + if (null != row[3]) + { + digitalSignature.SourceFile = Convert.ToString(row[3]); + } + + Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[2])); + if (null != digitalCertificate) + { + digitalSignature.AddChild(digitalCertificate); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[2]), "MsiDigitalCertificate")); + } + + Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(Convert.ToString(row[0]), Convert.ToString(row[1])); + if (null != parentElement) + { + parentElement.AddChild(digitalSignature); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SignObject", Convert.ToString(row[1]), Convert.ToString(row[0]))); + } + } + } + + /// + /// Decompile the MsiEmbeddedChainer table. + /// + /// The table to decompile. + private void DecompileMsiEmbeddedChainerTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.EmbeddedChainer embeddedChainer = new Wix.EmbeddedChainer(); + + embeddedChainer.Id = Convert.ToString(row[0]); + + embeddedChainer.Content = Convert.ToString(row[1]); + + if (null != row[2]) + { + embeddedChainer.CommandLine = Convert.ToString(row[2]); + } + + switch (Convert.ToInt32(row[4])) + { + case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData: + embeddedChainer.BinarySource = Convert.ToString(row[3]); + break; + case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile: + embeddedChainer.FileSource = Convert.ToString(row[3]); + break; + case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty: + embeddedChainer.PropertySource = Convert.ToString(row[3]); + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + break; + } + + this.core.RootElement.AddChild(embeddedChainer); + } + } + + /// + /// Decompile the MsiEmbeddedUI table. + /// + /// The table to decompile. + private void DecompileMsiEmbeddedUITable(Table table) + { + Wix.EmbeddedUI embeddedUI = new Wix.EmbeddedUI(); + bool foundEmbeddedUI = false; + bool foundEmbeddedResources = false; + + foreach (Row row in table.Rows) + { + int attributes = Convert.ToInt32(row[2]); + + if (MsiInterop.MsidbEmbeddedUI == (attributes & MsiInterop.MsidbEmbeddedUI)) + { + if (foundEmbeddedUI) + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); + } + else + { + embeddedUI.Id = Convert.ToString(row[0]); + embeddedUI.Name = Convert.ToString(row[1]); + + int messageFilter = Convert.ToInt32(row[3]); + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FATALEXIT)) + { + embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ERROR)) + { + embeddedUI.IgnoreError = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_WARNING)) + { + embeddedUI.IgnoreWarning = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_USER)) + { + embeddedUI.IgnoreUser = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INFO)) + { + embeddedUI.IgnoreInfo = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FILESINUSE)) + { + embeddedUI.IgnoreFilesInUse = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RESOLVESOURCE)) + { + embeddedUI.IgnoreResolveSource = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE)) + { + embeddedUI.IgnoreOutOfDiskSpace = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONSTART)) + { + embeddedUI.IgnoreActionStart = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONDATA)) + { + embeddedUI.IgnoreActionData = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_PROGRESS)) + { + embeddedUI.IgnoreProgress = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_COMMONDATA)) + { + embeddedUI.IgnoreCommonData = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INITIALIZE)) + { + embeddedUI.IgnoreInitialize = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_TERMINATE)) + { + embeddedUI.IgnoreTerminate = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_SHOWDIALOG)) + { + embeddedUI.IgnoreShowDialog = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RMFILESINUSE)) + { + embeddedUI.IgnoreRMFilesInUse = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLSTART)) + { + embeddedUI.IgnoreInstallStart = Wix.YesNoType.yes; + } + + if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLEND)) + { + embeddedUI.IgnoreInstallEnd = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbEmbeddedHandlesBasic == (attributes & MsiInterop.MsidbEmbeddedHandlesBasic)) + { + embeddedUI.SupportBasicUI = Wix.YesNoType.yes; + } + + embeddedUI.SourceFile = Convert.ToString(row[4]); + + this.core.UIElement.AddChild(embeddedUI); + foundEmbeddedUI = true; + } + } + else + { + Wix.EmbeddedUIResource embeddedResource = new Wix.EmbeddedUIResource(); + + embeddedResource.Id = Convert.ToString(row[0]); + embeddedResource.Name = Convert.ToString(row[1]); + embeddedResource.SourceFile = Convert.ToString(row[4]); + + embeddedUI.AddChild(embeddedResource); + foundEmbeddedResources = true; + } + } + + if (!foundEmbeddedUI && foundEmbeddedResources) + { + // TODO: warn + } + } + + /// + /// Decompile the MsiLockPermissionsEx table. + /// + /// The table to decompile. + private void DecompileMsiLockPermissionsExTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.PermissionEx permissionEx = new Wix.PermissionEx(); + permissionEx.Id = Convert.ToString(row[0]); + permissionEx.Sddl = Convert.ToString(row[3]); + + if (null != row[4]) + { + Wix.Condition condition = new Wix.Condition(); + condition.Content = Convert.ToString(row[4]); + permissionEx.AddChild(condition); + } + + switch (Convert.ToString(row[2])) + { + case "CreateFolder": + case "File": + case "Registry": + case "ServiceInstall": + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); + return; + } + + this.core.IndexElement(row, permissionEx); + } + } + + /// + /// Decompile the MsiPackageCertificate table. + /// + /// The table to decompile. + private void DecompileMsiPackageCertificateTable(Table table) + { + if (0 < table.Rows.Count) + { + Wix.PackageCertificates packageCertificates = new Wix.PackageCertificates(); + this.core.RootElement.AddChild(packageCertificates); + AddCertificates(table, packageCertificates); + } + } + + /// + /// Decompile the MsiPatchCertificate table. + /// + /// The table to decompile. + private void DecompileMsiPatchCertificateTable(Table table) + { + if (0 < table.Rows.Count) + { + Wix.PatchCertificates patchCertificates = new Wix.PatchCertificates(); + this.core.RootElement.AddChild(patchCertificates); + AddCertificates(table, patchCertificates); + } + } + + /// + /// Insert DigitalCertificate records associated with passed msiPackageCertificate or msiPatchCertificate table. + /// + /// The table being decompiled. + /// DigitalCertificate parent + private void AddCertificates(Table table, Wix.IParentElement parent) + { + foreach (Row row in table.Rows) + { + Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[1])); + + if (null != digitalCertificate) + { + parent.AddChild(digitalCertificate); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[1]), "MsiDigitalCertificate")); + } + } + } + + /// + /// Decompile the MsiShortcutProperty table. + /// + /// The table to decompile. + private void DecompileMsiShortcutPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ShortcutProperty property = new Wix.ShortcutProperty(); + property.Id = Convert.ToString(row[0]); + property.Key = Convert.ToString(row[2]); + property.Value = Convert.ToString(row[3]); + + Wix.Shortcut shortcut = (Wix.Shortcut)this.core.GetIndexedElement("Shortcut", Convert.ToString(row[1])); + if (null != shortcut) + { + shortcut.AddChild(property); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Shortcut_", Convert.ToString(row[1]), "Shortcut")); + } + } + } + + /// + /// Decompile the ODBCAttribute table. + /// + /// The table to decompile. + private void DecompileODBCAttributeTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Property property = new Wix.Property(); + + property.Id = Convert.ToString(row[1]); + + if (null != row[2]) + { + property.Value = Convert.ToString(row[2]); + } + + Wix.ODBCDriver odbcDriver = (Wix.ODBCDriver)this.core.GetIndexedElement("ODBCDriver", Convert.ToString(row[0])); + if (null != odbcDriver) + { + odbcDriver.AddChild(property); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Driver_", Convert.ToString(row[0]), "ODBCDriver")); + } + } + } + + /// + /// Decompile the ODBCDataSource table. + /// + /// The table to decompile. + private void DecompileODBCDataSourceTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ODBCDataSource odbcDataSource = new Wix.ODBCDataSource(); + + odbcDataSource.Id = Convert.ToString(row[0]); + + odbcDataSource.Name = Convert.ToString(row[2]); + + odbcDataSource.DriverName = Convert.ToString(row[3]); + + switch (Convert.ToInt32(row[4])) + { + case MsiInterop.MsidbODBCDataSourceRegistrationPerMachine: + odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine; + break; + case MsiInterop.MsidbODBCDataSourceRegistrationPerUser: + odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + break; + } + + this.core.IndexElement(row, odbcDataSource); + } + } + + /// + /// Decompile the ODBCDriver table. + /// + /// The table to decompile. + private void DecompileODBCDriverTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ODBCDriver odbcDriver = new Wix.ODBCDriver(); + + odbcDriver.Id = Convert.ToString(row[0]); + + odbcDriver.Name = Convert.ToString(row[2]); + + odbcDriver.File = Convert.ToString(row[3]); + + if (null != row[4]) + { + odbcDriver.SetupFile = Convert.ToString(row[4]); + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(odbcDriver); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, odbcDriver); + } + } + + /// + /// Decompile the ODBCSourceAttribute table. + /// + /// The table to decompile. + private void DecompileODBCSourceAttributeTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Property property = new Wix.Property(); + + property.Id = Convert.ToString(row[1]); + + if (null != row[2]) + { + property.Value = Convert.ToString(row[2]); + } + + Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[0])); + if (null != odbcDataSource) + { + odbcDataSource.AddChild(property); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DataSource_", Convert.ToString(row[0]), "ODBCDataSource")); + } + } + } + + /// + /// Decompile the ODBCTranslator table. + /// + /// The table to decompile. + private void DecompileODBCTranslatorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ODBCTranslator odbcTranslator = new Wix.ODBCTranslator(); + + odbcTranslator.Id = Convert.ToString(row[0]); + + odbcTranslator.Name = Convert.ToString(row[2]); + + odbcTranslator.File = Convert.ToString(row[3]); + + if (null != row[4]) + { + odbcTranslator.SetupFile = Convert.ToString(row[4]); + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(odbcTranslator); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + } + + /// + /// Decompile the PatchMetadata table. + /// + /// The table to decompile. + private void DecompilePatchMetadataTable(Table table) + { + if (0 < table.Rows.Count) + { + Wix.PatchMetadata patchMetadata = new Wix.PatchMetadata(); + + foreach (Row row in table.Rows) + { + string value = Convert.ToString(row[2]); + + switch (Convert.ToString(row[1])) + { + case "AllowRemoval": + if ("1" == value) + { + patchMetadata.AllowRemoval = Wix.YesNoType.yes; + } + break; + case "Classification": + if (null != value) + { + patchMetadata.Classification = value; + } + break; + case "CreationTimeUTC": + if (null != value) + { + patchMetadata.CreationTimeUTC = value; + } + break; + case "Description": + if (null != value) + { + patchMetadata.Description = value; + } + break; + case "DisplayName": + if (null != value) + { + patchMetadata.DisplayName = value; + } + break; + case "ManufacturerName": + if (null != value) + { + patchMetadata.ManufacturerName = value; + } + break; + case "MinorUpdateTargetRTM": + if (null != value) + { + patchMetadata.MinorUpdateTargetRTM = value; + } + break; + case "MoreInfoURL": + if (null != value) + { + patchMetadata.MoreInfoURL = value; + } + break; + case "OptimizeCA": + Wix.OptimizeCustomActions optimizeCustomActions = new Wix.OptimizeCustomActions(); + int optimizeCA = Int32.Parse(value, CultureInfo.InvariantCulture); + if (0 != (Convert.ToInt32(OptimizeCA.SkipAssignment) & optimizeCA)) + { + optimizeCustomActions.SkipAssignment = Wix.YesNoType.yes; + } + + if (0 != (Convert.ToInt32(OptimizeCA.SkipImmediate) & optimizeCA)) + { + optimizeCustomActions.SkipImmediate = Wix.YesNoType.yes; + } + + if (0 != (Convert.ToInt32(OptimizeCA.SkipDeferred) & optimizeCA)) + { + optimizeCustomActions.SkipDeferred = Wix.YesNoType.yes; + } + + patchMetadata.AddChild(optimizeCustomActions); + break; + case "OptimizedInstallMode": + if ("1" == value) + { + patchMetadata.OptimizedInstallMode = Wix.YesNoType.yes; + } + break; + case "TargetProductName": + if (null != value) + { + patchMetadata.TargetProductName = value; + } + break; + default: + Wix.CustomProperty customProperty = new Wix.CustomProperty(); + + if (null != row[0]) + { + customProperty.Company = Convert.ToString(row[0]); + } + + customProperty.Property = Convert.ToString(row[1]); + + if (null != row[2]) + { + customProperty.Value = Convert.ToString(row[2]); + } + + patchMetadata.AddChild(customProperty); + break; + } + } + + this.core.RootElement.AddChild(patchMetadata); + } + } + + /// + /// Decompile the PatchSequence table. + /// + /// The table to decompile. + private void DecompilePatchSequenceTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.PatchSequence patchSequence = new Wix.PatchSequence(); + + patchSequence.PatchFamily = Convert.ToString(row[0]); + + if (null != row[1]) + { + try + { + Guid guid = new Guid(Convert.ToString(row[1])); + + patchSequence.ProductCode = Convert.ToString(row[1]); + } + catch // non-guid value + { + patchSequence.TargetImage = Convert.ToString(row[1]); + } + } + + if (null != row[2]) + { + patchSequence.Sequence = Convert.ToString(row[2]); + } + + if (null != row[3] && 0x1 == Convert.ToInt32(row[3])) + { + patchSequence.Supersede = Wix.YesNoType.yes; + } + + this.core.RootElement.AddChild(patchSequence); + } + } + + /// + /// Decompile the ProgId table. + /// + /// The table to decompile. + private void DecompileProgIdTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ProgId progId = new Wix.ProgId(); + + progId.Advertise = Wix.YesNoType.yes; + + progId.Id = Convert.ToString(row[0]); + + if (null != row[3]) + { + progId.Description = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + progId.Icon = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + progId.IconIndex = Convert.ToInt32(row[5]); + } + + this.core.IndexElement(row, progId); + } + + // nest the ProgIds + foreach (Row row in table.Rows) + { + Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); + + if (null != row[1]) + { + Wix.ProgId parentProgId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[1])); + + if (null != parentProgId) + { + parentProgId.AddChild(progId); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Parent", Convert.ToString(row[1]), "ProgId")); + } + } + else if (null != row[2]) + { + // nesting is handled in FinalizeProgIdTable + } + else + { + // TODO: warn for orphaned ProgId + } + } + } + + /// + /// Decompile the Properties table. + /// + /// The table to decompile. + private void DecompilePropertiesTable(Table table) + { + Wix.PatchCreation patchCreation = (Wix.PatchCreation)this.core.RootElement; + + foreach (Row row in table.Rows) + { + string name = Convert.ToString(row[0]); + string value = Convert.ToString(row[1]); + + switch (name) + { + case "AllowProductCodeMismatches": + if ("1" == value) + { + patchCreation.AllowProductCodeMismatches = Wix.YesNoType.yes; + } + break; + case "AllowProductVersionMajorMismatches": + if ("1" == value) + { + patchCreation.AllowMajorVersionMismatches = Wix.YesNoType.yes; + } + break; + case "ApiPatchingSymbolFlags": + if (null != value) + { + try + { + // remove the leading "0x" if its present + if (value.StartsWith("0x", StringComparison.Ordinal)) + { + value = value.Substring(2); + } + + patchCreation.SymbolFlags = Convert.ToInt32(value, 16); + } + catch + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + } + } + break; + case "DontRemoveTempFolderWhenFinished": + if ("1" == value) + { + patchCreation.CleanWorkingFolder = Wix.YesNoType.no; + } + break; + case "IncludeWholeFilesOnly": + if ("1" == value) + { + patchCreation.WholeFilesOnly = Wix.YesNoType.yes; + } + break; + case "ListOfPatchGUIDsToReplace": + if (null != value) + { + Regex guidRegex = new Regex(@"\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}"); + MatchCollection guidMatches = guidRegex.Matches(value); + + foreach (Match guidMatch in guidMatches) + { + Wix.ReplacePatch replacePatch = new Wix.ReplacePatch(); + + replacePatch.Id = guidMatch.Value; + + this.core.RootElement.AddChild(replacePatch); + } + } + break; + case "ListOfTargetProductCodes": + if (null != value) + { + string[] targetProductCodes = value.Split(';'); + + foreach (string targetProductCodeString in targetProductCodes) + { + Wix.TargetProductCode targetProductCode = new Wix.TargetProductCode(); + + targetProductCode.Id = targetProductCodeString; + + this.core.RootElement.AddChild(targetProductCode); + } + } + break; + case "PatchGUID": + patchCreation.Id = value; + break; + case "PatchSourceList": + patchCreation.SourceList = value; + break; + case "PatchOutputPath": + patchCreation.OutputPath = value; + break; + default: + Wix.PatchProperty patchProperty = new Wix.PatchProperty(); + + patchProperty.Name = name; + + patchProperty.Value = value; + + this.core.RootElement.AddChild(patchProperty); + break; + } + } + } + + /// + /// Decompile the Property table. + /// + /// The table to decompile. + private void DecompilePropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + string id = Convert.ToString(row[0]); + string value = Convert.ToString(row[1]); + + if ("AdminProperties" == id || "MsiHiddenProperties" == id || "SecureCustomProperties" == id) + { + if (0 < value.Length) + { + foreach (string propertyId in value.Split(';')) + { + string property = propertyId; + bool suppressModulularization = false; + if (OutputType.Module == this.outputType) + { + if (propertyId.EndsWith(this.modularizationGuid.Substring(1, 36).Replace('-', '_'), StringComparison.Ordinal)) + { + property = propertyId.Substring(0, propertyId.Length - this.modularizationGuid.Length + 1); + } + else + { + suppressModulularization = true; + } + } + + Wix.Property specialProperty = this.EnsureProperty(property); + if (suppressModulularization) + { + specialProperty.SuppressModularization = Wix.YesNoType.yes; + } + + switch (id) + { + case "AdminProperties": + specialProperty.Admin = Wix.YesNoType.yes; + break; + case "MsiHiddenProperties": + specialProperty.Hidden = Wix.YesNoType.yes; + break; + case "SecureCustomProperties": + specialProperty.Secure = Wix.YesNoType.yes; + break; + } + } + } + + continue; + } + else if (OutputType.Product == this.outputType) + { + Wix.Product product = (Wix.Product)this.core.RootElement; + + switch (id) + { + case "Manufacturer": + product.Manufacturer = value; + continue; + case "ProductCode": + product.Id = value.ToUpper(CultureInfo.InvariantCulture); + continue; + case "ProductLanguage": + product.Language = value; + continue; + case "ProductName": + product.Name = value; + continue; + case "ProductVersion": + product.Version = value; + continue; + case "UpgradeCode": + product.UpgradeCode = value; + continue; + } + } + + if (!this.suppressUI || "ErrorDialog" != id) + { + Wix.Property property = this.EnsureProperty(id); + + property.Value = value; + } + } + } + + /// + /// Decompile the PublishComponent table. + /// + /// The table to decompile. + private void DecompilePublishComponentTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Category category = new Wix.Category(); + + category.Id = Convert.ToString(row[0]); + + category.Qualifier = Convert.ToString(row[1]); + + if (null != row[3]) + { + category.AppData = Convert.ToString(row[3]); + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); + if (null != component) + { + component.AddChild(category); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); + } + } + } + + /// + /// Decompile the RadioButton table. + /// + /// The table to decompile. + private void DecompileRadioButtonTable(Table table) + { + SortedList radioButtons = new SortedList(); + Hashtable radioButtonGroups = new Hashtable(); + + foreach (Row row in table.Rows) + { + Wix.RadioButton radioButton = new Wix.RadioButton(); + + radioButton.Value = Convert.ToString(row[2]); + + radioButton.X = Convert.ToString(row[3], CultureInfo.InvariantCulture); + + radioButton.Y = Convert.ToString(row[4], CultureInfo.InvariantCulture); + + radioButton.Width = Convert.ToString(row[5], CultureInfo.InvariantCulture); + + radioButton.Height = Convert.ToString(row[6], CultureInfo.InvariantCulture); + + if (null != row[7]) + { + radioButton.Text = Convert.ToString(row[7]); + } + + if (null != row[8]) + { + string[] help = (Convert.ToString(row[8])).Split('|'); + + if (2 == help.Length) + { + if (0 < help[0].Length) + { + radioButton.ToolTip = help[0]; + } + + if (0 < help[1].Length) + { + radioButton.Help = help[1]; + } + } + } + + radioButtons.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1:0000000000}", row[0], row[1]), row); + this.core.IndexElement(row, radioButton); + } + + // nest the radio buttons + foreach (Row row in radioButtons.Values) + { + Wix.RadioButton radioButton = (Wix.RadioButton)this.core.GetIndexedElement(row); + Wix.RadioButtonGroup radioButtonGroup = (Wix.RadioButtonGroup)radioButtonGroups[Convert.ToString(row[0])]; + + if (null == radioButtonGroup) + { + radioButtonGroup = new Wix.RadioButtonGroup(); + + radioButtonGroup.Property = Convert.ToString(row[0]); + + this.core.UIElement.AddChild(radioButtonGroup); + radioButtonGroups.Add(Convert.ToString(row[0]), radioButtonGroup); + } + + radioButtonGroup.AddChild(radioButton); + } + } + + /// + /// Decompile the Registry table. + /// + /// The table to decompile. + private void DecompileRegistryTable(Table table) + { + foreach (Row row in table.Rows) + { + if (("-" == Convert.ToString(row[3]) || "+" == Convert.ToString(row[3]) || "*" == Convert.ToString(row[3])) && null == row[4]) + { + Wix.RegistryKey registryKey = new Wix.RegistryKey(); + + registryKey.Id = Convert.ToString(row[0]); + + Wix.RegistryRootType registryRootType; + if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) + { + registryKey.Root = registryRootType; + } + + registryKey.Key = Convert.ToString(row[2]); + + switch (Convert.ToString(row[3])) + { + case "+": + registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; + break; + case "-": + registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; + break; + case "*": + registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; + registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; + break; + } + + this.core.IndexElement(row, registryKey); + } + else + { + Wix.RegistryValue registryValue = new Wix.RegistryValue(); + + registryValue.Id = Convert.ToString(row[0]); + + Wix.RegistryRootType registryRootType; + if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) + { + registryValue.Root = registryRootType; + } + + registryValue.Key = Convert.ToString(row[2]); + + if (null != row[3]) + { + registryValue.Name = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + string value = Convert.ToString(row[4]); + + if (value.StartsWith("#x", StringComparison.Ordinal)) + { + registryValue.Type = Wix.RegistryValue.TypeType.binary; + registryValue.Value = value.Substring(2); + } + else if (value.StartsWith("#%", StringComparison.Ordinal)) + { + registryValue.Type = Wix.RegistryValue.TypeType.expandable; + registryValue.Value = value.Substring(2); + } + else if (value.StartsWith("#", StringComparison.Ordinal) && !value.StartsWith("##", StringComparison.Ordinal)) + { + registryValue.Type = Wix.RegistryValue.TypeType.integer; + registryValue.Value = value.Substring(1); + } + else + { + if (value.StartsWith("##", StringComparison.Ordinal)) + { + value = value.Substring(1); + } + + if (0 <= value.IndexOf("[~]", StringComparison.Ordinal)) + { + registryValue.Type = Wix.RegistryValue.TypeType.multiString; + + if ("[~]" == value) + { + value = string.Empty; + } + else if (value.StartsWith("[~]", StringComparison.Ordinal) && value.EndsWith("[~]", StringComparison.Ordinal)) + { + value = value.Substring(3, value.Length - 6); + } + else if (value.StartsWith("[~]", StringComparison.Ordinal)) + { + registryValue.Action = Wix.RegistryValue.ActionType.append; + value = value.Substring(3); + } + else if (value.EndsWith("[~]", StringComparison.Ordinal)) + { + registryValue.Action = Wix.RegistryValue.ActionType.prepend; + value = value.Substring(0, value.Length - 3); + } + + string[] multiValues = NullSplitter.Split(value); + foreach (string multiValue in multiValues) + { + Wix.MultiStringValue multiStringValue = new Wix.MultiStringValue(); + + multiStringValue.Content = multiValue; + + registryValue.AddChild(multiStringValue); + } + } + else + { + registryValue.Type = Wix.RegistryValue.TypeType.@string; + registryValue.Value = value; + } + } + } + else + { + registryValue.Type = Wix.RegistryValue.TypeType.@string; + registryValue.Value = String.Empty; + } + + this.core.IndexElement(row, registryValue); + } + } + } + + /// + /// Decompile the RegLocator table. + /// + /// The table to decompile. + private void DecompileRegLocatorTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.RegistrySearch registrySearch = new Wix.RegistrySearch(); + + registrySearch.Id = Convert.ToString(row[0]); + + switch (Convert.ToInt32(row[1])) + { + case MsiInterop.MsidbRegistryRootClassesRoot: + registrySearch.Root = Wix.RegistrySearch.RootType.HKCR; + break; + case MsiInterop.MsidbRegistryRootCurrentUser: + registrySearch.Root = Wix.RegistrySearch.RootType.HKCU; + break; + case MsiInterop.MsidbRegistryRootLocalMachine: + registrySearch.Root = Wix.RegistrySearch.RootType.HKLM; + break; + case MsiInterop.MsidbRegistryRootUsers: + registrySearch.Root = Wix.RegistrySearch.RootType.HKU; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); + break; + } + + registrySearch.Key = Convert.ToString(row[2]); + + if (null != row[3]) + { + registrySearch.Name = Convert.ToString(row[3]); + } + + if (null == row[4]) + { + registrySearch.Type = Wix.RegistrySearch.TypeType.file; + } + else + { + int type = Convert.ToInt32(row[4]); + + if (MsiInterop.MsidbLocatorType64bit == (type & MsiInterop.MsidbLocatorType64bit)) + { + registrySearch.Win64 = Wix.YesNoType.yes; + type &= ~MsiInterop.MsidbLocatorType64bit; + } + + switch (type) + { + case MsiInterop.MsidbLocatorTypeDirectory: + registrySearch.Type = Wix.RegistrySearch.TypeType.directory; + break; + case MsiInterop.MsidbLocatorTypeFileName: + registrySearch.Type = Wix.RegistrySearch.TypeType.file; + break; + case MsiInterop.MsidbLocatorTypeRawValue: + registrySearch.Type = Wix.RegistrySearch.TypeType.raw; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + break; + } + } + + this.core.IndexElement(row, registrySearch); + } + } + + /// + /// Decompile the RemoveFile table. + /// + /// The table to decompile. + private void DecompileRemoveFileTable(Table table) + { + foreach (Row row in table.Rows) + { + if (null == row[2]) + { + Wix.RemoveFolder removeFolder = new Wix.RemoveFolder(); + + removeFolder.Id = Convert.ToString(row[0]); + + // directory/property is set in FinalizeDecompile + + switch (Convert.ToInt32(row[4])) + { + case MsiInterop.MsidbRemoveFileInstallModeOnInstall: + removeFolder.On = Wix.InstallUninstallType.install; + break; + case MsiInterop.MsidbRemoveFileInstallModeOnRemove: + removeFolder.On = Wix.InstallUninstallType.uninstall; + break; + case MsiInterop.MsidbRemoveFileInstallModeOnBoth: + removeFolder.On = Wix.InstallUninstallType.both; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + break; + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(removeFolder); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, removeFolder); + } + else + { + Wix.RemoveFile removeFile = new Wix.RemoveFile(); + + removeFile.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[2])); + if (null != names[0] && null != names[1]) + { + removeFile.ShortName = names[0]; + removeFile.Name = names[1]; + } + else if (null != names[0]) + { + removeFile.Name = names[0]; + } + + // directory/property is set in FinalizeDecompile + + switch (Convert.ToInt32(row[4])) + { + case MsiInterop.MsidbRemoveFileInstallModeOnInstall: + removeFile.On = Wix.InstallUninstallType.install; + break; + case MsiInterop.MsidbRemoveFileInstallModeOnRemove: + removeFile.On = Wix.InstallUninstallType.uninstall; + break; + case MsiInterop.MsidbRemoveFileInstallModeOnBoth: + removeFile.On = Wix.InstallUninstallType.both; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + break; + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(removeFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + this.core.IndexElement(row, removeFile); + } + } + } + + /// + /// Decompile the RemoveIniFile table. + /// + /// The table to decompile. + private void DecompileRemoveIniFileTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.IniFile iniFile = new Wix.IniFile(); + + iniFile.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[1])); + if (null != names[0] && null != names[1]) + { + iniFile.ShortName = names[0]; + iniFile.Name = names[1]; + } + else if (null != names[0]) + { + iniFile.Name = names[0]; + } + + if (null != row[2]) + { + iniFile.Directory = Convert.ToString(row[2]); + } + + iniFile.Section = Convert.ToString(row[3]); + + iniFile.Key = Convert.ToString(row[4]); + + if (null != row[5]) + { + iniFile.Value = Convert.ToString(row[5]); + } + + switch (Convert.ToInt32(row[6])) + { + case MsiInterop.MsidbIniFileActionRemoveLine: + iniFile.Action = Wix.IniFile.ActionType.removeLine; + break; + case MsiInterop.MsidbIniFileActionRemoveTag: + iniFile.Action = Wix.IniFile.ActionType.removeTag; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); + break; + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); + if (null != component) + { + component.AddChild(iniFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); + } + } + } + + /// + /// Decompile the RemoveRegistry table. + /// + /// The table to decompile. + private void DecompileRemoveRegistryTable(Table table) + { + foreach (Row row in table.Rows) + { + if ("-" == Convert.ToString(row[3])) + { + Wix.RemoveRegistryKey removeRegistryKey = new Wix.RemoveRegistryKey(); + + removeRegistryKey.Id = Convert.ToString(row[0]); + + Wix.RegistryRootType registryRootType; + if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) + { + removeRegistryKey.Root = registryRootType; + } + + removeRegistryKey.Key = Convert.ToString(row[2]); + + removeRegistryKey.Action = Wix.RemoveRegistryKey.ActionType.removeOnInstall; + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); + if (null != component) + { + component.AddChild(removeRegistryKey); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); + } + } + else + { + Wix.RemoveRegistryValue removeRegistryValue = new Wix.RemoveRegistryValue(); + + removeRegistryValue.Id = Convert.ToString(row[0]); + + Wix.RegistryRootType registryRootType; + if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) + { + removeRegistryValue.Root = registryRootType; + } + + removeRegistryValue.Key = Convert.ToString(row[2]); + + if (null != row[3]) + { + removeRegistryValue.Name = Convert.ToString(row[3]); + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); + if (null != component) + { + component.AddChild(removeRegistryValue); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); + } + } + } + } + + /// + /// Decompile the ReserveCost table. + /// + /// The table to decompile. + private void DecompileReserveCostTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ReserveCost reserveCost = new Wix.ReserveCost(); + + reserveCost.Id = Convert.ToString(row[0]); + + if (null != row[2]) + { + reserveCost.Directory = Convert.ToString(row[2]); + } + + reserveCost.RunLocal = Convert.ToInt32(row[3]); + + reserveCost.RunFromSource = Convert.ToInt32(row[4]); + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); + if (null != component) + { + component.AddChild(reserveCost); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); + } + } + } + + /// + /// Decompile the SelfReg table. + /// + /// The table to decompile. + private void DecompileSelfRegTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); + + if (null != file) + { + if (null != row[1]) + { + file.SelfRegCost = Convert.ToInt32(row[1]); + } + else + { + file.SelfRegCost = 0; + } + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); + } + } + } + + /// + /// Decompile the ServiceControl table. + /// + /// The table to decompile. + private void DecompileServiceControlTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ServiceControl serviceControl = new Wix.ServiceControl(); + + serviceControl.Id = Convert.ToString(row[0]); + + serviceControl.Name = Convert.ToString(row[1]); + + int eventValue = Convert.ToInt32(row[2]); + if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart) && + MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) + { + serviceControl.Start = Wix.InstallUninstallType.both; + } + else if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart)) + { + serviceControl.Start = Wix.InstallUninstallType.install; + } + else if (MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) + { + serviceControl.Start = Wix.InstallUninstallType.uninstall; + } + + if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop) && + MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) + { + serviceControl.Stop = Wix.InstallUninstallType.both; + } + else if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop)) + { + serviceControl.Stop = Wix.InstallUninstallType.install; + } + else if (MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) + { + serviceControl.Stop = Wix.InstallUninstallType.uninstall; + } + + if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete) && + MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) + { + serviceControl.Remove = Wix.InstallUninstallType.both; + } + else if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete)) + { + serviceControl.Remove = Wix.InstallUninstallType.install; + } + else if (MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) + { + serviceControl.Remove = Wix.InstallUninstallType.uninstall; + } + + if (null != row[3]) + { + string[] arguments = NullSplitter.Split(Convert.ToString(row[3])); + + foreach (string argument in arguments) + { + Wix.ServiceArgument serviceArgument = new Wix.ServiceArgument(); + + serviceArgument.Content = argument; + + serviceControl.AddChild(serviceArgument); + } + } + + if (null != row[4]) + { + if (0 == Convert.ToInt32(row[4])) + { + serviceControl.Wait = Wix.YesNoType.no; + } + else + { + serviceControl.Wait = Wix.YesNoType.yes; + } + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); + if (null != component) + { + component.AddChild(serviceControl); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); + } + } + } + + /// + /// Decompile the ServiceInstall table. + /// + /// The table to decompile. + private void DecompileServiceInstallTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.ServiceInstall serviceInstall = new Wix.ServiceInstall(); + + serviceInstall.Id = Convert.ToString(row[0]); + + serviceInstall.Name = Convert.ToString(row[1]); + + if (null != row[2]) + { + serviceInstall.DisplayName = Convert.ToString(row[2]); + } + + int serviceType = Convert.ToInt32(row[3]); + if (MsiInterop.MsidbServiceInstallInteractive == (serviceType & MsiInterop.MsidbServiceInstallInteractive)) + { + serviceInstall.Interactive = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess) && + MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) + { + // TODO: warn + } + else if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess)) + { + serviceInstall.Type = Wix.ServiceInstall.TypeType.ownProcess; + } + else if (MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) + { + serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess; + } + + int startType = Convert.ToInt32(row[4]); + if (MsiInterop.MsidbServiceInstallDisabled == startType) + { + serviceInstall.Start = Wix.ServiceInstall.StartType.disabled; + } + else if (MsiInterop.MsidbServiceInstallDemandStart == startType) + { + serviceInstall.Start = Wix.ServiceInstall.StartType.demand; + } + else if (MsiInterop.MsidbServiceInstallAutoStart == startType) + { + serviceInstall.Start = Wix.ServiceInstall.StartType.auto; + } + else + { + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); + } + + int errorControl = Convert.ToInt32(row[5]); + if (MsiInterop.MsidbServiceInstallErrorCritical == (errorControl & MsiInterop.MsidbServiceInstallErrorCritical)) + { + serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical; + } + else if (MsiInterop.MsidbServiceInstallErrorNormal == (errorControl & MsiInterop.MsidbServiceInstallErrorNormal)) + { + serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.normal; + } + else + { + serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.ignore; + } + + if (MsiInterop.MsidbServiceInstallErrorControlVital == (errorControl & MsiInterop.MsidbServiceInstallErrorControlVital)) + { + serviceInstall.Vital = Wix.YesNoType.yes; + } + + if (null != row[6]) + { + serviceInstall.LoadOrderGroup = Convert.ToString(row[6]); + } + + if (null != row[7]) + { + string[] dependencies = NullSplitter.Split(Convert.ToString(row[7])); + + foreach (string dependency in dependencies) + { + if (0 < dependency.Length) + { + Wix.ServiceDependency serviceDependency = new Wix.ServiceDependency(); + + if (dependency.StartsWith("+", StringComparison.Ordinal)) + { + serviceDependency.Group = Wix.YesNoType.yes; + serviceDependency.Id = dependency.Substring(1); + } + else + { + serviceDependency.Id = dependency; + } + + serviceInstall.AddChild(serviceDependency); + } + } + } + + if (null != row[8]) + { + serviceInstall.Account = Convert.ToString(row[8]); + } + + if (null != row[9]) + { + serviceInstall.Password = Convert.ToString(row[9]); + } + + if (null != row[10]) + { + serviceInstall.Arguments = Convert.ToString(row[10]); + } + + if (null != row[12]) + { + serviceInstall.Description = Convert.ToString(row[12]); + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[11])); + if (null != component) + { + component.AddChild(serviceInstall); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[11]), "Component")); + } + this.core.IndexElement(row, serviceInstall); + } + } + + /// + /// Decompile the SFPCatalog table. + /// + /// The table to decompile. + private void DecompileSFPCatalogTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.SFPCatalog sfpCatalog = new Wix.SFPCatalog(); + + sfpCatalog.Name = Convert.ToString(row[0]); + + sfpCatalog.SourceFile = Convert.ToString(row[1]); + + this.core.IndexElement(row, sfpCatalog); + } + + // nest the SFPCatalog elements + foreach (Row row in table.Rows) + { + Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement(row); + + if (null != row[2]) + { + Wix.SFPCatalog parentSFPCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[2])); + + if (null != parentSFPCatalog) + { + parentSFPCatalog.AddChild(sfpCatalog); + } + else + { + sfpCatalog.Dependency = Convert.ToString(row[2]); + + this.core.RootElement.AddChild(sfpCatalog); + } + } + else + { + this.core.RootElement.AddChild(sfpCatalog); + } + } + } + + /// + /// Decompile the Shortcut table. + /// + /// The table to decompile. + private void DecompileShortcutTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Shortcut shortcut = new Wix.Shortcut(); + + shortcut.Id = Convert.ToString(row[0]); + + shortcut.Directory = Convert.ToString(row[1]); + + string[] names = Common.GetNames(Convert.ToString(row[2])); + if (null != names[0] && null != names[1]) + { + shortcut.ShortName = names[0]; + shortcut.Name = names[1]; + } + else if (null != names[0]) + { + shortcut.Name = names[0]; + } + + string target = Convert.ToString(row[4]); + if (target.StartsWith("[", StringComparison.Ordinal) && target.EndsWith("]", StringComparison.Ordinal)) + { + // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element + shortcut.Target = target; + } + else + { + shortcut.Advertise = Wix.YesNoType.yes; + + // primary feature is set in FinalizeFeatureComponentsTable + } + + if (null != row[5]) + { + shortcut.Arguments = Convert.ToString(row[5]); + } + + if (null != row[6]) + { + shortcut.Description = Convert.ToString(row[6]); + } + + if (null != row[7]) + { + shortcut.Hotkey = Convert.ToInt32(row[7]); + } + + if (null != row[8]) + { + shortcut.Icon = Convert.ToString(row[8]); + } + + if (null != row[9]) + { + shortcut.IconIndex = Convert.ToInt32(row[9]); + } + + if (null != row[10]) + { + switch (Convert.ToInt32(row[10])) + { + case 1: + shortcut.Show = Wix.Shortcut.ShowType.normal; + break; + case 3: + shortcut.Show = Wix.Shortcut.ShowType.maximized; + break; + case 7: + shortcut.Show = Wix.Shortcut.ShowType.minimized; + break; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[10].Column.Name, row[10])); + break; + } + } + + if (null != row[11]) + { + shortcut.WorkingDirectory = Convert.ToString(row[11]); + } + + // Only try to read the MSI 4.0-specific columns if they actually exist + if (15 < row.Fields.Length) + { + if (null != row[12]) + { + shortcut.DisplayResourceDll = Convert.ToString(row[12]); + } + + if (null != row[13]) + { + shortcut.DisplayResourceId = Convert.ToInt32(row[13]); + } + + if (null != row[14]) + { + shortcut.DescriptionResourceDll = Convert.ToString(row[14]); + } + + if (null != row[15]) + { + shortcut.DescriptionResourceId = Convert.ToInt32(row[15]); + } + } + + Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); + if (null != component) + { + component.AddChild(shortcut); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); + } + + this.core.IndexElement(row, shortcut); + } + } + + /// + /// Decompile the Signature table. + /// + /// The table to decompile. + private void DecompileSignatureTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.FileSearch fileSearch = new Wix.FileSearch(); + + fileSearch.Id = Convert.ToString(row[0]); + + string[] names = Common.GetNames(Convert.ToString(row[1])); + if (null != names[0]) + { + // it is permissable to just have a long name + if (!this.core.IsValidShortFilename(names[0], false) && null == names[1]) + { + fileSearch.Name = names[0]; + } + else + { + fileSearch.ShortName = names[0]; + } + } + + if (null != names[1]) + { + fileSearch.Name = names[1]; + } + + if (null != row[2]) + { + fileSearch.MinVersion = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + fileSearch.MaxVersion = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + fileSearch.MinSize = Convert.ToInt32(row[4]); + } + + if (null != row[5]) + { + fileSearch.MaxSize = Convert.ToInt32(row[5]); + } + + if (null != row[6]) + { + fileSearch.MinDate = this.core.ConvertIntegerToDateTime(Convert.ToInt32(row[6])); + } + + if (null != row[7]) + { + fileSearch.MaxDate = this.core.ConvertIntegerToDateTime(Convert.ToInt32(row[7])); + } + + if (null != row[8]) + { + fileSearch.Languages = Convert.ToString(row[8]); + } + + this.core.IndexElement(row, fileSearch); + } + } + + /// + /// Decompile the TargetFiles_OptionalData table. + /// + /// The table to decompile. + private void DecompileTargetFiles_OptionalDataTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row[0]]; + if (null == targetFile) + { + targetFile = new Wix.TargetFile(); + + targetFile.Id = Convert.ToString(row[1]); + + Wix.TargetImage targetImage = (Wix.TargetImage)this.core.GetIndexedElement("TargetImages", Convert.ToString(row[0])); + if (null != targetImage) + { + targetImage.AddChild(targetFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); + } + this.patchTargetFiles.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), targetFile); + } + + if (null != row[2]) + { + string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); + + foreach (string symbolPathString in symbolPaths) + { + Wix.SymbolPath symbolPath = new Wix.SymbolPath(); + + symbolPath.Path = symbolPathString; + + targetFile.AddChild(symbolPath); + } + } + + if (null != row[3] && null != row[4]) + { + string[] ignoreOffsets = (Convert.ToString(row[3])).Split(','); + string[] ignoreLengths = (Convert.ToString(row[4])).Split(','); + + if (ignoreOffsets.Length == ignoreLengths.Length) + { + for (int i = 0; i < ignoreOffsets.Length; i++) + { + Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); + + if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) + { + ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i].Substring(2), 16); + } + else + { + ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i], CultureInfo.InvariantCulture); + } + + if (ignoreLengths[i].StartsWith("0x", StringComparison.Ordinal)) + { + ignoreRange.Length = Convert.ToInt32(ignoreLengths[i].Substring(2), 16); + } + else + { + ignoreRange.Length = Convert.ToInt32(ignoreLengths[i], CultureInfo.InvariantCulture); + } + + targetFile.AddChild(ignoreRange); + } + } + else + { + // TODO: warn + } + } + else if (null != row[3] || null != row[4]) + { + // TODO: warn about mismatch between columns + } + + // the RetainOffsets column is handled in FinalizeFamilyFileRangesTable + } + } + + /// + /// Decompile the TargetImages table. + /// + /// The table to decompile. + private void DecompileTargetImagesTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.TargetImage targetImage = new Wix.TargetImage(); + + targetImage.Id = Convert.ToString(row[0]); + + targetImage.SourceFile = Convert.ToString(row[1]); + + if (null != row[2]) + { + string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); + + foreach (string symbolPathString in symbolPaths) + { + Wix.SymbolPath symbolPath = new Wix.SymbolPath(); + + symbolPath.Path = symbolPathString; + + targetImage.AddChild(symbolPath); + } + } + + targetImage.Order = Convert.ToInt32(row[4]); + + if (null != row[5]) + { + targetImage.Validation = Convert.ToString(row[5]); + } + + if (0 != Convert.ToInt32(row[6])) + { + targetImage.IgnoreMissingFiles = Wix.YesNoType.yes; + } + + Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[3])); + if (null != upgradeImage) + { + upgradeImage.AddChild(targetImage); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); + } + this.core.IndexElement(row, targetImage); + } + } + + /// + /// Decompile the TextStyle table. + /// + /// The table to decompile. + private void DecompileTextStyleTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.TextStyle textStyle = new Wix.TextStyle(); + + textStyle.Id = Convert.ToString(row[0]); + + textStyle.FaceName = Convert.ToString(row[1]); + + textStyle.Size = Convert.ToString(row[2]); + + if (null != row[3]) + { + int color = Convert.ToInt32(row[3]); + + textStyle.Red = color & 0xFF; + + textStyle.Green = (color & 0xFF00) >> 8; + + textStyle.Blue = (color & 0xFF0000) >> 16; + } + + if (null != row[4]) + { + int styleBits = Convert.ToInt32(row[4]); + + if (MsiInterop.MsidbTextStyleStyleBitsBold == (styleBits & MsiInterop.MsidbTextStyleStyleBitsBold)) + { + textStyle.Bold = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbTextStyleStyleBitsItalic == (styleBits & MsiInterop.MsidbTextStyleStyleBitsItalic)) + { + textStyle.Italic = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbTextStyleStyleBitsUnderline == (styleBits & MsiInterop.MsidbTextStyleStyleBitsUnderline)) + { + textStyle.Underline = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbTextStyleStyleBitsStrike == (styleBits & MsiInterop.MsidbTextStyleStyleBitsStrike)) + { + textStyle.Strike = Wix.YesNoType.yes; + } + } + + this.core.UIElement.AddChild(textStyle); + } + } + + /// + /// Decompile the TypeLib table. + /// + /// The table to decompile. + private void DecompileTypeLibTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.TypeLib typeLib = new Wix.TypeLib(); + + typeLib.Id = Convert.ToString(row[0]); + + typeLib.Advertise = Wix.YesNoType.yes; + + typeLib.Language = Convert.ToInt32(row[1]); + + if (null != row[3]) + { + int version = Convert.ToInt32(row[3]); + + if (65536 == version) + { + this.core.OnMessage(WixWarnings.PossiblyIncorrectTypelibVersion(row.SourceLineNumbers, typeLib.Id)); + } + + typeLib.MajorVersion = ((version & 0xFFFF00) >> 8); + typeLib.MinorVersion = (version & 0xFF); + } + + if (null != row[4]) + { + typeLib.Description = Convert.ToString(row[4]); + } + + if (null != row[5]) + { + typeLib.HelpDirectory = Convert.ToString(row[5]); + } + + if (null != row[7]) + { + typeLib.Cost = Convert.ToInt32(row[7]); + } + + // nested under the appropriate File element in FinalizeFileTable + this.core.IndexElement(row, typeLib); + } + } + + /// + /// Decompile the Upgrade table. + /// + /// The table to decompile. + private void DecompileUpgradeTable(Table table) + { + Hashtable upgradeElements = new Hashtable(); + + foreach (UpgradeRow upgradeRow in table.Rows) + { + if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty || Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) + { + continue; // MajorUpgrade rows processed in FinalizeUpgradeTable + } + + Wix.Upgrade upgrade = (Wix.Upgrade)upgradeElements[upgradeRow.UpgradeCode]; + + // create the parent Upgrade element if it doesn't already exist + if (null == upgrade) + { + upgrade = new Wix.Upgrade(); + + upgrade.Id = upgradeRow.UpgradeCode; + + this.core.RootElement.AddChild(upgrade); + upgradeElements.Add(upgrade.Id, upgrade); + } + + Wix.UpgradeVersion upgradeVersion = new Wix.UpgradeVersion(); + + if (null != upgradeRow.VersionMin) + { + upgradeVersion.Minimum = upgradeRow.VersionMin; + } + + if (null != upgradeRow.VersionMax) + { + upgradeVersion.Maximum = upgradeRow.VersionMax; + } + + if (null != upgradeRow.Language) + { + upgradeVersion.Language = upgradeRow.Language; + } + + if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) + { + upgradeVersion.MigrateFeatures = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesOnlyDetect == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesOnlyDetect)) + { + upgradeVersion.OnlyDetect = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) + { + upgradeVersion.IgnoreRemoveFailure = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesVersionMinInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMinInclusive)) + { + upgradeVersion.IncludeMinimum = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) + { + upgradeVersion.IncludeMaximum = Wix.YesNoType.yes; + } + + if (MsiInterop.MsidbUpgradeAttributesLanguagesExclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesLanguagesExclusive)) + { + upgradeVersion.ExcludeLanguages = Wix.YesNoType.yes; + } + + if (null != upgradeRow.Remove) + { + upgradeVersion.RemoveFeatures = upgradeRow.Remove; + } + + upgradeVersion.Property = upgradeRow.ActionProperty; + + upgrade.AddChild(upgradeVersion); + } + } + + /// + /// Decompile the UpgradedFiles_OptionalData table. + /// + /// The table to decompile. + private void DecompileUpgradedFiles_OptionalDataTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); + + upgradeFile.File = Convert.ToString(row[1]); + + if (null != row[2]) + { + string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); + + foreach (string symbolPathString in symbolPaths) + { + Wix.SymbolPath symbolPath = new Wix.SymbolPath(); + + symbolPath.Path = symbolPathString; + + upgradeFile.AddChild(symbolPath); + } + } + + if (null != row[3] && 1 == Convert.ToInt32(row[3])) + { + upgradeFile.AllowIgnoreOnError = Wix.YesNoType.yes; + } + + if (null != row[4] && 0 != Convert.ToInt32(row[4])) + { + upgradeFile.WholeFile = Wix.YesNoType.yes; + } + + upgradeFile.Ignore = Wix.YesNoType.no; + + Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); + if (null != upgradeImage) + { + upgradeImage.AddChild(upgradeFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); + } + } + } + + /// + /// Decompile the UpgradedFilesToIgnore table. + /// + /// The table to decompile. + private void DecompileUpgradedFilesToIgnoreTable(Table table) + { + foreach (Row row in table.Rows) + { + if ("*" != Convert.ToString(row[0])) + { + Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); + + upgradeFile.File = Convert.ToString(row[1]); + + upgradeFile.Ignore = Wix.YesNoType.yes; + + Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); + if (null != upgradeImage) + { + upgradeImage.AddChild(upgradeFile); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); + } + } + else + { + this.core.OnMessage(WixWarnings.UnrepresentableColumnValue(row.SourceLineNumbers, table.Name, row.Fields[0].Column.Name, row[0])); + } + } + } + + /// + /// Decompile the UpgradedImages table. + /// + /// The table to decompile. + private void DecompileUpgradedImagesTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.UpgradeImage upgradeImage = new Wix.UpgradeImage(); + + upgradeImage.Id = Convert.ToString(row[0]); + + upgradeImage.SourceFile = Convert.ToString(row[1]); + + if (null != row[2]) + { + upgradeImage.SourcePatch = Convert.ToString(row[2]); + } + + if (null != row[3]) + { + string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); + + foreach (string symbolPathString in symbolPaths) + { + Wix.SymbolPath symbolPath = new Wix.SymbolPath(); + + symbolPath.Path = symbolPathString; + + upgradeImage.AddChild(symbolPath); + } + } + + Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[4])); + if (null != family) + { + family.AddChild(upgradeImage); + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[4]), "ImageFamilies")); + } + this.core.IndexElement(row, upgradeImage); + } + } + + /// + /// Decompile the UIText table. + /// + /// The table to decompile. + private void DecompileUITextTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.UIText uiText = new Wix.UIText(); + + uiText.Id = Convert.ToString(row[0]); + + uiText.Content = Convert.ToString(row[1]); + + this.core.UIElement.AddChild(uiText); + } + } + + /// + /// Decompile the Verb table. + /// + /// The table to decompile. + private void DecompileVerbTable(Table table) + { + foreach (Row row in table.Rows) + { + Wix.Verb verb = new Wix.Verb(); + + verb.Id = Convert.ToString(row[1]); + + if (null != row[2]) + { + verb.Sequence = Convert.ToInt32(row[2]); + } + + if (null != row[3]) + { + verb.Command = Convert.ToString(row[3]); + } + + if (null != row[4]) + { + verb.Argument = Convert.ToString(row[4]); + } + + this.core.IndexElement(row, verb); + } + } + + /// + /// Gets the RegistryRootType from an integer representation of the root. + /// + /// The source line information for the root. + /// The name of the table containing the field. + /// The field containing the root value. + /// The strongly-typed representation of the root. + /// true if the value could be converted; false otherwise. + private bool GetRegistryRootType(SourceLineNumber sourceLineNumbers, string tableName, Field field, out Wix.RegistryRootType registryRootType) + { + switch (Convert.ToInt32(field.Data)) + { + case (-1): + registryRootType = Wix.RegistryRootType.HKMU; + return true; + case MsiInterop.MsidbRegistryRootClassesRoot: + registryRootType = Wix.RegistryRootType.HKCR; + return true; + case MsiInterop.MsidbRegistryRootCurrentUser: + registryRootType = Wix.RegistryRootType.HKCU; + return true; + case MsiInterop.MsidbRegistryRootLocalMachine: + registryRootType = Wix.RegistryRootType.HKLM; + return true; + case MsiInterop.MsidbRegistryRootUsers: + registryRootType = Wix.RegistryRootType.HKU; + return true; + default: + this.core.OnMessage(WixWarnings.IllegalColumnValue(sourceLineNumbers, tableName, field.Column.Name, field.Data)); + registryRootType = Wix.RegistryRootType.HKCR; // assign anything to satisfy the out parameter + return false; + } + } + + /// + /// Set the primary feature for a component. + /// + /// The row which specifies a primary feature. + /// The index of the column contaning the feature identifier. + /// The index of the column containing the component identifier. + private void SetPrimaryFeature(Row row, int featureColumnIndex, int componentColumnIndex) + { + // only products contain primary features + if (OutputType.Product == this.outputType) + { + Field featureField = row.Fields[featureColumnIndex]; + Field componentField = row.Fields[componentColumnIndex]; + + Wix.ComponentRef componentRef = (Wix.ComponentRef)this.core.GetIndexedElement("FeatureComponents", Convert.ToString(featureField.Data), Convert.ToString(componentField.Data)); + + if (null != componentRef) + { + componentRef.Primary = Wix.YesNoType.yes; + } + else + { + this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), featureField.Column.Name, Convert.ToString(featureField.Data), componentField.Column.Name, Convert.ToString(componentField.Data), "FeatureComponents")); + } + } + } + + /// + /// Checks the InstallExecuteSequence table to determine where RemoveExistingProducts is scheduled and removes it. + /// + /// The collection of all tables. + private static Wix.MajorUpgrade.ScheduleType DetermineMajorUpgradeScheduling(TableIndexedCollection tables) + { + int sequenceRemoveExistingProducts = 0; + int sequenceInstallValidate = 0; + int sequenceInstallInitialize = 0; + int sequenceInstallFinalize = 0; + int sequenceInstallExecute = 0; + int sequenceInstallExecuteAgain = 0; + + Table installExecuteSequenceTable = tables["InstallExecuteSequence"]; + if (null != installExecuteSequenceTable) + { + int removeExistingProductsRow = -1; + for (int i = 0; i < installExecuteSequenceTable.Rows.Count; i++) + { + Row row = installExecuteSequenceTable.Rows[i]; + string action = Convert.ToString(row[0]); + int sequence = Convert.ToInt32(row[2]); + + switch (action) + { + case "RemoveExistingProducts": + sequenceRemoveExistingProducts = sequence; + removeExistingProductsRow = i; + break; + case "InstallValidate": + sequenceInstallValidate = sequence; + break; + case "InstallInitialize": + sequenceInstallInitialize = sequence; + break; + case "InstallExecute": + sequenceInstallExecute = sequence; + break; + case "InstallExecuteAgain": + sequenceInstallExecuteAgain = sequence; + break; + case "InstallFinalize": + sequenceInstallFinalize = sequence; + break; + } + } + + installExecuteSequenceTable.Rows.RemoveAt(removeExistingProductsRow); + } + + if (0 != sequenceInstallValidate && sequenceInstallValidate < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallInitialize) + { + return Wix.MajorUpgrade.ScheduleType.afterInstallValidate; + } + else if (0 != sequenceInstallInitialize && sequenceInstallInitialize < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallExecute) + { + return Wix.MajorUpgrade.ScheduleType.afterInstallInitialize; + } + else if (0 != sequenceInstallExecute && sequenceInstallExecute < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallExecuteAgain) + { + return Wix.MajorUpgrade.ScheduleType.afterInstallExecute; + } + else if (0 != sequenceInstallExecuteAgain && sequenceInstallExecuteAgain < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallFinalize) + { + return Wix.MajorUpgrade.ScheduleType.afterInstallExecuteAgain; + } + else + { + return Wix.MajorUpgrade.ScheduleType.afterInstallFinalize; + } + } +#endif + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs b/src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs new file mode 100644 index 00000000..2be986fc --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs @@ -0,0 +1,154 @@ +// 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 +{ + using System; + using System.Collections; + using WixToolset.Data; + using WixToolset.Extensibility; + using Wix = WixToolset.Data.Serialize; + +#if TODO + /// + /// The base of the decompiler. Holds some variables used by the decompiler and extensions, + /// as well as some utility methods. + /// + internal class DecompilerCore : IDecompilerCore + { + private Hashtable elements; + private Wix.IParentElement rootElement; + private bool showPedanticMessages; + private Wix.UI uiElement; + + /// + /// Instantiate a new decompiler core. + /// + /// The root element of the decompiled database. + /// The message handler. + internal DecompilerCore(Wix.IParentElement rootElement) + { + this.elements = new Hashtable(); + this.rootElement = rootElement; + } + + /// + /// Gets whether the decompiler core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + public bool EncounteredError + { + get { return Messaging.Instance.EncounteredError; } + } + + /// + /// Gets the root element of the decompiled output. + /// + /// The root element of the decompiled output. + public Wix.IParentElement RootElement + { + get { return this.rootElement; } + } + + /// + /// Gets or sets the option to show pedantic messages. + /// + /// The option to show pedantic messages. + public bool ShowPedanticMessages + { + get { return this.showPedanticMessages; } + set { this.showPedanticMessages = value; } + } + + /// + /// Gets the UI element. + /// + /// The UI element. + public Wix.UI UIElement + { + get + { + if (null == this.uiElement) + { + this.uiElement = new Wix.UI(); + this.rootElement.AddChild(this.uiElement); + } + + return this.uiElement; + } + } + + /// + /// Verifies if a filename is a valid short filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// True if the filename is a valid short filename + public virtual bool IsValidShortFilename(string filename, bool allowWildcards) + { + return false; + } + + /// + /// Convert an Int32 into a DateTime. + /// + /// The Int32 value. + /// The DateTime. + public DateTime ConvertIntegerToDateTime(int value) + { + int date = value / 65536; + int time = value % 65536; + + return new DateTime(1980 + (date / 512), (date % 512) / 32, date % 32, time / 2048, (time % 2048) / 32, (time % 32) * 2); + } + + /// + /// Gets the element corresponding to the row it came from. + /// + /// The row corresponding to the element. + /// The indexed element. + public Wix.ISchemaElement GetIndexedElement(Row row) + { + return this.GetIndexedElement(row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); + } + + /// + /// Gets the element corresponding to the primary key of the given table. + /// + /// The table corresponding to the element. + /// The primary key corresponding to the element. + /// The indexed element. + public Wix.ISchemaElement GetIndexedElement(string table, params string[] primaryKey) + { + return (Wix.ISchemaElement)this.elements[String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey))]; + } + + /// + /// Index an element by its corresponding row. + /// + /// The row corresponding to the element. + /// The element to index. + public void IndexElement(Row row, Wix.ISchemaElement element) + { + this.elements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element); + } + + /// + /// Indicates the decompiler encountered and unexpected table to decompile. + /// + /// Unknown decompiled table. + public void UnexpectedTable(Table table) + { + this.OnMessage(WixErrors.TableDecompilationUnimplemented(table.Name)); + } + + /// + /// Sends a message to the message delegate if there is one. + /// + /// Message event arguments. + public void OnMessage(MessageEventArgs e) + { + Messaging.Instance.OnMessage(e); + } + } +#endif +} diff --git a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs index 40901d7c..72c876e0 100644 --- a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs @@ -47,8 +47,8 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe Dictionary certificates = new Dictionary(); // Reset the in-memory tables for this new database - Table digitalSignatureTable = new Table(null, this.TableDefinitions["MsiDigitalSignature"]); - Table digitalCertificateTable = new Table(null, this.TableDefinitions["MsiDigitalCertificate"]); + Table digitalSignatureTable = new Table(this.TableDefinitions["MsiDigitalSignature"]); + Table digitalCertificateTable = new Table(this.TableDefinitions["MsiDigitalCertificate"]); // If any digital signature records exist that are not of the media type, preserve them if (database.TableExists("MsiDigitalSignature")) diff --git a/src/WixToolset.Core.WindowsInstaller/Melter.cs b/src/WixToolset.Core.WindowsInstaller/Melter.cs new file mode 100644 index 00000000..a57f73a5 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Melter.cs @@ -0,0 +1,400 @@ +// 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 +{ + using System; + using System.CodeDom.Compiler; + using System.Collections; + using System.Collections.Generic; + using System.Collections.Specialized; + using System.Globalization; + using System.IO; + using System.Text; + using System.Text.RegularExpressions; + using WixToolset.Data; + using Wix = WixToolset.Data.Serialize; + + /// + /// Converts a wixout representation of an MSM database into a ComponentGroup the form of WiX source. + /// + public sealed class Melter + { +#if TODO + private MelterCore core; + private Decompiler decompiler; + + private Wix.ComponentGroup componentGroup; + private Wix.DirectoryRef primaryDirectoryRef; + private Wix.Fragment fragment; + + private string id; + private string moduleId; + private const string nullGuid = "{00000000-0000-0000-0000-000000000000}"; + + public string Id + { + get { return this.id; } + set { this.id = value; } + } + + public Decompiler Decompiler + { + get { return this.decompiler; } + set { this.decompiler = value; } + } + + /// + /// Creates a new melter object. + /// + /// The decompiler to use during the melting process. + /// The Id to use for the ComponentGroup, DirectoryRef, and WixVariables. If null, defaults to the Module's Id + public Melter(Decompiler decompiler, string id) + { + this.core = new MelterCore(); + + this.componentGroup = new Wix.ComponentGroup(); + this.fragment = new Wix.Fragment(); + this.primaryDirectoryRef = new Wix.DirectoryRef(); + + this.decompiler = decompiler; + this.id = id; + + if (null == this.decompiler) + { + this.core.OnMessage(WixErrors.ExpectedDecompiler("The melting process")); + } + } + + /// + /// Converts a Module wixout into a ComponentGroup. + /// + /// The output object representing the unbound merge module to melt. + /// The converted Module as a ComponentGroup. + public Wix.Wix Melt(Output wixout) + { + this.moduleId = GetModuleId(wixout); + + // Assign the default componentGroupId if none was specified + if (null == this.id) + { + this.id = this.moduleId; + } + + this.componentGroup.Id = this.id; + this.primaryDirectoryRef.Id = this.id; + + PreDecompile(wixout); + + wixout.Type = OutputType.Product; + this.decompiler.TreatProductAsModule = true; + Wix.Wix wix = this.decompiler.Decompile(wixout); + + if (null == wix) + { + return wix; + } + + ConvertModule(wix); + + return wix; + } + + /// + /// Converts a Module to a ComponentGroup and adds all of its relevant elements to the main fragment. + /// + /// The output object representing an unbound merge module. + private void ConvertModule(Wix.Wix wix) + { + Wix.Product product = Melter.GetProduct(wix); + + List customActionsRemoved = new List(); + Dictionary customsToRemove = new Dictionary(); + + foreach (Wix.ISchemaElement child in product.Children) + { + Wix.Directory childDir = child as Wix.Directory; + if (null != childDir) + { + bool isTargetDir = this.WalkDirectory(childDir); + if (isTargetDir) + { + continue; + } + } + else + { + Wix.Dependency childDep = child as Wix.Dependency; + if (null != childDep) + { + this.AddPropertyRef(childDep.RequiredId); + continue; + } + else if (child is Wix.Package) + { + continue; + } + else if (child is Wix.CustomAction) + { + Wix.CustomAction customAction = child as Wix.CustomAction; + string directoryId; + if (StartsWithStandardDirectoryId(customAction.Id, out directoryId) && customAction.Property == customAction.Id) + { + customActionsRemoved.Add(customAction.Id); + continue; + } + } + else if (child is Wix.InstallExecuteSequence) + { + Wix.InstallExecuteSequence installExecuteSequence = child as Wix.InstallExecuteSequence; + + foreach (Wix.ISchemaElement sequenceChild in installExecuteSequence.Children) + { + Wix.Custom custom = sequenceChild as Wix.Custom; + string directoryId; + if (custom != null && StartsWithStandardDirectoryId(custom.Action, out directoryId)) + { + customsToRemove.Add(custom, installExecuteSequence); + } + } + } + } + + this.fragment.AddChild(child); + } + + // For any customaction that we removed, also remove the scheduling of that action. + foreach (Wix.Custom custom in customsToRemove.Keys) + { + if (customActionsRemoved.Contains(custom.Action)) + { + ((Wix.InstallExecuteSequence)customsToRemove[custom]).RemoveChild(custom); + } + } + + AddProperty(this.moduleId, this.id); + + wix.RemoveChild(product); + wix.AddChild(this.fragment); + + this.fragment.AddChild(this.componentGroup); + this.fragment.AddChild(this.primaryDirectoryRef); + } + + /// + /// Gets the module from the Wix object. + /// + /// The Wix object. + /// The Module in the Wix object, null if no Module was found + private static Wix.Product GetProduct(Wix.Wix wix) + { + foreach (Wix.ISchemaElement element in wix.Children) + { + Wix.Product productElement = element as Wix.Product; + if (null != productElement) + { + return productElement; + } + } + return null; + } + + /// + /// Adds a PropertyRef to the main Fragment. + /// + /// Id of the PropertyRef. + private void AddPropertyRef(string propertyRefId) + { + Wix.PropertyRef propertyRef = new Wix.PropertyRef(); + propertyRef.Id = propertyRefId; + this.fragment.AddChild(propertyRef); + } + + /// + /// Adds a Property to the main Fragment. + /// + /// Id of the Property. + /// Value of the Property. + private void AddProperty(string propertyId, string value) + { + Wix.Property property = new Wix.Property(); + property.Id = propertyId; + property.Value = value; + this.fragment.AddChild(property); + } + + /// + /// Walks a directory structure obtaining Component Id's and Standard Directory Id's. + /// + /// The Directory to walk. + /// true if the directory is TARGETDIR. + private bool WalkDirectory(Wix.Directory directory) + { + bool isTargetDir = false; + if ("TARGETDIR" == directory.Id) + { + isTargetDir = true; + } + + string standardDirectoryId = null; + if (Melter.StartsWithStandardDirectoryId(directory.Id, out standardDirectoryId) && !isTargetDir) + { + this.AddSetPropertyCustomAction(directory.Id, String.Format(CultureInfo.InvariantCulture, "[{0}]", standardDirectoryId)); + } + + foreach (Wix.ISchemaElement child in directory.Children) + { + Wix.Directory childDir = child as Wix.Directory; + if (null != childDir) + { + if (isTargetDir) + { + this.primaryDirectoryRef.AddChild(child); + } + this.WalkDirectory(childDir); + } + else + { + Wix.Component childComponent = child as Wix.Component; + if (null != childComponent) + { + if (isTargetDir) + { + this.primaryDirectoryRef.AddChild(child); + } + this.AddComponentRef(childComponent); + } + } + } + + return isTargetDir; + } + + /// + /// Gets the module Id out of the Output object. + /// + /// The output object. + /// The module Id from the Output object. + private string GetModuleId(Output wixout) + { + // get the moduleId from the wixout + Table moduleSignatureTable = wixout.Tables["ModuleSignature"]; + if (null == moduleSignatureTable || 0 >= moduleSignatureTable.Rows.Count) + { + this.core.OnMessage(WixErrors.ExpectedTableInMergeModule("ModuleSignature")); + } + return moduleSignatureTable.Rows[0].Fields[0].Data.ToString(); + } + + /// + /// Determines if the directory Id starts with a standard directory id. + /// + /// The directory id. + /// The standard directory id. + /// true if the directory starts with a standard directory id. + private static bool StartsWithStandardDirectoryId(string directoryId, out string standardDirectoryId) + { + standardDirectoryId = null; + foreach (string id in WindowsInstallerStandard.GetStandardDirectories()) + { + if (directoryId.StartsWith(id, StringComparison.Ordinal)) + { + standardDirectoryId = id; + return true; + } + } + return false; + } + + /// + /// Adds a ComponentRef to the main ComponentGroup. + /// + /// The component to add. + private void AddComponentRef(Wix.Component component) + { + Wix.ComponentRef componentRef = new Wix.ComponentRef(); + componentRef.Id = component.Id; + this.componentGroup.AddChild(componentRef); + } + + /// + /// Adds a SetProperty CA for a Directory. + /// + /// The Id of the Property to set. + /// The value to set the Property to. + private void AddSetPropertyCustomAction(string propertyId, string value) + { + // Add the action + Wix.CustomAction customAction = new Wix.CustomAction(); + customAction.Id = propertyId; + customAction.Property = propertyId; + customAction.Value = value; + this.fragment.AddChild(customAction); + + // Schedule the action + Wix.InstallExecuteSequence installExecuteSequence = new Wix.InstallExecuteSequence(); + Wix.Custom custom = new Wix.Custom(); + custom.Action = customAction.Id; + custom.Before = "CostInitialize"; + installExecuteSequence.AddChild(custom); + this.fragment.AddChild(installExecuteSequence); + } + + /// + /// Does any operations to the wixout that would need to be done before decompiling. + /// + /// The output object representing the unbound merge module. + private void PreDecompile(Output wixout) + { + string wixVariable = String.Format(CultureInfo.InvariantCulture, "!(wix.{0}", this.id); + + foreach (Table table in wixout.Tables) + { + // Determine if the table has a feature foreign key + bool hasFeatureForeignKey = false; + foreach (ColumnDefinition columnDef in table.Definition.Columns) + { + if (null != columnDef.KeyTable) + { + string[] keyTables = columnDef.KeyTable.Split(';'); + foreach (string keyTable in keyTables) + { + if ("Feature" == keyTable) + { + hasFeatureForeignKey = true; + break; + } + } + } + } + + // If this table has no foreign keys to the feature table, skip it. + if (!hasFeatureForeignKey) + { + continue; + } + + // Go through all the rows and replace the null guid with the wix variable + // for columns that are foreign keys into the feature table. + foreach (Row row in table.Rows) + { + foreach (Field field in row.Fields) + { + if (null != field.Column.KeyTable) + { + string[] keyTables = field.Column.KeyTable.Split(';'); + foreach (string keyTable in keyTables) + { + if ("Feature" == keyTable) + { + field.Data = field.Data.ToString().Replace(nullGuid, wixVariable); + break; + } + } + } + } + } + } + } +#endif + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/MelterCore.cs b/src/WixToolset.Core.WindowsInstaller/MelterCore.cs new file mode 100644 index 00000000..75d43619 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/MelterCore.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 +{ + using WixToolset.Data; + + /// + /// Melts a Module Wix document into a ComponentGroup representation. + /// + public sealed class MelterCore : IMessageHandler + { + /// + /// Gets whether the melter core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + public bool EncounteredError + { + get { return Messaging.Instance.EncounteredError; } + } + + /// + /// Sends a message to the message delegate if there is one. + /// + /// Message event arguments. + public void OnMessage(MessageEventArgs e) + { + Messaging.Instance.OnMessage(e); + } + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs index bf7b4579..2590c14f 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs @@ -28,7 +28,7 @@ namespace WixToolset.Core.WindowsInstaller return command.Execute(); } - public Output Unbind(IUnbindContext context) + public Intermediate Unbind(IUnbindContext context) { var command = new UnbindMsiOrMsmCommand(context); return command.Execute(); diff --git a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs index 69d7ada0..e39eb883 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs @@ -26,7 +26,7 @@ namespace WixToolset.Core.WindowsInstaller return false; } - public Output Unbind(IUnbindContext context) + public Intermediate Unbind(IUnbindContext context) { var command = new UnbindMsiOrMsmCommand(context); return command.Execute(); diff --git a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs index ea16a570..8fb63665 100644 --- a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs @@ -26,8 +26,9 @@ namespace WixToolset.Core.WindowsInstaller throw new NotImplementedException(); } - public Output Unbind(IUnbindContext context) + public Intermediate Unbind(IUnbindContext context) { +#if REVISIT_FOR_PATCHING Output patch; // patch files are essentially database files (use a special flag to let the API know its a patch file) @@ -65,7 +66,7 @@ namespace WixToolset.Core.WindowsInstaller string transformFile = Path.Combine(context.IntermediateFolder, String.Concat("Transform", Path.DirectorySeparatorChar, subStorageName, ".mst")); // ensure the parent directory exists - System.IO.Directory.CreateDirectory(Path.GetDirectoryName(transformFile)); + Directory.CreateDirectory(Path.GetDirectoryName(transformFile)); // copy the substorage to a new storage for the transform file using (Storage subStorage = storage.OpenStorage(subStorageName)) @@ -107,6 +108,8 @@ namespace WixToolset.Core.WindowsInstaller } return patch; +#endif + throw new NotImplementedException(); } } } \ No newline at end of file diff --git a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs index 66bc57ae..3e40a51f 100644 --- a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs @@ -14,6 +14,7 @@ namespace WixToolset.Core.WindowsInstaller { public BindResult Bind(IBindContext context) { +#if REVISIT_FOR_PATCHING var command = new BindTransformCommand(); command.Extensions = context.Extensions; command.TempFilesLocation = context.IntermediateFolder; @@ -22,6 +23,8 @@ namespace WixToolset.Core.WindowsInstaller command.Execute(); return new BindResult(Array.Empty(), Array.Empty()); +#endif + throw new NotImplementedException(); } public bool Inscribe(IInscribeContext context) @@ -29,7 +32,7 @@ namespace WixToolset.Core.WindowsInstaller throw new NotImplementedException(); } - public Output Unbind(IUnbindContext context) + public Intermediate Unbind(IUnbindContext context) { var command = new UnbindMsiOrMsmCommand(context); return command.Execute(); diff --git a/src/WixToolset.Core.WindowsInstaller/Patch.cs b/src/WixToolset.Core.WindowsInstaller/Patch.cs index 67150e32..f4dac6e6 100644 --- a/src/WixToolset.Core.WindowsInstaller/Patch.cs +++ b/src/WixToolset.Core.WindowsInstaller/Patch.cs @@ -53,6 +53,7 @@ namespace WixToolset.Data [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] public void AttachTransforms(List transforms) { +#if REVISIT_FOR_PATCHING // Track if at least one transform gets attached. bool attachedTransform = false; @@ -1231,6 +1232,8 @@ namespace WixToolset.Data } return pairedTransform; +#endif + throw new NotImplementedException(); } /// diff --git a/src/WixToolset.Core.WindowsInstaller/PatchTransform.cs b/src/WixToolset.Core.WindowsInstaller/PatchTransform.cs new file mode 100644 index 00000000..9ba14843 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/PatchTransform.cs @@ -0,0 +1,277 @@ +// 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 +{ + using System; + using System.Collections; + using System.Globalization; + using System.Text; + using System.Text.RegularExpressions; + using WixToolset.Data; + using WixToolset.Extensibility; + + public class PatchTransform : IMessageHandler + { + private string baseline; + private Intermediate transform; + private string transformPath; + + public string Baseline + { + get { return this.baseline; } + } + + public Intermediate Transform + { + get + { + if (null == this.transform) + { + this.transform = Intermediate.Load(this.transformPath, false); + } + + return this.transform; + } + } + + public string TransformPath + { + get { return this.transformPath; } + } + + public PatchTransform(string transformPath, string baseline) + { + this.transformPath = transformPath; + this.baseline = baseline; + } + + /// + /// Validates that the differences in the transform are valid for patch transforms. + /// + public void Validate() + { +#if REVISIT_FOR_PATCHING + // Changing the ProdocutCode in a patch transform is not recommended. + Table propertyTable = this.Transform.Tables["Property"]; + if (null != propertyTable) + { + foreach (Row row in propertyTable.Rows) + { + // Only interested in modified rows; fast check. + if (RowOperation.Modify == row.Operation) + { + if (0 == String.CompareOrdinal("ProductCode", (string)row[0])) + { + this.OnMessage(WixWarnings.MajorUpgradePatchNotRecommended()); + } + } + } + } + + // If there is nothing in the component table we can return early because the remaining checks are component based. + Table componentTable = this.Transform.Tables["Component"]; + if (null == componentTable) + { + return; + } + + // Index Feature table row operations + Table featureTable = this.Transform.Tables["Feature"]; + Table featureComponentsTable = this.Transform.Tables["FeatureComponents"]; + Hashtable featureOps = null; + if (null != featureTable) + { + int capacity = featureTable.Rows.Count; + featureOps = new Hashtable(capacity); + + foreach (Row row in featureTable.Rows) + { + featureOps[(string)row[0]] = row.Operation; + } + } + else + { + featureOps = new Hashtable(); + } + + // Index Component table and check for keypath modifications + Hashtable deletedComponent = new Hashtable(); + Hashtable componentKeyPath = new Hashtable(); + foreach (Row row in componentTable.Rows) + { + string id = row.Fields[0].Data.ToString(); + string keypath = (null == row.Fields[5].Data) ? String.Empty : row.Fields[5].Data.ToString(); + + componentKeyPath.Add(id, keypath); + if (RowOperation.Delete == row.Operation) + { + deletedComponent.Add(id, row); + } + else if (RowOperation.Modify == row.Operation) + { + if (row.Fields[1].Modified) + { + // Changing the guid of a component is equal to deleting the old one and adding a new one. + deletedComponent.Add(id, row); + } + + // If the keypath is modified its an error + if (row.Fields[5].Modified) + { + this.OnMessage(WixErrors.InvalidKeypathChange(row.SourceLineNumbers, id, this.transformPath)); + } + } + } + + // Verify changes in the file table + Table fileTable = this.Transform.Tables["File"]; + if (null != fileTable) + { + Hashtable componentWithChangedKeyPath = new Hashtable(); + foreach (Row row in fileTable.Rows) + { + if (RowOperation.None != row.Operation) + { + string fileId = row.Fields[0].Data.ToString(); + string componentId = row.Fields[1].Data.ToString(); + + // If this file is the keypath of a component + if (String.Equals((string)componentKeyPath[componentId], fileId, StringComparison.Ordinal)) + { + if (row.Fields[2].Modified) + { + // You cant change the filename of a file that is the keypath of a component. + this.OnMessage(WixErrors.InvalidKeypathChange(row.SourceLineNumbers, componentId, this.transformPath)); + } + + if (!componentWithChangedKeyPath.ContainsKey(componentId)) + { + componentWithChangedKeyPath.Add(componentId, fileId); + } + } + + if (RowOperation.Delete == row.Operation) + { + // If the file is removed from a component that is not deleted. + if (!deletedComponent.ContainsKey(componentId)) + { + bool foundRemoveFileEntry = false; + string filename = Common.GetName((string)row[2], false, true); + + Table removeFileTable = this.Transform.Tables["RemoveFile"]; + if (null != removeFileTable) + { + foreach (Row removeFileRow in removeFileTable.Rows) + { + if (RowOperation.Delete == removeFileRow.Operation) + { + continue; + } + + if (componentId == (string)removeFileRow[1]) + { + // Check if there is a RemoveFile entry for this file + if (null != removeFileRow[2]) + { + string removeFileName = Common.GetName((string)removeFileRow[2], false, true); + + // Convert the MSI format for a wildcard string to Regex format. + removeFileName = removeFileName.Replace('.', '|').Replace('?', '.').Replace("*", ".*").Replace("|", "\\."); + + Regex regex = new Regex(removeFileName, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (regex.IsMatch(filename)) + { + foundRemoveFileEntry = true; + break; + } + } + } + } + } + + if (!foundRemoveFileEntry) + { + this.OnMessage(WixWarnings.InvalidRemoveFile(row.SourceLineNumbers, fileId, componentId)); + } + } + } + } + } + } + + if (0 < deletedComponent.Count) + { + // Index FeatureComponents table. + Hashtable featureComponents = new Hashtable(); + + if (null != featureComponentsTable) + { + foreach (Row row in featureComponentsTable.Rows) + { + ArrayList features; + string componentId = row.Fields[1].Data.ToString(); + + if (featureComponents.Contains(componentId)) + { + features = (ArrayList)featureComponents[componentId]; + } + else + { + features = new ArrayList(); + featureComponents.Add(componentId, features); + } + features.Add(row.Fields[0].Data.ToString()); + } + } + + // Check to make sure if a component was deleted, the feature was too. + foreach (DictionaryEntry entry in deletedComponent) + { + if (featureComponents.Contains(entry.Key.ToString())) + { + ArrayList features = (ArrayList)featureComponents[entry.Key.ToString()]; + foreach (string featureId in features) + { + if (!featureOps.ContainsKey(featureId) || RowOperation.Delete != (RowOperation)featureOps[featureId]) + { + // The feature was not deleted. + this.OnMessage(WixErrors.InvalidRemoveComponent(((Row)entry.Value).SourceLineNumbers, entry.Key.ToString(), featureId, this.transformPath)); + } + } + } + } + } + + // Warn if new components are added to existing features + if (null != featureComponentsTable) + { + foreach (Row row in featureComponentsTable.Rows) + { + if (RowOperation.Add == row.Operation) + { + // Check if the feature is in the Feature table + string feature_ = (string)row[0]; + string component_ = (string)row[1]; + + // Features may not be present if not referenced + if (!featureOps.ContainsKey(feature_) || RowOperation.Add != (RowOperation)featureOps[feature_]) + { + this.OnMessage(WixWarnings.NewComponentAddedToExistingFeature(row.SourceLineNumbers, component_, feature_, this.transformPath)); + } + } + } + } +#endif + throw new NotImplementedException(); + } + + /// + /// Sends a message to the message delegate if there is one. + /// + /// Message event arguments. + public void OnMessage(MessageEventArgs e) + { + Messaging.Instance.OnMessage(e); + } + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs index 208be874..15445bc8 100644 --- a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs @@ -83,7 +83,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind { using (SummaryInformation summaryInformation = new SummaryInformation(this.Database)) { - Table table = new Table(null, this.TableDefinitions["_SummaryInformation"]); + Table table = new Table(this.TableDefinitions["_SummaryInformation"]); for (int i = 1; 19 >= i; i++) { @@ -277,7 +277,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind tableDefinition = this.TableDefinitions[tableName]; } - Table table = new Table(null, tableDefinition); + Table table = new Table(tableDefinition); while (true) { diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs index f04dcefe..ce3f1ff6 100644 --- a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs @@ -18,8 +18,9 @@ namespace WixToolset.Core.WindowsInstaller.Unbind public IUnbindContext Context { get; } - public Output Execute() + public Intermediate Execute() { +#if REVISIT_FOR_PATCHING Output output; try @@ -48,6 +49,8 @@ namespace WixToolset.Core.WindowsInstaller.Unbind } return output; +#endif + throw new NotImplementedException(); } } } diff --git a/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs b/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs new file mode 100644 index 00000000..ed55f312 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs @@ -0,0 +1,24 @@ +// 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.Core +{ + using WixToolset.Data; + using WixToolset.Extensibility; + + internal class UnbindContext : IUnbindContext + { + public Messaging Messaging { get; } = Messaging.Instance; + + public string ExportBasePath { get; set; } + + public string InputFilePath { get; set; } + + public string IntermediateFolder { get; set; } + + public bool IsAdminImage { get; set; } + + public bool SuppressExtractCabinets { get; set; } + + public bool SuppressDemodularization { get; set; } + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/Unbinder.cs b/src/WixToolset.Core.WindowsInstaller/Unbinder.cs new file mode 100644 index 00000000..d2d27d45 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Unbinder.cs @@ -0,0 +1,88 @@ +// 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.Core +{ + using System.Collections; + using System.IO; + using WixToolset.Data; + using WixToolset.Extensibility; + using System.Collections.Generic; + + /// + /// Unbinder core of the WiX toolset. + /// + public sealed class Unbinder + { + public IEnumerable BackendFactories { get; } + + /// + /// Gets or sets whether the input msi is an admin image. + /// + /// Set to true if the input msi is part of an admin image. + public bool IsAdminImage { get; set; } + + /// + /// Gets or sets the option to suppress demodularizing values. + /// + /// The option to suppress demodularizing values. + public bool SuppressDemodularization { get; set; } + + /// + /// Gets or sets the option to suppress extracting cabinets. + /// + /// The option to suppress extracting cabinets. + public bool SuppressExtractCabinets { get; set; } + + /// + /// Gets or sets the temporary path for the Binder. If left null, the binder + /// will use %TEMP% environment variable. + /// + /// Path to temp files. + public string TempFilesLocation => Path.GetTempPath(); + + /// + /// Unbind a Windows Installer file. + /// + /// The Windows Installer file. + /// The type of output to create. + /// The path where files should be exported. + /// The output representing the database. + public Intermediate Unbind(string file, OutputType outputType, string exportBasePath) + { + if (!File.Exists(file)) + { + if (OutputType.Transform == outputType) + { + throw new WixException(WixErrors.FileNotFound(null, file, "Transform")); + } + else + { + throw new WixException(WixErrors.FileNotFound(null, file, "Database")); + } + } + + // if we don't have the temporary files object yet, get one + Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there + + var context = new UnbindContext(); + context.InputFilePath = file; + context.ExportBasePath = exportBasePath; + context.IntermediateFolder = this.TempFilesLocation; + context.IsAdminImage = this.IsAdminImage; + context.SuppressDemodularization = this.SuppressDemodularization; + context.SuppressExtractCabinets = this.SuppressExtractCabinets; + + foreach (var factory in this.BackendFactories) + { + if (factory.TryCreateBackend(outputType.ToString(), file, null, out var backend)) + { + return backend.Unbind(context); + } + } + + // TODO: Display message that could not find a unbinder for output type? + + return null; + } + } +} diff --git a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj index d74cb1e8..da49f31c 100644 --- a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj +++ b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj @@ -22,6 +22,8 @@ + + diff --git a/src/WixToolset.Core/Bind/DelayedField.cs b/src/WixToolset.Core/Bind/DelayedField.cs index 6c56f27c..8b761b94 100644 --- a/src/WixToolset.Core/Bind/DelayedField.cs +++ b/src/WixToolset.Core/Bind/DelayedField.cs @@ -16,7 +16,7 @@ namespace WixToolset.Core.Bind /// /// Row for the field. /// Field needing further resolution. - public DelayedField(Row row, Field field) + public DelayedField(IntermediateTuple row, IntermediateField field) { this.Row = row; this.Field = field; @@ -25,11 +25,11 @@ namespace WixToolset.Core.Bind /// /// The row containing the field. /// - public Row Row { get; } + public IntermediateTuple Row { get; } /// /// The field needing further resolving. /// - public Field Field { get; } + public IntermediateField Field { get; } } } diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index aaa6b7d3..ebca9cff 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs @@ -3,19 +3,18 @@ namespace WixToolset.Core.Bind { using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; public class FileFacade { - public FileFacade(FileRow file, WixFileRow wixFile, WixDeltaPatchFileRow deltaPatchFile) + public FileFacade(FileTuple file, WixFileTuple wixFile, WixDeltaPatchFileTuple deltaPatchFile) { this.File = file; this.WixFile = wixFile; this.DeltaPatchFile = deltaPatchFile; } - public FileFacade(bool fromModule, FileRow file, WixFileRow wixFile) + public FileFacade(bool fromModule, FileTuple file, WixFileTuple wixFile) { this.FromModule = fromModule; this.File = file; @@ -24,21 +23,21 @@ namespace WixToolset.Core.Bind public bool FromModule { get; private set; } - public FileRow File { get; private set; } + public FileTuple File { get; private set; } - public WixFileRow WixFile { get; private set; } + public WixFileTuple WixFile { get; private set; } - public WixDeltaPatchFileRow DeltaPatchFile { get; private set; } + public WixDeltaPatchFileTuple DeltaPatchFile { get; private set; } /// /// Gets the set of MsiAssemblyName rows created for this file. /// /// RowCollection of MsiAssemblyName table. - public List AssemblyNames { get; set; } + public List AssemblyNames { get; set; } /// /// Gets or sets the MsiFileHash row for this file. /// - public Row Hash { get; set; } + public MsiFileHashTuple Hash { get; set; } } } diff --git a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs index 15365c2a..d05135cf 100644 --- a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs @@ -34,19 +34,19 @@ namespace WixToolset.Core.Bind { try { - Row propertyRow = delayedField.Row; + var propertyRow = delayedField.Row; // process properties first in case they refer to other binder variables - if ("Property" == propertyRow.Table.Name) + if (delayedField.Row.Definition.Type == TupleDefinitionType.Property) { - string value = WixVariableResolver.ResolveDelayedVariables(propertyRow.SourceLineNumbers, (string)delayedField.Field.Data, this.VariableCache); + var value = WixVariableResolver.ResolveDelayedVariables(propertyRow.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); // update the variable cache with the new value - string key = String.Concat("property.", Common.Demodularize(this.OutputType, this.ModularizationGuid, (string)propertyRow[0])); + var key = String.Concat("property.", Common.Demodularize(this.OutputType, this.ModularizationGuid, (string)propertyRow[0])); this.VariableCache[key] = value; // update the field data - delayedField.Field.Data = value; + delayedField.Field.Set(value); } else { @@ -103,11 +103,12 @@ namespace WixToolset.Core.Bind } // process the remaining fields in case they refer to property binder variables - foreach (DelayedField delayedField in deferredFields) + foreach (var delayedField in deferredFields) { try { - delayedField.Field.Data = WixVariableResolver.ResolveDelayedVariables(delayedField.Row.SourceLineNumbers, (string)delayedField.Field.Data, this.VariableCache); + var value = WixVariableResolver.ResolveDelayedVariables(delayedField.Row.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); + delayedField.Field.Set(value); } catch (WixException we) { diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index f4f4f9e8..9253f352 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs @@ -2,6 +2,7 @@ namespace WixToolset.Core.Bind { + using System; using System.Collections.Generic; using WixToolset.Data; using WixToolset.Data.Bind; @@ -24,7 +25,7 @@ namespace WixToolset.Core.Bind public string IntermediateFolder { private get; set; } - public TableIndexedCollection Tables { private get; set; } + public Intermediate Intermediate { private get; set; } public bool SupportDelayedResolution { private get; set; } @@ -36,25 +37,39 @@ namespace WixToolset.Core.Bind var fileResolver = new FileResolver(this.BindPaths, this.Extensions); - foreach (Table table in this.Tables) + foreach (var sections in this.Intermediate.Sections) { - foreach (Row row in table.Rows) + foreach (var row in sections.Tuples) { - foreach (Field field in row.Fields) + foreach (var field in row.Fields) { - bool isDefault = true; - bool delayedResolve = false; + if (field == null) + { + continue; + } + + var isDefault = true; + var delayedResolve = false; // Check to make sure we're in a scenario where we can handle variable resolution. if (null != delayedFields) { // resolve localization and wix variables - if (field.Data is string) + if (field.Type == IntermediateFieldType.String) { - field.Data = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, field.AsString(), false, out isDefault, out delayedResolve); - if (delayedResolve) + var original = field.AsString(); + if (!String.IsNullOrEmpty(original)) { - delayedFields.Add(new DelayedField(row, field)); + var value = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, original, false, out isDefault, out delayedResolve); + if (original != value) + { + field.Set(value); + } + + if (delayedResolve) + { + delayedFields.Add(new DelayedField(row, field)); + } } } } @@ -66,44 +81,51 @@ namespace WixToolset.Core.Bind } // Resolve file paths - if (ColumnType.Object == field.Column.Type) + if (field.Type == IntermediateFieldType.Path) { - ObjectField objectField = (ObjectField)field; + var objectField = field.AsPath(); +#if REVISIT_FOR_PATCHING // Skip file resolution if the file is to be deleted. if (RowOperation.Delete == row.Operation) { continue; } +#endif // File is embedded and path to it was not modified above. if (objectField.EmbeddedFileIndex.HasValue && isDefault) { - string extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileIndex(objectField.BaseUri, objectField.EmbeddedFileIndex.Value, this.IntermediateFolder); + var extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileIndex(objectField.BaseUri, objectField.EmbeddedFileIndex.Value, this.IntermediateFolder); // Set the path to the embedded file once where it will be extracted. - objectField.Data = extractPath; + field.Set(extractPath); } - else if (null != objectField.Data) // non-compressed file (or localized value) + else if (null != objectField.Path) // non-compressed file (or localized value) { try { if (!this.BuildingPatch) // Normal binding for non-Patch scenario such as link (light.exe) { +#if REVISIT_FOR_PATCHING // keep a copy of the un-resolved data for future replay. This will be saved into wixpdb file if (null == objectField.UnresolvedData) { objectField.UnresolvedData = (string)objectField.Data; } +#endif // resolve the path to the file - objectField.Data = fileResolver.ResolveFile((string)objectField.Data, table.Name, row.SourceLineNumbers, BindStage.Normal); + var value = fileResolver.ResolveFile(objectField.Path, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); + field.Set(value); } else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) { // resolve the path to the file - objectField.Data = fileResolver.ResolveFile((string)objectField.Data, table.Name, row.SourceLineNumbers, BindStage.Normal); + var value = fileResolver.ResolveFile(objectField.Path, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); + field.Set(value); } +#if REVISIT_FOR_PATCHING else // Re-base binding path scenario caused by pyro.exe -bt -bu { // by default, use the resolved Data for file lookup @@ -122,16 +144,18 @@ namespace WixToolset.Core.Bind } } - objectField.Data = fileResolver.ResolveFile(filePathToResolve, table.Name, row.SourceLineNumbers, BindStage.Updated); + objectField.Data = fileResolver.ResolveFile(filePathToResolve, row.Definition.Name, row.SourceLineNumbers, BindStage.Updated); } +#endif } catch (WixFileNotFoundException) { // display the error with source line information - Messaging.Instance.OnMessage(WixErrors.FileNotFound(row.SourceLineNumbers, (string)objectField.Data)); + Messaging.Instance.OnMessage(WixErrors.FileNotFound(row.SourceLineNumbers, objectField.Path)); } } +#if REVISIT_FOR_PATCHING if (null != objectField.PreviousData) { objectField.PreviousData = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, objectField.PreviousData, false, out isDefault); @@ -159,7 +183,7 @@ namespace WixToolset.Core.Bind if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) { // resolve the path to the file - objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, table.Name, row.SourceLineNumbers, BindStage.Normal); + objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); } else { @@ -177,7 +201,7 @@ namespace WixToolset.Core.Bind } // resolve the path to the file - objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, table.Name, row.SourceLineNumbers, BindStage.Target); + objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Target); } } @@ -189,6 +213,7 @@ namespace WixToolset.Core.Bind } } } +#endif } } } diff --git a/src/WixToolset.Core/BindContext.cs b/src/WixToolset.Core/BindContext.cs index 7b1a1877..7ef7ddd4 100644 --- a/src/WixToolset.Core/BindContext.cs +++ b/src/WixToolset.Core/BindContext.cs @@ -41,7 +41,7 @@ namespace WixToolset.Core public string IntermediateFolder { get; set; } - public Output IntermediateRepresentation { get; set; } + public Intermediate IntermediateRepresentation { get; set; } public string OutputPath { get; set; } diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs index 34bf0dee..07a92d02 100644 --- a/src/WixToolset.Core/Binder.cs +++ b/src/WixToolset.Core/Binder.cs @@ -14,7 +14,7 @@ namespace WixToolset.Core using WixToolset.Core.Bind; using WixToolset.Data; using WixToolset.Data.Bind; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Extensibility; using WixToolset.Extensibility.Services; @@ -43,16 +43,9 @@ namespace WixToolset.Core //this.SuppressIces = new List(); } - public Binder(IBindContext context) - { - this.Context = context; - - this.TableDefinitions = WindowsInstallerStandard.GetTableDefinitions(); - } - - private IBindContext Context { get; } + private IBindContext Context { get; set; } - private TableDefinitionCollection TableDefinitions { get; } + //private TableDefinitionCollection TableDefinitions { get; } //public IEnumerable BackendFactories { get; set; } @@ -173,8 +166,10 @@ namespace WixToolset.Core // this.fileManagers.Add(extension); //} - public bool Bind() + public bool Bind(IBindContext context) { + this.Context = context; + //if (!String.IsNullOrEmpty(this.Context.FileManagerCore.CabCachePath)) //{ // Directory.CreateDirectory(this.Context.FileManagerCore.CabCachePath); @@ -225,7 +220,7 @@ namespace WixToolset.Core private ResolveResult Resolve() { - var buildingPatch = (this.Context.IntermediateRepresentation.Type == OutputType.Patch); + var buildingPatch = this.Context.IntermediateRepresentation.Sections.Any(s => s.Type == SectionType.Patch); var filesWithEmbeddedFiles = new ExtractEmbeddedFiles(); @@ -238,13 +233,14 @@ namespace WixToolset.Core command.Extensions = this.Context.Extensions; command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; command.IntermediateFolder = this.Context.IntermediateFolder; - command.Tables = this.Context.IntermediateRepresentation.Tables; + command.Intermediate = this.Context.IntermediateRepresentation; command.SupportDelayedResolution = true; command.Execute(); delayedFields = command.DelayedFields; } +#if REVISIT_FOR_PATCHING if (this.Context.IntermediateRepresentation.SubStorages != null) { foreach (SubStorage transform in this.Context.IntermediateRepresentation.SubStorages) @@ -256,11 +252,12 @@ namespace WixToolset.Core command.Extensions = this.Context.Extensions; command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; command.IntermediateFolder = this.Context.IntermediateFolder; - command.Tables = transform.Data.Tables; + command.Intermediate = this.Context.IntermediateRepresentation; command.SupportDelayedResolution = false; command.Execute(); } } +#endif var expectedEmbeddedFiles = filesWithEmbeddedFiles.GetExpectedEmbeddedFiles(); @@ -275,9 +272,11 @@ namespace WixToolset.Core { var backendFactories = this.Context.ExtensionManager.Create(); + var entrySection = this.Context.IntermediateRepresentation.Sections[0]; + foreach (var factory in backendFactories) { - if (factory.TryCreateBackend(this.Context.IntermediateRepresentation.Type.ToString(), this.Context.OutputPath, null, out var backend)) + if (factory.TryCreateBackend(entrySection.Type.ToString(), this.Context.OutputPath, null, out var backend)) { var result = backend.Bind(this.Context); return result; @@ -288,6 +287,7 @@ namespace WixToolset.Core return null; } + private void Layout(BindResult result) { try @@ -461,25 +461,28 @@ namespace WixToolset.Core /// /// The output. /// The output file if OutputFile not set. - private void WriteBuildInfoTable(Output output, string outputFile) + private void WriteBuildInfoTable(Intermediate output, string outputFile) { - Table buildInfoTable = output.EnsureTable(this.TableDefinitions["WixBuildInfo"]); - Row buildInfoRow = buildInfoTable.CreateRow(null); + var entrySection = output.Sections.First(s => s.Type != SectionType.Fragment); Assembly executingAssembly = Assembly.GetExecutingAssembly(); FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location); - buildInfoRow[0] = fileVersion.FileVersion; - buildInfoRow[1] = outputFile; + + var buildInfoRow = new WixBuildInfoTuple(); + buildInfoRow.WixVersion = fileVersion.FileVersion; + buildInfoRow.WixOutputFile = outputFile; if (!String.IsNullOrEmpty(this.Context.WixprojectFile)) { - buildInfoRow[2] = this.Context.WixprojectFile; + buildInfoRow.WixProjectFile = this.Context.WixprojectFile; } if (!String.IsNullOrEmpty(this.Context.OutputPdbPath)) { - buildInfoRow[3] = this.Context.OutputPdbPath; + buildInfoRow.WixPdbFile = this.Context.OutputPdbPath; } + + entrySection.Tuples.Add(buildInfoRow); } #if DELETE_THIS_CODE @@ -720,7 +723,7 @@ namespace WixToolset.Core /// /// Path to write file. /// Collection of payloads whose source will be written to file. - private void CreateContentsFile(string path, IEnumerable payloads) + private void CreateContentsFile(string path, IEnumerable payloads) { string directory = Path.GetDirectoryName(path); if (!Directory.Exists(directory)) @@ -730,11 +733,12 @@ namespace WixToolset.Core using (StreamWriter contents = new StreamWriter(path, false)) { - foreach (WixBundlePayloadRow payload in payloads) + foreach (var payload in payloads) { if (payload.ContentFile) { - contents.WriteLine(payload.FullFileName); + var fullPath = Path.GetFullPath(payload.SourceFile); + contents.WriteLine(fullPath); } } } diff --git a/src/WixToolset.Core/BinderCore.cs b/src/WixToolset.Core/BinderCore.cs index 0feae0b2..84173b99 100644 --- a/src/WixToolset.Core/BinderCore.cs +++ b/src/WixToolset.Core/BinderCore.cs @@ -10,14 +10,6 @@ namespace WixToolset /// internal class BinderCore : IBinderCore { - /// - /// Constructor for binder core. - /// - internal BinderCore() - { - this.TableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - } - public IBinderFileManagerCore FileManagerCore { get; set; } /// @@ -29,12 +21,6 @@ namespace WixToolset get { return Messaging.Instance.EncounteredError; } } - /// - /// Gets the table definitions used by the Binder. - /// - /// Table definitions used by the binder. - public TableDefinitionCollection TableDefinitions { get; private set; } - /// /// Generate an identifier by hashing data from the row. /// diff --git a/src/WixToolset.Core/BinderFileManagerCore.cs b/src/WixToolset.Core/BinderFileManagerCore.cs index f1a78880..5780983a 100644 --- a/src/WixToolset.Core/BinderFileManagerCore.cs +++ b/src/WixToolset.Core/BinderFileManagerCore.cs @@ -34,13 +34,13 @@ namespace WixToolset /// Gets or sets the active subStorage used for binding. /// /// The subStorage object. - public SubStorage ActiveSubStorage { get; set; } + //public SubStorage ActiveSubStorage { get; set; } /// /// Gets or sets the output object used for binding. /// /// The output object. - public Output Output { get; set; } + public Intermediate Intermediate { get; set; } /// /// Gets or sets the path to the temp files location. diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 4a1fc1ed..54bf688d 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core using System.IO; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Extensibility; using WixToolset.Extensibility.Services; @@ -79,21 +79,19 @@ namespace WixToolset.Core return 1; } - var tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - if (this.OutputType == OutputType.Library) { - var library = this.LibraryPhase(intermediates, tableDefinitions); + var library = this.LibraryPhase(intermediates); library?.Save(this.OutputPath); } else { - var output = this.LinkPhase(intermediates, tableDefinitions); + var output = this.LinkPhase(intermediates); if (!Messaging.Instance.EncounteredError) { - this.BindPhase(output, tableDefinitions); + this.BindPhase(output); } } @@ -104,15 +102,26 @@ namespace WixToolset.Core { var intermediates = new List(); - var preprocessor = new Preprocessor(); - - var compiler = new Compiler(); foreach (var sourceFile in this.SourceFiles) { + //var preprocessContext = this.ServiceProvider.GetService(); + //preprocessContext.SourcePath = sourceFile.SourcePath; + //preprocessContext.Variables = this.PreprocessorVariables; + + var preprocessor = new Preprocessor(); var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); - var intermediate = compiler.Compile(document); + var compileContext = this.ServiceProvider.GetService(); + compileContext.Messaging = Messaging.Instance; + compileContext.CompilationId = Guid.NewGuid().ToString("N"); + compileContext.Extensions = this.ExtensionManager.Create(); + compileContext.OutputPath = sourceFile.OutputPath; + compileContext.Platform = Platform.X86; // TODO: set this correctly + compileContext.Source = document; + + var compiler = new Compiler(); + var intermediate = compiler.Compile(compileContext); intermediates.Add(intermediate); } @@ -120,9 +129,9 @@ namespace WixToolset.Core return intermediates; } - private Library LibraryPhase(IEnumerable intermediates, TableDefinitionCollection tableDefinitions) + private Intermediate LibraryPhase(IEnumerable intermediates) { - var localizations = this.LoadLocalizationFiles(tableDefinitions).ToList(); + var localizations = this.LoadLocalizationFiles().ToList(); // If there was an error adding localization files, then bail. if (Messaging.Instance.EncounteredError) @@ -137,35 +146,34 @@ namespace WixToolset.Core context.BindPaths = this.BindPaths; context.Extensions = this.ExtensionManager.Create(); context.Localizations = localizations; - context.Sections = intermediates.SelectMany(i => i.Sections).ToList(); + context.LibraryId = Guid.NewGuid().ToString("N"); + context.Intermediates = intermediates; context.WixVariableResolver = resolver; - var librarian = new Librarian(context); - - return librarian.Combine(); + var librarian = new Librarian(); + return librarian.Combine(context); } - private Output LinkPhase(IEnumerable intermediates, TableDefinitionCollection tableDefinitions) + private Intermediate LinkPhase(IEnumerable intermediates) { - var sections = intermediates.SelectMany(i => i.Sections).ToList(); - - sections.AddRange(this.SectionsFromLibraries(tableDefinitions)); + var creator = this.ServiceProvider.GetService(); - var linker = new Linker(); - - foreach (var data in this.ExtensionManager.Create()) - { - linker.AddExtensionData(data); - } + var libraries = this.LoadLibraries(creator); - var output = linker.Link(sections, this.OutputType); + var context = this.ServiceProvider.GetService(); + context.Messaging = Messaging.Instance; + context.Extensions = this.ExtensionManager.Create(); + context.Intermediates = intermediates.Union(libraries).ToList(); + context.ExpectedOutputType = this.OutputType; + var linker = new Linker(); + var output = linker.Link(context); return output; } - private void BindPhase(Output output, TableDefinitionCollection tableDefinitions) + private void BindPhase(Intermediate output) { - var localizations = this.LoadLocalizationFiles(tableDefinitions).ToList(); + var localizations = this.LoadLocalizationFiles().ToList(); var localizer = new Localizer(localizations); @@ -199,13 +207,13 @@ namespace WixToolset.Core context.BuiltOutputsFile = this.BuiltOutputsFile; context.WixprojectFile = this.WixProjectFile; - var binder = new Binder(context); - binder.Bind(); + var binder = new Binder(); + binder.Bind(context); } - private IEnumerable
SectionsFromLibraries(TableDefinitionCollection tableDefinitions) + private IEnumerable LoadLibraries(ITupleDefinitionCreator creator) { - var sections = new List
(); + var libraries = new List(); if (this.LibraryFiles != null) { @@ -213,9 +221,9 @@ namespace WixToolset.Core { try { - var library = Library.Load(libraryFile, tableDefinitions, false); + var library = Intermediate.Load(libraryFile, creator); - sections.AddRange(library.Sections); + libraries.Add(library); } catch (WixCorruptFileException e) { @@ -228,28 +236,28 @@ namespace WixToolset.Core } } - return sections; + return libraries; } - private IEnumerable LoadLocalizationFiles(TableDefinitionCollection tableDefinitions) + private IEnumerable LoadLocalizationFiles() { foreach (var loc in this.LocFiles) { - var localization = Localizer.ParseLocalizationFile(loc, tableDefinitions); + var localization = Localizer.ParseLocalizationFile(loc); yield return localization; } } - private static WixVariableResolver CreateWixResolverWithVariables(Localizer localizer, Output output) + private static WixVariableResolver CreateWixResolverWithVariables(Localizer localizer, Intermediate output) { var resolver = new WixVariableResolver(localizer); // Gather all the wix variables. - Table wixVariableTable = output?.Tables["WixVariable"]; - if (null != wixVariableTable) + var wixVariables = output?.Sections.SelectMany(s => s.Tuples).OfType(); + if (wixVariables != null) { - foreach (WixVariableRow wixVariableRow in wixVariableTable.Rows) + foreach (var wixVariableRow in wixVariables) { resolver.AddVariable(wixVariableRow); } diff --git a/src/WixToolset.Core/CommandLine/CommandLine.cs b/src/WixToolset.Core/CommandLine/CommandLine.cs index b0594348..c6fe11b7 100644 --- a/src/WixToolset.Core/CommandLine/CommandLine.cs +++ b/src/WixToolset.Core/CommandLine/CommandLine.cs @@ -218,7 +218,7 @@ namespace WixToolset.Core { var sourceFiles = GatherSourceFiles(files, outputFolder); var variables = GatherPreprocessorVariables(defines); - return new CompileCommand(sourceFiles, variables); + return new CompileCommand(this.ServiceProvider, this.ExtensionManager, sourceFiles, variables); } } diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 855e7c6a..58ba9d29 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs @@ -2,32 +2,47 @@ namespace WixToolset.Core { + using System; using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility; using WixToolset.Extensibility.Services; internal class CompileCommand : ICommandLineCommand { - public CompileCommand(IEnumerable sources, IDictionary preprocessorVariables) + public CompileCommand(IServiceProvider serviceProvider, IExtensionManager extensions, IEnumerable sources, IDictionary preprocessorVariables) { this.PreprocessorVariables = preprocessorVariables; + this.ServiceProvider = serviceProvider; + this.ExtensionManager = extensions; this.SourceFiles = sources; } + private IServiceProvider ServiceProvider { get; } + + private IExtensionManager ExtensionManager { get; } + private IEnumerable SourceFiles { get; } private IDictionary PreprocessorVariables { get; } public int Execute() { - var preprocessor = new Preprocessor(); - - var compiler = new Compiler(); - foreach (var sourceFile in this.SourceFiles) { + var preprocessor = new Preprocessor(); var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); - var intermediate = compiler.Compile(document); + var compileContext = this.ServiceProvider.GetService(); + compileContext.Messaging = Messaging.Instance; + compileContext.CompilationId = Guid.NewGuid().ToString("N"); + compileContext.Extensions = this.ExtensionManager.Create(); + compileContext.OutputPath = sourceFile.OutputPath; + compileContext.Platform = Platform.X86; // TODO: set this correctly + compileContext.Source = document; + + var compiler = new Compiler(); + var intermediate = compiler.Compile(compileContext); intermediate.Save(sourceFile.OutputPath); } diff --git a/src/WixToolset.Core/CompileContext.cs b/src/WixToolset.Core/CompileContext.cs new file mode 100644 index 00000000..85759ec9 --- /dev/null +++ b/src/WixToolset.Core/CompileContext.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.Core +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility; + + public class CompileContext : ICompileContext + { + internal CompileContext(IServiceProvider serviceProvider) + { + this.ServiceProvider = serviceProvider; + } + + public IServiceProvider ServiceProvider { get; } + + public Messaging Messaging { get; set; } + + public string CompilationId { get; set; } + + public IEnumerable Extensions { get; set; } + + public string OutputPath { get; set; } + + public Platform Platform { get; set; } + + public XDocument Source { get; set; } + } +} diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index d085e788..e0475baa 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -14,8 +14,9 @@ namespace WixToolset using WixToolset.Core; using WixToolset.Core.Native; using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Services; using Wix = WixToolset.Data.Serialize; /// @@ -39,12 +40,6 @@ namespace WixToolset private const string BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER = "WixBundleOriginalSourceFolder"; private const string BURN_BUNDLE_LAST_USED_SOURCE = "WixBundleLastUsedSource"; - private TableDefinitionCollection tableDefinitions; - private Dictionary extensions; - private List inspectorExtensions; - private CompilerCore core; - private bool showPedanticMessages; - // if these are true you know you are building a module or product // but if they are false you cannot not be sure they will not end // up a product or module. Use these flags carefully. @@ -57,18 +52,6 @@ namespace WixToolset private WixVariableResolver componentIdPlaceholdersResolver; - /// - /// Creates a new compiler object with a default set of table definitions. - /// - public Compiler() - { - this.tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - this.extensions = new Dictionary(); - this.inspectorExtensions = new List(); - - this.CurrentPlatform = Platform.X86; - } - /// /// Type of RadioButton element in a group. /// @@ -87,99 +70,68 @@ namespace WixToolset Icon, } + private ICompileContext Context { get; set; } + + private CompilerCore Core { get; set; } + /// /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. /// /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - public Platform CurrentPlatform { get; set; } + public Platform CurrentPlatform => this.Context.Platform; /// /// Gets or sets the option to show pedantic messages. /// /// The option to show pedantic messages. - public bool ShowPedanticMessages - { - get { return this.showPedanticMessages; } - set { this.showPedanticMessages = value; } - } + public bool ShowPedanticMessages { get; set; } /// - /// Adds a compiler extension. + /// Compiles the provided Xml document into an intermediate object /// - /// The extension to add. - public void AddExtension(ICompilerExtension extension) + /// Context for the compile. The BaseURI property + /// should be properly set to get messages containing source line information. + /// Intermediate object representing compiled source document. + /// This method is not thread-safe. + public Intermediate Compile(ICompileContext context) { - // Check if this extension is adding a schema namespace that already exists. - ICompilerExtension collidingExtension; - if (!this.extensions.TryGetValue(extension.Namespace, out collidingExtension)) - { - this.extensions.Add(extension.Namespace, extension); - } - else + this.Context = context ?? throw new ArgumentNullException(nameof(context)); + + var target = new Intermediate(); + + if (String.IsNullOrEmpty(context.CompilationId)) { - Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString())); + this.Context.CompilationId = target.Id; } - //if (null != extension.InspectorExtension) - //{ - // this.inspectorExtensions.Add(extension.InspectorExtension); - //} - } + var extensionsByNamespace = new Dictionary(); - /// - /// Adds table definitions from an extension - /// - /// Extension with table definitions. - public void AddExtensionData(IExtensionData extension) - { - if (null != extension.TableDefinitions) + foreach (var extension in this.Context.Extensions) { - foreach (TableDefinition tableDefinition in extension.TableDefinitions) + if (!extensionsByNamespace.TryGetValue(extension.Namespace, out var collidingExtension)) { - if (!this.tableDefinitions.Contains(tableDefinition.Name)) - { - this.tableDefinitions.Add(tableDefinition); - } - else - { - Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); - } + extensionsByNamespace.Add(extension.Namespace, extension); + } + else + { + Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString())); } - } - } - - /// - /// Compiles the provided Xml document into an intermediate object - /// - /// Source xml document to compile. The BaseURI property - /// should be properly set to get messages containing source line information. - /// Intermediate object representing compiled source document. - /// This method is not thread-safe. - [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] - public Intermediate Compile(XDocument source) - { - if (null == source) throw new ArgumentNullException(nameof(source)); - - bool encounteredError = false; - // create the intermediate - Intermediate target = new Intermediate(); + extension.PreCompile(context); + } - // try to compile it + // Try to compile it. try { - this.core = new CompilerCore(target, this.tableDefinitions, this.extensions); - this.core.ShowPedanticMessages = this.showPedanticMessages; - this.core.CurrentPlatform = this.CurrentPlatform; - this.componentIdPlaceholdersResolver = new WixVariableResolver(); + var creator = context.ServiceProvider.GetService(); - foreach (CompilerExtension extension in this.extensions.Values) - { - extension.Core = this.core; - extension.Initialize(); - } + this.Core = new CompilerCore(target, creator, extensionsByNamespace); + this.Core.CurrentPlatform = this.Context.Platform; + this.Core.ShowPedanticMessages = this.ShowPedanticMessages; + this.componentIdPlaceholdersResolver = new WixVariableResolver(); // parse the document + var source = context.Source; SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(source.Root); if ("Wix" == source.Root.Name.LocalName) { @@ -191,17 +143,17 @@ namespace WixToolset { if (String.IsNullOrEmpty(source.Root.Name.NamespaceName)) { - this.core.OnMessage(WixErrors.InvalidWixXmlNamespace(sourceLineNumbers, "Wix", CompilerCore.WixNamespace.ToString())); + this.Core.OnMessage(WixErrors.InvalidWixXmlNamespace(sourceLineNumbers, "Wix", CompilerCore.WixNamespace.ToString())); } else { - this.core.OnMessage(WixErrors.InvalidWixXmlNamespace(sourceLineNumbers, "Wix", source.Root.Name.NamespaceName, CompilerCore.WixNamespace.ToString())); + this.Core.OnMessage(WixErrors.InvalidWixXmlNamespace(sourceLineNumbers, "Wix", source.Root.Name.NamespaceName, CompilerCore.WixNamespace.ToString())); } } } else { - this.core.OnMessage(WixErrors.InvalidDocumentElement(sourceLineNumbers, source.Root.Name.LocalName, "source", "Wix")); + this.Core.OnMessage(WixErrors.InvalidDocumentElement(sourceLineNumbers, source.Root.Name.LocalName, "source", "Wix")); } // Resolve any Component Id placeholders compiled into the intermediate. @@ -209,55 +161,38 @@ namespace WixToolset { foreach (var section in target.Sections) { - foreach (Table table in section.Tables) + foreach (var tuple in section.Tuples) { - foreach (Row row in table.Rows) + foreach (var field in tuple.Fields) { - foreach (Field field in row.Fields) + if (field != null && field.Type == IntermediateFieldType.String) { - if (field.Data is string) + var data = field.AsString(); + if (!String.IsNullOrEmpty(data)) { - field.Data = this.componentIdPlaceholdersResolver.ResolveVariables(row.SourceLineNumbers, (string)field.Data, false, false, out var defaultIgnored, out var delayedIgnored); + var resolved = this.componentIdPlaceholdersResolver.ResolveVariables(tuple.SourceLineNumbers, data, false, false, out var defaultIgnored, out var delayedIgnored); + if (data != resolved) + { + field.Set(resolved); + } } } } } } } - - // inspect the document - InspectorCore inspectorCore = new InspectorCore(); - foreach (InspectorExtension inspectorExtension in this.inspectorExtensions) - { - inspectorExtension.Core = inspectorCore; - inspectorExtension.InspectIntermediate(target); - - // reset - inspectorExtension.Core = null; - } - - if (inspectorCore.EncounteredError) - { - encounteredError = true; - } } finally { - if (this.core.EncounteredError) + foreach (var extension in context.Extensions) { - encounteredError = true; + extension.PostCompile(target); } - foreach (CompilerExtension extension in this.extensions.Values) - { - extension.Finish(); - extension.Core = null; - } - this.core = null; + this.Core = null; } - // return the compiled intermediate only if it completed successfully - return (encounteredError ? null : target); + return Messaging.Instance.EncounteredError ? null : target; } /// @@ -299,7 +234,7 @@ namespace WixToolset } else { - if (this.core.IsValidShortFilename(longName, false)) + if (this.Core.IsValidShortFilename(longName, false)) { return longName; } @@ -318,15 +253,15 @@ namespace WixToolset /// Signature for search. private void AddAppSearch(SourceLineNumber sourceLineNumbers, Identifier property, string signature) { - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (property.Id != property.Id.ToUpperInvariant()) { - this.core.OnMessage(WixErrors.SearchPropertyNotUppercase(sourceLineNumbers, "Property", "Id", property.Id)); + this.Core.OnMessage(WixErrors.SearchPropertyNotUppercase(sourceLineNumbers, "Property", "Id", property.Id)); } - Row row = this.core.CreateRow(sourceLineNumbers, "AppSearch", property); - row[1] = signature; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.AppSearch, property); + row.Set(1, signature); } } @@ -358,33 +293,33 @@ namespace WixToolset Group group = match.Groups["identifier"]; if (group.Success) { - this.core.OnMessage(WixWarnings.PropertyValueContainsPropertyReference(sourceLineNumbers, property.Id, group.Value)); + this.Core.OnMessage(WixWarnings.PropertyValueContainsPropertyReference(sourceLineNumbers, property.Id, group.Value)); } } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Section section = this.core.ActiveSection; + var section = this.Core.ActiveSection; // Add the row to a separate section if requested. if (fragment) { - string id = String.Concat(this.core.ActiveSection.Id, ".", property.Id); + string id = String.Concat(this.Core.ActiveSection.Id, ".", property.Id); - section = this.core.CreateSection(id, SectionType.Fragment, this.core.ActiveSection.Codepage); + section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId); // Reference the property in the active section. - this.core.CreateSimpleReference(sourceLineNumbers, "Property", property.Id); + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property.Id); } - Row row = this.core.CreateRow(sourceLineNumbers, "Property", section, property); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Property, section, property); // Allow row to exist with no value so that PropertyRefs can be made for *Search elements // the linker will remove these rows before the final output is created. if (null != value) { - row[1] = value; + row.Set(1, value); } if (admin || hidden || secure) @@ -394,26 +329,24 @@ namespace WixToolset } } - private WixPropertyRow AddWixPropertyRow(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, Section section = null) + private void AddWixPropertyRow(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, IntermediateSection section = null) { if (secure && property.Id != property.Id.ToUpperInvariant()) { - this.core.OnMessage(WixErrors.SecurePropertyNotUppercase(sourceLineNumbers, "Property", "Id", property.Id)); + this.Core.OnMessage(WixErrors.SecurePropertyNotUppercase(sourceLineNumbers, "Property", "Id", property.Id)); } if (null == section) { - section = this.core.ActiveSection; + section = this.Core.ActiveSection; - this.core.EnsureTable(sourceLineNumbers, "Property"); // Property table is always required when using WixProperty table. + this.Core.EnsureTable(sourceLineNumbers, "Property"); // Property table is always required when using WixProperty table. } - WixPropertyRow row = (WixPropertyRow)this.core.CreateRow(sourceLineNumbers, "WixProperty", section, property); + var row = (WixPropertyTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixProperty, section, property); row.Admin = admin; row.Hidden = hidden; row.Secure = secure; - - return row; } /// @@ -425,7 +358,7 @@ namespace WixToolset /// Identifier of parent component. private void RegisterImplementedCategories(SourceLineNumber sourceLineNumbers, string categoryId, string classId, string componentId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Implemented Categories\\", categoryId), "*", null, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Implemented Categories\\", categoryId), "*", null, componentId); } /// @@ -457,51 +390,51 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - appId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "ActivateAtStorage": - activateAtStorage = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + activateAtStorage = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Advertise": - appIdAdvertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + appIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DllSurrogate": - dllSurrogate = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + dllSurrogate = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "LocalService": - localService = this.core.GetAttributeValue(sourceLineNumbers, attrib); + localService = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "RemoteServerName": - remoteServerName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remoteServerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "RunAsInteractiveUser": - runAsInteractiveUser = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + runAsInteractiveUser = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ServiceParameters": - serviceParameters = this.core.GetAttributeValue(sourceLineNumbers, attrib); + serviceParameters = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == appId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if ((YesNoType.No == advertise && YesNoType.Yes == appIdAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == appIdAdvertise)) { - this.core.OnMessage(WixErrors.AppIdIncompatibleAdvertiseState(sourceLineNumbers, node.Name.LocalName, "Advertise", appIdAdvertise.ToString(), advertise.ToString())); + this.Core.OnMessage(WixErrors.AppIdIncompatibleAdvertiseState(sourceLineNumbers, node.Name.LocalName, "Advertise", appIdAdvertise.ToString(), advertise.ToString())); } else { @@ -524,13 +457,13 @@ namespace WixToolset this.ParseClassElement(child, componentId, advertise, fileServer, typeLibId, typeLibVersion, appId); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -538,25 +471,25 @@ namespace WixToolset { if (null != description) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "Description")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "Description")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "AppId"); - row[0] = appId; - row[1] = remoteServerName; - row[2] = localService; - row[3] = serviceParameters; - row[4] = dllSurrogate; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.AppId); + row.Set(0, appId); + row.Set(1, remoteServerName); + row.Set(2, localService); + row.Set(3, serviceParameters); + row.Set(4, dllSurrogate); if (YesNoType.Yes == activateAtStorage) { - row[5] = 1; + row.Set(5, 1); } if (YesNoType.Yes == runAsInteractiveUser) { - row[6] = 1; + row.Set(6, 1); } } } @@ -564,41 +497,41 @@ namespace WixToolset { if (null != description) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), null, description, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), null, description, componentId); } else { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "+", null, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "+", null, componentId); } if (null != remoteServerName) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "RemoteServerName", remoteServerName, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "RemoteServerName", remoteServerName, componentId); } if (null != localService) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "LocalService", localService, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "LocalService", localService, componentId); } if (null != serviceParameters) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "ServiceParameters", serviceParameters, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "ServiceParameters", serviceParameters, componentId); } if (null != dllSurrogate) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "DllSurrogate", dllSurrogate, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "DllSurrogate", dllSurrogate, componentId); } if (YesNoType.Yes == activateAtStorage) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "ActivateAtStorage", "Y", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "ActivateAtStorage", "Y", componentId); } if (YesNoType.Yes == runAsInteractiveUser) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "RunAs", "Interactive User", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("AppID\\", appId), "RunAs", "Interactive User", componentId); } } } @@ -621,35 +554,35 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiAssemblyName"); - row[0] = componentId; - row[1] = id; - row[2] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiAssemblyName); + row.Set(0, componentId); + row.Set(1, id); + row.Set(2, value); } } @@ -673,71 +606,71 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "SourceFile": case "src": if (null != sourceFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile", "src")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile", "src")); } if ("src" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); } - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SuppressModularization": - suppressModularization = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (!String.IsNullOrEmpty(id.Id)) // only check legal values { if (55 < id.Id.Length) { - this.core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 55)); + this.Core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 55)); } else if (!this.compilingProduct) // if we're not doing a product then we can't be sure that a binary identifier will fit when modularized { if (18 < id.Id.Length) { - this.core.OnMessage(WixWarnings.IdentifierCannotBeModularized(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 18)); + this.Core.OnMessage(WixWarnings.IdentifierCannotBeModularized(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 18)); } } } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Binary", id); - row[1] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Binary, id); + row.Set(1, sourceFile); if (YesNoType.Yes == suppressModularization) { - Row wixSuppressModularizationRow = this.core.CreateRow(sourceLineNumbers, "WixSuppressModularization"); - wixSuppressModularizationRow[0] = id; + var wixSuppressModularizationRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixSuppressModularization); + wixSuppressModularizationRow.Set(0, id); } } @@ -762,53 +695,53 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (!String.IsNullOrEmpty(id.Id)) // only check legal values { if (57 < id.Id.Length) { - this.core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 57)); + this.Core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 57)); } else if (!this.compilingProduct) // if we're not doing a product then we can't be sure that a binary identifier will fit when modularized { if (20 < id.Id.Length) { - this.core.OnMessage(WixWarnings.IdentifierCannotBeModularized(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 20)); + this.Core.OnMessage(WixWarnings.IdentifierCannotBeModularized(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 20)); } } } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Icon", id); - row[1] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Icon, id); + row.Set(1, sourceFile); } return id.Id; @@ -830,23 +763,23 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Property": - property = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Property", property); + property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == property) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); } // find unexpected child elements @@ -860,13 +793,13 @@ namespace WixToolset ParseInstanceElement(child, property); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } @@ -891,53 +824,53 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ProductCode": - productCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); + productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); break; case "ProductName": - productName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + productName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "UpgradeCode": - upgradeCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == productCode) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProductCode")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProductCode")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixInstanceTransforms"); - row[0] = id; - row[1] = propertyId; - row[2] = productCode; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixInstanceTransforms); + row.Set(0, id); + row.Set(1, propertyId); + row.Set(2, productCode); if (null != productName) { - row[3] = productName; + row.Set(3, productName); } if (null != upgradeCode) { - row[4] = upgradeCode; + row.Set(4, upgradeCode); } } } @@ -962,55 +895,55 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "AppData": - appData = this.core.GetAttributeValue(sourceLineNumbers, attrib); + appData = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Feature": - feature = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); + feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); break; case "Qualifier": - qualifier = this.core.GetAttributeValue(sourceLineNumbers, attrib); + qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == qualifier) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Qualifier")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Qualifier")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "PublishComponent"); - row[0] = id; - row[1] = qualifier; - row[2] = componentId; - row[3] = appData; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PublishComponent); + row.Set(0, id); + row.Set(1, qualifier); + row.Set(2, componentId); + row.Set(3, appData); if (null == feature) { - row[4] = Guid.Empty.ToString("B"); + row.Set(4, Guid.Empty.ToString("B")); } else { - row[4] = feature; + row.Set(4, feature); } } } @@ -1062,81 +995,81 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - classId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Advertise": - classAdvertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + classAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "AppId": - appId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Argument": - argument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Context": - contexts = this.core.GetAttributeValue(sourceLineNumbers, attrib).Split("\r\n\t ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + contexts = this.Core.GetAttributeValue(sourceLineNumbers, attrib).Split("\r\n\t ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); break; case "Control": - control = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + control = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Handler": - defaultInprocHandler = this.core.GetAttributeValue(sourceLineNumbers, attrib); + defaultInprocHandler = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Icon": - icon = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "IconIndex": - iconIndex = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); + iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); break; case "RelativePath": - relativePath = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + relativePath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; // The following attributes result in rows always added to the Registry table rather than the Class table case "Insertable": - insertable = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? "Insertable" : "NotInsertable"; + insertable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? "Insertable" : "NotInsertable"; break; case "Programmable": - programmable = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + programmable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "SafeForInitializing": - safeForInit = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + safeForInit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "SafeForScripting": - safeForScripting = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + safeForScripting = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ForeignServer": - foreignServer = this.core.GetAttributeValue(sourceLineNumbers, attrib); + foreignServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Server": - localFileServer = this.core.GetAttributeValue(sourceLineNumbers, attrib); + localFileServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ShortPath": - shortServerPath = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + shortServerPath = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ThreadingModel": - threadingModel = this.core.GetAttributeValue(sourceLineNumbers, attrib); + threadingModel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Version": - version = this.core.GetAttributeValue(sourceLineNumbers, attrib); + version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == classId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } HashSet uniqueContexts = new HashSet(); @@ -1144,7 +1077,7 @@ namespace WixToolset { if (uniqueContexts.Contains(context)) { - this.core.OnMessage(WixErrors.DuplicateContextValue(sourceLineNumbers, context)); + this.Core.OnMessage(WixErrors.DuplicateContextValue(sourceLineNumbers, context)); } else { @@ -1163,7 +1096,7 @@ namespace WixToolset if ((YesNoType.No == advertise && YesNoType.Yes == classAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == classAdvertise)) { - this.core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, classAdvertise.ToString(), advertise.ToString())); + this.Core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, classAdvertise.ToString(), advertise.ToString())); } else { @@ -1178,17 +1111,17 @@ namespace WixToolset if (YesNoType.Yes == advertise && 0 == contexts.Length) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Context", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Context", "Advertise", "yes")); } if (!String.IsNullOrEmpty(parentAppId) && !String.IsNullOrEmpty(appId)) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "AppId", node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "AppId", node.Parent.Name.LocalName)); } if (!String.IsNullOrEmpty(localFileServer)) { - this.core.CreateSimpleReference(sourceLineNumbers, "File", localFileServer); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", localFileServer); } // Local variables used strictly for child node processing. @@ -1209,7 +1142,7 @@ namespace WixToolset else if (YesNoType.No == advertise) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.CreateRegistryRow(childSourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("FileType\\", classId, "\\", fileTypeMaskIndex.ToString()), String.Empty, this.ParseFileTypeMaskElement(child), componentId); + this.Core.CreateRegistryRow(childSourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("FileType\\", classId, "\\", fileTypeMaskIndex.ToString()), String.Empty, this.ParseFileTypeMaskElement(child), componentId); fileTypeMaskIndex++; } break; @@ -1228,13 +1161,13 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -1243,12 +1176,12 @@ namespace WixToolset { if (null != fileServer || null != localFileServer) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Server", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Server", "Advertise", "yes")); } if (null != foreignServer) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Advertise", "yes")); } if (null == appId && null != parentAppId) @@ -1257,37 +1190,37 @@ namespace WixToolset } // add a Class row for each context - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { foreach (string context in contexts) { - Row row = this.core.CreateRow(sourceLineNumbers, "Class"); - row[0] = classId; - row[1] = context; - row[2] = componentId; - row[3] = defaultProgId; - row[4] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Class); + row.Set(0, classId); + row.Set(1, context); + row.Set(2, componentId); + row.Set(3, defaultProgId); + row.Set(4, description); if (null != appId) { - row[5] = appId; - this.core.CreateSimpleReference(sourceLineNumbers, "AppId", appId); + row.Set(5, appId); + this.Core.CreateSimpleReference(sourceLineNumbers, "AppId", appId); } - row[6] = fileTypeMask; + row.Set(6, fileTypeMask); if (null != icon) { - row[7] = icon; - this.core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); + row.Set(7, icon); + this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); } if (CompilerConstants.IntegerNotSet != iconIndex) { - row[8] = iconIndex; + row.Set(8, iconIndex); } - row[9] = defaultInprocHandler; - row[10] = argument; - row[11] = Guid.Empty.ToString("B"); + row.Set(9, defaultInprocHandler); + row.Set(10, argument); + row.Set(11, Guid.Empty.ToString("B")); if (YesNoType.Yes == relativePath) { - row[12] = MsiInterop.MsidbClassAttributesRelativePath; + row.Set(12, MsiInterop.MsidbClassAttributesRelativePath); } } } @@ -1296,16 +1229,16 @@ namespace WixToolset { if (null == fileServer && null == localFileServer && null == foreignServer) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Server")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Server")); } if (null != fileServer && null != foreignServer) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "File")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "File")); } else if (null != localFileServer && null != foreignServer) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Server")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ForeignServer", "Server")); } else if (null == fileServer) { @@ -1314,7 +1247,7 @@ namespace WixToolset if (null != appId) // need to use nesting (not a reference) for the unadvertised Class elements { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "AppId", "Advertise", "no")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "AppId", "Advertise", "no")); } // add the core registry keys for each context in the class @@ -1324,7 +1257,7 @@ namespace WixToolset { if (null != argument) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Arguments", "Context", context)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Arguments", "Context", context)); } if (null != fileServer) @@ -1361,14 +1294,14 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Context", context, "InprocServer", "InprocServer32", "LocalServer", "LocalServer32")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Context", context, "InprocServer", "InprocServer32", "LocalServer", "LocalServer32")); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), String.Empty, formattedContextString, componentId); // ClassId context + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), String.Empty, formattedContextString, componentId); // ClassId context if (null != icon) // ClassId default icon { - this.core.CreateSimpleReference(sourceLineNumbers, "File", icon); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon); icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon); @@ -1376,18 +1309,18 @@ namespace WixToolset { icon = String.Concat(icon, ",", iconIndex); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context, "\\DefaultIcon"), String.Empty, icon, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context, "\\DefaultIcon"), String.Empty, icon, componentId); } } if (null != parentAppId) // ClassId AppId (must be specified via nesting, not with the AppId attribute) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId), "AppID", parentAppId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId), "AppID", parentAppId, componentId); } if (null != description) // ClassId description { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId), String.Empty, description, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId), String.Empty, description, componentId); } if (null != defaultInprocHandler) @@ -1395,24 +1328,24 @@ namespace WixToolset switch (defaultInprocHandler) // ClassId Default Inproc Handler { case "1": - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); break; case "2": - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); break; case "3": - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); break; default: - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, defaultInprocHandler, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, defaultInprocHandler, componentId); break; } } if (YesNoType.NotSet != relativePath) // ClassId's RelativePath { - this.core.OnMessage(WixErrors.RelativePathForRegistryElement(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.RelativePathForRegistryElement(sourceLineNumbers)); } } @@ -1423,36 +1356,36 @@ namespace WixToolset // add a threading model for each context in the class foreach (string context in contexts) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), "ThreadingModel", threadingModel, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), "ThreadingModel", threadingModel, componentId); } } if (null != typeLibId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\TypeLib"), null, typeLibId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\TypeLib"), null, typeLibId, componentId); } if (null != version) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Version"), null, version, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Version"), null, version, componentId); } if (null != insertable) { // Add "*" for name so that any subkeys (shouldn't be any) are removed on uninstall. - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", insertable), "*", null, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", insertable), "*", null, componentId); } if (control) { // Add "*" for name so that any subkeys (shouldn't be any) are removed on uninstall. - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Control"), "*", null, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Control"), "*", null, componentId); } if (programmable) { // Add "*" for name so that any subkeys (shouldn't be any) are removed on uninstall. - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Programmable"), "*", null, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\Programmable"), "*", null, componentId); } if (safeForInit) @@ -1491,77 +1424,77 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - interfaceId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + interfaceId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "BaseInterface": - baseInterface = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + baseInterface = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "NumMethods": - numMethods = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + numMethods = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "ProxyStubClassId": - proxyId = this.core.GetAttributeValue(sourceLineNumbers, attrib); + proxyId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ProxyStubClassId32": - proxyId32 = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + proxyId32 = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Versioned": - versioned = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + versioned = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == interfaceId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId), null, name, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId), null, name, componentId); if (null != typeLibId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\TypeLib"), null, typeLibId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\TypeLib"), null, typeLibId, componentId); if (versioned) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\TypeLib"), "Version", typelibVersion, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\TypeLib"), "Version", typelibVersion, componentId); } } if (null != baseInterface) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\BaseInterface"), null, baseInterface, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\BaseInterface"), null, baseInterface, componentId); } if (CompilerConstants.IntegerNotSet != numMethods) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\NumMethods"), null, numMethods.ToString(), componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\NumMethods"), null, numMethods.ToString(), componentId); } if (null != proxyId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\ProxyStubClsid"), null, proxyId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\ProxyStubClsid"), null, proxyId, componentId); } if (null != proxyId32) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\ProxyStubClsid32"), null, proxyId32, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("Interface\\", interfaceId, "\\ProxyStubClsid32"), null, proxyId32, componentId); } } @@ -1585,48 +1518,48 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Mask": - mask = this.core.GetAttributeValue(sourceLineNumbers, attrib); + mask = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Offset": - offset = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + offset = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == mask) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Mask")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Mask")); } if (CompilerConstants.IntegerNotSet == offset) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Offset")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Offset")); } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (mask.Length != value.Length) { - this.core.OnMessage(WixErrors.ValueAndMaskMustBeSameLength(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.ValueAndMaskMustBeSameLength(sourceLineNumbers)); } cb = mask.Length / 2; } @@ -1656,62 +1589,62 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "ExcludeLanguages": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive; } break; case "IncludeMaximum": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive; } break; case "IncludeMinimum": // this is "yes" by default - if (YesNoType.No == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive; } break; case "Language": - language = this.core.GetAttributeValue(sourceLineNumbers, attrib); + language = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Minimum": - minimum = this.core.GetAttributeValue(sourceLineNumbers, attrib); + minimum = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Maximum": - maximum = this.core.GetAttributeValue(sourceLineNumbers, attrib); + maximum = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "UpgradeCode": - upgradeCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == minimum && null == maximum) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Minimum", "Maximum")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Minimum", "Maximum")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Upgrade"); - row[0] = upgradeCode; - row[1] = minimum; - row[2] = maximum; - row[3] = language; - row[4] = options; - row[6] = propertyId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Upgrade); + row.Set(0, upgradeCode); + row.Set(1, minimum); + row.Set(2, maximum); + row.Set(3, language); + row.Set(4, options); + row.Set(6, propertyId); } } @@ -1739,19 +1672,19 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Root": - root = this.core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, false); + root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, false); break; case "Type": - string typeValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < typeValue.Length) { Wix.RegistrySearch.TypeType typeType = Wix.RegistrySearch.ParseTypeType(typeValue); @@ -1767,23 +1700,23 @@ namespace WixToolset type = 2; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "raw")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "raw")); break; } } break; case "Win64": explicitWin64 = true; - search64bit = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + search64bit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -1794,22 +1727,22 @@ namespace WixToolset if (null == id) { - id = this.core.CreateIdentifier("reg", root.ToString(), key, name, type.ToString(), search64bit.ToString()); + id = this.Core.CreateIdentifier("reg", root.ToString(), key, name, type.ToString(), search64bit.ToString()); } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (CompilerConstants.IntegerNotSet == root) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); } if (CompilerConstants.IntegerNotSet == type) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); } signature = id.Id; @@ -1823,7 +1756,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; @@ -1833,7 +1766,7 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, id.Id); @@ -1841,7 +1774,7 @@ namespace WixToolset case "FileSearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); @@ -1850,7 +1783,7 @@ namespace WixToolset case "FileSearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures @@ -1858,24 +1791,24 @@ namespace WixToolset signature = null; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "RegLocator", id); - row[1] = root; - row[2] = key; - row[3] = name; - row[4] = search64bit ? (type | 16) : type; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RegLocator, id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); + row.Set(4, search64bit ? (type | 16) : type); } return signature; @@ -1898,26 +1831,26 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return id; // the id of the RegistrySearchRef element is its signature } @@ -1963,13 +1896,13 @@ namespace WixToolset signature = this.ParseRegistrySearchRefElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } @@ -2003,7 +1936,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchElement(child, "CCP_DRIVE"); @@ -2011,25 +1944,25 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, "CCP_DRIVE"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (null == signature) { - this.core.OnMessage(WixErrors.SearchElementRequired(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.SearchElementRequired(sourceLineNumbers, node.Name.LocalName)); } return signature; @@ -2050,13 +1983,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -2075,19 +2008,19 @@ namespace WixToolset else if (signature != sig) { // all signatures under a ComplianceCheck must be the same - this.core.OnMessage(WixErrors.MultipleIdentifiersFound(sourceLineNumbers, node.Name.LocalName, sig, signature)); + this.Core.OnMessage(WixErrors.MultipleIdentifiersFound(sourceLineNumbers, node.Name.LocalName, sig, signature)); } } if (null == signature) { - this.core.OnMessage(WixErrors.SearchElementRequired(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.SearchElementRequired(sourceLineNumbers, node.Name.LocalName)); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "CCPSearch"); - row[0] = signature; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CCPSearch); + row.Set(0, signature); } } @@ -2132,31 +2065,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "ComPlusFlags": - comPlusBits = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + comPlusBits = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "DisableRegistryReflection": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesDisableRegistryReflection; } break; case "Directory": - directoryId = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); + directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); break; case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "Feature": - feature = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Guid": - guid = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, true, true); + guid = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true, true); break; case "KeyPath": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { keyFound = true; keyPath = null; @@ -2165,7 +2098,7 @@ namespace WixToolset } break; case "Location": - string location = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < location.Length) { Wix.Component.LocationType locationType = Wix.Component.ParseLocationType(location); @@ -2180,66 +2113,66 @@ namespace WixToolset bits |= MsiInterop.MsidbComponentAttributesSourceOnly; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "either", "local", "source")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "either", "local", "source")); break; } } break; case "MultiInstance": - multiInstance = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + multiInstance = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "NeverOverwrite": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesNeverOverwrite; } break; case "Permanent": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesPermanent; } break; case "Shared": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesShared; } break; case "SharedDllRefCount": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesSharedDllRefCount; } break; case "Transitive": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesTransitive; } break; case "UninstallWhenSuperseded": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributesUninstallOnSupersedence; } break; case "Win64": explicitWin64 = true; - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbComponentAttributes64bit; win64 = true; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -2251,34 +2184,34 @@ namespace WixToolset if (null == directoryId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Directory")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Directory")); } if (String.IsNullOrEmpty(guid) && MsiInterop.MsidbComponentAttributesShared == (bits & MsiInterop.MsidbComponentAttributesShared)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Shared", "yes", "Guid", "")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Shared", "yes", "Guid", "")); } if (String.IsNullOrEmpty(guid) && MsiInterop.MsidbComponentAttributesPermanent == (bits & MsiInterop.MsidbComponentAttributesPermanent)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Permanent", "yes", "Guid", "")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Permanent", "yes", "Guid", "")); } if (null != feature) { if (this.compilingModule) { - this.core.OnMessage(WixErrors.IllegalAttributeInMergeModule(sourceLineNumbers, node.Name.LocalName, "Feature")); + this.Core.OnMessage(WixErrors.IllegalAttributeInMergeModule(sourceLineNumbers, node.Name.LocalName, "Feature")); } else { if (ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.FeatureGroup == parentType) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Feature", node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Feature", node.Parent.Name.LocalName)); } else { - this.core.CreateComplexReference(sourceLineNumbers, ComplexReferenceParentType.Feature, feature, null, ComplexReferenceChildType.Component, id.Id, true); + this.Core.CreateComplexReference(sourceLineNumbers, ComplexReferenceParentType.Feature, feature, null, ComplexReferenceChildType.Component, id.Id, true); } } } @@ -2306,7 +2239,7 @@ namespace WixToolset if (null != condition) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } condition = this.ParseConditionElement(child, node.Name.LocalName, null, null); break; @@ -2349,10 +2282,10 @@ namespace WixToolset encounteredODBCDataSource = true; break; case "ODBCDriver": - this.ParseODBCDriverOrTranslator(child, id.Id, null, this.tableDefinitions["ODBCDriver"]); + this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCDriver); break; case "ODBCTranslator": - this.ParseODBCDriverOrTranslator(child, id.Id, null, this.tableDefinitions["ODBCTranslator"]); + this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCTranslator); break; case "ProgId": bool foundExtension = false; @@ -2403,14 +2336,14 @@ namespace WixToolset this.ParseTypeLibElement(child, id.Id, null, win64); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "ComponentId", id.Id }, { "DirectoryId", directoryId }, { "Win64", win64.ToString() }, }; - ComponentKeyPath possibleKeyPath = this.core.ParsePossibleKeyPathExtensionElement(node, child, context); + ComponentKeyPath possibleKeyPath = this.Core.ParsePossibleKeyPathExtensionElement(node, child, context); if (null != possibleKeyPath) { if (ComponentKeyPathType.None == possibleKeyPath.Type) @@ -2439,7 +2372,7 @@ namespace WixToolset if (keyFound && YesNoType.Yes == keyPathSet) { - this.core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, node.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); + this.Core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, node.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); } // if a possible KeyPath has been found and that value was explicitly set as @@ -2457,9 +2390,9 @@ namespace WixToolset if (shouldAddCreateFolder) { - Row row = this.core.CreateRow(sourceLineNumbers, "CreateFolder"); - row[0] = directoryId; - row[1] = id.Id; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CreateFolder); + row.Set(0, directoryId); + row.Set(1, id.Id); } // check for conditions that exclude this component from using generated guids @@ -2468,21 +2401,21 @@ namespace WixToolset { if (encounteredODBCDataSource) { - this.core.OnMessage(WixErrors.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers)); isGeneratableGuidOk = false; } if (0 != files && MsiInterop.MsidbComponentAttributesRegistryKeyPath == keyBits) { - this.core.OnMessage(WixErrors.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers, true)); + this.Core.OnMessage(WixErrors.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers, true)); isGeneratableGuidOk = false; } } // check for implicit KeyPath which can easily be accidentally changed - if (this.showPedanticMessages && !keyFound && !isGeneratableGuidOk) + if (this.ShowPedanticMessages && !keyFound && !isGeneratableGuidOk) { - this.core.OnMessage(WixErrors.ImplicitComponentKeyPath(sourceLineNumbers, id.Id)); + this.Core.OnMessage(WixErrors.ImplicitComponentKeyPath(sourceLineNumbers, id.Id)); } // if there isn't an @Id attribute value, replace the placeholder with the id of the keypath. @@ -2498,35 +2431,35 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.CannotDefaultComponentId(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.CannotDefaultComponentId(sourceLineNumbers)); } } // If an id was not determined by now, we have to error. if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } // finally add the Component table row - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Component", id); - row[1] = guid; - row[2] = directoryId; - row[3] = bits | keyBits; - row[4] = condition; - row[5] = keyPath; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Component, id); + row.Set(1, guid); + row.Set(2, directoryId); + row.Set(3, bits | keyBits); + row.Set(4, condition); + row.Set(5, keyPath); if (multiInstance) { - Row instanceComponentRow = this.core.CreateRow(sourceLineNumbers, "WixInstanceComponent"); - instanceComponentRow[0] = id; + var instanceComponentRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixInstanceComponent); + instanceComponentRow.Set(0, id); } if (0 < symbols.Count) { - WixDeltaPatchSymbolPathsRow symbolRow = (WixDeltaPatchSymbolPathsRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchSymbolPaths", id); + var symbolRow = (WixDeltaPatchSymbolPathsTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchSymbolPaths, id); symbolRow.Type = SymbolPathType.Component; symbolRow.SymbolPaths = String.Join(";", symbols); } @@ -2534,20 +2467,20 @@ namespace WixToolset // Complus if (CompilerConstants.IntegerNotSet != comPlusBits) { - row = this.core.CreateRow(sourceLineNumbers, "Complus"); - row[0] = id; - row[1] = comPlusBits; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Complus); + row.Set(0, id); + row.Set(1, comPlusBits); } // if this is a module, automatically add this component to the references to ensure it gets in the ModuleComponents table if (this.compilingModule) { - this.core.CreateComplexReference(sourceLineNumbers, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage, ComplexReferenceChildType.Component, id.Id, false); + this.Core.CreateComplexReference(sourceLineNumbers, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage, ComplexReferenceChildType.Component, id.Id, false); } else if (ComplexReferenceParentType.Unknown != parentType && null != parentId) // if parent was provided, add a complex reference to that. { // If the Component is defined directly under a feature, then mark the complex reference primary. - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.Component, id.Id, ComplexReferenceParentType.Feature == parentType); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.Component, id.Id, ComplexReferenceParentType.Feature == parentType); } } } @@ -2571,30 +2504,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Directory": // If the inline syntax is invalid it returns null. Use a static error identifier so the null // directory identifier here doesn't trickle down false errors into child elements. - directoryId = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null) ?? "ErrorParsingInlineSyntax"; + directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null) ?? "ErrorParsingInlineSyntax"; break; case "Source": - source = this.core.GetAttributeValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -2619,22 +2552,22 @@ namespace WixToolset this.ParseComponentElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null, CompilerConstants.IntegerNotSet, directoryId, source); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixComponentGroup", id); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixComponentGroup, id); // Add this componentGroup and its parent in WixGroup. - this.core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.ComponentGroup, id.Id); + this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.ComponentGroup, id.Id); } } @@ -2660,31 +2593,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id); break; case "Primary": - primary = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.ComponentGroup, id, (YesNoType.Yes == primary)); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.ComponentGroup, id, (YesNoType.Yes == primary)); } /// @@ -2709,31 +2642,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Component", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Component", id); break; case "Primary": - primary = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.Component, id, (YesNoType.Yes == primary)); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, parentLanguage, ComplexReferenceChildType.Component, id, (YesNoType.Yes == primary)); } /// @@ -2756,13 +2689,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Guid": - componentId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + componentId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Type": - string typeValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < typeValue.Length) { Wix.ComponentSearch.TypeType typeType = Wix.ComponentSearch.ParseTypeType(typeValue); @@ -2775,25 +2708,25 @@ namespace WixToolset type = MsiInterop.MsidbLocatorTypeFileName; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue, "directory", "file")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue, "directory", "file")); break; } } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifier("cmp", componentId, type.ToString()); + id = this.Core.CreateIdentifier("cmp", componentId, type.ToString()); } signature = id.Id; @@ -2807,7 +2740,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; @@ -2817,7 +2750,7 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, id.Id); @@ -2825,7 +2758,7 @@ namespace WixToolset case "FileSearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); @@ -2834,7 +2767,7 @@ namespace WixToolset case "FileSearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures @@ -2842,21 +2775,21 @@ namespace WixToolset signature = null; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "CompLocator", id); - row[1] = componentId; - row[2] = type; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CompLocator, id); + row.Set(1, componentId); + row.Set(2, type); } return signature; @@ -2880,16 +2813,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Directory": - directoryId = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); + directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -2909,22 +2842,22 @@ namespace WixToolset this.ParsePermissionExElement(child, directoryId, "CreateFolder"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "DirectoryId", directoryId }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "CreateFolder"); - row[0] = directoryId; - row[1] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CreateFolder); + row.Set(0, directoryId); + row.Set(1, componentId); } return directoryId; @@ -2957,167 +2890,167 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Delete": - delete = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + delete = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "DestinationDirectory": - destinationDirectory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + destinationDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); break; case "DestinationName": - destinationName = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + destinationName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "DestinationProperty": - destinationProperty = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + destinationProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "DestinationShortName": - destinationShortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + destinationShortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "FileId": if (null != fileId) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); } - fileId = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", fileId); + fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", fileId); break; case "SourceDirectory": - sourceDirectory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); break; case "SourceName": - sourceName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SourceProperty": - sourceProperty = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + sourceProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null != sourceFolder && null != sourceDirectory) // SourceFolder and SourceDirectory cannot coexist { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "SourceDirectory")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "SourceDirectory")); } if (null != sourceFolder && null != sourceProperty) // SourceFolder and SourceProperty cannot coexist { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "SourceProperty")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "SourceProperty")); } if (null != sourceDirectory && null != sourceProperty) // SourceDirectory and SourceProperty cannot coexist { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceProperty", "SourceDirectory")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceProperty", "SourceDirectory")); } if (null != destinationDirectory && null != destinationProperty) // DestinationDirectory and DestinationProperty cannot coexist { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationProperty", "DestinationDirectory")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationProperty", "DestinationDirectory")); } // generate a short file name - if (null == destinationShortName && (null != destinationName && !this.core.IsValidShortFilename(destinationName, false))) + if (null == destinationShortName && (null != destinationName && !this.Core.IsValidShortFilename(destinationName, false))) { - destinationShortName = this.core.CreateShortName(destinationName, true, false, node.Name.LocalName, componentId); + destinationShortName = this.Core.CreateShortName(destinationName, true, false, node.Name.LocalName, componentId); } if (null == id) { - id = this.core.CreateIdentifier("cf", sourceFolder, sourceDirectory, sourceProperty, destinationDirectory, destinationProperty, destinationName); + id = this.Core.CreateIdentifier("cf", sourceFolder, sourceDirectory, sourceProperty, destinationDirectory, destinationProperty, destinationName); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (null == fileId) { // DestinationDirectory or DestinationProperty must be specified if (null == destinationDirectory && null == destinationProperty) { - this.core.OnMessage(WixErrors.ExpectedAttributesWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationDirectory", "DestinationProperty", "FileId")); + this.Core.OnMessage(WixErrors.ExpectedAttributesWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DestinationDirectory", "DestinationProperty", "FileId")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MoveFile", id); - row[1] = componentId; - row[2] = sourceName; - row[3] = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MoveFile, id); + row.Set(1, componentId); + row.Set(2, sourceName); + row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName)); if (null != sourceDirectory) { - row[4] = sourceDirectory; + row.Set(4, sourceDirectory); } else if (null != sourceProperty) { - row[4] = sourceProperty; + row.Set(4, sourceProperty); } else { - row[4] = sourceFolder; + row.Set(4, sourceFolder); } if (null != destinationDirectory) { - row[5] = destinationDirectory; + row.Set(5, destinationDirectory); } else { - row[5] = destinationProperty; + row.Set(5, destinationProperty); } - row[6] = delete ? 1 : 0; + row.Set(6, delete ? 1 : 0); } } else // copy the file { if (null != sourceDirectory) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceDirectory", "FileId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceDirectory", "FileId")); } if (null != sourceFolder) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "FileId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFolder", "FileId")); } if (null != sourceName) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceName", "FileId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceName", "FileId")); } if (null != sourceProperty) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceProperty", "FileId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceProperty", "FileId")); } if (delete) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Delete", "FileId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Delete", "FileId")); } if (null == destinationName && null == destinationDirectory && null == destinationProperty) { - this.core.OnMessage(WixWarnings.CopyFileFileIdUseless(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.CopyFileFileIdUseless(sourceLineNumbers)); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "DuplicateFile", id); - row[1] = componentId; - row[2] = fileId; - row[3] = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DuplicateFile, id); + row.Set(1, componentId); + row.Set(2, fileId); + row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName)); if (null != destinationDirectory) { - row[4] = destinationDirectory; + row.Set(4, destinationDirectory); } else { - row[4] = destinationProperty; + row.Set(4, destinationProperty); } } } @@ -3149,39 +3082,39 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "BinaryKey": if (null != source) { - this.core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); + this.Core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); } - source = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData; - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary break; case "Directory": if (null != source) { - this.core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); + this.Core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); } - source = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + source = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); sourceBits = MsiInterop.MsidbCustomActionTypeDirectory; break; case "DllEntry": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); targetBits = MsiInterop.MsidbCustomActionTypeDll; break; case "Error": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); targetBits = MsiInterop.MsidbCustomActionTypeTextData | MsiInterop.MsidbCustomActionTypeSourceFile; bool errorReference = true; @@ -3204,19 +3137,19 @@ namespace WixToolset if (errorReference) { - this.core.CreateSimpleReference(sourceLineNumbers, "Error", target); + this.Core.CreateSimpleReference(sourceLineNumbers, "Error", target); } break; case "ExeCommand": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid targetBits = MsiInterop.MsidbCustomActionTypeExe; break; case "Execute": - string execute = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string execute = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < execute.Length) { Wix.CustomAction.ExecuteType executeType = Wix.CustomAction.ParseExecuteType(execute); @@ -3243,7 +3176,7 @@ namespace WixToolset bits |= MsiInterop.MsidbCustomActionTypeClientRepeat; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, execute, "commit", "deferred", "firstSequence", "immediate", "oncePerProcess", "rollback", "secondSequence")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, execute, "commit", "deferred", "firstSequence", "immediate", "oncePerProcess", "rollback", "secondSequence")); break; } } @@ -3251,20 +3184,20 @@ namespace WixToolset case "FileKey": if (null != source) { - this.core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); + this.Core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); } - source = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile; - this.core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File + this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File break; case "HideTarget": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbCustomActionTypeHideTarget; } break; case "Impersonate": - if (YesNoType.No == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbCustomActionTypeNoImpersonate; } @@ -3272,13 +3205,13 @@ namespace WixToolset case "JScriptCall": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid targetBits = MsiInterop.MsidbCustomActionTypeJScript; break; case "PatchUninstall": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { extendedBits |= MsiInterop.MsidbCustomActionTypePatchUninstall; } @@ -3286,13 +3219,13 @@ namespace WixToolset case "Property": if (null != source) { - this.core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); + this.Core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); } - source = this.core.GetAttributeValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); sourceBits = MsiInterop.MsidbCustomActionTypeProperty; break; case "Return": - string returnValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string returnValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < returnValue.Length) { Wix.CustomAction.ReturnType returnType = Wix.CustomAction.ParseReturnType(returnValue); @@ -3310,7 +3243,7 @@ namespace WixToolset bits |= MsiInterop.MsidbCustomActionTypeContinue; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, returnValue, "asyncNoWait", "asyncWait", "check", "ignore")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, returnValue, "asyncNoWait", "asyncWait", "check", "ignore")); break; } } @@ -3318,12 +3251,12 @@ namespace WixToolset case "Script": if (null != source) { - this.core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); + this.Core.OnMessage(WixErrors.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); } if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } // set the source and target to empty string for error messages when the user sets multiple sources or targets @@ -3332,7 +3265,7 @@ namespace WixToolset inlineScript = true; - string script = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string script = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < script.Length) { Wix.CustomAction.ScriptType scriptType = Wix.CustomAction.ParseScriptType(script); @@ -3347,16 +3280,16 @@ namespace WixToolset targetBits = MsiInterop.MsidbCustomActionTypeVBScript; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, script, "jscript", "vbscript")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, script, "jscript", "vbscript")); break; } } break; case "SuppressModularization": - suppressModularization = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "TerminalServerAware": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbCustomActionTypeTSAware; } @@ -3364,40 +3297,40 @@ namespace WixToolset case "Value": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid targetBits = MsiInterop.MsidbCustomActionTypeTextData; break; case "VBScriptCall": if (null != target) { - this.core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid targetBits = MsiInterop.MsidbCustomActionTypeVBScript; break; case "Win64": explicitWin64 = true; - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbCustomActionType64BitScript; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -3407,7 +3340,7 @@ namespace WixToolset } // get the inner text if any exists - innerText = this.core.GetTrimmedInnerText(node); + innerText = this.Core.GetTrimmedInnerText(node); // if we have an in-lined Script CustomAction ensure no source or target attributes were provided if (inlineScript) @@ -3418,48 +3351,48 @@ namespace WixToolset { if (null == source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "VBScriptCall", "BinaryKey", "FileKey", "Property")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "VBScriptCall", "BinaryKey", "FileKey", "Property")); } else if (MsiInterop.MsidbCustomActionTypeDirectory == sourceBits) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "VBScriptCall", "Directory")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "VBScriptCall", "Directory")); } } else if (MsiInterop.MsidbCustomActionTypeJScript == targetBits) // non-inline jscript { if (null == source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "JScriptCall", "BinaryKey", "FileKey", "Property")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "JScriptCall", "BinaryKey", "FileKey", "Property")); } else if (MsiInterop.MsidbCustomActionTypeDirectory == sourceBits) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "JScriptCall", "Directory")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "JScriptCall", "Directory")); } } else if (MsiInterop.MsidbCustomActionTypeExe == targetBits) // exe-command { if (null == source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ExeCommand", "BinaryKey", "Directory", "FileKey", "Property")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ExeCommand", "BinaryKey", "Directory", "FileKey", "Property")); } } else if (MsiInterop.MsidbCustomActionTypeTextData == (bits | sourceBits | targetBits)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Value", "Directory", "Property")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Value", "Directory", "Property")); } else if (!String.IsNullOrEmpty(innerText)) // inner text cannot be specified with non-script CAs { - this.core.OnMessage(WixErrors.CustomActionIllegalInnerText(sourceLineNumbers, node.Name.LocalName, innerText, "Script")); + this.Core.OnMessage(WixErrors.CustomActionIllegalInnerText(sourceLineNumbers, node.Name.LocalName, innerText, "Script")); } if (MsiInterop.MsidbCustomActionType64BitScript == (bits & MsiInterop.MsidbCustomActionType64BitScript) && MsiInterop.MsidbCustomActionTypeVBScript != targetBits && MsiInterop.MsidbCustomActionTypeJScript != targetBits) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Win64", "Script", "VBScriptCall", "JScriptCall")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Win64", "Script", "VBScriptCall", "JScriptCall")); } if ((MsiInterop.MsidbCustomActionTypeAsync | MsiInterop.MsidbCustomActionTypeContinue) == (bits & (MsiInterop.MsidbCustomActionTypeAsync | MsiInterop.MsidbCustomActionTypeContinue)) && MsiInterop.MsidbCustomActionTypeExe != targetBits) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Return", "asyncNoWait", "ExeCommand")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Return", "asyncNoWait", "ExeCommand")); } if (MsiInterop.MsidbCustomActionTypeTSAware == (bits & MsiInterop.MsidbCustomActionTypeTSAware)) @@ -3467,7 +3400,7 @@ namespace WixToolset // TS-aware CAs are valid only when deferred so require the in-script Type bit... if (0 == (bits & MsiInterop.MsidbCustomActionTypeInScript)) { - this.core.OnMessage(WixErrors.IllegalTerminalServerCustomActionAttributes(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.IllegalTerminalServerCustomActionAttributes(sourceLineNumbers)); } } @@ -3476,30 +3409,30 @@ namespace WixToolset MsiInterop.MsidbCustomActionTypeTextData == targetBits && 0 != (bits & MsiInterop.MsidbCustomActionTypeInScript)) { - this.core.OnMessage(WixErrors.IllegalPropertyCustomActionAttributes(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.IllegalPropertyCustomActionAttributes(sourceLineNumbers)); } if (0 == targetBits) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "CustomAction", id); - row[1] = bits | sourceBits | targetBits; - row[2] = source; - row[3] = target; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CustomAction, id); + row.Set(1, bits | sourceBits | targetBits); + row.Set(2, source); + row.Set(3, target); if (0 != extendedBits) { - row[4] = extendedBits; + row.Set(4, extendedBits); } if (YesNoType.Yes == suppressModularization) { - this.core.CreateRow(sourceLineNumbers, "WixSuppressModularization", id); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixSuppressModularization, id); } // For deferred CAs that specify HideTarget we should also hide the CA data property for the action. @@ -3529,26 +3462,26 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, table, id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, table, id); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return id; } @@ -3572,34 +3505,34 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - primaryKeys[0] = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + primaryKeys[0] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ProductCode": - primaryKeys[1] = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + primaryKeys[1] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == primaryKeys[0]) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.CreateSimpleReference(sourceLineNumbers, "MsiPatchSequence", primaryKeys); + this.Core.CreateSimpleReference(sourceLineNumbers, "MsiPatchSequence", primaryKeys); - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamily, primaryKeys[0], true); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamily, primaryKeys[0], true); } } @@ -3620,22 +3553,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -3655,22 +3588,22 @@ namespace WixToolset this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixPatchFamilyGroup", id); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchFamilyGroup, id); //Add this PatchFamilyGroup and its parent in WixGroup. - this.core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PatchFamilyGroup, id.Id); + this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PatchFamilyGroup, id.Id); } } @@ -3694,30 +3627,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamilyGroup, id, true); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamilyGroup, id, true); } } @@ -3737,31 +3670,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (31 < id.Length) { - this.core.OnMessage(WixErrors.TableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id)); + this.Core.OnMessage(WixErrors.TableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id)); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - this.core.EnsureTable(sourceLineNumbers, id); + this.Core.EnsureTable(sourceLineNumbers, id); } /// @@ -3769,9 +3702,6 @@ namespace WixToolset /// /// Element to parse. /// not cleaned - [SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Changing the way this string normalizes would result " + - "in a change to the way the WixCustomTable table is generated. Furthermore, there is no security hole here, as the strings won't need to " + - "make a round trip")] private void ParseCustomTableElement(XElement node) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); @@ -3798,29 +3728,29 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - tableId = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + tableId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "BootstrapperApplicationData": - bootstrapperApplicationData = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + bootstrapperApplicationData = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == tableId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (31 < tableId.Length) { - this.core.OnMessage(WixErrors.CustomTableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", tableId)); + this.Core.OnMessage(WixErrors.CustomTableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", tableId)); } foreach (XElement child in node.Elements()) @@ -3854,43 +3784,43 @@ namespace WixToolset switch (childAttrib.Name.LocalName) { case "Id": - columnName = this.core.GetAttributeIdentifierValue(childSourceLineNumbers, childAttrib); + columnName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, childAttrib); break; case "Category": - category = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + category = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; case "Description": - description = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + description = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; case "KeyColumn": - keyColumn = this.core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 1, 32); + keyColumn = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 1, 32); break; case "KeyTable": - keyTable = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + keyTable = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; case "Localizable": - localizable = YesNoType.Yes == this.core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); + localizable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); break; case "MaxValue": - maxValue = this.core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue); + maxValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue); break; case "MinValue": - minValue = this.core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue); + minValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue); break; case "Modularize": - modularization = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + modularization = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; case "Nullable": - nullable = YesNoType.Yes == this.core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); + nullable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); break; case "PrimaryKey": - primaryKey = YesNoType.Yes == this.core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); + primaryKey = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib); break; case "Set": - setValues = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + setValues = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; case "Type": - string typeValue = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + string typeValue = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); if (0 < typeValue.Length) { Wix.Column.TypeType typeType = Wix.Column.ParseTypeType(typeValue); @@ -3906,34 +3836,34 @@ namespace WixToolset typeName = "CHAR"; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(childSourceLineNumbers, child.Name.LocalName, "Type", typeValue, "binary", "int", "string")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(childSourceLineNumbers, child.Name.LocalName, "Type", typeValue, "binary", "int", "string")); break; } } break; case "Width": - width = this.core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 0, int.MaxValue); + width = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 0, int.MaxValue); break; default: - this.core.UnexpectedAttribute(child, childAttrib); + this.Core.UnexpectedAttribute(child, childAttrib); break; } } if (null == columnName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Id")); } if (null == typeName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Type")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Type")); } else if ("SHORT" == typeName) { if (2 != width && 4 != width) { - this.core.OnMessage(WixErrors.CustomTableIllegalColumnWidth(childSourceLineNumbers, child.Name.LocalName, "Width", width)); + this.Core.OnMessage(WixErrors.CustomTableIllegalColumnWidth(childSourceLineNumbers, child.Name.LocalName, "Width", width)); } columnType = String.Concat(nullable ? "I" : "i", width); } @@ -3946,12 +3876,12 @@ namespace WixToolset { if ("Binary" != category) { - this.core.OnMessage(WixErrors.ExpectedBinaryCategory(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.ExpectedBinaryCategory(childSourceLineNumbers)); } columnType = String.Concat(nullable ? "V" : "v", width); } - this.core.ParseForExtensionElements(child); + this.Core.ParseForExtensionElements(child); columnNames = String.Concat(columnNames, null == columnNames ? String.Empty : "\t", columnName); columnTypes = String.Concat(columnTypes, null == columnTypes ? String.Empty : "\t", columnType); @@ -3975,7 +3905,7 @@ namespace WixToolset foreach (XAttribute childAttrib in child.Attributes()) { - this.core.ParseExtensionAttribute(child, childAttrib); + this.Core.ParseExtensionAttribute(child, childAttrib); } foreach (XElement data in child.Elements()) @@ -3990,17 +3920,17 @@ namespace WixToolset switch (dataAttrib.Name.LocalName) { case "Column": - columnName = this.core.GetAttributeValue(dataSourceLineNumbers, dataAttrib); + columnName = this.Core.GetAttributeValue(dataSourceLineNumbers, dataAttrib); break; default: - this.core.UnexpectedAttribute(data, dataAttrib); + this.Core.UnexpectedAttribute(data, dataAttrib); break; } } if (null == columnName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(dataSourceLineNumbers, data.Name.LocalName, "Column")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(dataSourceLineNumbers, data.Name.LocalName, "Column")); } dataValue = String.Concat(dataValue, null == dataValue ? String.Empty : Common.CustomRowFieldSeparator.ToString(), columnName, ":", Common.GetInnerText(data)); @@ -4008,23 +3938,23 @@ namespace WixToolset } } - this.core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row rowRow = this.core.CreateRow(childSourceLineNumbers, "WixCustomRow"); - rowRow[0] = tableId; - rowRow[1] = dataValue; + var rowRow = this.Core.CreateRow(childSourceLineNumbers, TupleDefinitionType.WixCustomRow); + rowRow.Set(0, tableId); + rowRow.Set(1, dataValue); } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -4032,26 +3962,26 @@ namespace WixToolset { if (null == primaryKeys || 0 == primaryKeys.Length) { - this.core.OnMessage(WixErrors.CustomTableMissingPrimaryKey(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.CustomTableMissingPrimaryKey(sourceLineNumbers)); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixCustomTable"); - row[0] = tableId; - row[1] = columnCount; - row[2] = columnNames; - row[3] = columnTypes; - row[4] = primaryKeys; - row[5] = minValues; - row[6] = maxValues; - row[7] = keyTables; - row[8] = keyColumns; - row[9] = categories; - row[10] = sets; - row[11] = descriptions; - row[12] = modularizations; - row[13] = bootstrapperApplicationData ? 1 : 0; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixCustomTable); + row.Set(0, tableId); + row.Set(1, columnCount); + row.Set(2, columnNames); + row.Set(3, columnTypes); + row.Set(4, primaryKeys); + row.Set(5, minValues); + row.Set(6, maxValues); + row.Set(7, keyTables); + row.Set(8, keyColumns); + row.Set(9, categories); + row.Set(10, sets); + row.Set(11, descriptions); + row.Set(12, modularizations); + row.Set(13, bootstrapperApplicationData ? 1 : 0); } } } @@ -4086,16 +4016,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "ComponentGuidGenerationSeed": - componentGuidGenerationSeed = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + componentGuidGenerationSeed = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "FileSource": - fileSource = this.core.GetAttributeValue(sourceLineNumbers, attrib); + fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib); fileSourceAttribSet = true; break; case "Name": @@ -4106,14 +4036,14 @@ namespace WixToolset } else { - inlineSyntax = this.core.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attrib); + inlineSyntax = this.Core.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attrib); } break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "ShortSourceName": - shortSourceName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortSourceName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "SourceName": if ("." == attrib.Value) @@ -4122,17 +4052,17 @@ namespace WixToolset } else { - sourceName = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + sourceName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -4151,14 +4081,14 @@ namespace WixToolset if (inlineSyntax[0].EndsWith(":")) { parentId = inlineSyntax[0].TrimEnd(':'); - this.core.CreateSimpleReference(sourceLineNumbers, "Directory", parentId); + this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", parentId); pathStartsAt = 1; } for (int i = pathStartsAt; i < inlineSyntax.Length - 1; ++i) { - Identifier inlineId = this.core.CreateDirectoryRow(sourceLineNumbers, null, parentId, inlineSyntax[i]); + Identifier inlineId = this.Core.CreateDirectoryRow(sourceLineNumbers, null, parentId, inlineSyntax[i]); parentId = inlineId.Id; } @@ -4170,30 +4100,30 @@ namespace WixToolset { if (!String.IsNullOrEmpty(shortName)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name")); } if (null == parentId) { - this.core.OnMessage(WixErrors.DirectoryRootWithoutName(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.DirectoryRootWithoutName(sourceLineNumbers, node.Name.LocalName, "Name")); } } else if (!String.IsNullOrEmpty(name)) { if (String.IsNullOrEmpty(shortName)) { - if (!name.Equals(".") && !name.Equals("SourceDir") && !this.core.IsValidShortFilename(name, false)) + if (!name.Equals(".") && !name.Equals("SourceDir") && !this.Core.IsValidShortFilename(name, false)) { - shortName = this.core.CreateShortName(name, false, false, "Directory", parentId); + shortName = this.Core.CreateShortName(name, false, false, "Directory", parentId); } } else if (name.Equals(".")) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name", name)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name", name)); } else if (name.Equals(shortName)) { - this.core.OnMessage(WixWarnings.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "Name", "ShortName", name)); + this.Core.OnMessage(WixWarnings.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "Name", "ShortName", name)); } } @@ -4201,25 +4131,25 @@ namespace WixToolset { if (!String.IsNullOrEmpty(shortSourceName)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName")); } } else { if (String.IsNullOrEmpty(shortSourceName)) { - if (!sourceName.Equals(".") && !this.core.IsValidShortFilename(sourceName, false)) + if (!sourceName.Equals(".") && !this.Core.IsValidShortFilename(sourceName, false)) { - shortSourceName = this.core.CreateShortName(sourceName, false, false, "Directory", parentId); + shortSourceName = this.Core.CreateShortName(sourceName, false, false, "Directory", parentId); } } else if (sourceName.Equals(".")) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName", sourceName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "ShortSourceName", "SourceName", sourceName)); } else if (sourceName.Equals(shortSourceName)) { - this.core.OnMessage(WixWarnings.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "SourceName", "ShortSourceName", sourceName)); + this.Core.OnMessage(WixWarnings.DirectoryRedundantNames(sourceLineNumbers, node.Name.LocalName, "SourceName", "ShortSourceName", sourceName)); } } @@ -4252,7 +4182,7 @@ namespace WixToolset if (null == id) { - id = this.core.CreateIdentifier("dir", parentId, name, shortName, sourceName, shortSourceName); + id = this.Core.CreateIdentifier("dir", parentId, name, shortName, sourceName, shortSourceName); } // Calculate the DefaultDir for the directory row. @@ -4264,7 +4194,7 @@ namespace WixToolset if ("TARGETDIR".Equals(id.Id) && !"SourceDir".Equals(defaultDir)) { - this.core.OnMessage(WixErrors.IllegalTargetDirDefaultDir(sourceLineNumbers, defaultDir)); + this.Core.OnMessage(WixErrors.IllegalTargetDirDefaultDir(sourceLineNumbers, defaultDir)); } foreach (XElement child in node.Elements()) @@ -4293,32 +4223,32 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Directory", id); - row[1] = parentId; - row[2] = defaultDir; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Directory, id); + row.Set(1, parentId); + row.Set(2, defaultDir); if (null != componentGuidGenerationSeed) { - Row wixRow = this.core.CreateRow(sourceLineNumbers, "WixDirectory"); - wixRow[0] = id.Id; - wixRow[1] = componentGuidGenerationSeed; + var wixRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDirectory); + wixRow.Set(0, id.Id); + wixRow.Set(1, componentGuidGenerationSeed); } if (null != symbols) { - WixDeltaPatchSymbolPathsRow symbolRow = (WixDeltaPatchSymbolPathsRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchSymbolPaths", id); + var symbolRow = (WixDeltaPatchSymbolPathsTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchSymbolPaths, id); symbolRow.Type = SymbolPathType.Directory; symbolRow.SymbolPaths = symbols; } @@ -4344,29 +4274,29 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Directory", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); break; case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "FileSource": - fileSource = this.core.GetAttributeValue(sourceLineNumbers, attrib); + fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (!String.IsNullOrEmpty(fileSource) && !fileSource.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) @@ -4390,13 +4320,13 @@ namespace WixToolset this.ParseMergeElement(child, id, diskId); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } @@ -4423,31 +4353,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Depth": - depth = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + depth = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Path": - path = this.core.GetAttributeValue(sourceLineNumbers, attrib); + path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "AssignToProperty": - assignToProperty = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + assignToProperty = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifier("dir", path, depth.ToString()); + id = this.Core.CreateIdentifier("dir", path, depth.ToString()); } signature = id.Id; @@ -4464,7 +4394,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchElement(child, id.Id); @@ -4472,7 +4402,7 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, id.Id); @@ -4480,7 +4410,7 @@ namespace WixToolset case "FileSearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; hasFileSearch = true; @@ -4489,13 +4419,13 @@ namespace WixToolset case "FileSearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseSimpleRefElement(child, "Signature"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } @@ -4505,7 +4435,7 @@ namespace WixToolset { if (!hasFileSearch) { - this.core.OnMessage(WixErrors.IllegalParentAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "AssignToProperty", child.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalParentAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "AssignToProperty", child.Name.LocalName)); } else if (!oneChild) { @@ -4516,11 +4446,11 @@ namespace WixToolset } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { Identifier rowId = id; @@ -4535,12 +4465,12 @@ namespace WixToolset signature = id.Id; } - Row row = this.core.CreateRow(sourceLineNumbers, "DrLocator", rowId); - row[1] = parentSignature; - row[2] = path; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DrLocator, rowId); + row.Set(1, parentSignature); + row.Set(2, path); if (CompilerConstants.IntegerNotSet != depth) { - row[3] = depth; + row.Set(3, depth); } } @@ -4568,22 +4498,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Parent": - parent = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + parent = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Path": - path = this.core.GetAttributeValue(sourceLineNumbers, attrib); + path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -4591,7 +4521,7 @@ namespace WixToolset { if (!String.IsNullOrEmpty(parentSignature)) { - this.core.OnMessage(WixErrors.CanNotHaveTwoParents(sourceLineNumbers, id.Id, parent.Id, parentSignature)); + this.Core.OnMessage(WixErrors.CanNotHaveTwoParents(sourceLineNumbers, id.Id, parent.Id, parentSignature)); } else { @@ -4601,7 +4531,7 @@ namespace WixToolset if (null == id) { - id = this.core.CreateIdentifier("dsr", parentSignature, path); + id = this.Core.CreateIdentifier("dsr", parentSignature, path); } signature = id.Id; @@ -4617,7 +4547,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchElement(child, id.Id); @@ -4625,7 +4555,7 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, id.Id); @@ -4633,7 +4563,7 @@ namespace WixToolset case "FileSearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); @@ -4641,24 +4571,24 @@ namespace WixToolset case "FileSearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseSimpleRefElement(child, "Signature"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - this.core.CreateSimpleReference(sourceLineNumbers, "DrLocator", id.Id, parentSignature, path); + this.Core.CreateSimpleReference(sourceLineNumbers, "DrLocator", id.Id, parentSignature, path); return signature; } @@ -4694,10 +4624,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Absent": - string absent = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string absent = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < absent.Length) { Wix.Feature.AbsentType absentType = Wix.Feature.ParseAbsentType(absent); @@ -4709,13 +4639,13 @@ namespace WixToolset bits = bits | MsiInterop.MsidbFeatureAttributesUIDisallowAbsent; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, absent, "allow", "disallow")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, absent, "allow", "disallow")); break; } } break; case "AllowAdvertise": - allowAdvertise = this.core.GetAttributeValue(sourceLineNumbers, attrib); + allowAdvertise = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < allowAdvertise.Length) { Wix.Feature.AllowAdvertiseType allowAdvertiseType = Wix.Feature.ParseAllowAdvertiseType(allowAdvertise); @@ -4730,22 +4660,22 @@ namespace WixToolset case Wix.Feature.AllowAdvertiseType.yes: // this is the default break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, allowAdvertise, "no", "system", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, allowAdvertise, "no", "system", "yes")); break; } } break; case "ConfigurableDirectory": - configurableDirectory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + configurableDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Display": - display = this.core.GetAttributeValue(sourceLineNumbers, attrib); + display = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "InstallDefault": - installDefault = this.core.GetAttributeValue(sourceLineNumbers, attrib); + installDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < installDefault.Length) { Wix.Feature.InstallDefaultType installDefaultType = Wix.Feature.ParseInstallDefaultType(installDefault); @@ -4754,7 +4684,7 @@ namespace WixToolset case Wix.Feature.InstallDefaultType.followParent: if (ComplexReferenceParentType.Product == parentType) { - this.core.OnMessage(WixErrors.RootFeatureCannotFollowParent(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.RootFeatureCannotFollowParent(sourceLineNumbers)); } bits = bits | MsiInterop.MsidbFeatureAttributesFollowParent; break; @@ -4764,23 +4694,23 @@ namespace WixToolset bits = bits | MsiInterop.MsidbFeatureAttributesFavorSource; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installDefault, "followParent", "local", "source")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installDefault, "followParent", "local", "source")); break; } } break; case "Level": - level = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Title": - title = this.core.GetAttributeValue(sourceLineNumbers, attrib); + title = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if ("PUT-FEATURE-TITLE-HERE" == title) { - this.core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, title)); + this.Core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, title)); } break; case "TypicalDefault": - typicalDefault = this.core.GetAttributeValue(sourceLineNumbers, attrib); + typicalDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < typicalDefault.Length) { Wix.Feature.TypicalDefaultType typicalDefaultType = Wix.Feature.ParseTypicalDefaultType(typicalDefault); @@ -4792,45 +4722,45 @@ namespace WixToolset case Wix.Feature.TypicalDefaultType.install: // this is the default break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typicalDefault, "advertise", "install")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typicalDefault, "advertise", "install")); break; } } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (38 < id.Id.Length) { - this.core.OnMessage(WixErrors.FeatureNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.FeatureNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } if (null != configurableDirectory && configurableDirectory.ToUpper(CultureInfo.InvariantCulture) != configurableDirectory) { - this.core.OnMessage(WixErrors.FeatureConfigurableDirectoryNotUppercase(sourceLineNumbers, node.Name.LocalName, "ConfigurableDirectory", configurableDirectory)); + this.Core.OnMessage(WixErrors.FeatureConfigurableDirectoryNotUppercase(sourceLineNumbers, node.Name.LocalName, "ConfigurableDirectory", configurableDirectory)); } if ("advertise" == typicalDefault && "no" == allowAdvertise) { - this.core.OnMessage(WixErrors.FeatureCannotFavorAndDisallowAdvertise(sourceLineNumbers, node.Name.LocalName, "TypicalDefault", typicalDefault, "AllowAdvertise", allowAdvertise)); + this.Core.OnMessage(WixErrors.FeatureCannotFavorAndDisallowAdvertise(sourceLineNumbers, node.Name.LocalName, "TypicalDefault", typicalDefault, "AllowAdvertise", allowAdvertise)); } if (YesNoType.Yes == followParent && ("local" == installDefault || "source" == installDefault)) { - this.core.OnMessage(WixErrors.FeatureCannotFollowParentAndFavorLocalOrSource(sourceLineNumbers, node.Name.LocalName, "InstallDefault", "FollowParent", "yes")); + this.Core.OnMessage(WixErrors.FeatureCannotFollowParentAndFavorLocalOrSource(sourceLineNumbers, node.Name.LocalName, "InstallDefault", "FollowParent", "yes")); } int childDisplay = 0; @@ -4865,46 +4795,46 @@ namespace WixToolset this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id.Id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Feature", id); - row[1] = null; // this column is set in the linker - row[2] = title; - row[3] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Feature, id); + row.Set(1, null); // this column is set in the linker + row.Set(2, title); + row.Set(3, description); if (0 < display.Length) { switch (display) { case "collapse": lastDisplay = (lastDisplay | 1) + 1; - row[4] = lastDisplay; + row.Set(4, lastDisplay); break; case "expand": lastDisplay = (lastDisplay + 1) | 1; - row[4] = lastDisplay; + row.Set(4, lastDisplay); break; case "hidden": - row[4] = 0; + row.Set(4, 0); break; default: int value; if (!Int32.TryParse(display, NumberStyles.Integer, CultureInfo.InvariantCulture, out value)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Display", display, "collapse", "expand", "hidden")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Display", display, "collapse", "expand", "hidden")); } else { - row[4] = value; + row.Set(4, value); // save the display value of this row (if its not hidden) for subsequent rows if (0 != (int)row[4]) { @@ -4914,13 +4844,13 @@ namespace WixToolset break; } } - row[5] = level; - row[6] = configurableDirectory; - row[7] = bits; + row.Set(5, level); + row.Set(6, configurableDirectory); + row.Set(7, bits); if (ComplexReferenceParentType.Unknown != parentType) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Feature, id.Id, false); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Feature, id.Id, false); } } } @@ -4945,27 +4875,27 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Feature", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", id); break; case "IgnoreParent": - ignoreParent = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } int lastDisplay = 0; @@ -5000,21 +4930,21 @@ namespace WixToolset this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (ComplexReferenceParentType.Unknown != parentType && YesNoType.Yes != ignoreParent) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Feature, id, false); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Feature, id, false); } } } @@ -5036,22 +4966,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -5084,22 +5014,22 @@ namespace WixToolset this.ParseMergeRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixFeatureGroup", id); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixFeatureGroup, id); //Add this FeatureGroup and its parent in WixGroup. - this.core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.FeatureGroup, id.Id); + this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.FeatureGroup, id.Id); } } @@ -5125,38 +5055,38 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id); + id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id); break; case "IgnoreParent": - ignoreParent = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Primary": - primary = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (YesNoType.Yes != ignoreParent) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.FeatureGroup, id, (YesNoType.Yes == primary)); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.FeatureGroup, id, (YesNoType.Yes == primary)); } } } @@ -5187,10 +5117,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Action": - string value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < value.Length) { Wix.Environment.ActionType actionType = Wix.Environment.ParseActionType(value); @@ -5206,59 +5136,59 @@ namespace WixToolset action = "!"; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "create", "set", "remove")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "create", "set", "remove")); break; } } break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Part": - part = this.core.GetAttributeValue(sourceLineNumbers, attrib); + part = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (!Wix.Environment.TryParsePartType(part, out partType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Part", part, "all", "first", "last")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Part", part, "all", "first", "last")); } break; case "Permanent": - permanent = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + permanent = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Separator": - separator = this.core.GetAttributeValue(sourceLineNumbers, attrib); + separator = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "System": - system = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + system = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Value": - text = this.core.GetAttributeValue(sourceLineNumbers, attrib); + text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifier("env", action, name, part, system.ToString()); + id = this.Core.CreateIdentifier("env", action, name, part, system.ToString()); } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (Wix.Environment.PartType.NotSet != partType) { if ("+" == action) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Part", "Action", "create")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Part", "Action", "create")); } switch (partType) @@ -5279,14 +5209,14 @@ namespace WixToolset uninstall = null; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Environment", id); - row[1] = String.Concat(action, uninstall, system ? "*" : String.Empty, name); - row[2] = text; - row[3] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Environment, id); + row.Set(1, String.Concat(action, uninstall, system ? "*" : String.Empty, name)); + row.Set(2, text); + row.Set(3, componentId); } } @@ -5306,32 +5236,32 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (CompilerConstants.IntegerNotSet == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = CompilerConstants.IllegalInteger; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Error"); - row[0] = id; - row[1] = Common.GetInnerText(node); // TODO: * + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Error); + row.Set(0, id); + row.Set(1, Common.GetInnerText(node)); // TODO: * } } @@ -5355,28 +5285,28 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - extension = this.core.GetAttributeValue(sourceLineNumbers, attrib); + extension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Advertise": - YesNoType extensionAdvertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType extensionAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if ((YesNoType.No == advertise && YesNoType.Yes == extensionAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == extensionAdvertise)) { - this.core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, extensionAdvertise.ToString(), advertise.ToString())); + this.Core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, extensionAdvertise.ToString(), advertise.ToString())); } advertise = extensionAdvertise; break; case "ContentType": - mime = this.core.GetAttributeValue(sourceLineNumbers, attrib); + mime = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { Dictionary context = new Dictionary() { { "ProgId", progId }, { "ComponentId", componentId } }; - this.core.ParseExtensionAttribute(node, attrib, context); + this.Core.ParseExtensionAttribute(node, attrib, context); } } @@ -5402,37 +5332,37 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (YesNoType.Yes == advertise) { - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Extension"); - row[0] = extension; - row[1] = componentId; - row[2] = progId; - row[3] = mime; - row[4] = Guid.Empty.ToString("B"); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Extension); + row.Set(0, extension); + row.Set(1, componentId); + row.Set(2, progId); + row.Set(3, mime); + row.Set(4, Guid.Empty.ToString("B")); - this.core.EnsureTable(sourceLineNumbers, "Verb"); + this.Core.EnsureTable(sourceLineNumbers, "Verb"); } } else if (YesNoType.No == advertise) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(".", extension), String.Empty, progId, componentId); // Extension + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(".", extension), String.Empty, progId, componentId); // Extension if (null != mime) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(".", extension), "Content Type", mime, componentId); // Extension's MIME ContentType + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(".", extension), "Content Type", mime, componentId); // Extension's MIME ContentType } } } @@ -5458,7 +5388,15 @@ namespace WixToolset string assemblyApplication = null; string assemblyManifest = null; string bindPath = null; - int bits = MsiInterop.MsidbFileAttributesVital; // assume all files are vital. + + //int bits = MsiInterop.MsidbFileAttributesVital; + bool readOnly = false; + bool checksum = false; + bool? compressed = null; + bool hidden = false; + bool system = false; + bool vital = true; // assume all files are vital. + string companionFile = null; string defaultLanguage = null; int defaultSize = 0; @@ -5491,10 +5429,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Assembly": - string assemblyValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string assemblyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < assemblyValue.Length) { Wix.File.AssemblyType parsedAssemblyType = Wix.File.ParseAssemblyType(assemblyValue); @@ -5510,84 +5448,88 @@ namespace WixToolset assemblyType = FileAssemblyType.Win32Assembly; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net")); break; } } break; case "AssemblyApplication": - assemblyApplication = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication); + assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication); break; case "AssemblyManifest": - assemblyManifest = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest); + assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest); break; case "BindPath": - bindPath = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "Checksum": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - bits |= MsiInterop.MsidbFileAttributesChecksum; + checksum = true; + //bits |= MsiInterop.MsidbFileAttributesChecksum; } break; case "CompanionFile": - companionFile = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", companionFile); + companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", companionFile); break; case "Compressed": - YesNoDefaultType compressed = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); - if (YesNoDefaultType.Yes == compressed) + YesNoDefaultType compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + if (YesNoDefaultType.Yes == compressedValue) { - bits |= MsiInterop.MsidbFileAttributesCompressed; + compressed = true; + //bits |= MsiInterop.MsidbFileAttributesCompressed; } - else if (YesNoDefaultType.No == compressed) + else if (YesNoDefaultType.No == compressedValue) { - bits |= MsiInterop.MsidbFileAttributesNoncompressed; + compressed = false; + //bits |= MsiInterop.MsidbFileAttributesNoncompressed; } break; case "DefaultLanguage": - defaultLanguage = this.core.GetAttributeValue(sourceLineNumbers, attrib); + defaultLanguage = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DefaultSize": - defaultSize = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + defaultSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "DefaultVersion": - defaultVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + defaultVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "FontTitle": - fontTitle = this.core.GetAttributeValue(sourceLineNumbers, attrib); + fontTitle = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Hidden": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - bits |= MsiInterop.MsidbFileAttributesHidden; + hidden = true; + //bits |= MsiInterop.MsidbFileAttributesHidden; } break; case "KeyPath": - keyPath = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "PatchGroup": - patchGroup = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); + patchGroup = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); break; case "PatchIgnore": - patchIgnore = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + patchIgnore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "PatchWholeFile": - patchIncludeWholeFile = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + patchIncludeWholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "PatchAllowIgnoreOnError": - patchAllowIgnoreOnError = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + patchAllowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ProcessorArchitecture": - string procArchValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string procArchValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < procArchValue.Length) { Wix.File.ProcessorArchitectureType procArchType = Wix.File.ParseProcessorArchitectureType(procArchValue); @@ -5606,58 +5548,62 @@ namespace WixToolset procArch = "ia64"; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "File", "ProcessorArchitecture", procArchValue, "msil", "x86", "x64", "ia64")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "File", "ProcessorArchitecture", procArchValue, "msil", "x86", "x64", "ia64")); break; } } break; case "ReadOnly": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - bits |= MsiInterop.MsidbFileAttributesReadOnly; + readOnly = true; + //bits |= MsiInterop.MsidbFileAttributesReadOnly; } break; case "SelfRegCost": - selfRegCost = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + selfRegCost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "Source": - source = this.core.GetAttributeValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); sourceSet = true; break; case "System": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - bits |= MsiInterop.MsidbFileAttributesSystem; + system = true; + //bits |= MsiInterop.MsidbFileAttributesSystem; } break; case "TrueType": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { fontTitle = String.Empty; } break; case "Vital": - YesNoType isVital = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType isVital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == isVital) { - bits |= MsiInterop.MsidbFileAttributesVital; + vital = true; + //bits |= MsiInterop.MsidbFileAttributesVital; } else if (YesNoType.No == isVital) { - bits &= ~MsiInterop.MsidbFileAttributesVital; + vital = false; + //bits &= ~MsiInterop.MsidbFileAttributesVital; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -5666,29 +5612,29 @@ namespace WixToolset // the companion file cannot be the key path of a component if (YesNoType.Yes == keyPath) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "CompanionFile", "KeyPath", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "CompanionFile", "KeyPath", "yes")); } } if (sourceSet && !source.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) && null == name) { name = Path.GetFileName(source); - if (!this.core.IsValidLongFilename(name, false)) + if (!this.Core.IsValidLongFilename(name, false)) { - this.core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); + this.Core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); } } // generate a short file name - if (null == shortName && (null != name && !this.core.IsValidShortFilename(name, false))) + if (null == shortName && (null != name && !this.Core.IsValidShortFilename(name, false))) { - shortName = this.core.CreateShortName(name, true, false, node.Name.LocalName, directoryId); + shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, directoryId); generatedShortFileName = true; } if (null == id) { - id = this.core.CreateIdentifier("fil", directoryId, name ?? shortName); + id = this.Core.CreateIdentifier("fil", directoryId, name ?? shortName); } if (!this.compilingModule && CompilerConstants.IntegerNotSet == diskId) @@ -5698,32 +5644,32 @@ namespace WixToolset if (null != defaultVersion && null != companionFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DefaultVersion", "CompanionFile", companionFile)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DefaultVersion", "CompanionFile", companionFile)); } if (FileAssemblyType.NotAnAssembly == assemblyType) { if (null != assemblyManifest) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", "AssemblyManifest")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", "AssemblyManifest")); } if (null != assemblyApplication) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", "AssemblyApplication")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", "AssemblyApplication")); } } else { if (FileAssemblyType.Win32Assembly == assemblyType && null == assemblyManifest) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AssemblyManifest", "Assembly", "win32")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AssemblyManifest", "Assembly", "win32")); } // allow "*" guid components to omit explicit KeyPath as they can have only one file and therefore this file is the keypath if (YesNoType.Yes != keyPath && "*" != componentGuid) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", (FileAssemblyType.DotNetAssembly == assemblyType ? ".net" : "win32"), "KeyPath", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", (FileAssemblyType.DotNetAssembly == assemblyType ? ".net" : "win32"), "KeyPath", "yes")); } } @@ -5749,10 +5695,10 @@ namespace WixToolset this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths); break; case "ODBCDriver": - this.ParseODBCDriverOrTranslator(child, componentId, id.Id, this.tableDefinitions["ODBCDriver"]); + this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCDriver); break; case "ODBCTranslator": - this.ParseODBCDriverOrTranslator(child, componentId, id.Id, this.tableDefinitions["ODBCTranslator"]); + this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCTranslator); break; case "Permission": this.ParsePermissionElement(child, id.Id, "File"); @@ -5780,19 +5726,19 @@ namespace WixToolset this.ParseTypeLibElement(child, componentId, id.Id, win64Component); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "FileId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { PatchAttributeType patchAttributes = PatchAttributeType.None; if (patchIgnore) @@ -5831,28 +5777,34 @@ namespace WixToolset } } - FileRow fileRow = (FileRow)this.core.CreateRow(sourceLineNumbers, "File", id); - fileRow[1] = componentId; - fileRow[2] = GetMsiFilenameValue(shortName, name); - fileRow[3] = defaultSize; + var fileRow = (FileTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.File, id); + fileRow.Component_ = componentId; + //fileRow.FileName = GetMsiFilenameValue(shortName, name); + fileRow.ShortFileName = shortName; + fileRow.LongFileName = name; + fileRow.FileSize = defaultSize; if (null != companionFile) { - fileRow[4] = companionFile; + fileRow.Version = companionFile; } else if (null != defaultVersion) { - fileRow[4] = defaultVersion; + fileRow.Version = defaultVersion; } - fileRow[5] = defaultLanguage; - fileRow[6] = bits; - + fileRow.Language = defaultLanguage; + fileRow.ReadOnly = readOnly; + fileRow.Checksum = checksum; + fileRow.Compressed = compressed; + fileRow.Hidden = hidden; + fileRow.System = system; + fileRow.Vital = vital; // the Sequence row is set in the binder - WixFileRow wixFileRow = (WixFileRow)this.core.CreateRow(sourceLineNumbers, "WixFile", id); + var wixFileRow = (WixFileTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixFile, id); wixFileRow.AssemblyType = assemblyType; - wixFileRow.AssemblyManifest = assemblyManifest; - wixFileRow.AssemblyApplication = assemblyApplication; - wixFileRow.Directory = directoryId; + wixFileRow.File_AssemblyManifest = assemblyManifest; + wixFileRow.File_AssemblyApplication = assemblyApplication; + wixFileRow.Directory_ = directoryId; wixFileRow.DiskId = (CompilerConstants.IntegerNotSet == diskId) ? 0 : diskId; wixFileRow.Source = source; wixFileRow.ProcessorArchitecture = procArch; @@ -5862,7 +5814,7 @@ namespace WixToolset // Always create a delta patch row for this file since other elements (like Component and Media) may // want to add symbol paths to it. - WixDeltaPatchFileRow deltaPatchFileRow = (WixDeltaPatchFileRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchFile", id); + var deltaPatchFileRow = (WixDeltaPatchFileTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchFile, id); deltaPatchFileRow.RetainLengths = protectLengths; deltaPatchFileRow.IgnoreOffsets = ignoreOffsets; deltaPatchFileRow.IgnoreLengths = ignoreLengths; @@ -5870,46 +5822,46 @@ namespace WixToolset if (null != symbols) { - WixDeltaPatchSymbolPathsRow symbolRow = (WixDeltaPatchSymbolPathsRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchSymbolPaths", id); + var symbolRow = (WixDeltaPatchSymbolPathsTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchSymbolPaths, id); symbolRow.Type = SymbolPathType.File; symbolRow.SymbolPaths = symbols; } if (FileAssemblyType.NotAnAssembly != assemblyType) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiAssembly"); - row[0] = componentId; - row[1] = Guid.Empty.ToString("B"); - row[2] = assemblyManifest; - row[3] = assemblyApplication; - row[4] = (FileAssemblyType.DotNetAssembly == assemblyType) ? 0 : 1; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiAssembly); + row.Set(0, componentId); + row.Set(1, Guid.Empty.ToString("B")); + row.Set(2, assemblyManifest); + row.Set(3, assemblyApplication); + row.Set(4, (FileAssemblyType.DotNetAssembly == assemblyType) ? 0 : 1); } if (null != bindPath) { - Row row = this.core.CreateRow(sourceLineNumbers, "BindImage"); - row[0] = id.Id; - row[1] = bindPath; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.BindImage); + row.Set(0, id.Id); + row.Set(1, bindPath); // TODO: technically speaking each of the properties in the "bindPath" should be added as references, but how much do we really care about BindImage? } if (CompilerConstants.IntegerNotSet != selfRegCost) { - Row row = this.core.CreateRow(sourceLineNumbers, "SelfReg"); - row[0] = id.Id; - row[1] = selfRegCost; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.SelfReg); + row.Set(0, id.Id); + row.Set(1, selfRegCost); } if (null != fontTitle) { - Row row = this.core.CreateRow(sourceLineNumbers, "Font"); - row[0] = id.Id; - row[1] = fontTitle; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Font); + row.Set(0, id.Id); + row.Set(1, fontTitle); } } - this.core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); + this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); // If this component does not have a companion file this file is a possible keypath. possibleKeyPath = null; @@ -5950,57 +5902,57 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "MinVersion": - minVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + minVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MaxVersion": - maxVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + maxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MinSize": - minSize = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + minSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "MaxSize": - maxSize = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + maxSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "MinDate": - minDate = this.core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); + minDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); break; case "MaxDate": - maxDate = this.core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); + maxDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); break; case "Languages": - languages = this.core.GetAttributeValue(sourceLineNumbers, attrib); + languages = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // Using both ShortName and Name will not always work due to a Windows Installer bug. if (null != shortName && null != name) { - this.core.OnMessage(WixWarnings.FileSearchFileNameIssue(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name")); + this.Core.OnMessage(WixWarnings.FileSearchFileNameIssue(sourceLineNumbers, node.Name.LocalName, "ShortName", "Name")); } else if (null == shortName && null == name) // at least one name must be specified. { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } - if (this.core.IsValidShortFilename(name, false)) + if (this.Core.IsValidShortFilename(name, false)) { if (null == shortName) { @@ -6009,7 +5961,7 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); } } @@ -6017,7 +5969,7 @@ namespace WixToolset { if (String.IsNullOrEmpty(parentSignature)) { - id = this.core.CreateIdentifier("fs", name ?? shortName); + id = this.Core.CreateIdentifier("fs", name ?? shortName); } else // reuse parent signature in the Signature table { @@ -6032,7 +5984,7 @@ namespace WixToolset // value must be specified and unique. if (isSameId) { - this.core.OnMessage(WixErrors.UniqueFileSearchIdRequired(sourceLineNumbers, parentSignature, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.UniqueFileSearchIdRequired(sourceLineNumbers, parentSignature, node.Name.LocalName)); } } else if (parentDepth > 1) @@ -6041,36 +5993,36 @@ namespace WixToolset // as the parent DirectorySearch if AssignToProperty is not set. if (!isSameId) { - this.core.OnMessage(WixErrors.IllegalSearchIdForParentDepth(sourceLineNumbers, id.Id, parentSignature)); + this.Core.OnMessage(WixErrors.IllegalSearchIdForParentDepth(sourceLineNumbers, id.Id, parentSignature)); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Signature", id); - row[1] = name ?? shortName; - row[2] = minVersion; - row[3] = maxVersion; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Signature, id); + row.Set(1, name ?? shortName); + row.Set(2, minVersion); + row.Set(3, maxVersion); if (CompilerConstants.IntegerNotSet != minSize) { - row[4] = minSize; + row.Set(4, minSize); } if (CompilerConstants.IntegerNotSet != maxSize) { - row[5] = maxSize; + row.Set(5, maxSize); } if (CompilerConstants.IntegerNotSet != minDate) { - row[6] = minDate; + row.Set(6, minDate); } if (CompilerConstants.IntegerNotSet != maxDate) { - row[7] = maxDate; + row.Set(7, maxDate); } - row[8] = languages; + row.Set(8, languages); // Create a DrLocator row to associate the file with a directory // when a different identifier is specified for the FileSearch. @@ -6080,14 +6032,14 @@ namespace WixToolset { // Creates the DrLocator row for the directory search while // the parent DirectorySearch creates the file locator row. - row = this.core.CreateRow(sourceLineNumbers, "DrLocator"); - row[0] = parentSignature; - row[1] = id; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DrLocator); + row.Set(0, parentSignature); + row.Set(1, id); } else { - row = this.core.CreateRow(sourceLineNumbers, "DrLocator", id); - row[1] = parentSignature; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DrLocator, id); + row.Set(1, parentSignature); } } } @@ -6115,22 +6067,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // NOTE: Id is not required for Fragments, this is a departure from the normal run of the mill processing. - this.core.CreateActiveSection(id, SectionType.Fragment, 0); + this.Core.CreateActiveSection(id, SectionType.Fragment, 0, this.Context.CompilationId); int featureDisplay = 0; foreach (XElement child in node.Elements()) @@ -6282,20 +6234,20 @@ namespace WixToolset this.ParseWixVariableElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError && null != id) + if (!this.Core.EncounteredError && null != id) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixFragment"); - row[0] = id; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixFragment); + row.Set(0, id); } } @@ -6325,7 +6277,7 @@ namespace WixToolset case "Action": if ("Control" == parentElementLocalName) { - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < action.Length) { Wix.Condition.ActionType actionType; @@ -6335,56 +6287,56 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "default", "disable", "enable", "hide", "show")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "default", "disable", "enable", "hide", "show")); } } } else { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } break; case "Level": if ("Feature" == parentElementLocalName) { - level = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); } else { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } break; case "Message": if ("Fragment" == parentElementLocalName || "Product" == parentElementLocalName) { - message = this.core.GetAttributeValue(sourceLineNumbers, attrib); + message = this.Core.GetAttributeValue(sourceLineNumbers, attrib); } else { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // get the condition from the inner text of the element - condition = this.core.GetConditionInnerText(node); + condition = this.Core.GetConditionInnerText(node); - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); // the condition should not be empty if (null == condition || 0 == condition.Length) { condition = null; - this.core.OnMessage(WixErrors.ConditionExpected(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.ConditionExpected(sourceLineNumbers, node.Name.LocalName)); } switch (parentElementLocalName) @@ -6392,45 +6344,45 @@ namespace WixToolset case "Control": if (null == action) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ControlCondition"); - row[0] = dialog; - row[1] = id; - row[2] = action; - row[3] = condition; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ControlCondition); + row.Set(0, dialog); + row.Set(1, id); + row.Set(2, action); + row.Set(3, condition); } break; case "Feature": if (CompilerConstants.IntegerNotSet == level) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level")); level = CompilerConstants.IllegalInteger; } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Condition"); - row[0] = id; - row[1] = level; - row[2] = condition; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Condition); + row.Set(0, id); + row.Set(1, level); + row.Set(2, condition); } break; case "Fragment": case "Product": if (null == message) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "LaunchCondition"); - row[0] = condition; - row[1] = message; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); + row.Set(0, condition); + row.Set(1, message); } break; } @@ -6453,7 +6405,7 @@ namespace WixToolset string name = null; string section = null; string shortName = null; - string tableName = null; + TupleDefinitionType tableName; string value = null; foreach (XAttribute attrib in node.Attributes()) @@ -6463,10 +6415,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Action": - string actionValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string actionValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < actionValue.Length) { Wix.IniFile.ActionType actionType = Wix.IniFile.ParseActionType(actionValue); @@ -6488,58 +6440,58 @@ namespace WixToolset action = MsiInterop.MsidbIniFileActionRemoveTag; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", actionValue, "addLine", "addTag", "createLine", "removeLine", "removeTag")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", actionValue, "addLine", "addTag", "createLine", "removeLine", "removeTag")); break; } } break; case "Directory": - directory = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + directory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "Section": - section = this.core.GetAttributeValue(sourceLineNumbers, attrib); + section = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (CompilerConstants.IntegerNotSet == action) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); action = CompilerConstants.IllegalInteger; } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (0 < name.Length) { - if (this.core.IsValidShortFilename(name, false)) + if (this.Core.IsValidShortFilename(name, false)) { if (null == shortName) { @@ -6548,54 +6500,54 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); } } else // generate a short file name. { if (null == shortName) { - shortName = this.core.CreateShortName(name, true, false, node.Name.LocalName, componentId); + shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, componentId); } } } if (null == section) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Section")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Section")); } if (null == id) { - id = this.core.CreateIdentifier("ini", directory, name ?? shortName, section, key, name); + id = this.Core.CreateIdentifier("ini", directory, name ?? shortName, section, key, name); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (MsiInterop.MsidbIniFileActionRemoveLine == action || MsiInterop.MsidbIniFileActionRemoveTag == action) { - tableName = "RemoveIniFile"; + tableName = TupleDefinitionType.RemoveIniFile; } else { if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - tableName = "IniFile"; + tableName = TupleDefinitionType.IniFile; } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, tableName, id); - row[1] = GetMsiFilenameValue(shortName, name); - row[2] = directory; - row[3] = section; - row[4] = key; - row[5] = value; - row[6] = action; - row[7] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, tableName, id); + row.Set(1, GetMsiFilenameValue(shortName, name)); + row.Set(2, directory); + row.Set(3, section); + row.Set(4, key); + row.Set(5, value); + row.Set(6, action); + row.Set(7, componentId); } } @@ -6623,25 +6575,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Field": - field = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + field = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "Section": - section = this.core.GetAttributeValue(sourceLineNumbers, attrib); + section = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "Type": - string typeValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < typeValue.Length) { Wix.IniFileSearch.TypeType typeType = Wix.IniFileSearch.ParseTypeType(typeValue); @@ -6657,34 +6609,34 @@ namespace WixToolset type = 2; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "registry")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "registry")); break; } } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (0 < name.Length) { - if (this.core.IsValidShortFilename(name, false)) + if (this.Core.IsValidShortFilename(name, false)) { if (null == shortName) { @@ -6693,23 +6645,23 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); } } else if (null == shortName) // generate a short file name. { - shortName = this.core.CreateShortName(name, true, false, node.Name.LocalName); + shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName); } } if (null == section) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Section")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Section")); } if (null == id) { - id = this.core.CreateIdentifier("ini", name, section, key, field.ToString(), type.ToString()); + id = this.Core.CreateIdentifier("ini", name, section, key, field.ToString(), type.ToString()); } signature = id.Id; @@ -6725,7 +6677,7 @@ namespace WixToolset case "DirectorySearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; @@ -6735,7 +6687,7 @@ namespace WixToolset case "DirectorySearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseDirectorySearchRefElement(child, id.Id); @@ -6743,7 +6695,7 @@ namespace WixToolset case "FileSearch": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); @@ -6752,7 +6704,7 @@ namespace WixToolset case "FileSearchRef": if (oneChild) { - this.core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); } oneChild = true; string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures @@ -6760,27 +6712,27 @@ namespace WixToolset signature = null; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "IniLocator", id); - row[1] = GetMsiFilenameValue(shortName, name); - row[2] = section; - row[3] = key; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.IniLocator, id); + row.Set(1, GetMsiFilenameValue(shortName, name)); + row.Set(2, section); + row.Set(3, key); if (CompilerConstants.IntegerNotSet != field) { - row[4] = field; + row.Set(4, field); } - row[5] = type; + row.Set(5, type); } return signature; @@ -6803,32 +6755,32 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Shared": - shared = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Component", shared); + shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Component", shared); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == shared) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Shared")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Shared")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "IsolatedComponent"); - row[0] = shared; - row[1] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.IsolatedComponent); + row.Set(0, shared); + row.Set(1, componentId); } } @@ -6845,11 +6797,11 @@ namespace WixToolset { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -6862,21 +6814,21 @@ namespace WixToolset case "DigitalCertificate": string name = this.ParseDigitalCertificateElement(child); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? "MsiPatchCertificate" : "MsiPackageCertificate"); - row[0] = name; - row[1] = name; + var row = this.Core.CreateRow(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? TupleDefinitionType.MsiPatchCertificate : TupleDefinitionType.MsiPackageCertificate); + row.Set(0, name); + row.Set(1, name); } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } @@ -6899,30 +6851,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (40 < id.Id.Length) { - this.core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 40)); + this.Core.OnMessage(WixErrors.StreamNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, id.Id.Length, 40)); // No need to check for modularization problems since DigitalSignature and thus DigitalCertificate // currently have no usage in merge modules. @@ -6930,15 +6882,15 @@ namespace WixToolset if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiDigitalCertificate", id); - row[1] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiDigitalCertificate, id); + row.Set(1, sourceFile); } return id.Id; @@ -6962,16 +6914,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -6991,28 +6943,28 @@ namespace WixToolset certificateId = this.ParseDigitalCertificateElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (null == certificateId) { - this.core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "DigitalCertificate")); + this.Core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "DigitalCertificate")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiDigitalSignature"); - row[0] = "Media"; - row[1] = diskId; - row[2] = certificateId; - row[3] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiDigitalSignature); + row.Set(0, "Media"); + row.Set(1, diskId); + row.Set(2, certificateId); + row.Set(3, sourceFile); } } @@ -7036,13 +6988,13 @@ namespace WixToolset string upgradeCode = contextValues["UpgradeCode"]; if (String.IsNullOrEmpty(upgradeCode)) { - this.core.OnMessage(WixErrors.ParentElementAttributeRequired(sourceLineNumbers, "Product", "UpgradeCode", node.Name.LocalName)); + this.Core.OnMessage(WixErrors.ParentElementAttributeRequired(sourceLineNumbers, "Product", "UpgradeCode", node.Name.LocalName)); } string productVersion = contextValues["ProductVersion"]; if (String.IsNullOrEmpty(productVersion)) { - this.core.OnMessage(WixErrors.ParentElementAttributeRequired(sourceLineNumbers, "Product", "Version", node.Name.LocalName)); + this.Core.OnMessage(WixErrors.ParentElementAttributeRequired(sourceLineNumbers, "Product", "Version", node.Name.LocalName)); } string productLanguage = contextValues["ProductLanguage"]; @@ -7054,104 +7006,104 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "AllowDowngrades": - allowDowngrades = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowDowngrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "AllowSameVersionUpgrades": - allowSameVersionUpgrades = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowSameVersionUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Disallow": - blockUpgrades = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + blockUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "DowngradeErrorMessage": - downgradeErrorMessage = this.core.GetAttributeValue(sourceLineNumbers, attrib); + downgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisallowUpgradeErrorMessage": - disallowUpgradeErrorMessage = this.core.GetAttributeValue(sourceLineNumbers, attrib); + disallowUpgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MigrateFeatures": - if (YesNoType.No == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options &= ~MsiInterop.MsidbUpgradeAttributesMigrateFeatures; } break; case "IgnoreLanguage": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { productLanguage = null; } break; case "IgnoreRemoveFailure": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure; } break; case "RemoveFeatures": - removeFeatures = this.core.GetAttributeValue(sourceLineNumbers, attrib); + removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Schedule": - schedule = this.core.GetAttributeValue(sourceLineNumbers, attrib); + schedule = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (!allowDowngrades && String.IsNullOrEmpty(downgradeErrorMessage)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DowngradeErrorMessage", "AllowDowngrades", "yes", true)); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DowngradeErrorMessage", "AllowDowngrades", "yes", true)); } if (allowDowngrades && !String.IsNullOrEmpty(downgradeErrorMessage)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DowngradeErrorMessage", "AllowDowngrades", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DowngradeErrorMessage", "AllowDowngrades", "yes")); } if (allowDowngrades && allowSameVersionUpgrades) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "AllowSameVersionUpgrades", "AllowDowngrades", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "AllowSameVersionUpgrades", "AllowDowngrades", "yes")); } if (blockUpgrades && String.IsNullOrEmpty(disallowUpgradeErrorMessage)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisallowUpgradeErrorMessage", "Disallow", "yes", true)); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisallowUpgradeErrorMessage", "Disallow", "yes", true)); } if (!blockUpgrades && !String.IsNullOrEmpty(disallowUpgradeErrorMessage)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DisallowUpgradeErrorMessage", "Disallow", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DisallowUpgradeErrorMessage", "Disallow", "yes")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { // create the row that performs the upgrade (or downgrade) - Row row = this.core.CreateRow(sourceLineNumbers, "Upgrade"); - row[0] = upgradeCode; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Upgrade); + row.Set(0, upgradeCode); if (allowDowngrades) { - row[1] = "0"; // let any version satisfy - // row[2] = maximum version; omit so we don't have to fake a version like "255.255.65535"; - row[3] = productLanguage; - row[4] = options | MsiInterop.MsidbUpgradeAttributesVersionMinInclusive; + row.Set(1, "0"); // let any version satisfy + // row.Set(2, maximum version; omit so we don't have to fake a version like "255.255.65535"; + row.Set(3, productLanguage); + row.Set(4, options | MsiInterop.MsidbUpgradeAttributesVersionMinInclusive); } else { - // row[1] = minimum version; skip it so we detect all prior versions. - row[2] = productVersion; - row[3] = productLanguage; - row[4] = allowSameVersionUpgrades ? (options | MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive) : options; + // row.Set(1, minimum version; skip it so we detect all prior versions. + row.Set(2, productVersion); + row.Set(3, productLanguage); + row.Set(4, allowSameVersionUpgrades ? (options | MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive) : options); } - row[5] = removeFeatures; - row[6] = Compiler.UpgradeDetectedProperty; + row.Set(5, removeFeatures); + row.Set(6, Compiler.UpgradeDetectedProperty); // Ensure the action property is secure. this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Compiler.UpgradeDetectedProperty, AccessModifier.Public), false, true, false); @@ -7159,61 +7111,61 @@ namespace WixToolset // Add launch condition that blocks upgrades if (blockUpgrades) { - row = this.core.CreateRow(sourceLineNumbers, "LaunchCondition"); - row[0] = Compiler.UpgradePreventedCondition; - row[1] = disallowUpgradeErrorMessage; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); + row.Set(0, Compiler.UpgradePreventedCondition); + row.Set(1, disallowUpgradeErrorMessage); } // now create the Upgrade row and launch conditions to prevent downgrades (unless explicitly permitted) if (!allowDowngrades) { - row = this.core.CreateRow(sourceLineNumbers, "Upgrade"); - row[0] = upgradeCode; - row[1] = productVersion; - // row[2] = maximum version; skip it so we detect all future versions. - row[3] = productLanguage; - row[4] = MsiInterop.MsidbUpgradeAttributesOnlyDetect; - // row[5] = removeFeatures; - row[6] = Compiler.DowngradeDetectedProperty; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Upgrade); + row.Set(0, upgradeCode); + row.Set(1, productVersion); + // row.Set(2, maximum version; skip it so we detect all future versions. + row.Set(3, productLanguage); + row.Set(4, MsiInterop.MsidbUpgradeAttributesOnlyDetect); + // row.Set(5, removeFeatures); + row.Set(6, Compiler.DowngradeDetectedProperty); // Ensure the action property is secure. this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Compiler.DowngradeDetectedProperty, AccessModifier.Public), false, true, false); - row = this.core.CreateRow(sourceLineNumbers, "LaunchCondition"); - row[0] = Compiler.DowngradePreventedCondition; - row[1] = downgradeErrorMessage; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); + row.Set(0, Compiler.DowngradePreventedCondition); + row.Set(1, downgradeErrorMessage); } // finally, schedule RemoveExistingProducts - row = this.core.CreateRow(sourceLineNumbers, "WixAction"); - row[0] = "InstallExecuteSequence"; - row[1] = "RemoveExistingProducts"; - // row[2] = condition; - // row[3] = sequence; - row[6] = 0; // overridable + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction); + row.Set(0, "InstallExecuteSequence"); + row.Set(1, "RemoveExistingProducts"); + // row.Set(2, condition); + // row.Set(3, sequence); + row.Set(6, false); // overridable switch (schedule) { case null: case "afterInstallValidate": - // row[4] = beforeAction; - row[5] = "InstallValidate"; + // row.Set(4, beforeAction; + row.Set(5, "InstallValidate"); break; case "afterInstallInitialize": - // row[4] = beforeAction; - row[5] = "InstallInitialize"; + // row.Set(4, beforeAction; + row.Set(5, "InstallInitialize"); break; case "afterInstallExecute": - // row[4] = beforeAction; - row[5] = "InstallExecute"; + // row.Set(4, beforeAction; + row.Set(5, "InstallExecute"); break; case "afterInstallExecuteAgain": - // row[4] = beforeAction; - row[5] = "InstallExecuteAgain"; + // row.Set(4, beforeAction; + row.Set(5, "InstallExecuteAgain"); break; case "afterInstallFinalize": - // row[4] = beforeAction; - row[5] = "InstallFinalize"; + // row.Set(4, beforeAction; + row.Set(5, "InstallFinalize"); break; } } @@ -7246,19 +7198,19 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "Cabinet": - cabinet = this.core.GetAttributeValue(sourceLineNumbers, attrib); + cabinet = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "CompressionLevel": - string compressionLevelString = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string compressionLevelString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < compressionLevelString.Length) { Wix.CompressionLevelType compressionLevelType; if (!Wix.Enums.TryParseCompressionLevelType(compressionLevelString, out compressionLevelType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevelString, "high", "low", "medium", "mszip", "none")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevelString, "high", "low", "medium", "mszip", "none")); } else { @@ -7267,45 +7219,45 @@ namespace WixToolset } break; case "DiskPrompt": - diskPrompt = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined + diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined break; case "EmbedCab": - embedCab = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Layout": case "src": if (null != layout) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Layout", "src")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Layout", "src")); } if ("src" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Layout")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Layout")); } - layout = this.core.GetAttributeValue(sourceLineNumbers, attrib); + layout = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "VolumeLabel": - volumeLabel = this.core.GetAttributeValue(sourceLineNumbers, attrib); + volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Source": - source = this.core.GetAttributeValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (CompilerConstants.IntegerNotSet == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = CompilerConstants.IllegalInteger; } @@ -7315,13 +7267,13 @@ namespace WixToolset { if (null == cabinet) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Cabinet", "EmbedCab", "yes")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Cabinet", "EmbedCab", "yes")); } else { if (62 < cabinet.Length) { - this.core.OnMessage(WixErrors.MediaEmbeddedCabinetNameTooLong(sourceLineNumbers, node.Name.LocalName, "Cabinet", cabinet, cabinet.Length)); + this.Core.OnMessage(WixErrors.MediaEmbeddedCabinetNameTooLong(sourceLineNumbers, node.Name.LocalName, "Cabinet", cabinet, cabinet.Length)); } cabinet = String.Concat("#", cabinet); @@ -7330,12 +7282,12 @@ namespace WixToolset else // external cabinet file { // external cabinet files must use 8.3 filenames - if (!String.IsNullOrEmpty(cabinet) && !this.core.IsValidShortFilename(cabinet, false)) + if (!String.IsNullOrEmpty(cabinet) && !this.Core.IsValidShortFilename(cabinet, false)) { // WiX variables in the name will trip the "not a valid 8.3 name" switch, so let them through if (!Common.WixVariableRegex.Match(cabinet).Success) { - this.core.OnMessage(WixWarnings.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "Cabinet", cabinet)); + this.Core.OnMessage(WixWarnings.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "Cabinet", cabinet)); } } } @@ -7343,7 +7295,7 @@ namespace WixToolset if (null != compressionLevel && null == cabinet) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Cabinet", "CompressionLevel")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Cabinet", "CompressionLevel")); } if (patch) @@ -7365,11 +7317,11 @@ namespace WixToolset case "DigitalSignature": if (YesNoType.Yes == embedCab) { - this.core.OnMessage(WixErrors.SignedEmbeddedCabinet(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.SignedEmbeddedCabinet(childSourceLineNumbers)); } else if (null == cabinet) { - this.core.OnMessage(WixErrors.ExpectedSignedCabinetName(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.ExpectedSignedCabinetName(childSourceLineNumbers)); } else { @@ -7383,7 +7335,7 @@ namespace WixToolset } else { - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); } break; case "SymbolPath": @@ -7397,22 +7349,22 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } // add the row to the section - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - MediaRow mediaRow = (MediaRow)this.core.CreateRow(sourceLineNumbers, "Media"); + var mediaRow = (MediaTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Media); mediaRow.DiskId = id; mediaRow.LastSequence = 0; // this is set in the binder mediaRow.DiskPrompt = diskPrompt; @@ -7424,15 +7376,15 @@ namespace WixToolset if (null != compressionLevel || null != layout) { - WixMediaRow row = (WixMediaRow)this.core.CreateRow(sourceLineNumbers, "WixMedia"); - row.DiskId = id; + var row = (WixMediaTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixMedia); + row.DiskId_ = id; row.CompressionLevel = compressionLevel; row.Layout = layout; } if (null != symbols) { - WixDeltaPatchSymbolPathsRow symbolRow = (WixDeltaPatchSymbolPathsRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchSymbolPaths"); + var symbolRow = (WixDeltaPatchSymbolPathsTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchSymbolPaths); symbolRow.Id = id.ToString(CultureInfo.InvariantCulture); symbolRow.Type = SymbolPathType.Media; symbolRow.SymbolPaths = symbols; @@ -7466,7 +7418,7 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "CabinetTemplate": - string authoredCabinetTemplateValue = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + string authoredCabinetTemplateValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); if (!String.IsNullOrEmpty(authoredCabinetTemplateValue)) { cabinetTemplate = authoredCabinetTemplateValue; @@ -7474,56 +7426,56 @@ namespace WixToolset // Create an example cabinet name using the maximum number of cabinets supported, 999. string exampleCabinetName = String.Format(cabinetTemplate, "###"); - if (!this.core.IsValidLocIdentifier(exampleCabinetName)) + if (!this.Core.IsValidLocIdentifier(exampleCabinetName)) { // The example name should not match the authored template since that would nullify the // reason for having multiple cabients. External cabinet files must also be valid file names. - if (exampleCabinetName.Equals(authoredCabinetTemplateValue) || !this.core.IsValidLongFilename(exampleCabinetName, false)) + if (exampleCabinetName.Equals(authoredCabinetTemplateValue) || !this.Core.IsValidLongFilename(exampleCabinetName, false)) { - this.core.OnMessage(WixErrors.InvalidCabinetTemplate(sourceLineNumbers, cabinetTemplate)); + this.Core.OnMessage(WixErrors.InvalidCabinetTemplate(sourceLineNumbers, cabinetTemplate)); } - else if (!this.core.IsValidShortFilename(exampleCabinetName, false) && !Common.WixVariableRegex.Match(exampleCabinetName).Success) // ignore short names with wix variables because it rarely works out. + else if (!this.Core.IsValidShortFilename(exampleCabinetName, false) && !Common.WixVariableRegex.Match(exampleCabinetName).Success) // ignore short names with wix variables because it rarely works out. { - this.core.OnMessage(WixWarnings.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "CabinetTemplate", cabinetTemplate)); + this.Core.OnMessage(WixWarnings.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "CabinetTemplate", cabinetTemplate)); } } break; case "CompressionLevel": - compressionLevel = this.core.GetAttributeValue(sourceLineNumbers, attrib); + compressionLevel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < compressionLevel.Length) { if (!Wix.Enums.TryParseCompressionLevelType(compressionLevel, out compressionLevelType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevel, "high", "low", "medium", "mszip", "none")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevel, "high", "low", "medium", "mszip", "none")); } } break; case "DiskPrompt": - diskPrompt = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined - this.core.OnMessage(WixWarnings.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined + this.Core.OnMessage(WixWarnings.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "EmbedCab": - embedCab = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "VolumeLabel": - volumeLabel = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.OnMessage(WixWarnings.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "MaximumUncompressedMediaSize": - maximumUncompressedMediaSize = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); + maximumUncompressedMediaSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); break; case "MaximumCabinetSizeForLargeFileSplitting": - maximumCabinetSizeForLargeFileSplitting = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, CompilerCore.MinValueOfMaxCabSizeForLargeFileSplitting, CompilerCore.MaxValueOfMaxCabSizeForLargeFileSplitting); + maximumCabinetSizeForLargeFileSplitting = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, CompilerCore.MinValueOfMaxCabSizeForLargeFileSplitting, CompilerCore.MaxValueOfMaxCabSizeForLargeFileSplitting); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -7535,11 +7487,11 @@ namespace WixToolset } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - MediaRow temporaryMediaRow = (MediaRow)this.core.CreateRow(sourceLineNumbers, "Media"); - temporaryMediaRow.DiskId = 1; - WixMediaTemplateRow mediaTemplateRow = (WixMediaTemplateRow)this.core.CreateRow(sourceLineNumbers, "WixMediaTemplate"); + var temporaryMediaRow = (MediaTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Media, new Identifier(1, AccessModifier.Public)); + + var mediaTemplateRow = (WixMediaTemplateTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixMediaTemplate); mediaTemplateRow.CabinetTemplate = cabinetTemplate; mediaTemplateRow.VolumeLabel = volumeLabel; mediaTemplateRow.DiskPrompt = diskPrompt; @@ -7606,50 +7558,50 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); - this.core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); break; case "FileCompression": - fileCompression = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + fileCompression = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Language": - language = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + language = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == language) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } if (CompilerConstants.IntegerNotSet == diskId) { - this.core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "DiskId", "Directory")); + this.Core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "DiskId", "Directory")); diskId = CompilerConstants.IllegalInteger; } @@ -7670,37 +7622,37 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixMerge", id); - row[1] = language; - row[2] = directoryId; - row[3] = sourceFile; - row[4] = diskId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixMerge, id); + row.Set(1, language); + row.Set(2, directoryId); + row.Set(3, sourceFile); + row.Set(4, diskId); if (YesNoType.Yes == fileCompression) { - row[5] = 1; + row.Set(5, 1); } else if (YesNoType.No == fileCompression) { - row[5] = 0; + row.Set(5, 0); } else // YesNoType.NotSet == fileCompression { // and we leave the column null } - row[6] = configData; - row[7] = Guid.Empty.ToString("B"); + row.Set(6, configData); + row.Set(7, Guid.Empty.ToString("B")); } } @@ -7722,25 +7674,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else // need to hex encode these characters { @@ -7751,7 +7703,7 @@ namespace WixToolset if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } else // need to hex encode these characters { @@ -7760,7 +7712,7 @@ namespace WixToolset value = value.Replace(",", "%2C"); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return String.Concat(name, "=", value); } @@ -7784,31 +7736,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id); break; case "Primary": - primary = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Module, id, (YesNoType.Yes == primary)); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.Module, id, (YesNoType.Yes == primary)); } /// @@ -7834,31 +7786,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Advertise": - advertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Class": - classId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "ContentType": - contentType = this.core.GetAttributeValue(sourceLineNumbers, attrib); + contentType = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Default": - returnContentType = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + returnContentType = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == contentType) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ContentType")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ContentType")); } // if the advertise state has not been set, default to non-advertised @@ -7867,34 +7819,34 @@ namespace WixToolset advertise = YesNoType.No; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (YesNoType.Yes == advertise) { if (YesNoType.Yes != parentAdvertised) { - this.core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, advertise.ToString(), parentAdvertised.ToString())); + this.Core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, advertise.ToString(), parentAdvertised.ToString())); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MIME"); - row[0] = contentType; - row[1] = extension; - row[2] = classId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MIME); + row.Set(0, contentType); + row.Set(1, extension); + row.Set(2, classId); } } else if (YesNoType.No == advertise) { if (YesNoType.Yes == returnContentType && YesNoType.Yes == parentAdvertised) { - this.core.OnMessage(WixErrors.CannotDefaultMismatchedAdvertiseStates(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.CannotDefaultMismatchedAdvertiseStates(sourceLineNumbers)); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("MIME\\Database\\Content Type\\", contentType), "Extension", String.Concat(".", extension), componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("MIME\\Database\\Content Type\\", contentType), "Extension", String.Concat(".", extension), componentId); if (null != classId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("MIME\\Database\\Content Type\\", contentType), "CLSID", classId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("MIME\\Database\\Content Type\\", contentType), "CLSID", classId, componentId); } } @@ -7922,63 +7874,63 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - this.activeName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if ("PUT-MODULE-NAME-HERE" == this.activeName) { - this.core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); + this.Core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); } else { - this.activeName = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.activeName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); } break; case "Codepage": - codepage = this.core.GetAttributeCodePageValue(sourceLineNumbers, attrib); + codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); break; case "Guid": - moduleId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); - this.core.OnMessage(WixWarnings.DeprecatedModuleGuidAttribute(sourceLineNumbers)); + moduleId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + this.Core.OnMessage(WixWarnings.DeprecatedModuleGuidAttribute(sourceLineNumbers)); break; case "Language": - this.activeLanguage = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Version": - version = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == this.activeName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == this.activeLanguage) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); } if (null == version) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } else if (!CompilerCore.IsValidModuleOrBundleVersion(version)) { - this.core.OnMessage(WixWarnings.InvalidModuleOrBundleVersion(sourceLineNumbers, "Module", version)); + this.Core.OnMessage(WixWarnings.InvalidModuleOrBundleVersion(sourceLineNumbers, "Module", version)); } try { this.compilingModule = true; // notice that we are actually building a Merge Module here - this.core.CreateActiveSection(this.activeName, SectionType.Module, codepage); + this.Core.CreateActiveSection(this.activeName, SectionType.Module, codepage, this.Context.CompilationId); foreach (XElement child in node.Elements()) { @@ -8082,23 +8034,23 @@ namespace WixToolset this.ParseWixVariableElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleSignature"); - row[0] = this.activeName; - row[1] = this.activeLanguage; - row[2] = version; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleSignature); + row.Set(0, this.activeName); + row.Set(1, this.activeLanguage); + row.Set(2, version); } } finally @@ -8132,49 +8084,49 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - this.activeName = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + this.activeName = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "AllowMajorVersionMismatches": - versionMismatches = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + versionMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "AllowProductCodeMismatches": - productMismatches = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + productMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "CleanWorkingFolder": - clean = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + clean = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Codepage": - codepage = this.core.GetAttributeCodePageValue(sourceLineNumbers, attrib); + codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); break; case "OutputPath": - outputPath = this.core.GetAttributeValue(sourceLineNumbers, attrib); + outputPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SourceList": - sourceList = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceList = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SymbolFlags": - symbolFlags = String.Format(CultureInfo.InvariantCulture, "0x{0:x8}", this.core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, uint.MaxValue)); + symbolFlags = String.Format(CultureInfo.InvariantCulture, "0x{0:x8}", this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, uint.MaxValue)); break; case "WholeFilesOnly": - wholeFiles = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + wholeFiles = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == this.activeName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.CreateActiveSection(this.activeName, SectionType.PatchCreation, codepage); + this.Core.CreateActiveSection(this.activeName, SectionType.PatchCreation, codepage, this.Context.CompilationId); foreach (XElement child in node.Elements()) { @@ -8209,13 +8161,13 @@ namespace WixToolset targetProducts = String.Concat(targetProducts, targetProduct); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -8272,43 +8224,43 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "DiskId": - diskId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "DiskPrompt": - diskPrompt = this.core.GetAttributeValue(sourceLineNumbers, attrib); + diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MediaSrcProp": - mediaSrcProp = this.core.GetAttributeValue(sourceLineNumbers, attrib); + mediaSrcProp = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SequenceStart": - sequenceStart = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); + sequenceStart = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); break; case "VolumeLabel": - volumeLabel = this.core.GetAttributeValue(sourceLineNumbers, attrib); + volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (0 < name.Length) { if (8 < name.Length) // check the length { - this.core.OnMessage(WixErrors.FamilyNameTooLong(sourceLineNumbers, node.Name.LocalName, "Name", name, name.Length)); + this.Core.OnMessage(WixErrors.FamilyNameTooLong(sourceLineNumbers, node.Name.LocalName, "Name", name, name.Length)); } else // check for illegal characters { @@ -8316,7 +8268,7 @@ namespace WixToolset { if (!Char.IsLetterOrDigit(character) && '_' != character) { - this.core.OnMessage(WixErrors.IllegalFamilyName(sourceLineNumbers, node.Name.LocalName, "Name", name)); + this.Core.OnMessage(WixErrors.IllegalFamilyName(sourceLineNumbers, node.Name.LocalName, "Name", name)); } } } @@ -8338,32 +8290,32 @@ namespace WixToolset this.ParseProtectFileElement(child, name); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ImageFamilies"); - row[0] = name; - row[1] = mediaSrcProp; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ImageFamilies); + row.Set(0, name); + row.Set(1, mediaSrcProp); if (CompilerConstants.IntegerNotSet != diskId) { - row[2] = diskId; + row.Set(2, diskId); } if (CompilerConstants.IntegerNotSet != sequenceStart) { - row[3] = sequenceStart; + row.Set(3, sequenceStart); } - row[4] = diskPrompt; - row[5] = volumeLabel; + row.Set(4, diskPrompt); + row.Set(5, volumeLabel); } } @@ -8387,57 +8339,57 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - upgrade = this.core.GetAttributeValue(sourceLineNumbers, attrib); + upgrade = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (13 < upgrade.Length) { - this.core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", upgrade, 13)); + this.Core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", upgrade, 13)); } break; case "SourceFile": case "src": if (null != sourceFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); } if ("src" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); } - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SourcePatch": case "srcPatch": if (null != sourcePatch) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "srcPatch", "SourcePatch")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "srcPatch", "SourcePatch")); } if ("srcPatch" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourcePatch")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourcePatch")); } - sourcePatch = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourcePatch = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == upgrade) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } foreach (XElement child in node.Elements()) @@ -8456,24 +8408,24 @@ namespace WixToolset this.ParseUpgradeFileElement(child, upgrade); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "UpgradedImages"); - row[0] = upgrade; - row[1] = sourceFile; - row[2] = sourcePatch; - row[3] = String.Join(";", symbols); - row[4] = family; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.UpgradedImages); + row.Set(0, upgrade); + row.Set(1, sourceFile); + row.Set(2, sourcePatch); + row.Set(3, String.Join(";", symbols)); + row.Set(4, family); } } @@ -8498,31 +8450,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "AllowIgnoreOnError": - allowIgnoreOnError = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "File": - file = this.core.GetAttributeValue(sourceLineNumbers, attrib); + file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Ignore": - ignore = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "WholeFile": - wholeFile = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + wholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == file) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); } foreach (XElement child in node.Elements()) @@ -8535,32 +8487,32 @@ namespace WixToolset symbols.Add(this.ParseSymbolPathElement(child)); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (ignore) { - Row row = this.core.CreateRow(sourceLineNumbers, "UpgradedFilesToIgnore"); - row[0] = upgrade; - row[1] = file; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.UpgradedFilesToIgnore); + row.Set(0, upgrade); + row.Set(1, file); } else { - Row row = this.core.CreateRow(sourceLineNumbers, "UpgradedFiles_OptionalData"); - row[0] = upgrade; - row[1] = file; - row[2] = String.Join(";", symbols); - row[3] = allowIgnoreOnError ? 1 : 0; - row[4] = wholeFile ? 1 : 0; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.UpgradedFiles_OptionalData); + row.Set(0, upgrade); + row.Set(1, file); + row.Set(2, String.Join(";", symbols)); + row.Set(3, allowIgnoreOnError ? 1 : 0); + row.Set(4, wholeFile ? 1 : 0); } } } @@ -8588,58 +8540,58 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (target.Length > 13) { - this.core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", target, 13)); + this.Core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", target, 13)); } break; case "IgnoreMissingFiles": - ignore = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Order": - order = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); + order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); break; case "SourceFile": case "src": if (null != sourceFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); } if ("src" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); } - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Validation": - validation = this.core.GetAttributeValue(sourceLineNumbers, attrib); + validation = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == target) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } if (CompilerConstants.IntegerNotSet == order) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); } foreach (XElement child in node.Elements()) @@ -8662,26 +8614,26 @@ namespace WixToolset this.ParseTargetFileElement(child, target, family); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "TargetImages"); - row[0] = target; - row[1] = sourceFile; - row[2] = symbols; - row[3] = upgrade; - row[4] = order; - row[5] = validation; - row[6] = ignore ? 1 : 0; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.TargetImages); + row.Set(0, target); + row.Set(1, sourceFile); + row.Set(2, symbols); + row.Set(3, upgrade); + row.Set(4, order); + row.Set(5, validation); + row.Set(6, ignore ? 1 : 0); } } @@ -8708,22 +8660,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - file = this.core.GetAttributeValue(sourceLineNumbers, attrib); + file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == file) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } foreach (XElement child in node.Elements()) @@ -8742,34 +8694,34 @@ namespace WixToolset symbols = this.ParseSymbolPathElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "TargetFiles_OptionalData"); - row[0] = target; - row[1] = file; - row[2] = symbols; - row[3] = ignoreOffsets; - row[4] = ignoreLengths; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.TargetFiles_OptionalData); + row.Set(0, target); + row.Set(1, file); + row.Set(2, symbols); + row.Set(3, ignoreOffsets); + row.Set(4, ignoreLengths); if (null != protectOffsets) { - row[5] = protectOffsets; + row.Set(5, protectOffsets); - Row row2 = this.core.CreateRow(sourceLineNumbers, "FamilyFileRanges"); - row2[0] = family; - row2[1] = file; - row2[2] = protectOffsets; - row2[3] = protectLengths; + var row2 = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.FamilyFileRanges); + row2.Set(0, family); + row2.Set(1, file); + row2.Set(2, protectOffsets); + row2.Set(3, protectLengths); } } } @@ -8798,48 +8750,48 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "File": - file = this.core.GetAttributeValue(sourceLineNumbers, attrib); + file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Order": - order = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); + order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); break; case "Source": case "src": if (null != source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "Source")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "Source")); } if ("src" == attrib.Name.LocalName) { - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Source")); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Source")); } - source = this.core.GetAttributeValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == file) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); } if (null == source) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Source")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Source")); } if (CompilerConstants.IntegerNotSet == order) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); } foreach (XElement child in node.Elements()) @@ -8858,42 +8810,42 @@ namespace WixToolset symbols = this.ParseSymbolPathElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ExternalFiles"); - row[0] = family; - row[1] = file; - row[2] = source; - row[3] = symbols; - row[4] = ignoreOffsets; - row[5] = ignoreLengths; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ExternalFiles); + row.Set(0, family); + row.Set(1, file); + row.Set(2, source); + row.Set(3, symbols); + row.Set(4, ignoreOffsets); + row.Set(5, ignoreLengths); if (null != protectOffsets) { - row[6] = protectOffsets; + row.Set(6, protectOffsets); } if (CompilerConstants.IntegerNotSet != order) { - row[7] = order; + row.Set(7, order); } if (null != protectOffsets) { - Row row2 = this.core.CreateRow(sourceLineNumbers, "FamilyFileRanges"); - row2[0] = family; - row2[1] = file; - row2[2] = protectOffsets; - row2[3] = protectLengths; + var row2 = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.FamilyFileRanges); + row2.Set(0, family); + row2.Set(1, file); + row2.Set(2, protectOffsets); + row2.Set(3, protectLengths); } } } @@ -8917,22 +8869,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "File": - file = this.core.GetAttributeValue(sourceLineNumbers, attrib); + file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == file) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); } foreach (XElement child in node.Elements()) @@ -8945,28 +8897,28 @@ namespace WixToolset this.ParseRangeElement(child, ref protectOffsets, ref protectLengths); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (null == protectOffsets || null == protectLengths) { - this.core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "ProtectRange")); + this.Core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "ProtectRange")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "FamilyFileRanges"); - row[0] = family; - row[1] = file; - row[2] = protectOffsets; - row[3] = protectLengths; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.FamilyFileRanges); + row.Set(0, family); + row.Set(1, file); + row.Set(2, protectOffsets); + row.Set(3, protectLengths); } } @@ -8989,33 +8941,33 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Length": - length = this.core.GetAttributeValue(sourceLineNumbers, attrib); + length = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Offset": - offset = this.core.GetAttributeValue(sourceLineNumbers, attrib); + offset = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == length) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Length")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Length")); } if (null == offset) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Offset")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Offset")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (null != lengths) { @@ -9056,50 +9008,50 @@ namespace WixToolset { case "Id": case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Company": - company = this.core.GetAttributeValue(sourceLineNumbers, attrib); + company = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (patch) { // /Patch/PatchProperty goes directly into MsiPatchMetadata table - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = company; - row[1] = name; - row[2] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, company); + row.Set(1, name); + row.Set(2, value); } else { if (null != company) { - this.core.OnMessage(WixErrors.UnexpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Company")); + this.Core.OnMessage(WixErrors.UnexpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Company")); } this.ProcessProperties(sourceLineNumbers, name, value); } @@ -9124,68 +9076,68 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "PatchFamily": - family = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + family = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ProductCode": if (null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "TargetImage")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "TargetImage")); } - target = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + target = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Target": if (null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetImage", "ProductCode")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetImage", "ProductCode")); } - this.core.OnMessage(WixWarnings.DeprecatedPatchSequenceTargetAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.DeprecatedPatchSequenceTargetAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "TargetImage": if (null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode")); } - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target); break; case "Sequence": - sequence = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "Supersede": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= 0x1; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == family) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PatchFamily")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PatchFamily")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchSequence"); - row[0] = family; - row[1] = target; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchSequence); + row.Set(0, family); + row.Set(1, target); if (!String.IsNullOrEmpty(sequence)) { - row[2] = sequence; + row.Set(2, sequence); } - row[3] = attributes; + row.Set(3, attributes); } } @@ -9206,29 +9158,29 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (id.Length > 0 && "*" != id) { - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return id; } @@ -9250,16 +9202,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Replace": - replace = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + replace = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -9273,7 +9225,7 @@ namespace WixToolset string id = this.ParseTargetProductCodeElement(child); if (0 == String.CompareOrdinal("*", id)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWhenNested(sourceLineNumbers, child.Name.LocalName, "Id", id, node.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWhenNested(sourceLineNumbers, child.Name.LocalName, "Id", id, node.Name.LocalName)); } else { @@ -9281,29 +9233,29 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { // By default, target ProductCodes should be added. if (!replace) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixPatchTarget"); - row[0] = "*"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchTarget); + row.Set(0, "*"); } foreach (string targetProductCode in targetProductCodes) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixPatchTarget"); - row[0] = targetProductCode; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchTarget); + row.Set(0, targetProductCode); } } } @@ -9325,25 +9277,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return id; } @@ -9365,25 +9317,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Path": - path = this.core.GetAttributeValue(sourceLineNumbers, attrib); + path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == path) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Path")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Path")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return path; } @@ -9422,10 +9374,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - patchId = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); + patchId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); break; case "Codepage": - codepage = this.core.GetAttributeCodePageValue(sourceLineNumbers, attrib); + codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); break; case "AllowMajorVersionMismatches": ////versionMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); @@ -9434,58 +9386,58 @@ namespace WixToolset ////productMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); break; case "AllowRemoval": - allowRemoval = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); + allowRemoval = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); break; case "Classification": - classification = this.core.GetAttributeValue(sourceLineNumbers, attrib); + classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ClientPatchId": - clientPatchId = this.core.GetAttributeValue(sourceLineNumbers, attrib); + clientPatchId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Comments": - comments = this.core.GetAttributeValue(sourceLineNumbers, attrib); + comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Manufacturer": - manufacturer = this.core.GetAttributeValue(sourceLineNumbers, attrib); + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MinorUpdateTargetRTM": - minorUpdateTargetRTM = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + minorUpdateTargetRTM = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "MoreInfoURL": - moreInfoUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "OptimizedInstallMode": - optimizedInstallMode = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "TargetProductName": - targetProductName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ApiPatchingSymbolNoImagehlpFlag": - apiPatchingSymbolFlags |= (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_IMAGEHLP : 0; + apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_IMAGEHLP : 0; break; case "ApiPatchingSymbolNoFailuresFlag": - apiPatchingSymbolFlags |= (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_FAILURES : 0; + apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_FAILURES : 0; break; case "ApiPatchingSymbolUndecoratedTooFlag": - apiPatchingSymbolFlags |= (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_UNDECORATED_TOO : 0; + apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_UNDECORATED_TOO : 0; break; case "OptimizePatchSizeForLargeFiles": - optimizePatchSizeForLargeFiles = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); + optimizePatchSizeForLargeFiles = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -9498,11 +9450,11 @@ namespace WixToolset if (null == this.activeName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == classification) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Classification")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Classification")); } if (null == clientPatchId) { @@ -9510,18 +9462,18 @@ namespace WixToolset } if (null == description) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); } if (null == displayName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayName")); } if (null == manufacturer) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); } - this.core.CreateActiveSection(this.activeName, SectionType.Patch, codepage); + this.Core.CreateActiveSection(this.activeName, SectionType.Patch, codepage, this.Context.CompilationId); foreach (XElement child in node.Elements()) { @@ -9557,118 +9509,118 @@ namespace WixToolset this.ParseTargetProductCodesElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row patchIdRow = this.core.CreateRow(sourceLineNumbers, "WixPatchId"); - patchIdRow[0] = patchId; - patchIdRow[1] = clientPatchId; - patchIdRow[2] = optimizePatchSizeForLargeFiles ? 1 : 0; - patchIdRow[3] = apiPatchingSymbolFlags; + var patchIdRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchId); + patchIdRow.Set(0, patchId); + patchIdRow.Set(1, clientPatchId); + patchIdRow.Set(2, optimizePatchSizeForLargeFiles ? 1 : 0); + patchIdRow.Set(3, apiPatchingSymbolFlags); if (allowRemoval) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "AllowRemoval"; - row[2] = allowRemoval ? "1" : "0"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "AllowRemoval"); + row.Set(2, allowRemoval ? "1" : "0"); } if (null != classification) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "Classification"; - row[2] = classification; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "Classification"); + row.Set(2, classification); } // always generate the CreationTimeUTC { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "CreationTimeUTC"; - row[2] = DateTime.UtcNow.ToString("MM-dd-yy HH:mm", CultureInfo.InvariantCulture); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "CreationTimeUTC"); + row.Set(2, DateTime.UtcNow.ToString("MM-dd-yy HH:mm", CultureInfo.InvariantCulture)); } if (null != description) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "Description"; - row[2] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "Description"); + row.Set(2, description); } if (null != displayName) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "DisplayName"; - row[2] = displayName; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "DisplayName"); + row.Set(2, displayName); } if (null != manufacturer) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "ManufacturerName"; - row[2] = manufacturer; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "ManufacturerName"); + row.Set(2, manufacturer); } if (YesNoType.NotSet != minorUpdateTargetRTM) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "MinorUpdateTargetRTM"; - row[2] = YesNoType.Yes == minorUpdateTargetRTM ? "1" : "0"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "MinorUpdateTargetRTM"); + row.Set(2, YesNoType.Yes == minorUpdateTargetRTM ? "1" : "0"); } if (null != moreInfoUrl) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "MoreInfoURL"; - row[2] = moreInfoUrl; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "MoreInfoURL"); + row.Set(2, moreInfoUrl); } if (CompilerConstants.IntegerNotSet != optimizeCA) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "OptimizeCA"; - row[2] = optimizeCA.ToString(CultureInfo.InvariantCulture); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "OptimizeCA"); + row.Set(2, optimizeCA.ToString(CultureInfo.InvariantCulture)); } if (YesNoType.NotSet != optimizedInstallMode) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "OptimizedInstallMode"; - row[2] = YesNoType.Yes == optimizedInstallMode ? "1" : "0"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "OptimizedInstallMode"); + row.Set(2, YesNoType.Yes == optimizedInstallMode ? "1" : "0"); } if (null != targetProductName) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchMetadata"); - row[0] = null; - row[1] = "TargetProductName"; - row[2] = targetProductName; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchMetadata); + row.Set(0, null); + row.Set(1, "TargetProductName"); + row.Set(2, targetProductName); } if (null != comments) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixPatchMetadata"); - row[0] = "Comments"; - row[1] = comments; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchMetadata); + row.Set(0, "Comments"); + row.Set(1, comments); } } // TODO: do something with versionMismatches and productMismatches @@ -9693,44 +9645,44 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "ProductCode": - productCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Version": - version = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "Supersede": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= 0x1; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } if (String.IsNullOrEmpty(version)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } else if (!CompilerCore.IsValidProductVersion(version)) { - this.core.OnMessage(WixErrors.InvalidProductVersion(sourceLineNumbers, version)); + this.Core.OnMessage(WixErrors.InvalidProductVersion(sourceLineNumbers, version)); } // find unexpected child elements @@ -9771,27 +9723,27 @@ namespace WixToolset this.ParsePatchChildRefElement(child, "WixUI"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiPatchSequence", id); - row[1] = productCode; - row[2] = version; - row[3] = attributes; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiPatchSequence, id); + row.Set(1, productCode); + row.Set(2, version); + row.Set(3, attributes); if (ComplexReferenceParentType.Unknown != parentType) { - this.core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamily, id.Id, ComplexReferenceParentType.Patch == parentType); + this.Core.CreateComplexReference(sourceLineNumbers, parentType, parentId, null, ComplexReferenceChildType.PatchFamily, id.Id, ComplexReferenceParentType.Patch == parentType); } } } @@ -9809,22 +9761,22 @@ namespace WixToolset { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); // Always warn when using the All element. - this.core.OnMessage(WixWarnings.AllChangesIncludedInPatch(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.AllChangesIncludedInPatch(sourceLineNumbers)); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreatePatchFamilyChildReference(sourceLineNumbers, "*", "*"); + this.Core.CreatePatchFamilyChildReference(sourceLineNumbers, "*", "*"); } } @@ -9845,29 +9797,29 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreatePatchFamilyChildReference(sourceLineNumbers, tableName, id); + this.Core.CreatePatchFamilyChildReference(sourceLineNumbers, tableName, id); } } @@ -9890,27 +9842,27 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (27 < id.Id.Length) { - this.core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, 27)); + this.Core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, 27)); } foreach (XElement child in node.Elements()) @@ -9923,7 +9875,7 @@ namespace WixToolset if (parsedValidate) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } else { @@ -9932,21 +9884,21 @@ namespace WixToolset } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixPatchBaseline", id); - row[1] = diskId; - row[2] = (int)validationFlags; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchBaseline, id); + row.Set(1, diskId); + row.Set(2, (int)validationFlags); } } @@ -9966,7 +9918,7 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "ProductId": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ValidateProduct; } @@ -9976,7 +9928,7 @@ namespace WixToolset } break; case "ProductLanguage": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ValidateLanguage; } @@ -9986,7 +9938,7 @@ namespace WixToolset } break; case "ProductVersion": - string check = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string check = this.Core.GetAttributeValue(sourceLineNumbers, attrib); validationFlags &= ~TransformFlags.ProductVersionMask; Wix.Validate.ProductVersionType productVersionType = Wix.Validate.ParseProductVersionType(check); switch (productVersionType) @@ -10001,12 +9953,12 @@ namespace WixToolset validationFlags |= TransformFlags.ValidateUpdateVersion; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Version", check, "Major", "Minor", "Update")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Version", check, "Major", "Minor", "Update")); break; } break; case "ProductVersionOperator": - string op = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string op = this.Core.GetAttributeValue(sourceLineNumbers, attrib); validationFlags &= ~TransformFlags.ProductVersionOperatorMask; Wix.Validate.ProductVersionOperatorType opType = Wix.Validate.ParseProductVersionOperatorType(op); switch (opType) @@ -10027,12 +9979,12 @@ namespace WixToolset validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Operator", op, "Lesser", "LesserOrEqual", "Equal", "GreaterOrEqual", "Greater")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Operator", op, "Lesser", "LesserOrEqual", "Equal", "GreaterOrEqual", "Greater")); break; } break; case "UpgradeCode": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ValidateUpgradeCode; } @@ -10042,7 +9994,7 @@ namespace WixToolset } break; case "IgnoreAddExistingRow": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorAddExistingRow; } @@ -10052,7 +10004,7 @@ namespace WixToolset } break; case "IgnoreAddExistingTable": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorAddExistingTable; } @@ -10062,7 +10014,7 @@ namespace WixToolset } break; case "IgnoreDeleteMissingRow": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorDeleteMissingRow; } @@ -10072,7 +10024,7 @@ namespace WixToolset } break; case "IgnoreDeleteMissingTable": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorDeleteMissingTable; } @@ -10082,7 +10034,7 @@ namespace WixToolset } break; case "IgnoreUpdateMissingRow": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorUpdateMissingRow; } @@ -10092,7 +10044,7 @@ namespace WixToolset } break; case "IgnoreChangingCodePage": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { validationFlags |= TransformFlags.ErrorChangeCodePage; } @@ -10102,13 +10054,13 @@ namespace WixToolset } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -10122,11 +10074,11 @@ namespace WixToolset /// Value of the property. private void ProcessProperties(SourceLineNumber sourceLineNumbers, string name, string value) { - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Properties"); - row[0] = name; - row[1] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Properties); + row.Set(0, name); + row.Set(1, value); } } @@ -10148,47 +10100,47 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "RequiredId": - requiredId = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + requiredId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "RequiredLanguage": - requiredLanguage = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + requiredLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "RequiredVersion": - requiredVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + requiredVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == requiredId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RequiredId")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RequiredId")); requiredId = String.Empty; } if (CompilerConstants.IntegerNotSet == requiredLanguage) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RequiredLanguage")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RequiredLanguage")); requiredLanguage = CompilerConstants.IllegalInteger; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleDependency"); - row[0] = this.activeName; - row[1] = this.activeLanguage; - row[2] = requiredId; - row[3] = requiredLanguage.ToString(CultureInfo.InvariantCulture); - row[4] = requiredVersion; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleDependency); + row.Set(0, this.activeName); + row.Set(1, this.activeLanguage); + row.Set(2, requiredId); + row.Set(3, requiredLanguage.ToString(CultureInfo.InvariantCulture)); + row.Set(4, requiredVersion); } } @@ -10213,40 +10165,40 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "ExcludedId": - excludedId = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + excludedId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ExcludeExceptLanguage": - excludeExceptLanguage = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + excludeExceptLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "ExcludeLanguage": - excludeLanguage = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + excludeLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "ExcludedMaxVersion": - excludedMaxVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + excludedMaxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ExcludedMinVersion": - excludedMinVersion = this.core.GetAttributeValue(sourceLineNumbers, attrib); + excludedMinVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == excludedId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ExcludedId")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ExcludedId")); excludedId = String.Empty; } if (CompilerConstants.IntegerNotSet != excludeExceptLanguage && CompilerConstants.IntegerNotSet != excludeLanguage) { - this.core.OnMessage(WixErrors.IllegalModuleExclusionLanguageAttributes(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.IllegalModuleExclusionLanguageAttributes(sourceLineNumbers)); } else if (CompilerConstants.IntegerNotSet != excludeExceptLanguage) { @@ -10257,17 +10209,17 @@ namespace WixToolset excludedLanguageField = Convert.ToString(excludeLanguage, CultureInfo.InvariantCulture); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleExclusion"); - row[0] = this.activeName; - row[1] = this.activeLanguage; - row[2] = excludedId; - row[3] = excludedLanguageField; - row[4] = excludedMinVersion; - row[5] = excludedMaxVersion; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleExclusion); + row.Set(0, this.activeName); + row.Set(1, this.activeLanguage); + row.Set(2, excludedId); + row.Set(3, excludedLanguageField); + row.Set(4, excludedMinVersion); + row.Set(5, excludedMaxVersion); } } @@ -10296,22 +10248,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Name": - name = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ContextData": - contextData = this.core.GetAttributeValue(sourceLineNumbers, attrib); + contextData = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DefaultValue": - defaultValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + defaultValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Format": - string formatStr = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string formatStr = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < formatStr.Length) { Wix.Configuration.FormatType formatType = Wix.Configuration.ParseFormatType(formatStr); @@ -10330,70 +10282,70 @@ namespace WixToolset format = 3; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Format", formatStr, "Text", "Key", "Integer", "Bitfield")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Format", formatStr, "Text", "Key", "Integer", "Bitfield")); break; } } break; case "HelpKeyword": - helpKeyword = this.core.GetAttributeValue(sourceLineNumbers, attrib); + helpKeyword = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "HelpLocation": - helpLocation = this.core.GetAttributeValue(sourceLineNumbers, attrib); + helpLocation = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "KeyNoOrphan": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan; } break; case "NonNullable": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= MsiInterop.MsidbMsmConfigurableOptionNonNullable; } break; case "Type": - type = this.core.GetAttributeValue(sourceLineNumbers, attrib); + type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); name = String.Empty; } if (CompilerConstants.IntegerNotSet == format) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Format")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Format")); format = CompilerConstants.IllegalInteger; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleConfiguration"); - row[0] = name; - row[1] = format; - row[2] = type; - row[3] = contextData; - row[4] = defaultValue; - row[5] = attributes; - row[6] = displayName; - row[7] = description; - row[8] = helpLocation; - row[9] = helpKeyword; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleConfiguration); + row.Set(0, name); + row.Set(1, format); + row.Set(2, type); + row.Set(3, contextData); + row.Set(4, defaultValue); + row.Set(5, attributes); + row.Set(6, displayName); + row.Set(7, description); + row.Set(8, helpLocation); + row.Set(9, helpKeyword); } } @@ -10416,54 +10368,54 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Column": - column = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + column = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Row": - rowKeys = this.core.GetAttributeValue(sourceLineNumbers, attrib); + rowKeys = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Table": - table = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + table = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == column) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Column")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Column")); column = String.Empty; } if (null == table) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Table")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Table")); table = String.Empty; } if (null == rowKeys) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Row")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Row")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleSubstitution"); - row[0] = table; - row[1] = rowKeys; - row[2] = column; - row[3] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleSubstitution); + row.Set(0, table); + row.Set(1, rowKeys); + row.Set(2, column); + row.Set(3, value); } } @@ -10483,30 +10435,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ModuleIgnoreTable"); - row[0] = id; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ModuleIgnoreTable); + row.Set(0, id); } } @@ -10517,7 +10469,7 @@ namespace WixToolset /// Identifier of parent component. /// Default identifer for driver/translator file. /// Table we're processing for. - private void ParseODBCDriverOrTranslator(XElement node, string componentId, string fileId, TableDefinition table) + private void ParseODBCDriverOrTranslator(XElement node, string componentId, string fileId, TupleDefinitionType tableName) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); Identifier id = null; @@ -10532,42 +10484,42 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "File": - driver = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", driver); + driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SetupFile": - setup = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", setup); + setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (null == id) { - id = this.core.CreateIdentifier("odb", name, fileId, setup); + id = this.Core.CreateIdentifier("odb", name, fileId, setup); } // drivers have a few possible children - if ("ODBCDriver" == table.Name) + if (TupleDefinitionType.ODBCDriver == tableName) { // process any data sources for the driver foreach (XElement child in node.Elements()) @@ -10581,31 +10533,31 @@ namespace WixToolset this.ParseODBCDataSource(child, componentId, name, out ignoredKeyPath); break; case "Property": - this.ParseODBCProperty(child, id.Id, "ODBCAttribute"); + this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCAttribute); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } else { - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, table.Name, id); - row[1] = componentId; - row[2] = name; - row[3] = driver; - row[4] = setup; + var row = this.Core.CreateRow(sourceLineNumbers, tableName, id); + row.Set(1, componentId); + row.Set(2, name); + row.Set(3, driver); + row.Set(4, setup); } } @@ -10615,7 +10567,7 @@ namespace WixToolset /// Element to parse. /// Identifier of parent driver or translator. /// Name of the table to create property in. - private void ParseODBCProperty(XElement node, string parentId, string tableName) + private void ParseODBCProperty(XElement node, string parentId, TupleDefinitionType tableName) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); string id = null; @@ -10628,35 +10580,35 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - propertyValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + propertyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, tableName); - row[0] = parentId; - row[1] = id; - row[2] = propertyValue; + var row = this.Core.CreateRow(sourceLineNumbers, tableName); + row.Set(0, parentId); + row.Set(1, id); + row.Set(2, propertyValue); } } @@ -10683,19 +10635,19 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "DriverName": - driverName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + driverName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "KeyPath": - keyPath = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Registration": - string registrationValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string registrationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < registrationValue.Length) { Wix.ODBCDataSource.RegistrationType registrationType = Wix.ODBCDataSource.ParseRegistrationType(registrationValue); @@ -10708,31 +10660,31 @@ namespace WixToolset registration = 1; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Registration", registrationValue, "machine", "user")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Registration", registrationValue, "machine", "user")); break; } } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (CompilerConstants.IntegerNotSet == registration) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Registration")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Registration")); registration = CompilerConstants.IllegalInteger; } if (null == id) { - id = this.core.CreateIdentifier("odc", name, driverName, registration.ToString()); + id = this.Core.CreateIdentifier("odc", name, driverName, registration.ToString()); } foreach (XElement child in node.Elements()) @@ -10742,26 +10694,26 @@ namespace WixToolset switch (child.Name.LocalName) { case "Property": - this.ParseODBCProperty(child, id.Id, "ODBCSourceAttribute"); + this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCSourceAttribute); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ODBCDataSource", id); - row[1] = componentId; - row[2] = name; - row[3] = driverName; - row[4] = registration; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ODBCDataSource, id); + row.Set(1, componentId); + row.Set(2, name); + row.Set(3, driverName); + row.Set(4, registration); } possibleKeyPath = id.Id; @@ -10789,7 +10741,7 @@ namespace WixToolset string platformValue = null; YesNoDefaultType security = YesNoDefaultType.Default; int sourceBits = (this.compilingModule ? 2 : 0); - Row row; + IntermediateTuple row; bool installPrivilegeSeen = false; bool installScopeSeen = false; @@ -10821,34 +10773,34 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - packageCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, this.compilingProduct); + packageCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, this.compilingProduct); break; case "AdminImage": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { sourceBits = sourceBits | 4; } break; case "Comments": - comments = this.core.GetAttributeValue(sourceLineNumbers, attrib); + comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Compressed": // merge modules must always be compressed, so this attribute is invalid if (this.compilingModule) { - this.core.OnMessage(WixWarnings.DeprecatedPackageCompressedAttribute(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.DeprecatedPackageCompressedAttribute(sourceLineNumbers)); // this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Compressed", "Module")); } - else if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + else if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { sourceBits = sourceBits | 2; } break; case "Description": - packageName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "InstallPrivileges": - string installPrivileges = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string installPrivileges = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < installPrivileges.Length) { installPrivilegeSeen = true; @@ -10862,13 +10814,13 @@ namespace WixToolset sourceBits = sourceBits | 8; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installPrivileges, "elevated", "limited")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installPrivileges, "elevated", "limited")); break; } } break; case "InstallScope": - string installScope = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < installScope.Length) { installScopeSeen = true; @@ -10876,47 +10828,47 @@ namespace WixToolset switch (installScopeType) { case Wix.Package.InstallScopeType.perMachine: - row = this.core.CreateRow(sourceLineNumbers, "Property"); - row[0] = "ALLUSERS"; - row[1] = "1"; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Property); + row.Set(0, "ALLUSERS"); + row.Set(1, "1"); break; case Wix.Package.InstallScopeType.perUser: sourceBits = sourceBits | 8; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser")); break; } } break; case "InstallerVersion": - msiVersion = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "Keywords": - keywords = this.core.GetAttributeValue(sourceLineNumbers, attrib); + keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Languages": - packageLanguages = this.core.GetAttributeValue(sourceLineNumbers, attrib); + packageLanguages = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Manufacturer": - packageAuthor = this.core.GetAttributeValue(sourceLineNumbers, attrib); + packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if ("PUT-COMPANY-NAME-HERE" == packageAuthor) { - this.core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor)); + this.Core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor)); } break; case "Platform": if (null != platformValue) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platforms")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platforms")); } - platformValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); Wix.Package.PlatformType platformType = Wix.Package.ParsePlatformType(platformValue); switch (platformType) { case Wix.Package.PlatformType.intel: - this.core.OnMessage(WixWarnings.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "x86")); + this.Core.OnMessage(WixWarnings.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "x86")); goto case Wix.Package.PlatformType.x86; case Wix.Package.PlatformType.x86: platform = "Intel"; @@ -10925,7 +10877,7 @@ namespace WixToolset platform = "x64"; break; case Wix.Package.PlatformType.intel64: - this.core.OnMessage(WixWarnings.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "ia64")); + this.Core.OnMessage(WixWarnings.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "ia64")); goto case Wix.Package.PlatformType.ia64; case Wix.Package.PlatformType.ia64: platform = "Intel64"; @@ -10934,71 +10886,71 @@ namespace WixToolset platform = "Arm"; break; default: - this.core.OnMessage(WixErrors.InvalidPlatformValue(sourceLineNumbers, platformValue)); + this.Core.OnMessage(WixErrors.InvalidPlatformValue(sourceLineNumbers, platformValue)); break; } break; case "Platforms": if (null != platformValue) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); } - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); - platformValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); + platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); platform = platformValue; break; case "ReadOnly": - security = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; case "ShortNames": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { sourceBits = sourceBits | 1; this.useShortFileNames = true; } break; case "SummaryCodepage": - codepage = this.core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true); + codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (installPrivilegeSeen && installScopeSeen) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "InstallPrivileges", "InstallScope")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "InstallPrivileges", "InstallScope")); } if ((0 != String.Compare(platform, "Intel", StringComparison.OrdinalIgnoreCase)) && 200 > msiVersion) { msiVersion = 200; - this.core.OnMessage(WixWarnings.RequiresMsi200for64bitPackage(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.RequiresMsi200for64bitPackage(sourceLineNumbers)); } if ((0 == String.Compare(platform, "Arm", StringComparison.OrdinalIgnoreCase)) && 500 > msiVersion) { msiVersion = 500; - this.core.OnMessage(WixWarnings.RequiresMsi500forArmPackage(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.RequiresMsi500forArmPackage(sourceLineNumbers)); } if (null == packageAuthor) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); } if (this.compilingModule) { if (null == packageCode) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } // merge modules use the modularization guid as the package code @@ -11019,66 +10971,66 @@ namespace WixToolset if ("*" != packageCode) { - this.core.OnMessage(WixWarnings.PackageCodeSet(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.PackageCodeSet(sourceLineNumbers)); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 1; - row[1] = codepage; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 1); + row.Set(1, codepage); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 2; - row[1] = "Installation Database"; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 2); + row.Set(1, "Installation Database"); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 3; - row[1] = packageName; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 3); + row.Set(1, packageName); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 4; - row[1] = packageAuthor; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 4); + row.Set(1, packageAuthor); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 5; - row[1] = keywords; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 5); + row.Set(1, keywords); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 6; - row[1] = comments; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 6); + row.Set(1, comments); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 7; - row[1] = String.Format(CultureInfo.InvariantCulture, "{0};{1}", platform, packageLanguages); + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 7); + row.Set(1, String.Format(CultureInfo.InvariantCulture, "{0};{1}", platform, packageLanguages)); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 9; - row[1] = packageCode; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 9); + row.Set(1, packageCode); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 14; - row[1] = msiVersion.ToString(CultureInfo.InvariantCulture); + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 14); + row.Set(1, msiVersion.ToString(CultureInfo.InvariantCulture)); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 15; - row[1] = sourceBits.ToString(CultureInfo.InvariantCulture); + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 15); + row.Set(1, sourceBits.ToString(CultureInfo.InvariantCulture)); - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 19; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 19); switch (security) { case YesNoDefaultType.No: // no restriction - row[1] = "0"; + row.Set(1, "0"); break; case YesNoDefaultType.Default: // read-only recommended - row[1] = "2"; + row.Set(1, "2"); break; case YesNoDefaultType.Yes: // read-only enforced - row[1] = "4"; + row.Set(1, "4"); break; } } @@ -11110,79 +11062,79 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "AllowRemoval": - allowRemoval = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowRemoval = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Classification": - classification = this.core.GetAttributeValue(sourceLineNumbers, attrib); + classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "CreationTimeUTC": - creationTimeUtc = this.core.GetAttributeValue(sourceLineNumbers, attrib); + creationTimeUtc = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ManufacturerName": - manufacturerName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + manufacturerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MinorUpdateTargetRTM": - minorUpdateTargetRTM = this.core.GetAttributeValue(sourceLineNumbers, attrib); + minorUpdateTargetRTM = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "MoreInfoURL": - moreInfoUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "OptimizedInstallMode": - optimizedInstallMode = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "TargetProductName": - targetProductName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (YesNoType.NotSet == allowRemoval) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AllowRemoval")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AllowRemoval")); } if (null == classification) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Classification")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Classification")); } if (null == description) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); } if (null == displayName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayName")); } if (null == manufacturerName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ManufacturerName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ManufacturerName")); } if (null == moreInfoUrl) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "MoreInfoURL")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "MoreInfoURL")); } if (null == targetProductName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "TargetProductName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "TargetProductName")); } foreach (XElement child in node.Elements()) @@ -11198,104 +11150,104 @@ namespace WixToolset optimizeCA = this.ParseOptimizeCustomActionsElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (YesNoType.NotSet != allowRemoval) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "AllowRemoval"; - row[2] = YesNoType.Yes == allowRemoval ? "1" : "0"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "AllowRemoval"); + row.Set(2, YesNoType.Yes == allowRemoval ? "1" : "0"); } if (null != classification) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "Classification"; - row[2] = classification; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "Classification"); + row.Set(2, classification); } if (null != creationTimeUtc) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "CreationTimeUTC"; - row[2] = creationTimeUtc; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "CreationTimeUTC"); + row.Set(2, creationTimeUtc); } if (null != description) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "Description"; - row[2] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "Description"); + row.Set(2, description); } if (null != displayName) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "DisplayName"; - row[2] = displayName; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "DisplayName"); + row.Set(2, displayName); } if (null != manufacturerName) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "ManufacturerName"; - row[2] = manufacturerName; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "ManufacturerName"); + row.Set(2, manufacturerName); } if (null != minorUpdateTargetRTM) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "MinorUpdateTargetRTM"; - row[2] = minorUpdateTargetRTM; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "MinorUpdateTargetRTM"); + row.Set(2, minorUpdateTargetRTM); } if (null != moreInfoUrl) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "MoreInfoURL"; - row[2] = moreInfoUrl; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "MoreInfoURL"); + row.Set(2, moreInfoUrl); } if (CompilerConstants.IntegerNotSet != optimizeCA) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "OptimizeCA"; - row[2] = optimizeCA.ToString(CultureInfo.InvariantCulture); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "OptimizeCA"); + row.Set(2, optimizeCA.ToString(CultureInfo.InvariantCulture)); } if (YesNoType.NotSet != optimizedInstallMode) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "OptimizedInstallMode"; - row[2] = YesNoType.Yes == optimizedInstallMode ? "1" : "0"; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "OptimizedInstallMode"); + row.Set(2, YesNoType.Yes == optimizedInstallMode ? "1" : "0"); } if (null != targetProductName) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = null; - row[1] = "TargetProductName"; - row[2] = targetProductName; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, null); + row.Set(1, "TargetProductName"); + row.Set(2, targetProductName); } } } @@ -11318,48 +11270,48 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Company": - company = this.core.GetAttributeValue(sourceLineNumbers, attrib); + company = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Property": - property = this.core.GetAttributeValue(sourceLineNumbers, attrib); + property = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == company) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Company")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Company")); } if (null == property) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "PatchMetadata"); - row[0] = company; - row[1] = property; - row[2] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.PatchMetadata); + row.Set(0, company); + row.Set(1, property); + row.Set(2, value); } } @@ -11380,31 +11332,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "SkipAssignment": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { optimizeCA |= OptimizeCA.SkipAssignment; } break; case "SkipImmediate": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { optimizeCA |= OptimizeCA.SkipImmediate; } break; case "SkipDeferred": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { optimizeCA |= OptimizeCA.SkipDeferred; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -11433,118 +11385,118 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "AdminImage": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "Comments": - comments = this.core.GetAttributeValue(sourceLineNumbers, attrib); + comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Compressed": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "Description": - packageName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Keywords": - keywords = this.core.GetAttributeValue(sourceLineNumbers, attrib); + keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Languages": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "Manufacturer": - packageAuthor = this.core.GetAttributeValue(sourceLineNumbers, attrib); + packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Platforms": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "ReadOnly": - security = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; case "ShortNames": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "SummaryCodepage": - codepage = this.core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib); + codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { // PID_CODEPAGE - Row row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 1; - row[1] = codepage; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 1); + row.Set(1, codepage); // PID_TITLE - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 2; - row[1] = "Patch"; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 2); + row.Set(1, "Patch"); // PID_SUBJECT if (null != packageName) { - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 3; - row[1] = packageName; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 3); + row.Set(1, packageName); } // PID_AUTHOR if (null != packageAuthor) { - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 4; - row[1] = packageAuthor; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 4); + row.Set(1, packageAuthor); } // PID_KEYWORDS if (null != keywords) { - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 5; - row[1] = keywords; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 5); + row.Set(1, keywords); } // PID_COMMENTS if (null != comments) { - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 6; - row[1] = comments; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 6); + row.Set(1, comments); } // PID_PAGECOUNT - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 14; - row[1] = msiVersion.ToString(CultureInfo.InvariantCulture); + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 14); + row.Set(1, msiVersion.ToString(CultureInfo.InvariantCulture)); // PID_WORDCOUNT - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 15; - row[1] = "0"; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 15); + row.Set(1, "0"); // PID_SECURITY - row = this.core.CreateRow(sourceLineNumbers, "_SummaryInformation"); - row[0] = 19; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType._SummaryInformation); + row.Set(0, 19); switch (security) { case YesNoDefaultType.No: // no restriction - row[1] = "0"; + row.Set(1, "0"); break; case YesNoDefaultType.Default: // read-only recommended - row[1] = "2"; + row.Set(1, "2"); break; case YesNoDefaultType.Yes: // read-only enforced - row[1] = "4"; + row.Set(1, "4"); break; } } @@ -11559,7 +11511,7 @@ namespace WixToolset SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); string name = null; - this.core.OnMessage(WixWarnings.DeprecatedIgnoreModularizationElement(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.DeprecatedIgnoreModularizationElement(sourceLineNumbers)); foreach (XAttribute attrib in node.Attributes()) { @@ -11568,33 +11520,33 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Name": - name = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Type": // this is actually not used break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixSuppressModularization"); - row[0] = name; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixSuppressModularization); + row.Set(0, name); } } @@ -11625,7 +11577,7 @@ namespace WixToolset specialPermissions = Common.RegistryPermissions; break; default: - this.core.UnexpectedElement(node.Parent, node); + this.Core.UnexpectedElement(node.Parent, node); return; // stop processing this element since no valid permissions are available } @@ -11636,10 +11588,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Domain": - domain = this.core.GetAttributeValue(sourceLineNumbers, attrib); + domain = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "User": - user = this.core.GetAttributeValue(sourceLineNumbers, attrib); + user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "FileAllRights": // match the WinNT.h mask FILE_ALL_ACCESS for value 0x001F01FF (aka 1 1111 0000 0001 1111 1111 or 2032127) @@ -11650,14 +11602,14 @@ namespace WixToolset bits[0] = bits[1] = bits[2] = bits[3] = bits[4] = bits[5] = bits[6] = bits[7] = bits[8] = bits[9] = bits[10] = bits[11] = bits[12] = bits[13] = bits[14] = bits[15] = true; break; default: - YesNoType attribValue = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - if (!this.core.TrySetBitFromName(Common.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16)) + YesNoType attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + if (!this.Core.TrySetBitFromName(Common.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16)) { - if (!this.core.TrySetBitFromName(Common.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28)) + if (!this.Core.TrySetBitFromName(Common.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28)) { - if (!this.core.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0)) + if (!this.Core.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0)) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } @@ -11667,32 +11619,32 @@ namespace WixToolset } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - permission = this.core.CreateIntegerFromBitArray(bits); + permission = this.Core.CreateIntegerFromBitArray(bits); if (null == user) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "User")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "User")); } if (int.MinValue == permission) // just GENERIC_READ, which is MSI_NULL { - this.core.OnMessage(WixErrors.GenericReadNotAllowed(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.GenericReadNotAllowed(sourceLineNumbers)); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "LockPermissions"); - row[0] = objectId; - row[1] = tableName; - row[2] = domain; - row[3] = user; - row[4] = permission; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LockPermissions); + row.Set(0, objectId); + row.Set(1, tableName); + row.Set(2, domain); + row.Set(3, user); + row.Set(4, permission); } } @@ -11717,7 +11669,7 @@ namespace WixToolset case "ServiceInstall": break; default: - this.core.UnexpectedElement(node.Parent, node); + this.Core.UnexpectedElement(node.Parent, node); return; // stop processing this element since nothing will be valid. } @@ -11728,30 +11680,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Sddl": - sddl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sddl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == sddl) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Sddl")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Sddl")); } if (null == id) { - id = this.core.CreateIdentifier("pme", objectId, tableName, sddl); + id = this.Core.CreateIdentifier("pme", objectId, tableName, sddl); } foreach (XElement child in node.Elements()) @@ -11764,29 +11716,29 @@ namespace WixToolset if (null != condition) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } condition = this.ParseConditionElement(child, node.Name.LocalName, null, null); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiLockPermissionsEx", id); - row[1] = objectId; - row[2] = tableName; - row[3] = sddl; - row[4] = condition; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiLockPermissionsEx, id); + row.Set(1, objectId); + row.Set(2, tableName); + row.Set(3, sddl); + row.Set(4, condition); } } @@ -11815,84 +11767,84 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - productCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); + productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); break; case "Codepage": - codepage = this.core.GetAttributeCodePageValue(sourceLineNumbers, attrib); + codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); break; case "Language": - this.activeLanguage = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Manufacturer": - manufacturer = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); if ("PUT-COMPANY-NAME-HERE" == manufacturer) { - this.core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, manufacturer)); + this.Core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, manufacturer)); } break; case "Name": - this.activeName = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); + this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); if ("PUT-PRODUCT-NAME-HERE" == this.activeName) { - this.core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); + this.Core.OnMessage(WixWarnings.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); } break; case "UpgradeCode": - upgradeCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Version": // if the attribute is valid version, use the attribute value as is (so "1.0000.01.01" would *not* get translated to "1.0.1.1"). - string verifiedVersion = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + string verifiedVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); if (!String.IsNullOrEmpty(verifiedVersion)) { version = attrib.Value; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == productCode) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == this.activeLanguage) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); } if (null == manufacturer) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); } if (null == this.activeName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (null == upgradeCode) { - this.core.OnMessage(WixWarnings.MissingUpgradeCode(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.MissingUpgradeCode(sourceLineNumbers)); } if (null == version) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } else if (!CompilerCore.IsValidProductVersion(version)) { - this.core.OnMessage(WixErrors.InvalidProductVersion(sourceLineNumbers, version)); + this.Core.OnMessage(WixErrors.InvalidProductVersion(sourceLineNumbers, version)); } - if (this.core.EncounteredError) + if (this.Core.EncounteredError) { return; } @@ -11900,7 +11852,7 @@ namespace WixToolset try { this.compilingProduct = true; - this.core.CreateActiveSection(productCode, SectionType.Product, codepage); + this.Core.CreateActiveSection(productCode, SectionType.Product, codepage, this.Context.CompilationId); this.AddProperty(sourceLineNumbers, new Identifier("Manufacturer", AccessModifier.Public), manufacturer, false, false, false, true); this.AddProperty(sourceLineNumbers, new Identifier("ProductCode", AccessModifier.Public), productCode, false, false, false, true); @@ -12045,21 +11997,21 @@ namespace WixToolset this.ParseWixVariableElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (null != symbols) { - WixDeltaPatchSymbolPathsRow symbolRow = (WixDeltaPatchSymbolPathsRow)this.core.CreateRow(sourceLineNumbers, "WixDeltaPatchSymbolPaths"); + var symbolRow = (WixDeltaPatchSymbolPathsTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixDeltaPatchSymbolPaths); symbolRow.Id = productCode; symbolRow.Type = SymbolPathType.Product; symbolRow.SymbolPaths = symbols; @@ -12100,37 +12052,37 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - progId = this.core.GetAttributeValue(sourceLineNumbers, attrib); + progId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Advertise": - progIdAdvertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + progIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "Icon": - icon = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "IconIndex": - iconIndex = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); + iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); break; case "NoOpen": - noOpen = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + noOpen = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if ((YesNoType.No == advertise && YesNoType.Yes == progIdAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == progIdAdvertise)) { - this.core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, advertise.ToString(), progIdAdvertise.ToString())); + this.Core.OnMessage(WixErrors.AdvertiseStateMustMatch(sourceLineNumbers, advertise.ToString(), progIdAdvertise.ToString())); } else { @@ -12144,7 +12096,7 @@ namespace WixToolset if (null != parent && (null != icon || CompilerConstants.IntegerNotSet != iconIndex)) { - this.core.OnMessage(WixErrors.VersionIndependentProgIdsCannotHaveIcons(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.VersionIndependentProgIdsCannotHaveIcons(sourceLineNumbers)); } YesNoType firstProgIdForNestedClass = YesNoType.Yes; @@ -12176,70 +12128,70 @@ namespace WixToolset else { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.ProgIdNestedTooDeep(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.ProgIdNestedTooDeep(childSourceLineNumbers)); } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (YesNoType.Yes == advertise) { - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ProgId"); - row[0] = progId; - row[1] = parent; - row[2] = classId; - row[3] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ProgId); + row.Set(0, progId); + row.Set(1, parent); + row.Set(2, classId); + row.Set(3, description); if (null != icon) { - row[4] = icon; - this.core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); + row.Set(4, icon); + this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); } if (CompilerConstants.IntegerNotSet != iconIndex) { - row[5] = iconIndex; + row.Set(5, iconIndex); } - this.core.EnsureTable(sourceLineNumbers, "Class"); + this.Core.EnsureTable(sourceLineNumbers, "Class"); } } else if (YesNoType.No == advertise) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, progId, String.Empty, description, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, progId, String.Empty, description, componentId); if (null != classId) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\CLSID"), String.Empty, classId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\CLSID"), String.Empty, classId, componentId); if (null != parent) // if this is a version independent ProgId { if (YesNoType.Yes == firstProgIdForClass) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\VersionIndependentProgID"), String.Empty, progId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\VersionIndependentProgID"), String.Empty, progId, componentId); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\CurVer"), String.Empty, parent, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\CurVer"), String.Empty, parent, componentId); } else { if (YesNoType.Yes == firstProgIdForClass) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\ProgID"), String.Empty, progId, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\ProgID"), String.Empty, progId, componentId); } } } if (null != icon) // ProgId's Default Icon { - this.core.CreateSimpleReference(sourceLineNumbers, "File", icon); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon); icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon); @@ -12248,19 +12200,19 @@ namespace WixToolset icon = String.Concat(icon, ",", iconIndex); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\DefaultIcon"), String.Empty, icon, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(progId, "\\DefaultIcon"), String.Empty, icon, componentId); } } if (null != noOpen) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, progId, "NoOpen", noOpen, componentId); // ProgId NoOpen name + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, progId, "NoOpen", noOpen, componentId); // ProgId NoOpen name } // raise an error for an orphaned ProgId if (YesNoType.Yes == advertise && !foundExtension && null == parent && null == classId) { - this.core.OnMessage(WixWarnings.OrphanedProgId(sourceLineNumbers, progId)); + this.Core.OnMessage(WixWarnings.OrphanedProgId(sourceLineNumbers, progId)); } return progId; @@ -12288,58 +12240,58 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Admin": - admin = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + admin = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ComplianceCheck": - complianceCheck = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + complianceCheck = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Hidden": - hidden = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Secure": - secure = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + secure = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "SuppressModularization": - suppressModularization = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if ("ProductID" == id.Id) { - this.core.OnMessage(WixWarnings.ProductIdAuthored(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.ProductIdAuthored(sourceLineNumbers)); } else if ("SecureCustomProperties" == id.Id || "AdminProperties" == id.Id || "MsiHiddenProperties" == id.Id) { - this.core.OnMessage(WixErrors.CannotAuthorSpecialProperties(sourceLineNumbers, id.Id)); + this.Core.OnMessage(WixErrors.CannotAuthorSpecialProperties(sourceLineNumbers, id.Id)); } - string innerText = this.core.GetTrimmedInnerText(node); + string innerText = this.Core.GetTrimmedInnerText(node); if (null != value) { // cannot specify both the value attribute and inner text if (!String.IsNullOrEmpty(innerText)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithInnerText(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithInnerText(sourceLineNumbers, node.Name.LocalName, "Value")); } } else // value attribute not specified, use inner text if any. @@ -12349,7 +12301,7 @@ namespace WixToolset if ("ErrorDialog" == id.Id) { - this.core.CreateSimpleReference(sourceLineNumbers, "Dialog", value); + this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value); } foreach (XElement child in node.Elements()) @@ -12377,14 +12329,14 @@ namespace WixToolset // If we're doing CCP then there must be a signature. if (complianceCheck && 0 == signatures.Count) { - this.core.OnMessage(WixErrors.SearchElementRequiredWithAttribute(sourceLineNumbers, node.Name.LocalName, "ComplianceCheck", "yes")); + this.Core.OnMessage(WixErrors.SearchElementRequiredWithAttribute(sourceLineNumbers, node.Name.LocalName, "ComplianceCheck", "yes")); } foreach (string sig in signatures) { - if (complianceCheck && !this.core.EncounteredError) + if (complianceCheck && !this.Core.EncounteredError) { - this.core.CreateRow(sourceLineNumbers, "CCPSearch", new Identifier(sig, AccessModifier.Private)); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CCPSearch, new Identifier(sig, AccessModifier.Private)); } this.AddAppSearch(sourceLineNumbers, id, sig); @@ -12401,7 +12353,7 @@ namespace WixToolset // the element. if (String.IsNullOrEmpty(value) && !admin && !secure && !hidden) { - this.core.OnMessage(WixWarnings.PropertyUseless(sourceLineNumbers, id.Id)); + this.Core.OnMessage(WixWarnings.PropertyUseless(sourceLineNumbers, id.Id)); } else // there is a value and/or a flag set, do that. { @@ -12409,11 +12361,11 @@ namespace WixToolset } } - if (!this.core.EncounteredError && YesNoType.Yes == suppressModularization) + if (!this.Core.EncounteredError && YesNoType.Yes == suppressModularization) { - this.core.OnMessage(WixWarnings.PropertyModularizationSuppressed(sourceLineNumbers)); + this.Core.OnMessage(WixWarnings.PropertyModularizationSuppressed(sourceLineNumbers)); - this.core.CreateRow(sourceLineNumbers, "WixSuppressModularization", id); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixSuppressModularization, id); } } @@ -12450,11 +12402,11 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Action": - this.core.OnMessage(WixWarnings.DeprecatedRegistryKeyActionAttribute(sourceLineNumbers)); - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.DeprecatedRegistryKeyActionAttribute(sourceLineNumbers)); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < action.Length) { actionType = Wix.RegistryKey.ParseActionType(action); @@ -12470,19 +12422,19 @@ namespace WixToolset case Wix.RegistryKey.ActionType.none: break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "create", "createAndRemoveOnUninstall", "none")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "create", "createAndRemoveOnUninstall", "none")); break; } } break; case "ForceCreateOnInstall": - forceCreateOnInstall = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + forceCreateOnInstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ForceDeleteOnUninstall": - forceDeleteOnUninstall = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + forceDeleteOnUninstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (null != parentKey) { key = Path.Combine(parentKey, key); @@ -12491,19 +12443,19 @@ namespace WixToolset case "Root": if (CompilerConstants.IntegerNotSet != root) { - this.core.OnMessage(WixErrors.RegistryRootInvalid(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.RegistryRootInvalid(sourceLineNumbers)); } - root = this.core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); + root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -12514,26 +12466,26 @@ namespace WixToolset // generate the identifier if it wasn't provided if (null == id) { - id = this.core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); + id = this.Core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); } } else // does not generate a Registry row, so no Id should be present { if (null != id) { - this.core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Id", "ForceCreateOnInstall", "ForceDeleteOnUninstall", "yes", true)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Id", "ForceCreateOnInstall", "ForceDeleteOnUninstall", "yes", true)); } } if (CompilerConstants.IntegerNotSet == root) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); root = CompilerConstants.IllegalInteger; } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); key = String.Empty; // set the key to something to prevent null reference exceptions } @@ -12550,7 +12502,7 @@ namespace WixToolset { if (YesNoType.Yes == keyPath) { - this.core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); + this.Core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); } possibleKeyPath = possibleChildKeyPath; // the child is the key path @@ -12566,7 +12518,7 @@ namespace WixToolset { if (YesNoType.Yes == keyPath) { - this.core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); + this.Core.OnMessage(WixErrors.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource")); } possibleKeyPath = possibleChildKeyPath; // the child is the key path @@ -12580,38 +12532,38 @@ namespace WixToolset case "Permission": if (!forceCreateOnInstall) { - this.core.OnMessage(WixErrors.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); + this.Core.OnMessage(WixErrors.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); } this.ParsePermissionElement(child, id.Id, "Registry"); break; case "PermissionEx": if (!forceCreateOnInstall) { - this.core.OnMessage(WixErrors.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); + this.Core.OnMessage(WixErrors.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); } this.ParsePermissionExElement(child, id.Id, "Registry"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } - if (!this.core.EncounteredError && null != name) + if (!this.Core.EncounteredError && null != name) { - Row row = this.core.CreateRow(sourceLineNumbers, "Registry", id); - row[1] = root; - row[2] = key; - row[3] = name; - row[4] = null; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Registry, id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); + row.Set(4, null); + row.Set(5, componentId); } return keyPath; @@ -12653,20 +12605,20 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Action": - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < action.Length) { if (!Wix.RegistryValue.TryParseActionType(action, out actionType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "append", "prepend", "write")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "append", "prepend", "write")); } } break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (null != parentKey) { if (parentKey.EndsWith("\\", StringComparison.Ordinal)) @@ -12680,68 +12632,68 @@ namespace WixToolset } break; case "KeyPath": - keyPath = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Root": if (CompilerConstants.IntegerNotSet != root) { - this.core.OnMessage(WixErrors.RegistryRootInvalid(sourceLineNumbers)); + this.Core.OnMessage(WixErrors.RegistryRootInvalid(sourceLineNumbers)); } - root = this.core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); + root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); break; case "Type": - type = this.core.GetAttributeValue(sourceLineNumbers, attrib); + type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < type.Length) { if (!Wix.RegistryValue.TryParseTypeType(type, out typeType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, type, "binary", "expandable", "integer", "multiString", "string")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, type, "binary", "expandable", "integer", "multiString", "string")); } } break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // generate the identifier if it wasn't provided if (null == id) { - id = this.core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); + id = this.Core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); } if ((Wix.RegistryValue.ActionType.append == actionType || Wix.RegistryValue.ActionType.prepend == actionType) && Wix.RegistryValue.TypeType.multiString != typeType) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Action", action, "Type", "multiString")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Action", action, "Type", "multiString")); } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (CompilerConstants.IntegerNotSet == root) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); } if (null == type) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); } foreach (XElement child in node.Elements()) @@ -12753,7 +12705,7 @@ namespace WixToolset case "MultiStringValue": if (Wix.RegistryValue.TypeType.multiString != typeType && null != value) { - this.core.OnMessage(WixErrors.RegistryMultipleValuesWithoutMultiString(sourceLineNumbers, node.Name.LocalName, "Value", child.Name.LocalName, "Type")); + this.Core.OnMessage(WixErrors.RegistryMultipleValuesWithoutMultiString(sourceLineNumbers, node.Name.LocalName, "Value", child.Name.LocalName, "Type")); } else if (null == value) { @@ -12771,14 +12723,14 @@ namespace WixToolset this.ParsePermissionExElement(child, id.Id, "Registry"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } @@ -12824,21 +12776,21 @@ namespace WixToolset // value may be set by child MultiStringValue elements, so it must be checked here if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } else if (0 == value.Length && ("+" == name || "-" == name || "*" == name)) // prevent accidental authoring of special name values { - this.core.OnMessage(WixErrors.RegistryNameValueIncorrect(sourceLineNumbers, node.Name.LocalName, "Name", name)); + this.Core.OnMessage(WixErrors.RegistryNameValueIncorrect(sourceLineNumbers, node.Name.LocalName, "Name", name)); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Registry", id); - row[1] = root; - row[2] = key; - row[3] = name; - row[4] = value; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Registry, id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); + row.Set(4, value); + row.Set(5, componentId); } // If this was just a regular registry key (that could be the key path) @@ -12877,72 +12829,72 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Action": - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < action.Length) { if (!Wix.RemoveRegistryKey.TryParseActionType(action, out actionType)) { - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "removeOnInstall", "removeOnUninstall")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "removeOnInstall", "removeOnUninstall")); } } break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Root": - root = this.core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); + root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // generate the identifier if it wasn't provided if (null == id) { - id = this.core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); + id = this.Core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); } if (null == action) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (CompilerConstants.IntegerNotSet == root) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, (Wix.RemoveRegistryKey.ActionType.removeOnUninstall == actionType ? "Registry" : "RemoveRegistry"), id); - row[1] = root; - row[2] = key; - row[3] = name; + var row = this.Core.CreateRow(sourceLineNumbers, (Wix.RemoveRegistryKey.ActionType.removeOnUninstall == actionType ? TupleDefinitionType.Registry : TupleDefinitionType.RemoveRegistry), id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); if (Wix.RemoveRegistryKey.ActionType.removeOnUninstall == actionType) // Registry table { - row[4] = null; - row[5] = componentId; + row.Set(4, null); + row.Set(5, componentId); } else // RemoveRegistry table { - row[4] = componentId; + row.Set(4, componentId); } } } @@ -12970,53 +12922,53 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Root": - root = this.core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); + root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // generate the identifier if it wasn't provided if (null == id) { - id = this.core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); + id = this.Core.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), LowercaseOrNull(key), LowercaseOrNull(name)); } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } if (CompilerConstants.IntegerNotSet == root) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Root")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "RemoveRegistry", id); - row[1] = root; - row[2] = key; - row[3] = name; - row[4] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RemoveRegistry, id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); + row.Set(4, componentId); } } @@ -13043,16 +12995,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Directory": - directory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); + directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, true); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, true); break; case "On": - Wix.InstallUninstallType onValue = this.core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); + Wix.InstallUninstallType onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); switch (onValue) { case Wix.InstallUninstallType.install: @@ -13070,29 +13022,29 @@ namespace WixToolset } break; case "Property": - property = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, true); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, true); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (0 < name.Length) { - if (this.core.IsValidShortFilename(name, true)) + if (this.Core.IsValidShortFilename(name, true)) { if (null == shortName) { @@ -13101,51 +13053,51 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); } } else if (null == shortName) // generate a short file name. { - shortName = this.core.CreateShortName(name, true, true, node.Name.LocalName, componentId); + shortName = this.Core.CreateShortName(name, true, true, node.Name.LocalName, componentId); } } if (CompilerConstants.IntegerNotSet == on) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "On")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "On")); on = CompilerConstants.IllegalInteger; } if (null != directory && null != property) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "Directory", directory)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "Directory", directory)); } if (null == id) { - id = this.core.CreateIdentifier("rmf", directory ?? property ?? parentDirectory, LowercaseOrNull(shortName), LowercaseOrNull(name), on.ToString()); + id = this.Core.CreateIdentifier("rmf", directory ?? property ?? parentDirectory, LowercaseOrNull(shortName), LowercaseOrNull(name), on.ToString()); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "RemoveFile", id); - row[1] = componentId; - row[2] = GetMsiFilenameValue(shortName, name); + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RemoveFile, id); + row.Set(1, componentId); + row.Set(2, GetMsiFilenameValue(shortName, name)); if (null != directory) { - row[3] = directory; + row.Set(3, directory); } else if (null != property) { - row[3] = property; + row.Set(3, property); } else { - row[3] = parentDirectory; + row.Set(3, parentDirectory); } - row[4] = on; + row.Set(4, on); } } @@ -13170,13 +13122,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Directory": - directory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); + directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); break; case "On": - Wix.InstallUninstallType onValue = this.core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); + Wix.InstallUninstallType onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); switch (onValue) { case Wix.InstallUninstallType.install: @@ -13194,55 +13146,55 @@ namespace WixToolset } break; case "Property": - property = this.core.GetAttributeValue(sourceLineNumbers, attrib); + property = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (CompilerConstants.IntegerNotSet == on) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "On")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "On")); on = CompilerConstants.IllegalInteger; } if (null != directory && null != property) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "Directory", directory)); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "Directory", directory)); } if (null == id) { - id = this.core.CreateIdentifier("rmf", directory ?? property ?? parentDirectory, on.ToString()); + id = this.Core.CreateIdentifier("rmf", directory ?? property ?? parentDirectory, on.ToString()); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "RemoveFile", id); - row[1] = componentId; - row[2] = null; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RemoveFile, id); + row.Set(1, componentId); + row.Set(2, null); if (null != directory) { - row[3] = directory; + row.Set(3, directory); } else if (null != property) { - row[3] = property; + row.Set(3, property); } else { - row[3] = parentDirectory; + row.Set(3, parentDirectory); } - row[4] = on; + row.Set(4, on); } } @@ -13266,52 +13218,52 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Directory": - directoryId = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); + directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); break; case "RunFromSource": - runFromSource = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + runFromSource = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "RunLocal": - runLocal = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + runLocal = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifier("rc", componentId, directoryId); + id = this.Core.CreateIdentifier("rc", componentId, directoryId); } if (CompilerConstants.IntegerNotSet == runFromSource) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RunFromSource")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RunFromSource")); } if (CompilerConstants.IntegerNotSet == runLocal) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RunLocal")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "RunLocal")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ReserveCost", id); - row[1] = componentId; - row[2] = directoryId; - row[3] = runLocal; - row[4] = runFromSource; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ReserveCost, id); + row.Set(1, componentId); + row.Set(2, directoryId); + row.Set(3, runLocal); + row.Set(4, runFromSource); } } @@ -13354,51 +13306,51 @@ namespace WixToolset case "Action": if (customAction) { - actionName = this.core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); - this.core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName); + actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); + this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName); } else { - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); } break; case "After": if (customAction || showDialog || specialAction || specialStandardAction) { - afterAction = this.core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); - this.core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, afterAction); + afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); + this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, afterAction); } else { - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); } break; case "Before": if (customAction || showDialog || specialAction || specialStandardAction) { - beforeAction = this.core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); - this.core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, beforeAction); + beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); + this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, beforeAction); } else { - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); } break; case "Dialog": if (showDialog) { - actionName = this.core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); - this.core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName); + actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); + this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName); } else { - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); } break; case "OnExit": if (customAction || showDialog || specialAction) { - Wix.ExitType exitValue = this.core.GetAttributeExitValue(childSourceLineNumbers, attrib); + Wix.ExitType exitValue = this.Core.GetAttributeExitValue(childSourceLineNumbers, attrib); switch (exitValue) { case Wix.ExitType.success: @@ -13417,51 +13369,51 @@ namespace WixToolset } else { - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); } break; case "Overridable": - overridable = YesNoType.Yes == this.core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); + overridable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); break; case "Sequence": - sequence = this.core.GetAttributeIntegerValue(childSourceLineNumbers, attrib, 1, short.MaxValue); + sequence = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, attrib, 1, short.MaxValue); break; case "Suppress": - suppress = YesNoType.Yes == this.core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); + suppress = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // Get the condition from the inner text of the element. - condition = this.core.GetConditionInnerText(child); + condition = this.Core.GetConditionInnerText(child); if (customAction && "Custom" == actionName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Action")); } else if (showDialog && "Show" == actionName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Dialog")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Dialog")); } if (CompilerConstants.IntegerNotSet != sequence) { if (CompilerConstants.IntegerNotSet != exitSequence) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "Sequence", "OnExit")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "Sequence", "OnExit")); } else if (null != beforeAction || null != afterAction) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "Sequence", "Before", "After")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "Sequence", "Before", "After")); } } else // sequence not specified use OnExit (which may also be not set). @@ -13471,59 +13423,59 @@ namespace WixToolset if (null != beforeAction && null != afterAction) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "After", "Before")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(childSourceLineNumbers, child.Name.LocalName, "After", "Before")); } else if ((customAction || showDialog || specialAction) && !suppress && CompilerConstants.IntegerNotSet == sequence && null == beforeAction && null == afterAction) { - this.core.OnMessage(WixErrors.NeedSequenceBeforeOrAfter(childSourceLineNumbers, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.NeedSequenceBeforeOrAfter(childSourceLineNumbers, child.Name.LocalName)); } // action that is scheduled to occur before/after itself if (beforeAction == actionName) { - this.core.OnMessage(WixErrors.ActionScheduledRelativeToItself(childSourceLineNumbers, child.Name.LocalName, "Before", beforeAction)); + this.Core.OnMessage(WixErrors.ActionScheduledRelativeToItself(childSourceLineNumbers, child.Name.LocalName, "Before", beforeAction)); } else if (afterAction == actionName) { - this.core.OnMessage(WixErrors.ActionScheduledRelativeToItself(childSourceLineNumbers, child.Name.LocalName, "After", afterAction)); + this.Core.OnMessage(WixErrors.ActionScheduledRelativeToItself(childSourceLineNumbers, child.Name.LocalName, "After", afterAction)); } // normal standard actions cannot be set overridable by the user (since they are overridable by default) if (overridable && WindowsInstallerStandard.IsStandardAction(actionName) && !specialAction) { - this.core.OnMessage(WixErrors.UnexpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Overridable")); + this.Core.OnMessage(WixErrors.UnexpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Overridable")); } // suppress cannot be specified at the same time as Before, After, or Sequence if (suppress && (null != afterAction || null != beforeAction || CompilerConstants.IntegerNotSet != sequence || overridable)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(childSourceLineNumbers, child.Name.LocalName, "Suppress", "Before", "After", "Sequence", "Overridable")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(childSourceLineNumbers, child.Name.LocalName, "Suppress", "Before", "After", "Sequence", "Overridable")); } - this.core.ParseForExtensionElements(child); + this.Core.ParseForExtensionElements(child); // add the row and any references needed - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (suppress) { - Row row = this.core.CreateRow(childSourceLineNumbers, "WixSuppressAction"); - row[0] = sequenceTable; - row[1] = actionName; + var row = this.Core.CreateRow(childSourceLineNumbers, TupleDefinitionType.WixSuppressAction); + row.Set(0, sequenceTable); + row.Set(1, actionName); } else { - Row row = this.core.CreateRow(childSourceLineNumbers, "WixAction"); - row[0] = sequenceTable; - row[1] = actionName; - row[2] = condition; + var row = this.Core.CreateRow(childSourceLineNumbers, TupleDefinitionType.WixAction); + row.Set(0, sequenceTable); + row.Set(1, actionName); + row.Set(2, condition); if (CompilerConstants.IntegerNotSet != sequence) { - row[3] = sequence; + row.Set(3, sequence); } - row[4] = beforeAction; - row[5] = afterAction; - row[6] = overridable ? 1 : 0; + row.Set(4, beforeAction); + row.Set(5, afterAction); + row.Set(6, overridable ? 1 : 0); } } } @@ -13548,7 +13500,7 @@ namespace WixToolset string requiredPrivileges = null; string sid = null; - this.core.OnMessage(WixWarnings.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixWarnings.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); foreach (XAttribute attrib in node.Attributes()) { @@ -13557,10 +13509,10 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "DelayedAutoStart": - delayedAutoStart = this.core.GetAttributeValue(sourceLineNumbers, attrib); + delayedAutoStart = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < delayedAutoStart.Length) { switch (delayedAutoStart) @@ -13578,7 +13530,7 @@ namespace WixToolset } break; case "FailureActionsWhen": - failureActionsWhen = this.core.GetAttributeValue(sourceLineNumbers, attrib); + failureActionsWhen = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < failureActionsWhen.Length) { switch (failureActionsWhen) @@ -13596,42 +13548,42 @@ namespace WixToolset } break; case "OnInstall": - YesNoType install = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == install) { events |= MsiInterop.MsidbServiceConfigEventInstall; } break; case "OnReinstall": - YesNoType reinstall = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == reinstall) { events |= MsiInterop.MsidbServiceConfigEventReinstall; } break; case "OnUninstall": - YesNoType uninstall = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == uninstall) { events |= MsiInterop.MsidbServiceConfigEventUninstall; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; case "PreShutdownDelay": - preShutdownDelay = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + preShutdownDelay = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "ServiceName": if (!String.IsNullOrEmpty(serviceName)) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); } - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ServiceSid": - sid = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sid = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < sid.Length) { switch (sid) @@ -13655,7 +13607,7 @@ namespace WixToolset } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -13667,7 +13619,7 @@ namespace WixToolset switch (child.Name.LocalName) { case "RequiredPrivilege": - string privilege = this.core.GetTrimmedInnerText(child); + string privilege = this.Core.GetTrimmedInnerText(child); switch (privilege) { case "assignPrimaryToken": @@ -13791,85 +13743,85 @@ namespace WixToolset requiredPrivileges = String.Concat(requiredPrivileges, privilege); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (String.IsNullOrEmpty(name)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ServiceName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ServiceName")); } else if (null == id) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (0 == events) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "OnInstall", "OnReinstall", "OnUninstall")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "OnInstall", "OnReinstall", "OnUninstall")); } if (String.IsNullOrEmpty(delayedAutoStart) && String.IsNullOrEmpty(failureActionsWhen) && String.IsNullOrEmpty(preShutdownDelay) && String.IsNullOrEmpty(requiredPrivileges) && String.IsNullOrEmpty(sid)) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "DelayedAutoStart", "FailureActionsWhen", "PreShutdownDelay", "ServiceSid", "RequiredPrivilege")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "DelayedAutoStart", "FailureActionsWhen", "PreShutdownDelay", "ServiceSid", "RequiredPrivilege")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (!String.IsNullOrEmpty(delayedAutoStart)) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfig", new Identifier(String.Concat(id.Id, ".DS"), id.Access)); - row[1] = name; - row[2] = events; - row[3] = 3; - row[4] = delayedAutoStart; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".DS"), id.Access)); + row.Set(1, name); + row.Set(2, events); + row.Set(3, 3); + row.Set(4, delayedAutoStart); + row.Set(5, componentId); } if (!String.IsNullOrEmpty(failureActionsWhen)) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfig", new Identifier(String.Concat(id.Id, ".FA"), id.Access)); - row[1] = name; - row[2] = events; - row[3] = 4; - row[4] = failureActionsWhen; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".FA"), id.Access)); + row.Set(1, name); + row.Set(2, events); + row.Set(3, 4); + row.Set(4, failureActionsWhen); + row.Set(5, componentId); } if (!String.IsNullOrEmpty(sid)) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfig", new Identifier(String.Concat(id.Id, ".SS"), id.Access)); - row[1] = name; - row[2] = events; - row[3] = 5; - row[4] = sid; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".SS"), id.Access)); + row.Set(1, name); + row.Set(2, events); + row.Set(3, 5); + row.Set(4, sid); + row.Set(5, componentId); } if (!String.IsNullOrEmpty(requiredPrivileges)) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfig", new Identifier(String.Concat(id.Id, ".RP"), id.Access)); - row[1] = name; - row[2] = events; - row[3] = 6; - row[4] = requiredPrivileges; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".RP"), id.Access)); + row.Set(1, name); + row.Set(2, events); + row.Set(3, 6); + row.Set(4, requiredPrivileges); + row.Set(5, componentId); } if (!String.IsNullOrEmpty(preShutdownDelay)) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfig", new Identifier(String.Concat(id.Id, ".PD"), id.Access)); - row[1] = name; - row[2] = events; - row[3] = 7; - row[4] = preShutdownDelay; - row[5] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".PD"), id.Access)); + row.Set(1, name); + row.Set(2, events); + row.Set(3, 7); + row.Set(4, preShutdownDelay); + row.Set(5, componentId); } } } @@ -13892,7 +13844,7 @@ namespace WixToolset string actions = null; string actionsDelays = null; - this.core.OnMessage(WixWarnings.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixWarnings.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); foreach (XAttribute attrib in node.Attributes()) { @@ -13901,54 +13853,54 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Command": - command = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + command = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "OnInstall": - YesNoType install = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == install) { events |= MsiInterop.MsidbServiceConfigEventInstall; } break; case "OnReinstall": - YesNoType reinstall = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == reinstall) { events |= MsiInterop.MsidbServiceConfigEventReinstall; } break; case "OnUninstall": - YesNoType uninstall = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + YesNoType uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); if (YesNoType.Yes == uninstall) { events |= MsiInterop.MsidbServiceConfigEventUninstall; } break; case "RebootMessage": - rebootMessage = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + rebootMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "ResetPeriod": - resetPeriod = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + resetPeriod = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "ServiceName": if (!String.IsNullOrEmpty(serviceName)) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); } - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -13971,7 +13923,7 @@ namespace WixToolset switch (childAttrib.Name.LocalName) { case "Action": - action = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + action = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); switch (action) { case "none": @@ -13992,10 +13944,10 @@ namespace WixToolset } break; case "Delay": - delay = this.core.GetAttributeValue(childSourceLineNumbers, childAttrib); + delay = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); break; default: - this.core.UnexpectedAttribute(child, childAttrib); + this.Core.UnexpectedAttribute(child, childAttrib); break; } } @@ -14003,12 +13955,12 @@ namespace WixToolset if (String.IsNullOrEmpty(action)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Action")); } if (String.IsNullOrEmpty(delay)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Delay")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Delay")); } if (!String.IsNullOrEmpty(actions)) @@ -14024,44 +13976,44 @@ namespace WixToolset actionsDelays = String.Concat(actionsDelays, delay); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (String.IsNullOrEmpty(name)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ServiceName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ServiceName")); } else if (null == id) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (0 == events) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "OnInstall", "OnReinstall", "OnUninstall")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "OnInstall", "OnReinstall", "OnUninstall")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiServiceConfigFailureActions", id); - row[1] = name; - row[2] = events; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfigFailureActions, id); + row.Set(1, name); + row.Set(2, events); if (CompilerConstants.IntegerNotSet != resetPeriod) { - row[3] = resetPeriod; + row.Set(3, resetPeriod); } - row[4] = rebootMessage ?? "[~]"; - row[5] = command ?? "[~]"; - row[6] = actions; - row[7] = actionsDelays; - row[8] = componentId; + row.Set(4, rebootMessage ?? "[~]"); + row.Set(5, command ?? "[~]"); + row.Set(6, actions); + row.Set(7, actionsDelays); + row.Set(8, componentId); } } @@ -14086,13 +14038,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Remove": - Wix.InstallUninstallType removeValue = this.core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); + Wix.InstallUninstallType removeValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); switch (removeValue) { case Wix.InstallUninstallType.install: @@ -14107,7 +14059,7 @@ namespace WixToolset } break; case "Start": - Wix.InstallUninstallType startValue = this.core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); + Wix.InstallUninstallType startValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); switch (startValue) { case Wix.InstallUninstallType.install: @@ -14122,7 +14074,7 @@ namespace WixToolset } break; case "Stop": - Wix.InstallUninstallType stopValue = this.core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); + Wix.InstallUninstallType stopValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); switch (stopValue) { case Wix.InstallUninstallType.install: @@ -14137,27 +14089,27 @@ namespace WixToolset } break; case "Wait": - wait = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + wait = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } // get the ServiceControl arguments @@ -14172,30 +14124,30 @@ namespace WixToolset { arguments = String.Concat(arguments, "[~]"); } - arguments = String.Concat(arguments, this.core.GetTrimmedInnerText(child)); + arguments = String.Concat(arguments, this.Core.GetTrimmedInnerText(child)); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ServiceControl", id); - row[1] = name; - row[2] = events; - row[3] = arguments; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ServiceControl, id); + row.Set(1, name); + row.Set(2, events); + row.Set(3, arguments); if (YesNoType.NotSet != wait) { - row[4] = YesNoType.Yes == wait ? 1 : 0; + row.Set(4, YesNoType.Yes == wait ? 1 : 0); } - row[5] = componentId; + row.Set(5, componentId); } } @@ -14217,28 +14169,28 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - dependency = this.core.GetAttributeValue(sourceLineNumbers, attrib); + dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Group": - group = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + group = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == dependency) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return group ? String.Concat("+", dependency) : dependency; } @@ -14272,25 +14224,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Account": - account = this.core.GetAttributeValue(sourceLineNumbers, attrib); + account = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Arguments": - arguments = this.core.GetAttributeValue(sourceLineNumbers, attrib); + arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "EraseDescription": - eraseDescription = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + eraseDescription = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "ErrorControl": - string errorControlValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string errorControlValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < errorControlValue.Length) { Wix.ServiceInstall.ErrorControlType errorControlType = Wix.ServiceInstall.ParseErrorControlType(errorControlValue); @@ -14306,28 +14258,28 @@ namespace WixToolset errorbits |= MsiInterop.MsidbServiceInstallErrorCritical; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, errorControlValue, "ignore", "normal", "critical")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, errorControlValue, "ignore", "normal", "critical")); break; } } break; case "Interactive": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { typebits |= MsiInterop.MsidbServiceInstallInteractive; } break; case "LoadOrderGroup": - loadOrderGroup = this.core.GetAttributeValue(sourceLineNumbers, attrib); + loadOrderGroup = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Password": - password = this.core.GetAttributeValue(sourceLineNumbers, attrib); + password = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Start": - string startValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string startValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < startValue.Length) { Wix.ServiceInstall.StartType start = Wix.ServiceInstall.ParseStartType(startValue); @@ -14344,16 +14296,16 @@ namespace WixToolset break; case Wix.ServiceInstall.StartType.boot: case Wix.ServiceInstall.StartType.system: - this.core.OnMessage(WixErrors.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue)); + this.Core.OnMessage(WixErrors.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue)); break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue, "auto", "demand", "disabled")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue, "auto", "demand", "disabled")); break; } } break; case "Type": - string typeValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < typeValue.Length) { Wix.ServiceInstall.TypeType typeType = Wix.ServiceInstall.ParseTypeType(typeValue); @@ -14367,43 +14319,43 @@ namespace WixToolset break; case Wix.ServiceInstall.TypeType.kernelDriver: case Wix.ServiceInstall.TypeType.systemDriver: - this.core.OnMessage(WixErrors.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue)); + this.Core.OnMessage(WixErrors.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue)); break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, node.Name.LocalName, typeValue, "ownProcess", "shareProcess")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, node.Name.LocalName, typeValue, "ownProcess", "shareProcess")); break; } } break; case "Vital": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { errorbits |= MsiInterop.MsidbServiceInstallErrorControlVital; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(name)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (null == id) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (0 == startType) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Start")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Start")); } if (eraseDescription) @@ -14431,14 +14383,14 @@ namespace WixToolset dependencies = String.Concat(dependencies, this.ParseServiceDependencyElement(child), "[~]"); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { Dictionary context = new Dictionary() { { "ServiceInstallId", id.Id }, { "ServiceInstallName", name }, { "ServiceInstallComponentId", componentId }, { "Win64", win64Component.ToString() } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } @@ -14447,21 +14399,21 @@ namespace WixToolset dependencies = String.Concat(dependencies, "[~]"); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ServiceInstall", id); - row[1] = name; - row[2] = displayName; - row[3] = typebits; - row[4] = startType; - row[5] = errorbits; - row[6] = loadOrderGroup; - row[7] = dependencies; - row[8] = account; - row[9] = password; - row[10] = arguments; - row[11] = componentId; - row[12] = description; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ServiceInstall, id); + row.Set(1, name); + row.Set(2, displayName); + row.Set(3, typebits); + row.Set(4, startType); + row.Set(5, errorbits); + row.Set(6, loadOrderGroup); + row.Set(7, dependencies); + row.Set(8, account); + row.Set(9, password); + row.Set(10, arguments); + row.Set(11, componentId); + row.Set(12, description); } } @@ -14486,14 +14438,14 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Action": - actionName = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Directory", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); break; case "Sequence": - string sequenceValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < sequenceValue.Length) { Wix.SequenceType sequenceType = Wix.Enums.ParseSequenceType(sequenceValue); @@ -14513,30 +14465,30 @@ namespace WixToolset // default so no work necessary. break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both")); break; } } break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - condition = this.core.GetConditionInnerText(node); + condition = this.Core.GetConditionInnerText(node); if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (String.IsNullOrEmpty(actionName)) { @@ -14545,30 +14497,30 @@ namespace WixToolset if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); // add the row and any references needed - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "CustomAction"); - row[0] = actionName; - row[1] = MsiInterop.MsidbCustomActionTypeProperty | MsiInterop.MsidbCustomActionTypeTextData | extraBits; - row[2] = id; - row[3] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CustomAction); + row.Set(0, actionName); + row.Set(1, MsiInterop.MsidbCustomActionTypeProperty | MsiInterop.MsidbCustomActionTypeTextData | extraBits); + row.Set(2, id); + row.Set(3, value); foreach (string sequence in sequences) { - Row sequenceRow = this.core.CreateRow(sourceLineNumbers, "WixAction"); - sequenceRow[0] = sequence; - sequenceRow[1] = actionName; - sequenceRow[2] = condition; + var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction); + sequenceRow.Set(0, sequence); + sequenceRow.Set(1, actionName); + sequenceRow.Set(2, condition); // no explicit sequence // no before action - sequenceRow[5] = "CostInitialize"; - sequenceRow[6] = 0; // not overridable + sequenceRow.Set(5, "CostInitialize"); + sequenceRow.Set(6, 0); // not overridable } } } @@ -14596,19 +14548,19 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Action": - actionName = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "After": - afterAction = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + afterAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Before": - beforeAction = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + beforeAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Sequence": - string sequenceValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (0 < sequenceValue.Length) { Wix.SequenceType sequenceType = Wix.Enums.ParseSequenceType(sequenceValue); @@ -14628,30 +14580,30 @@ namespace WixToolset // default so no work necessary. break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both")); break; } } break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - condition = this.core.GetConditionInnerText(node); + condition = this.Core.GetConditionInnerText(node); if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (String.IsNullOrEmpty(actionName)) { @@ -14660,59 +14612,59 @@ namespace WixToolset if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } if (null != beforeAction && null != afterAction) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "After", "Before")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "After", "Before")); } else if (null == beforeAction && null == afterAction) { - this.core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "After", "Before", "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "After", "Before", "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); // add the row and any references needed - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { // action that is scheduled to occur before/after itself if (beforeAction == actionName) { - this.core.OnMessage(WixErrors.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "Before", beforeAction)); + this.Core.OnMessage(WixErrors.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "Before", beforeAction)); } else if (afterAction == actionName) { - this.core.OnMessage(WixErrors.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction)); + this.Core.OnMessage(WixErrors.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction)); } - Row row = this.core.CreateRow(sourceLineNumbers, "CustomAction"); - row[0] = actionName; - row[1] = MsiInterop.MsidbCustomActionTypeProperty | MsiInterop.MsidbCustomActionTypeTextData | extraBits; - row[2] = id; - row[3] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CustomAction); + row.Set(0, actionName); + row.Set(1, MsiInterop.MsidbCustomActionTypeProperty | MsiInterop.MsidbCustomActionTypeTextData | extraBits); + row.Set(2, id); + row.Set(3, value); foreach (string sequence in sequences) { - Row sequenceRow = this.core.CreateRow(sourceLineNumbers, "WixAction"); - sequenceRow[0] = sequence; - sequenceRow[1] = actionName; - sequenceRow[2] = condition; + var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction); + sequenceRow.Set(0, sequence); + sequenceRow.Set(1, actionName); + sequenceRow.Set(2, condition); // no explicit sequence - sequenceRow[4] = beforeAction; - sequenceRow[5] = afterAction; - sequenceRow[6] = 0; // not overridable + sequenceRow.Set(4, beforeAction); + sequenceRow.Set(5, afterAction); + sequenceRow.Set(6, 0); // not overridable if (null != beforeAction) { if (WindowsInstallerStandard.IsStandardAction(beforeAction)) { - this.core.CreateSimpleReference(sourceLineNumbers, "WixAction", sequence, beforeAction); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", sequence, beforeAction); } else { - this.core.CreateSimpleReference(sourceLineNumbers, "CustomAction", beforeAction); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", beforeAction); } } @@ -14720,11 +14672,11 @@ namespace WixToolset { if (WindowsInstallerStandard.IsStandardAction(afterAction)) { - this.core.CreateSimpleReference(sourceLineNumbers, "WixAction", sequence, afterAction); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", sequence, afterAction); } else { - this.core.CreateSimpleReference(sourceLineNumbers, "CustomAction", afterAction); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", afterAction); } } } @@ -14748,31 +14700,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "FileSFPCatalog"); - row[0] = id; - row[1] = parentSFPCatalog; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.FileSFPCatalog); + row.Set(0, id); + row.Set(1, parentSFPCatalog); } } @@ -14796,34 +14748,34 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Dependency": - dependency = this.core.GetAttributeValue(sourceLineNumbers, attrib); + dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); parentSFPCatalog = name; break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } foreach (XElement child in node.Elements()) @@ -14836,7 +14788,7 @@ namespace WixToolset this.ParseSFPCatalogElement(child, ref parentName); if (null != dependency && parentName == dependency) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency")); } dependency = parentName; break; @@ -14844,27 +14796,27 @@ namespace WixToolset this.ParseSFPFileElement(child, name); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (null == dependency) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "SFPCatalog"); - row[0] = name; - row[1] = sourceFile; - row[2] = dependency; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.SFPCatalog); + row.Set(0, name); + row.Set(1, sourceFile); + row.Set(2, dependency); } } @@ -14904,50 +14856,50 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Advertise": - advertise = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + advertise = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Arguments": - arguments = this.core.GetAttributeValue(sourceLineNumbers, attrib); + arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DescriptionResourceDll": - descriptionResourceDll = this.core.GetAttributeValue(sourceLineNumbers, attrib); + descriptionResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DescriptionResourceId": - descriptionResourceId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + descriptionResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Directory": - directory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); break; case "DisplayResourceDll": - displayResourceDll = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayResourceId": - displayResourceId = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + displayResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Hotkey": - hotkey = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + hotkey = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Icon": - icon = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); + icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); break; case "IconIndex": - iconIndex = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); + iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "ShortName": - shortName = this.core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); + shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); break; case "Show": - string showValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string showValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (showValue.Length == 0) { show = CompilerConstants.IllegalInteger; @@ -14967,32 +14919,32 @@ namespace WixToolset show = 7; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Show", showValue, "normal", "maximized", "minimized")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Show", showValue, "normal", "maximized", "minimized")); show = CompilerConstants.IllegalInteger; break; } } break; case "Target": - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "WorkingDirectory": - workingDirectory = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + workingDirectory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (advertise && null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "Advertise", "yes")); } if (null == directory) @@ -15003,7 +14955,7 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Directory", "Component")); + this.Core.OnMessage(WixErrors.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Directory", "Component")); } } @@ -15011,14 +14963,14 @@ namespace WixToolset { if (CompilerConstants.IntegerNotSet == descriptionResourceId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DescriptionResourceDll", "DescriptionResourceId")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DescriptionResourceDll", "DescriptionResourceId")); } } else { if (CompilerConstants.IntegerNotSet != descriptionResourceId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DescriptionResourceId", "DescriptionResourceDll")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DescriptionResourceId", "DescriptionResourceDll")); } } @@ -15026,24 +14978,24 @@ namespace WixToolset { if (CompilerConstants.IntegerNotSet == displayResourceId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayResourceDll", "DisplayResourceId")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayResourceDll", "DisplayResourceId")); } } else { if (CompilerConstants.IntegerNotSet != displayResourceId) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayResourceId", "DisplayResourceDll")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "DisplayResourceId", "DisplayResourceDll")); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (0 < name.Length) { - if (this.core.IsValidShortFilename(name, false)) + if (this.Core.IsValidShortFilename(name, false)) { if (null == shortName) { @@ -15052,23 +15004,23 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", name, "ShortName")); } } else if (null == shortName) // generate a short file name. { - shortName = this.core.CreateShortName(name, true, false, node.Name.LocalName, componentId, directory); + shortName = this.Core.CreateShortName(name, true, false, node.Name.LocalName, componentId, directory); } } if ("Component" != parentElementLocalName && null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Target", parentElementLocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Target", parentElementLocalName)); } if (null == id) { - id = this.core.CreateIdentifier("sct", directory, LowercaseOrNull(name) ?? LowercaseOrNull(shortName)); + id = this.Core.CreateIdentifier("sct", directory, LowercaseOrNull(name) ?? LowercaseOrNull(shortName)); } foreach (XElement child in node.Elements()) @@ -15084,68 +15036,68 @@ namespace WixToolset this.ParseShortcutPropertyElement(child, id.Id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Shortcut", id); - row[1] = directory; - row[2] = GetMsiFilenameValue(shortName, name); - row[3] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Shortcut, id); + row.Set(1, directory); + row.Set(2, GetMsiFilenameValue(shortName, name)); + row.Set(3, componentId); if (advertise) { if (YesNoType.Yes != parentKeyPath && "Component" != parentElementLocalName) { - this.core.OnMessage(WixWarnings.UnclearShortcut(sourceLineNumbers, id.Id, componentId, defaultTarget)); + this.Core.OnMessage(WixWarnings.UnclearShortcut(sourceLineNumbers, id.Id, componentId, defaultTarget)); } - row[4] = Guid.Empty.ToString("B"); + row.Set(4, Guid.Empty.ToString("B")); } else if (null != target) { - row[4] = target; + row.Set(4, target); } else if ("Component" == parentElementLocalName || "CreateFolder" == parentElementLocalName) { - row[4] = String.Format(CultureInfo.InvariantCulture, "[{0}]", defaultTarget); + row.Set(4, String.Format(CultureInfo.InvariantCulture, "[{0}]", defaultTarget)); } else if ("File" == parentElementLocalName) { - row[4] = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget); + row.Set(4, String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget)); } - row[5] = arguments; - row[6] = description; + row.Set(5, arguments); + row.Set(6, description); if (CompilerConstants.IntegerNotSet != hotkey) { - row[7] = hotkey; + row.Set(7, hotkey); } - row[8] = icon; + row.Set(8, icon); if (CompilerConstants.IntegerNotSet != iconIndex) { - row[9] = iconIndex; + row.Set(9, iconIndex); } if (CompilerConstants.IntegerNotSet != show) { - row[10] = show; + row.Set(10, show); } - row[11] = workingDirectory; - row[12] = displayResourceDll; + row.Set(11, workingDirectory); + row.Set(12, displayResourceDll); if (CompilerConstants.IntegerNotSet != displayResourceId) { - row[13] = displayResourceId; + row.Set(13, displayResourceId); } - row[14] = descriptionResourceDll; + row.Set(14, descriptionResourceDll); if (CompilerConstants.IntegerNotSet != descriptionResourceId) { - row[15] = descriptionResourceId; + row.Set(15, descriptionResourceId); } } } @@ -15168,35 +15120,35 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(key)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } else if (null == id) { - id = this.core.CreateIdentifier("scp", shortcutId, key.ToUpperInvariant()); + id = this.Core.CreateIdentifier("scp", shortcutId, key.ToUpperInvariant()); } - string innerText = this.core.GetTrimmedInnerText(node); + string innerText = this.Core.GetTrimmedInnerText(node); if (!String.IsNullOrEmpty(innerText)) { if (String.IsNullOrEmpty(value)) @@ -15205,23 +15157,23 @@ namespace WixToolset } else // cannot specify both the value attribute and inner text { - this.core.OnMessage(WixErrors.IllegalAttributeWithInnerText(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithInnerText(sourceLineNumbers, node.Name.LocalName, "Value")); } } if (String.IsNullOrEmpty(value)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiShortcutProperty", id); - row[1] = shortcutId; - row[2] = key; - row[3] = value; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiShortcutProperty, id); + row.Set(1, shortcutId); + row.Set(2, key); + row.Set(3, value); } } @@ -15253,75 +15205,75 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Advertise": - advertise = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Control": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { flags |= 2; } break; case "Cost": - cost = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + cost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "HasDiskImage": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { flags |= 8; } break; case "HelpDirectory": - helpDirectory = this.core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); + helpDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); break; case "Hidden": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { flags |= 4; } break; case "Language": - language = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + language = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "MajorVersion": - majorVersion = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, ushort.MaxValue); + majorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, ushort.MaxValue); break; case "MinorVersion": - minorVersion = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); + minorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); break; case "ResourceId": - resourceId = this.core.GetAttributeLongValue(sourceLineNumbers, attrib, int.MinValue, int.MaxValue); + resourceId = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, int.MinValue, int.MaxValue); break; case "Restricted": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { flags |= 1; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (CompilerConstants.IntegerNotSet == language) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); language = CompilerConstants.IllegalInteger; } @@ -15370,13 +15322,13 @@ namespace WixToolset this.ParseInterfaceElement(child, componentId, null, null, id, registryVersion); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -15385,48 +15337,48 @@ namespace WixToolset { if (CompilerConstants.LongNotSet != resourceId) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "ResourceId")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "ResourceId")); } if (0 != flags) { if (0x1 == (flags & 0x1)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Restricted", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Restricted", "Advertise", "yes")); } if (0x2 == (flags & 0x2)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Control", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Control", "Advertise", "yes")); } if (0x4 == (flags & 0x4)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Hidden", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Hidden", "Advertise", "yes")); } if (0x8 == (flags & 0x8)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "HasDiskImage", "Advertise", "yes")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "HasDiskImage", "Advertise", "yes")); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "TypeLib"); - row[0] = id; - row[1] = language; - row[2] = componentId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.TypeLib); + row.Set(0, id); + row.Set(1, language); + row.Set(2, componentId); if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion) { - row[3] = (CompilerConstants.IntegerNotSet != majorVersion ? majorVersion * 256 : 0) + (CompilerConstants.IntegerNotSet != minorVersion ? minorVersion : 0); + row.Set(3, (CompilerConstants.IntegerNotSet != majorVersion ? majorVersion * 256 : 0) + (CompilerConstants.IntegerNotSet != minorVersion ? minorVersion : 0)); } - row[4] = description; - row[5] = helpDirectory; - row[6] = Guid.Empty.ToString("B"); + row.Set(4, description); + row.Set(5, helpDirectory); + row.Set(6, Guid.Empty.ToString("B")); if (CompilerConstants.IntegerNotSet != cost) { - row[7] = cost; + row.Set(7, cost); } } } @@ -15434,21 +15386,21 @@ namespace WixToolset { if (CompilerConstants.IntegerNotSet != cost && CompilerConstants.IllegalInteger != cost) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Cost", "Advertise", "no")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Cost", "Advertise", "no")); } if (null == fileServer) { - this.core.OnMessage(WixErrors.MissingTypeLibFile(sourceLineNumbers, node.Name.LocalName, "File")); + this.Core.OnMessage(WixErrors.MissingTypeLibFile(sourceLineNumbers, node.Name.LocalName, "File")); } if (null == registryVersion) { - this.core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "MajorVersion", "MinorVersion", "Advertise", "no")); + this.Core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "MajorVersion", "MinorVersion", "Advertise", "no")); } // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion], (Default) = [Description] - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}", id, registryVersion), null, description, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}", id, registryVersion), null, description, componentId); // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion]\[Language]\[win16|win32|win64], (Default) = [TypeLibPath]\[ResourceId] string path = String.Concat("[#", fileServer, "]"); @@ -15456,15 +15408,15 @@ namespace WixToolset { path = String.Concat(path, Path.DirectorySeparatorChar, resourceId.ToString(CultureInfo.InvariantCulture.NumberFormat)); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\{2}\{3}", id, registryVersion, language, (win64Component ? "win64" : "win32")), null, path, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\{2}\{3}", id, registryVersion, language, (win64Component ? "win64" : "win32")), null, path, componentId); // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion]\FLAGS, (Default) = [TypeLibFlags] - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\FLAGS", id, registryVersion), null, flags.ToString(CultureInfo.InvariantCulture.NumberFormat), componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\FLAGS", id, registryVersion), null, flags.ToString(CultureInfo.InvariantCulture.NumberFormat), componentId); if (null != helpDirectory) { // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion]\HELPDIR, (Default) = [HelpDirectory] - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\HELPDIR", id, registryVersion), null, String.Concat("[", helpDirectory, "]"), componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}\HELPDIR", id, registryVersion), null, String.Concat("[", helpDirectory, "]"), componentId); } } } @@ -15489,69 +15441,69 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "BinarySource": if (null != source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "FileSource", "PropertySource")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "FileSource", "PropertySource")); } - source = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData; - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary break; case "CommandLine": - commandLine = this.core.GetAttributeValue(sourceLineNumbers, attrib); + commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "FileSource": if (null != source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "PropertySource")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "PropertySource")); } - source = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile; - this.core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File + this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File break; case "PropertySource": if (null != source) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "FileSource")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "FileSource")); } - source = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty; // cannot add a reference to a Property because it may be created at runtime. break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } // Get the condition from the inner text of the element. - condition = this.core.GetConditionInnerText(node); + condition = this.Core.GetConditionInnerText(node); if (null == id) { - id = this.core.CreateIdentifier("mec", source, type.ToString()); + id = this.Core.CreateIdentifier("mec", source, type.ToString()); } if (null == source) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "BinarySource", "FileSource", "PropertySource")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "BinarySource", "FileSource", "PropertySource")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiEmbeddedChainer", id); - row[1] = condition; - row[2] = commandLine; - row[3] = source; - row[4] = type; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiEmbeddedChainer, id); + row.Set(1, condition); + row.Set(2, commandLine); + row.Set(3, source); + row.Set(4, type); } } @@ -15572,16 +15524,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -15595,7 +15547,7 @@ namespace WixToolset this.ParseBillboardActionElement(child); break; case "ComboBox": - this.ParseControlGroupElement(child, this.tableDefinitions["ComboBox"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem"); break; case "Dialog": this.ParseDialogElement(child); @@ -15607,7 +15559,7 @@ namespace WixToolset if (0 < embeddedUICount) // there can be only one embedded UI { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } this.ParseEmbeddedUIElement(child); ++embeddedUICount; @@ -15616,10 +15568,10 @@ namespace WixToolset this.ParseErrorElement(child); break; case "ListBox": - this.ParseControlGroupElement(child, this.tableDefinitions["ListBox"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem"); break; case "ListView": - this.ParseControlGroupElement(child, this.tableDefinitions["ListView"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem"); break; case "ProgressText": this.ParseActionTextElement(child); @@ -15633,7 +15585,7 @@ namespace WixToolset if (RadioButtonType.Bitmap == radioButtonType || RadioButtonType.Icon == radioButtonType) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.RadioButtonBitmapAndIconDisallowed(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.RadioButtonBitmapAndIconDisallowed(childSourceLineNumbers)); } break; case "TextStyle": @@ -15662,19 +15614,19 @@ namespace WixToolset break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (null != id && !this.core.EncounteredError) + if (null != id && !this.Core.EncounteredError) { - this.core.CreateRow(sourceLineNumbers, "WixUI", id); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixUI, id); } } @@ -15685,7 +15637,7 @@ namespace WixToolset /// Table to add row to. /// Identifier of property referred to by list item. /// Relative order of list items. - private void ParseListItemElement(XElement node, TableDefinition table, string property, ref int order) + private void ParseListItemElement(XElement node, TupleDefinitionType tableName, string property, ref int order) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); string icon = null; @@ -15699,50 +15651,50 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Icon": - if ("ListView" == table.Name) + if (TupleDefinitionType.ListView == tableName) { - icon = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", icon); + icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", icon); } else { - this.core.OnMessage(WixErrors.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ListView")); + this.Core.OnMessage(WixErrors.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ListView")); } break; case "Text": - text = this.core.GetAttributeValue(sourceLineNumbers, attrib); + text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, table.Name); - row[0] = property; - row[1] = ++order; - row[2] = value; - row[3] = text; + var row = this.Core.CreateRow(sourceLineNumbers, tableName); + row.Set(0, property); + row.Set(1, ++order); + row.Set(2, value); + row.Set(3, text); if (null != icon) { - row[4] = icon; + row.Set(4, icon); } } } @@ -15776,102 +15728,102 @@ namespace WixToolset case "Bitmap": if (RadioButtonType.NotSet != type) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text")); } - text = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", text); + text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); type = RadioButtonType.Bitmap; break; case "Height": - height = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Help": - help = this.core.GetAttributeValue(sourceLineNumbers, attrib); + help = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Icon": if (RadioButtonType.NotSet != type) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text")); } - text = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", text); + text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); type = RadioButtonType.Icon; break; case "Text": if (RadioButtonType.NotSet != type) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Icon")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Icon")); } - text = this.core.GetAttributeValue(sourceLineNumbers, attrib); + text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); type = RadioButtonType.Text; break; case "ToolTip": - tooltip = this.core.GetAttributeValue(sourceLineNumbers, attrib); + tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Width": - width = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "X": - x = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Y": - y = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } if (null == x) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "X")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "X")); } if (null == y) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Y")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Y")); } if (null == width) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Width")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Width")); } if (null == height) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Height")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Height")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "RadioButton"); - row[0] = property; - row[1] = ++order; - row[2] = value; - row[3] = x; - row[4] = y; - row[5] = width; - row[6] = height; - row[7] = text; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RadioButton); + row.Set(0, property); + row.Set(1, ++order); + row.Set(2, value); + row.Set(3, x); + row.Set(4, y); + row.Set(5, width); + row.Set(6, height); + row.Set(7, text); if (null != tooltip || null != help) { - row[8] = String.Concat(tooltip, "|", help); + row.Set(8, String.Concat(tooltip, "|", help)); } } @@ -15895,23 +15847,23 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - action = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action); + action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == action) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } foreach (XElement child in node.Elements()) @@ -15925,13 +15877,13 @@ namespace WixToolset this.ParseBillboardElement(child, action, order); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } @@ -15955,26 +15907,26 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Feature": - feature = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); + feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - id = this.core.CreateIdentifier("bil", action, order.ToString(), feature); + id = this.Core.CreateIdentifier("bil", action, order.ToString(), feature); } foreach (XElement child in node.Elements()) @@ -15985,31 +15937,31 @@ namespace WixToolset { case "Control": // These are all thrown away. - Row lastTabRow = null; + IntermediateTuple lastTabRow = null; string firstControl = null; string defaultControl = null; string cancelControl = null; - this.ParseControlElement(child, id.Id, this.tableDefinitions["BBControl"], ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, false); + this.ParseControlElement(child, id.Id, TupleDefinitionType.BBControl, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, false); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Billboard", id); - row[1] = feature; - row[2] = action; - row[3] = order; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Billboard, id); + row.Set(1, feature); + row.Set(2, action); + row.Set(3, order); } } @@ -16019,7 +15971,7 @@ namespace WixToolset /// Element to parse. /// Table referred to by control group. /// Expected child elements. - private void ParseControlGroupElement(XElement node, TableDefinition table, string childTag) + private void ParseControlGroupElement(XElement node, TupleDefinitionType tableName, string childTag) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); int order = 0; @@ -16032,22 +15984,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Property": - property = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == property) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); } foreach (XElement child in node.Elements()) @@ -16056,25 +16008,25 @@ namespace WixToolset { if (childTag != child.Name.LocalName) { - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); } switch (child.Name.LocalName) { case "ListItem": - this.ParseListItemElement(child, table, property, ref order); + this.ParseListItemElement(child, tableName, property, ref order); break; case "Property": this.ParsePropertyElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -16099,23 +16051,23 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Property": - property = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Property", property); + property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == property) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); } foreach (XElement child in node.Elements()) @@ -16133,17 +16085,17 @@ namespace WixToolset else if (groupType != type) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.RadioButtonTypeInconsistent(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.RadioButtonTypeInconsistent(childSourceLineNumbers)); } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -16168,35 +16120,35 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Action": - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Template": - template = this.core.GetAttributeValue(sourceLineNumbers, attrib); + template = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == action) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ActionText"); - row[0] = action; - row[1] = Common.GetInnerText(node); - row[2] = template; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ActionText); + row.Set(0, action); + row.Set(1, Common.GetInnerText(node)); + row.Set(2, template); } } @@ -16217,16 +16169,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -16234,15 +16186,15 @@ namespace WixToolset if (null == id) { - id = this.core.CreateIdentifier("txt", text); + id = this.Core.CreateIdentifier("txt", text); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "UIText", id); - row[1] = text; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.UIText, id); + row.Set(1, text); } } @@ -16266,12 +16218,12 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; // RGB Values case "Red": - int redColor = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); + int redColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); if (CompilerConstants.IllegalInteger != redColor) { if (CompilerConstants.IntegerNotSet == color) @@ -16285,7 +16237,7 @@ namespace WixToolset } break; case "Green": - int greenColor = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); + int greenColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); if (CompilerConstants.IllegalInteger != greenColor) { if (CompilerConstants.IntegerNotSet == color) @@ -16299,7 +16251,7 @@ namespace WixToolset } break; case "Blue": - int blueColor = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); + int blueColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); if (CompilerConstants.IllegalInteger != blueColor) { if (CompilerConstants.IntegerNotSet == color) @@ -16315,25 +16267,25 @@ namespace WixToolset // Style values case "Bold": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbTextStyleStyleBitsBold; } break; case "Italic": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbTextStyleStyleBitsItalic; } break; case "Strike": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbTextStyleStyleBitsStrike; } break; case "Underline": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits |= MsiInterop.MsidbTextStyleStyleBitsUnderline; } @@ -16341,48 +16293,48 @@ namespace WixToolset // Font values case "FaceName": - faceName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + faceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Size": - size = this.core.GetAttributeValue(sourceLineNumbers, attrib); + size = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.CreateIdentifier("txs", faceName, size.ToString(), color.ToString(), bits.ToString()); + this.Core.CreateIdentifier("txs", faceName, size.ToString(), color.ToString(), bits.ToString()); } if (null == faceName) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "FaceName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "FaceName")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "TextStyle", id); - row[1] = faceName; - row[2] = size; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.TextStyle, id); + row.Set(1, faceName); + row.Set(2, size); if (0 <= color) { - row[3] = color; + row.Set(3, color); } if (0 < bits) { - row[4] = bits; + row.Set(4, bits); } } } @@ -16410,86 +16362,86 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Height": - height = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + height = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Title": - title = this.core.GetAttributeValue(sourceLineNumbers, attrib); + title = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Width": - width = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + width = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "X": - x = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); + x = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); break; case "Y": - y = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); + y = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); break; case "CustomPalette": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesUseCustomPalette; } break; case "ErrorDialog": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesError; } break; case "Hidden": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesVisible; } break; case "KeepModeless": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesKeepModeless; } break; case "LeftScroll": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesLeftScroll; } break; case "Modeless": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesModal; } break; case "NoMinimize": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesMinimize; } break; case "RightAligned": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesRightAligned; } break; case "RightToLeft": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesRTLRO; } break; case "SystemModal": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesSysModal; } break; case "TrackDiskSpace": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { bits ^= MsiInterop.MsidbDialogAttributesTrackDiskSpace; trackDiskSpace = true; @@ -16497,23 +16449,23 @@ namespace WixToolset break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } - Row lastTabRow = null; + IntermediateTuple lastTabRow = null; string cancelControl = null; string defaultControl = null; string firstControl = null; @@ -16525,16 +16477,16 @@ namespace WixToolset switch (child.Name.LocalName) { case "Control": - this.ParseControlElement(child, id.Id, this.tableDefinitions["Control"], ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, trackDiskSpace); + this.ParseControlElement(child, id.Id, TupleDefinitionType.Control, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, trackDiskSpace); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -16543,27 +16495,27 @@ namespace WixToolset { if (firstControl != lastTabRow[1].ToString()) { - lastTabRow[10] = firstControl; + lastTabRow.Set(10, firstControl); } } if (null == firstControl) { - this.core.OnMessage(WixErrors.NoFirstControlSpecified(sourceLineNumbers, id.Id)); + this.Core.OnMessage(WixErrors.NoFirstControlSpecified(sourceLineNumbers, id.Id)); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Dialog", id); - row[1] = x; - row[2] = y; - row[3] = width; - row[4] = height; - row[5] = bits; - row[6] = title; - row[7] = firstControl; - row[8] = defaultControl; - row[9] = cancelControl; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Dialog, id); + row.Set(1, x); + row.Set(2, y); + row.Set(3, width); + row.Set(4, height); + row.Set(5, bits); + row.Set(6, title); + row.Set(7, firstControl); + row.Set(8, defaultControl); + row.Set(9, cancelControl); } } @@ -16592,149 +16544,149 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "IgnoreFatalExit": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_FATALEXIT; } break; case "IgnoreError": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_ERROR; } break; case "IgnoreWarning": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_WARNING; } break; case "IgnoreUser": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_USER; } break; case "IgnoreInfo": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_INFO; } break; case "IgnoreFilesInUse": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_FILESINUSE; } break; case "IgnoreResolveSource": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_RESOLVESOURCE; } break; case "IgnoreOutOfDiskSpace": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE; } break; case "IgnoreActionStart": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONSTART; } break; case "IgnoreActionData": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONDATA; } break; case "IgnoreProgress": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_PROGRESS; } break; case "IgnoreCommonData": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_COMMONDATA; } break; case "IgnoreInitialize": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_INITIALIZE; } break; case "IgnoreTerminate": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_TERMINATE; } break; case "IgnoreShowDialog": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_SHOWDIALOG; } break; case "IgnoreRMFilesInUse": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_RMFILESINUSE; } break; case "IgnoreInstallStart": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLSTART; } break; case "IgnoreInstallEnd": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLEND; } break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SupportBasicUI": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= MsiInterop.MsidbEmbeddedHandlesBasic; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(sourceFile)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } else if (String.IsNullOrEmpty(name)) { name = Path.GetFileName(sourceFile); - if (!this.core.IsValidLongFilename(name, false)) + if (!this.Core.IsValidLongFilename(name, false)) { - this.core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); + this.Core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); } } @@ -16742,16 +16694,16 @@ namespace WixToolset { if (!String.IsNullOrEmpty(name)) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (!Common.IsIdentifier(id.Id)) { - this.core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } } else if (String.IsNullOrEmpty(name)) @@ -16761,7 +16713,7 @@ namespace WixToolset if (!name.Contains(".")) { - this.core.OnMessage(WixErrors.InvalidEmbeddedUIFileName(sourceLineNumbers, name)); + this.Core.OnMessage(WixErrors.InvalidEmbeddedUIFileName(sourceLineNumbers, name)); } foreach (XElement child in node.Elements()) @@ -16774,23 +16726,23 @@ namespace WixToolset this.ParseEmbeddedUIResourceElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiEmbeddedUI", id); - row[1] = name; - row[2] = attributes; - row[3] = messageFilter; - row[4] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiEmbeddedUI, id); + row.Set(1, name); + row.Set(2, attributes); + row.Set(3, messageFilter); + row.Set(4, sourceFile); } } @@ -16813,35 +16765,35 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(sourceFile)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } else if (String.IsNullOrEmpty(name)) { name = Path.GetFileName(sourceFile); - if (!this.core.IsValidLongFilename(name, false)) + if (!this.Core.IsValidLongFilename(name, false)) { - this.core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); + this.Core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Source", name)); } } @@ -16849,16 +16801,16 @@ namespace WixToolset { if (!String.IsNullOrEmpty(name)) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else if (!Common.IsIdentifier(id.Id)) { - this.core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } } else if (String.IsNullOrEmpty(name)) @@ -16866,15 +16818,15 @@ namespace WixToolset name = id.Id; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "MsiEmbeddedUI", id); - row[1] = name; - row[2] = 0; // embedded UI resources always set this to 0 - row[3] = null; - row[4] = sourceFile; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiEmbeddedUI, id); + row.Set(1, name); + row.Set(2, 0); // embedded UI resources always set this to 0 + row.Set(3, null); + row.Set(4, sourceFile); } } @@ -16889,7 +16841,7 @@ namespace WixToolset /// Name of the default control. /// Name of the candle control. /// True if the containing dialog tracks disk space. - private void ParseControlElement(XElement node, string dialog, TableDefinition table, ref Row lastTabRow, ref string firstControl, ref string defaultControl, ref string cancelControl, bool trackDiskSpace) + private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tableName, ref IntermediateTuple lastTabRow, ref string firstControl, ref string defaultControl, ref string cancelControl, bool trackDiskSpace) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); Identifier id = null; @@ -16919,11 +16871,11 @@ namespace WixToolset XAttribute typeAttribute = node.Attribute("Type"); if (null == typeAttribute) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); } else { - controlType = this.core.GetAttributeValue(sourceLineNumbers, typeAttribute); + controlType = this.Core.GetAttributeValue(sourceLineNumbers, typeAttribute); } switch (controlType) @@ -16933,7 +16885,7 @@ namespace WixToolset notTabbable = true; disabled = true; - this.core.EnsureTable(sourceLineNumbers, "Billboard"); + this.Core.EnsureTable(sourceLineNumbers, "Billboard"); break; case "Bitmap": specialAttributes = MsiInterop.BitmapControlAttributes; @@ -17025,30 +16977,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Type": // already processed break; case "Cancel": - isCancel = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + isCancel = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "CheckBoxPropertyRef": - checkBoxPropertyRef = this.core.GetAttributeValue(sourceLineNumbers, attrib); + checkBoxPropertyRef = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "CheckBoxValue": - checkboxValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + checkboxValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Default": - isDefault = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + isDefault = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Height": - height = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Help": - help = this.core.GetAttributeValue(sourceLineNumbers, attrib); + help = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "IconSize": - string iconSizeValue = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string iconSizeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (null != specialAttributes) { if (0 < iconSizeValue.Length) @@ -17057,54 +17009,54 @@ namespace WixToolset switch (iconsSizeType) { case Wix.Control.IconSizeType.Item16: - this.core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); + this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); break; case Wix.Control.IconSizeType.Item32: - this.core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); + this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); break; case Wix.Control.IconSizeType.Item48: - this.core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); - this.core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); + this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); + this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "16", "32", "48")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "16", "32", "48")); break; } } } else { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "Type")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "Type")); } break; case "Property": - property = this.core.GetAttributeValue(sourceLineNumbers, attrib); + property = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "TabSkip": - notTabbable = YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + notTabbable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Text": - text = this.core.GetAttributeValue(sourceLineNumbers, attrib); + text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ToolTip": - tooltip = this.core.GetAttributeValue(sourceLineNumbers, attrib); + tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Width": - width = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "X": - x = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; case "Y": - y = this.core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); + y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); break; default: - YesNoType attribValue = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - if (!this.core.TrySetBitFromName(MsiInterop.CommonControlAttributes, attrib.Name.LocalName, attribValue, bits, 0)) + YesNoType attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + if (!this.Core.TrySetBitFromName(MsiInterop.CommonControlAttributes, attrib.Name.LocalName, attribValue, bits, 0)) { - if (null == specialAttributes || !this.core.TrySetBitFromName(specialAttributes, attrib.Name.LocalName, attribValue, bits, 16)) + if (null == specialAttributes || !this.Core.TrySetBitFromName(specialAttributes, attrib.Name.LocalName, attribValue, bits, 16)) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } } break; @@ -17112,11 +17064,11 @@ namespace WixToolset } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - attributes = this.core.CreateIntegerFromBitArray(bits); + attributes = this.Core.CreateIntegerFromBitArray(bits); if (disabled) { @@ -17125,27 +17077,27 @@ namespace WixToolset if (null == height) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Height")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Height")); } if (null == width) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Width")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Width")); } if (null == x) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "X")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "X")); } if (null == y) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Y")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Y")); } if (null == id) { - id = this.core.CreateIdentifier("ctl", dialog, x, y, height, width); + id = this.Core.CreateIdentifier("ctl", dialog, x, y, height, width); } if (isCancel) @@ -17169,16 +17121,16 @@ namespace WixToolset this.ParseBinaryElement(child); break; case "ComboBox": - this.ParseControlGroupElement(child, this.tableDefinitions["ComboBox"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem"); break; case "Condition": this.ParseConditionElement(child, node.Name.LocalName, id.Id, dialog); break; case "ListBox": - this.ParseControlGroupElement(child, this.tableDefinitions["ListBox"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem"); break; case "ListView": - this.ParseControlGroupElement(child, this.tableDefinitions["ListView"], "ListItem"); + this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem"); break; case "Property": this.ParsePropertyElement(child); @@ -17200,33 +17152,33 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "SourceFile": - sourceFile = this.core.GetAttributeValue(childSourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(childSourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(child, attrib); + this.Core.UnexpectedAttribute(child, attrib); break; } } else { - this.core.ParseExtensionAttribute(child, attrib); + this.Core.ParseExtensionAttribute(child, attrib); } } text = Common.GetInnerText(child); if (!String.IsNullOrEmpty(text) && null != sourceFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithInnerText(childSourceLineNumbers, child.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithInnerText(childSourceLineNumbers, child.Name.LocalName, "SourceFile")); } break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -17255,79 +17207,75 @@ namespace WixToolset } // the logic for creating control rows is a little tricky because of the way tabable controls are set - Row row = null; - if (!this.core.EncounteredError) + IntermediateTuple row = null; + if (!this.Core.EncounteredError) { if ("CheckBox" == controlType) { if (String.IsNullOrEmpty(property) && String.IsNullOrEmpty(checkBoxPropertyRef)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "CheckBoxPropertyRef", true)); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "CheckBoxPropertyRef", true)); } else if (!String.IsNullOrEmpty(property) && !String.IsNullOrEmpty(checkBoxPropertyRef)) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "CheckBoxPropertyRef")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Property", "CheckBoxPropertyRef")); } else if (!String.IsNullOrEmpty(property)) { - row = this.core.CreateRow(sourceLineNumbers, "CheckBox"); - row[0] = property; - row[1] = checkboxValue; + row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CheckBox); + row.Set(0, property); + row.Set(1, checkboxValue); } else { - this.core.CreateSimpleReference(sourceLineNumbers, "CheckBox", checkBoxPropertyRef); + this.Core.CreateSimpleReference(sourceLineNumbers, "CheckBox", checkBoxPropertyRef); } } - row = this.core.CreateRow(sourceLineNumbers, table.Name); - row.Access = id.Access; - row[0] = dialog; - row[1] = id.Id; - row[2] = controlType; - row[3] = x; - row[4] = y; - row[5] = width; - row[6] = height; - row[7] = attributes ^ (MsiInterop.MsidbControlAttributesVisible | MsiInterop.MsidbControlAttributesEnabled); - if ("BBControl" == table.Name) + var dialogId = new Identifier(dialog, id.Access); + + row = this.Core.CreateRow(sourceLineNumbers, tableName, dialogId); + row.Set(1, id.Id); + row.Set(2, controlType); + row.Set(3, x); + row.Set(4, y); + row.Set(5, width); + row.Set(6, height); + row.Set(7, attributes ^ (MsiInterop.MsidbControlAttributesVisible | MsiInterop.MsidbControlAttributesEnabled)); + if (TupleDefinitionType.BBControl == tableName) { - row[8] = text; // BBControl.Text + row.Set(8, text); // BBControl.Text if (null != sourceFile) { - Row wixBBControlRow = this.core.CreateRow(sourceLineNumbers, "WixBBControl"); - wixBBControlRow.Access = id.Access; - wixBBControlRow[0] = dialog; - wixBBControlRow[1] = id.Id; - wixBBControlRow[2] = sourceFile; + var wixBBControlRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBBControl, dialogId); + wixBBControlRow.Set(1, id.Id); + wixBBControlRow.Set(2, sourceFile); } } else { - row[8] = !String.IsNullOrEmpty(property) ? property : checkBoxPropertyRef; - row[9] = text; + row.Set(8, !String.IsNullOrEmpty(property) ? property : checkBoxPropertyRef); + row.Set(9, text); if (null != tooltip || null != help) { - row[11] = String.Concat(tooltip, "|", help); // Separator is required, even if only one is non-null. + row.Set(11, String.Concat(tooltip, "|", help)); // Separator is required, even if only one is non-null. } if (null != sourceFile) { - Row wixControlRow = this.core.CreateRow(sourceLineNumbers, "WixControl"); - wixControlRow.Access = id.Access; - wixControlRow[0] = dialog; - wixControlRow[1] = id.Id; - wixControlRow[2] = sourceFile; + var wixControlRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixControl, dialogId); + wixControlRow.Set(1, id.Id); + wixControlRow.Set(2, sourceFile); } } } if (!notTabbable) { - if ("BBControl" == table.Name) + if (TupleDefinitionType.BBControl == tableName) { - this.core.OnMessage(WixErrors.TabbableControlNotAllowedInBillboard(sourceLineNumbers, node.Name.LocalName, controlType)); + this.Core.OnMessage(WixErrors.TabbableControlNotAllowedInBillboard(sourceLineNumbers, node.Name.LocalName, controlType)); } if (null == firstControl) @@ -17337,7 +17285,7 @@ namespace WixToolset if (null != lastTabRow) { - lastTabRow[10] = id.Id; + lastTabRow.Set(10, id.Id); } lastTabRow = row; } @@ -17346,7 +17294,7 @@ namespace WixToolset // add a reference if the identifier of the binary entry is known during compilation if (("Bitmap" == controlType || "Icon" == controlType) && Common.IsIdentifier(text)) { - this.core.CreateSimpleReference(sourceLineNumbers, "Binary", text); + this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); } } @@ -17377,67 +17325,67 @@ namespace WixToolset case "Control": if (null != control) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); } - control = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + control = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "Dialog": if (null != dialog) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); } - dialog = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog); + dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog); break; case "Event": - controlEvent = Compiler.UppercaseFirstChar(this.core.GetAttributeValue(sourceLineNumbers, attrib)); + controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); break; case "Order": - order = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 2147483647); + order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 2147483647); break; case "Property": - property = String.Concat("[", this.core.GetAttributeValue(sourceLineNumbers, attrib), "]"); + property = String.Concat("[", this.Core.GetAttributeValue(sourceLineNumbers, attrib), "]"); break; case "Value": - argument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - condition = this.core.GetConditionInnerText(node); + condition = this.Core.GetConditionInnerText(node); if (null == control) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Control")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Control")); } if (null == dialog) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dialog")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dialog")); } if (null == controlEvent && null == property) // need to specify at least one { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Event", "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Event", "Property")); } else if (null != controlEvent && null != property) // cannot specify both { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Event", "Property")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Event", "Property")); } if (null == argument) { if (null != controlEvent) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value", "Event")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value", "Event")); } else if (null != property) { @@ -17446,17 +17394,17 @@ namespace WixToolset } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "ControlEvent"); - row[0] = dialog; - row[1] = control; - row[2] = (null != controlEvent ? controlEvent : property); - row[3] = argument; - row[4] = condition; - row[5] = order; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ControlEvent); + row.Set(0, dialog); + row.Set(1, control); + row.Set(2, (null != controlEvent ? controlEvent : property)); + row.Set(3, argument); + row.Set(4, condition); + row.Set(5, order); } if ("DoAction" == controlEvent && null != argument) @@ -17465,14 +17413,14 @@ namespace WixToolset // to the custom action. if (!WindowsInstallerStandard.IsStandardAction(argument) && !Common.ContainsProperty(argument)) { - this.core.CreateSimpleReference(sourceLineNumbers, "CustomAction", argument); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", argument); } } // if we're referring to a dialog but not through a property, add it to the references if (("NewDialog" == controlEvent || "SpawnDialog" == controlEvent || "SpawnWaitDialog" == controlEvent || "SelectionBrowse" == controlEvent) && Common.IsIdentifier(argument)) { - this.core.CreateSimpleReference(sourceLineNumbers, "Dialog", argument); + this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", argument); } } @@ -17495,31 +17443,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Attribute": - controlAttribute = Compiler.UppercaseFirstChar(this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); + controlAttribute = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); break; case "Event": - eventMapping = Compiler.UppercaseFirstChar(this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); + eventMapping = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "EventMapping"); - row[0] = dialog; - row[1] = control; - row[2] = eventMapping; - row[3] = controlAttribute; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.EventMapping); + row.Set(0, dialog); + row.Set(1, control); + row.Set(2, eventMapping); + row.Set(3, controlAttribute); } } @@ -17539,22 +17487,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } // process the UpgradeVersion children here @@ -17568,23 +17516,22 @@ namespace WixToolset { case "Property": this.ParsePropertyElement(child); - this.core.OnMessage(WixWarnings.DeprecatedUpgradeProperty(childSourceLineNumbers)); + this.Core.OnMessage(WixWarnings.DeprecatedUpgradeProperty(childSourceLineNumbers)); break; case "UpgradeVersion": this.ParseUpgradeVersionElement(child, id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - // No rows created here. All row creation is done in ParseUpgradeVersionElement. } @@ -17611,93 +17558,93 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "ExcludeLanguages": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive; } break; case "IgnoreRemoveFailure": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure; } break; case "IncludeMaximum": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive; } break; case "IncludeMinimum": // this is "yes" by default - if (YesNoType.No == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive; } break; case "Language": - language = this.core.GetAttributeValue(sourceLineNumbers, attrib); + language = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Minimum": - minimum = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + minimum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "Maximum": - maximum = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + maximum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "MigrateFeatures": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesMigrateFeatures; } break; case "OnlyDetect": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { options |= MsiInterop.MsidbUpgradeAttributesOnlyDetect; } break; case "Property": - actionProperty = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + actionProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; case "RemoveFeatures": - removeFeatures = this.core.GetAttributeValue(sourceLineNumbers, attrib); + removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == actionProperty) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); } else if (actionProperty.ToUpper(CultureInfo.InvariantCulture) != actionProperty) { - this.core.OnMessage(WixErrors.SecurePropertyNotUppercase(sourceLineNumbers, node.Name.LocalName, "Property", actionProperty)); + this.Core.OnMessage(WixErrors.SecurePropertyNotUppercase(sourceLineNumbers, node.Name.LocalName, "Property", actionProperty)); } if (null == minimum && null == maximum) { - this.core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Minimum", "Maximum")); + this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "Minimum", "Maximum")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Upgrade"); - row[0] = upgradeId; - row[1] = minimum; - row[2] = maximum; - row[3] = language; - row[4] = options; - row[5] = removeFeatures; - row[6] = actionProperty; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Upgrade); + row.Set(0, upgradeId); + row.Set(1, minimum); + row.Set(2, maximum); + row.Set(3, language); + row.Set(4, options); + row.Set(5, removeFeatures); + row.Set(6, actionProperty); // Ensure the action property is secure. this.AddWixPropertyRow(sourceLineNumbers, new Identifier(actionProperty, AccessModifier.Private), false, true, false); @@ -17706,7 +17653,7 @@ namespace WixToolset // if at least one row in Upgrade table lacks the OnlyDetect attribute. if (0 == (options & MsiInterop.MsidbUpgradeAttributesOnlyDetect)) { - this.core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", "RemoveExistingProducts"); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", "RemoveExistingProducts"); } } } @@ -17737,101 +17684,101 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Argument": - argument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Command": - command = this.core.GetAttributeValue(sourceLineNumbers, attrib); + command = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Sequence": - sequence = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); + sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); break; case "Target": - target = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetFile", "TargetProperty")); + target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetFile", "TargetProperty")); break; case "TargetFile": - targetFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "File", targetFile); + targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile); break; case "TargetProperty": - targetProperty = this.core.GetAttributeValue(sourceLineNumbers, attrib); + targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null != target && null != targetFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "TargetFile")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "TargetFile")); } if (null != target && null != targetProperty) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "TargetProperty")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Target", "TargetProperty")); } if (null != targetFile && null != targetProperty) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "TargetFile", "TargetProperty")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "TargetFile", "TargetProperty")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (YesNoType.Yes == advertise) { if (null != target) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "Target")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "Target")); } if (null != targetFile) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "TargetFile")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "TargetFile")); } if (null != targetProperty) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "TargetProperty")); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenAdvertised(sourceLineNumbers, node.Name.LocalName, "TargetProperty")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "Verb"); - row[0] = extension; - row[1] = id; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Verb); + row.Set(0, extension); + row.Set(1, id); if (CompilerConstants.IntegerNotSet != sequence) { - row[2] = sequence; + row.Set(2, sequence); } - row[3] = command; - row[4] = argument; + row.Set(3, command); + row.Set(4, argument); } } else if (YesNoType.No == advertise) { if (CompilerConstants.IntegerNotSet != sequence) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Sequence", "Advertise", "no")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Sequence", "Advertise", "no")); } if (null == target && null == targetFile && null == targetProperty) { - this.core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "TargetFile", "TargetProperty", "Advertise", "no")); + this.Core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "TargetFile", "TargetProperty", "Advertise", "no")); } if (null == target) @@ -17856,10 +17803,10 @@ namespace WixToolset if (null != command) { - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(prefix, "\\shell\\", id), String.Empty, command, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(prefix, "\\shell\\", id), String.Empty, command, componentId); } - this.core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(prefix, "\\shell\\", id, "\\command"), String.Empty, target, componentId); + this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat(prefix, "\\shell\\", id, "\\command"), String.Empty, target, componentId); } } @@ -17883,36 +17830,36 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Key": - key = this.core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Value": - valueName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Win64": - win64 = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + win64 = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == key) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } BundleApprovedExeForElevationAttributes attributes = BundleApprovedExeForElevationAttributes.None; @@ -17922,14 +17869,14 @@ namespace WixToolset attributes |= BundleApprovedExeForElevationAttributes.Win64; } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixApprovedExeForElevationRow wixApprovedExeForElevationRow = (WixApprovedExeForElevationRow)this.core.CreateRow(sourceLineNumbers, "WixApprovedExeForElevation", id); + var wixApprovedExeForElevationRow = (WixApprovedExeForElevationTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixApprovedExeForElevation, id); wixApprovedExeForElevationRow.Key = key; - wixApprovedExeForElevationRow.ValueName = valueName; - wixApprovedExeForElevationRow.Attributes = attributes; + wixApprovedExeForElevationRow.Value = valueName; + wixApprovedExeForElevationRow.Attributes = (int)attributes; } } @@ -17969,19 +17916,19 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "AboutUrl": - aboutUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + aboutUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Compressed": - compressed = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; case "Condition": - condition = this.core.GetAttributeValue(sourceLineNumbers, attrib); + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Copyright": - copyright = this.core.GetAttributeValue(sourceLineNumbers, attrib); + copyright = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisableModify": - string value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); switch (value) { case "button": @@ -17994,51 +17941,51 @@ namespace WixToolset disableModify = 0; break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); break; } break; case "DisableRemove": - disableRemove = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + disableRemove = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "DisableRepair": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); break; case "HelpTelephone": - helpTelephone = this.core.GetAttributeValue(sourceLineNumbers, attrib); + helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "HelpUrl": - helpUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + helpUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Manufacturer": - manufacturer = this.core.GetAttributeValue(sourceLineNumbers, attrib); + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "IconSourceFile": - iconSourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + iconSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ParentName": - parentName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "SplashScreenSourceFile": - splashScreenSourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Tag": - tag = this.core.GetAttributeValue(sourceLineNumbers, attrib); + tag = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "UpdateUrl": - updateUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + updateUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "UpgradeCode": - upgradeCode = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Version": - version = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } @@ -18046,16 +17993,16 @@ namespace WixToolset if (String.IsNullOrEmpty(version)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } else if (!CompilerCore.IsValidModuleOrBundleVersion(version)) { - this.core.OnMessage(WixWarnings.InvalidModuleOrBundleVersion(sourceLineNumbers, "Bundle", version)); + this.Core.OnMessage(WixWarnings.InvalidModuleOrBundleVersion(sourceLineNumbers, "Bundle", version)); } if (String.IsNullOrEmpty(upgradeCode)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "UpgradeCode")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "UpgradeCode")); } if (String.IsNullOrEmpty(copyright)) @@ -18082,14 +18029,14 @@ namespace WixToolset } this.activeName = String.IsNullOrEmpty(name) ? Common.GenerateGuid() : name; - this.core.CreateActiveSection(this.activeName, SectionType.Bundle, 0); + this.Core.CreateActiveSection(this.activeName, SectionType.Bundle, 0, this.Context.CompilationId); // Now that the active section is initialized, process only extension attributes. foreach (XAttribute attrib in node.Attributes()) { if (!String.IsNullOrEmpty(attrib.Name.NamespaceName) && CompilerCore.WixNamespace != attrib.Name.Namespace) { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -18110,7 +18057,7 @@ namespace WixToolset if (baSeen) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "BootstrapperApplication")); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "BootstrapperApplication")); } this.ParseBootstrapperApplicationElement(child); baSeen = true; @@ -18128,7 +18075,7 @@ namespace WixToolset if (chainSeen) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain")); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain")); } this.ParseChainElement(child); chainSeen = true; @@ -18143,7 +18090,7 @@ namespace WixToolset if (logSeen) { SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log")); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log")); } logVariablePrefixAndExtension = this.ParseLogElement(child, fileSystemSafeBundleName); logSeen = true; @@ -18167,86 +18114,86 @@ namespace WixToolset this.ParseWixVariableElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (!chainSeen) { - this.core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Chain")); + this.Core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Chain")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { if (null != upgradeCode) { - Row relatedBundleRow = this.core.CreateRow(sourceLineNumbers, "WixRelatedBundle"); - relatedBundleRow[0] = upgradeCode; - relatedBundleRow[1] = (int)Wix.RelatedBundle.ActionType.Upgrade; + var relatedBundleRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixRelatedBundle); + relatedBundleRow.Set(0, upgradeCode); + relatedBundleRow.Set(1, (int)Wix.RelatedBundle.ActionType.Upgrade); } - WixBundleContainerRow containerRow = (WixBundleContainerRow)this.core.CreateRow(sourceLineNumbers, "WixBundleContainer"); - containerRow.Id = Compiler.BurnDefaultAttachedContainerId; + var containerRow = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer); + containerRow.WixBundleContainer = Compiler.BurnDefaultAttachedContainerId; containerRow.Name = "bundle-attached.cab"; containerRow.Type = ContainerType.Attached; - Row row = this.core.CreateRow(sourceLineNumbers, "WixBundle"); - row[0] = version; - row[1] = copyright; - row[2] = name; - row[3] = aboutUrl; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundle); + row.Set(0, version); + row.Set(1, copyright); + row.Set(2, name); + row.Set(3, aboutUrl); if (-1 != disableModify) { - row[4] = disableModify; + row.Set(4, disableModify); } if (YesNoType.NotSet != disableRemove) { - row[5] = (YesNoType.Yes == disableRemove) ? 1 : 0; + row.Set(5, (YesNoType.Yes == disableRemove) ? 1 : 0); } - // row[6] - (deprecated) "disable repair" - row[7] = helpTelephone; - row[8] = helpUrl; - row[9] = manufacturer; - row[10] = updateUrl; + // row.Set(6] - (deprecated) "disable repair" + row.Set(7, helpTelephone); + row.Set(8, helpUrl); + row.Set(9, manufacturer); + row.Set(10, updateUrl); if (YesNoDefaultType.Default != compressed) { - row[11] = (YesNoDefaultType.Yes == compressed) ? 1 : 0; + row.Set(11, (YesNoDefaultType.Yes == compressed) ? 1 : 0); } - row[12] = logVariablePrefixAndExtension; - row[13] = iconSourceFile; - row[14] = splashScreenSourceFile; - row[15] = condition; - row[16] = tag; - row[17] = this.CurrentPlatform.ToString(); - row[18] = parentName; - row[19] = upgradeCode; + row.Set(12, logVariablePrefixAndExtension); + row.Set(13, iconSourceFile); + row.Set(14, splashScreenSourceFile); + row.Set(15, condition); + row.Set(16, tag); + row.Set(17, this.CurrentPlatform.ToString()); + row.Set(18, parentName); + row.Set(19, upgradeCode); // Ensure that the bundle stores the well-known persisted values. - WixBundleVariableRow bundleNameWellKnownVariable = (WixBundleVariableRow)this.core.CreateRow(sourceLineNumbers, "WixBundleVariable"); - bundleNameWellKnownVariable.Id = Compiler.BURN_BUNDLE_NAME; + var bundleNameWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); + bundleNameWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_NAME; bundleNameWellKnownVariable.Hidden = false; bundleNameWellKnownVariable.Persisted = true; - WixBundleVariableRow bundleOriginalSourceWellKnownVariable = (WixBundleVariableRow)this.core.CreateRow(sourceLineNumbers, "WixBundleVariable"); - bundleOriginalSourceWellKnownVariable.Id = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE; + var bundleOriginalSourceWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); + bundleOriginalSourceWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE; bundleOriginalSourceWellKnownVariable.Hidden = false; bundleOriginalSourceWellKnownVariable.Persisted = true; - WixBundleVariableRow bundleOriginalSourceFolderWellKnownVariable = (WixBundleVariableRow)this.core.CreateRow(sourceLineNumbers, "WixBundleVariable"); - bundleOriginalSourceFolderWellKnownVariable.Id = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER; + var bundleOriginalSourceFolderWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); + bundleOriginalSourceFolderWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER; bundleOriginalSourceFolderWellKnownVariable.Hidden = false; bundleOriginalSourceFolderWellKnownVariable.Persisted = true; - WixBundleVariableRow bundleLastUsedSourceWellKnownVariable = (WixBundleVariableRow)this.core.CreateRow(sourceLineNumbers, "WixBundleVariable"); - bundleLastUsedSourceWellKnownVariable.Id = Compiler.BURN_BUNDLE_LAST_USED_SOURCE; + var bundleLastUsedSourceWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); + bundleLastUsedSourceWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_LAST_USED_SOURCE; bundleLastUsedSourceWellKnownVariable.Hidden = false; bundleLastUsedSourceWellKnownVariable.Persisted = true; } @@ -18271,25 +18218,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Disable": - disableLog = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + disableLog = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "PathVariable": - variable = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "Prefix": - logPrefix = this.core.GetAttributeValue(sourceLineNumbers, attrib); + logPrefix = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Extension": - logExtension = this.core.GetAttributeValue(sourceLineNumbers, attrib); + logExtension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -18298,7 +18245,7 @@ namespace WixToolset logExtension = String.Concat(".", logExtension); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); return YesNoType.Yes == disableLog ? null : String.Concat(variable, ":", logPrefix, logExtension); } @@ -18320,13 +18267,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } @@ -18334,23 +18281,23 @@ namespace WixToolset if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == sourceFile) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); // Create catalog row - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { this.CreatePayloadRow(sourceLineNumbers, id, Path.GetFileName(sourceFile), sourceFile, null, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, ComplexReferenceChildType.Unknown, null, YesNoDefaultType.Yes, YesNoType.Yes, null, null, null); - WixBundleCatalogRow wixCatalogRow = (WixBundleCatalogRow)this.core.CreateRow(sourceLineNumbers, "WixBundleCatalog", id); - wixCatalogRow.Payload = id.Id; + var wixCatalogRow = (WixBundleCatalogTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleCatalog, id); + wixCatalogRow.Payload_ = id.Id; } } @@ -18373,29 +18320,29 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "DownloadUrl": - downloadUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Type": - string typeString = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string typeString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (!Enum.TryParse(typeString, out type)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached")); } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -18403,17 +18350,17 @@ namespace WixToolset { if (!String.IsNullOrEmpty(name)) { - id = this.core.CreateIdentifierFromFilename(name); + id = this.Core.CreateIdentifierFromFilename(name); } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (!Common.IsIdentifier(id.Id)) { - this.core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } } else if (null == name) @@ -18423,7 +18370,7 @@ namespace WixToolset if (!String.IsNullOrEmpty(downloadUrl) && ContainerType.Detached != type) { - this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "Type", "attached")); + this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "Type", "attached")); } foreach (XElement child in node.Elements()) @@ -18436,20 +18383,20 @@ namespace WixToolset this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.Container, id.Id); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundleContainerRow row = (WixBundleContainerRow)this.core.CreateRow(sourceLineNumbers, "WixBundleContainer", id); + var row = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer, id); row.Name = name; row.Type = type; row.DownloadUrl = downloadUrl; @@ -18490,13 +18437,13 @@ namespace WixToolset previousType = ComplexReferenceChildType.PayloadGroup; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } @@ -18505,21 +18452,21 @@ namespace WixToolset // We need *either* or or even just @SourceFile on the BA... // but we just say there's a missing . // TODO: Is there a better message for this? - this.core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload")); + this.Core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload")); } // Add the application as an attached container and if an Id was provided add that too. - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundleContainerRow containerRow = (WixBundleContainerRow)this.core.CreateRow(sourceLineNumbers, "WixBundleContainer"); - containerRow.Id = Compiler.BurnUXContainerId; + var containerRow = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer); + containerRow.WixBundleContainer = Compiler.BurnUXContainerId; containerRow.Name = "bundle-ux.cab"; containerRow.Type = ContainerType.Attached; if (!String.IsNullOrEmpty(id)) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixBootstrapperApplication"); - row[0] = id; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBootstrapperApplication); + row.Set(0, id); } } } @@ -18542,16 +18489,16 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -18570,24 +18517,24 @@ namespace WixToolset previousType = ComplexReferenceChildType.PayloadGroup; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (String.IsNullOrEmpty(id)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } else { - this.core.CreateSimpleReference(sourceLineNumbers, "WixBootstrapperApplication", id); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixBootstrapperApplication", id); } } @@ -18616,28 +18563,28 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Manufacturer": - manufacturer = this.core.GetAttributeValue(sourceLineNumbers, attrib); + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Department": - department = this.core.GetAttributeValue(sourceLineNumbers, attrib); + department = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ProductFamily": - productFamily = this.core.GetAttributeValue(sourceLineNumbers, attrib); + productFamily = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Classification": - classification = this.core.GetAttributeValue(sourceLineNumbers, attrib); + classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -18649,7 +18596,7 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "Manufacturer", node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "Manufacturer", node.Parent.Name.LocalName)); } } @@ -18669,25 +18616,25 @@ namespace WixToolset } else { - this.core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "Name", node.Parent.Name.LocalName)); + this.Core.OnMessage(WixErrors.ExpectedAttributeInElementOrParent(sourceLineNumbers, node.Name.LocalName, "Name", node.Parent.Name.LocalName)); } } if (String.IsNullOrEmpty(classification)) { - this.core.OnMessage(WixErrors.IllegalEmptyAttributeValue(sourceLineNumbers, node.Name.LocalName, "Classification", defaultClassification)); + this.Core.OnMessage(WixErrors.IllegalEmptyAttributeValue(sourceLineNumbers, node.Name.LocalName, "Classification", defaultClassification)); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixUpdateRegistration"); - row[0] = manufacturer; - row[1] = department; - row[2] = productFamily; - row[3] = name; - row[4] = classification; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixUpdateRegistration); + row.Set(0, manufacturer); + row.Set(1, department); + row.Set(2, productFamily); + row.Set(3, name); + row.Set(4, classification); } } @@ -18713,13 +18660,13 @@ namespace WixToolset switch (child.Name.LocalName) { default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } @@ -18756,25 +18703,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Compressed": - compressed = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DownloadUrl": - downloadUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "EnableSignatureVerification": - enableSignatureVerification = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } @@ -18792,7 +18739,7 @@ namespace WixToolset if (null == id) { - id = this.core.CreateIdentifier("pay", (null != sourceFile) ? sourceFile.ToUpperInvariant() : String.Empty); + id = this.Core.CreateIdentifier("pay", (null != sourceFile) ? sourceFile.ToUpperInvariant() : String.Empty); } // Now that the PayloadId is known, we can parse the extension attributes. @@ -18801,7 +18748,7 @@ namespace WixToolset foreach (XAttribute extensionAttribute in extensionAttributes) { - this.core.ParseExtensionAttribute(node, extensionAttribute, context); + this.Core.ParseExtensionAttribute(node, extensionAttribute, context); } // We only handle the elements we care about. Let caller handle other children. @@ -18811,13 +18758,13 @@ namespace WixToolset if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage") { - this.core.OnMessage(WixErrors.RemotePayloadUnsupported(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.RemotePayloadUnsupported(childSourceLineNumbers)); continue; } if (null != remotePayload) { - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } remotePayload = this.ParseRemotePayloadElement(child); @@ -18825,11 +18772,11 @@ namespace WixToolset if (null != sourceFile && null != remotePayload) { - this.core.OnMessage(WixErrors.UnexpectedElementWithAttribute(sourceLineNumbers, node.Name.LocalName, "RemotePayload", "SourceFile")); + this.Core.OnMessage(WixErrors.UnexpectedElementWithAttribute(sourceLineNumbers, node.Name.LocalName, "RemotePayload", "SourceFile")); } else if (null == sourceFile && null == remotePayload) { - this.core.OnMessage(WixErrors.ExpectedAttributeOrElement(sourceLineNumbers, node.Name.LocalName, "SourceFile", "RemotePayload")); + this.Core.OnMessage(WixErrors.ExpectedAttributeOrElement(sourceLineNumbers, node.Name.LocalName, "SourceFile", "RemotePayload")); } else if (null == sourceFile) { @@ -18838,14 +18785,14 @@ namespace WixToolset if (null == downloadUrl && null != remotePayload) { - this.core.OnMessage(WixErrors.ExpectedAttributeWithElement(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "RemotePayload")); + this.Core.OnMessage(WixErrors.ExpectedAttributeWithElement(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "RemotePayload")); } if (Compiler.BurnUXContainerId == parentId) { if (compressed == YesNoDefaultType.No) { - core.OnMessage(WixWarnings.UxPayloadsOnlySupportEmbedding(sourceLineNumbers, sourceFile)); + Core.OnMessage(WixWarnings.UxPayloadsOnlySupportEmbedding(sourceLineNumbers, sourceFile)); } compressed = YesNoDefaultType.Yes; @@ -18868,60 +18815,60 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "CertificatePublicKey": - remotePayload.CertificatePublicKey = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.CertificatePublicKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "CertificateThumbprint": - remotePayload.CertificateThumbprint = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.CertificateThumbprint = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - remotePayload.Description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.Description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Hash": - remotePayload.Hash = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.Hash = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "ProductName": - remotePayload.ProductName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Size": - remotePayload.Size = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + remotePayload.Size = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "Version": - remotePayload.Version = this.core.GetAttributeValue(sourceLineNumbers, attrib); + remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(remotePayload.ProductName)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProductName")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProductName")); } if (String.IsNullOrEmpty(remotePayload.Description)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); } if (String.IsNullOrEmpty(remotePayload.Hash)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Hash")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Hash")); } if (0 == remotePayload.Size) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Size")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Size")); } if (String.IsNullOrEmpty(remotePayload.Version)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } return remotePayload; @@ -18933,15 +18880,15 @@ namespace WixToolset /// Element to parse /// ComplexReferenceParentType of parent element /// Identifier of parent element. - private WixBundlePayloadRow CreatePayloadRow(SourceLineNumber sourceLineNumbers, Identifier id, string name, string sourceFile, string downloadUrl, ComplexReferenceParentType parentType, + private WixBundlePayloadTuple CreatePayloadRow(SourceLineNumber sourceLineNumbers, Identifier id, string name, string sourceFile, string downloadUrl, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId, YesNoDefaultType compressed, YesNoType enableSignatureVerification, string displayName, string description, Wix.RemotePayload remotePayload) { - WixBundlePayloadRow row = null; + WixBundlePayloadTuple row = null; - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - row = (WixBundlePayloadRow)this.core.CreateRow(sourceLineNumbers, "WixBundlePayload", id); + row = (WixBundlePayloadTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePayload, id); row.Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name; row.SourceFile = sourceFile; row.DownloadUrl = downloadUrl; @@ -18988,22 +18935,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -19024,20 +18971,20 @@ namespace WixToolset previousType = ComplexReferenceChildType.PayloadGroup; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreateRow(sourceLineNumbers, "WixBundlePayloadGroup", id); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePayloadGroup, id); this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PayloadGroup, id.Id, ComplexReferenceChildType.Unknown, null); } @@ -19064,26 +19011,26 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PayloadGroup, id, previousType, previousId); @@ -19107,7 +19054,7 @@ namespace WixToolset { if (ComplexReferenceParentType.Unknown != parentType && null != parentId) { - this.core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, type, id); + this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, type, id); } if (ComplexReferenceChildType.Unknown != previousType && null != previousId) @@ -19124,8 +19071,8 @@ namespace WixToolset private void ParseExitCodeElement(XElement node, string packageId) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); - int value = CompilerConstants.IntegerNotSet; - ExitCodeBehaviorType behavior = ExitCodeBehaviorType.NotSet; + var value = CompilerConstants.IntegerNotSet; + var behavior = ExitCodeBehaviorType.NotSet; foreach (XAttribute attrib in node.Attributes()) { @@ -19134,36 +19081,36 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Value": - value = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); + value = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); break; case "Behavior": - string behaviorString = this.core.GetAttributeValue(sourceLineNumbers, attrib); + string behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); if (!Enum.TryParse(behaviorString, true, out behavior)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (ExitCodeBehaviorType.NotSet == behavior) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Behavior")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Behavior")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundlePackageExitCodeRow row = (WixBundlePackageExitCodeRow)this.core.CreateRow(sourceLineNumbers, "WixBundlePackageExitCode"); + var row = (WixBundlePackageExitCodeTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageExitCode); row.ChainPackageId = packageId; row.Code = value; row.Behavior = behavior; @@ -19177,7 +19124,7 @@ namespace WixToolset private void ParseChainElement(XElement node) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); - WixChainAttributes attributes = WixChainAttributes.None; + var attributes = WixChainAttributes.None; foreach (XAttribute attrib in node.Attributes()) { @@ -19186,31 +19133,31 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "DisableRollback": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= WixChainAttributes.DisableRollback; } break; case "DisableSystemRestore": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= WixChainAttributes.DisableSystemRestore; } break; case "ParallelCache": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= WixChainAttributes.ParallelCache; } break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } @@ -19251,25 +19198,25 @@ namespace WixToolset previousType = ComplexReferenceChildType.PackageGroup; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } if (null == previousId) { - this.core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "MsiPackage", "ExePackage", "PackageGroupRef")); + this.Core.OnMessage(WixErrors.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "MsiPackage", "ExePackage", "PackageGroupRef")); } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixChainRow row = (WixChainRow)this.core.CreateRow(sourceLineNumbers, "WixChain"); + var row = (WixChainTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChain); row.Attributes = attributes; } } @@ -19361,13 +19308,13 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Vital": - vital = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Transaction": - transaction = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + transaction = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; default: allowed = false; @@ -19376,7 +19323,7 @@ namespace WixToolset if (!allowed) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } } else @@ -19390,17 +19337,17 @@ namespace WixToolset { if (!String.IsNullOrEmpty(previousId)) { - id = this.core.CreateIdentifier("rba", previousId); + id = this.Core.CreateIdentifier("rba", previousId); } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (!Common.IsIdentifier(id.Id)) { - this.core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } } @@ -19409,12 +19356,12 @@ namespace WixToolset contextValues["RollbackBoundaryId"] = id.Id; foreach (XAttribute attribute in extensionAttributes) { - this.core.ParseExtensionAttribute(node, attribute, contextValues); + this.Core.ParseExtensionAttribute(node, attribute, contextValues); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { this.CreateRollbackBoundary(sourceLineNumbers, id, vital, transaction, parentType, parentId, previousType, previousId); } @@ -19487,112 +19434,112 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Name": - name = this.core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); - if (!this.core.IsValidLongFilename(name, false, true)) + name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); + if (!this.Core.IsValidLongFilename(name, false, true)) { - this.core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Name", name)); + this.Core.OnMessage(WixErrors.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Name", name)); } break; case "SourceFile": - sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); + sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DownloadUrl": - downloadUrl = this.core.GetAttributeValue(sourceLineNumbers, attrib); + downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "After": - after = this.core.GetAttributeValue(sourceLineNumbers, attrib); + after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "InstallCondition": - installCondition = this.core.GetAttributeValue(sourceLineNumbers, attrib); + installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Cache": - cache = this.core.GetAttributeYesNoAlwaysValue(sourceLineNumbers, attrib); + cache = this.Core.GetAttributeYesNoAlwaysValue(sourceLineNumbers, attrib); break; case "CacheId": - cacheId = this.core.GetAttributeValue(sourceLineNumbers, attrib); + cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Description": - description = this.core.GetAttributeValue(sourceLineNumbers, attrib); + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "DisplayInternalUI": - displayInternalUI = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + displayInternalUI = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp); break; case "EnableFeatureSelection": - enableFeatureSelection = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + enableFeatureSelection = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msi); break; case "ForcePerMachine": - forcePerMachine = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + forcePerMachine = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msi); break; case "LogPathVariable": - logPathVariable = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "RollbackLogPathVariable": - rollbackPathVariable = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + rollbackPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "Permanent": - permanent = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + permanent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Visible": - visible = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + visible = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msi); break; case "Vital": - vital = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "InstallCommand": - installCommand = this.core.GetAttributeValue(sourceLineNumbers, attrib); + installCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Exe); break; case "RepairCommand": - repairCommand = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + repairCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); repairable = YesNoType.Yes; allowed = (packageType == WixBundlePackageType.Exe); break; case "UninstallCommand": - uninstallCommand = this.core.GetAttributeValue(sourceLineNumbers, attrib); + uninstallCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Exe); break; case "PerMachine": - perMachine = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + perMachine = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msp); break; case "DetectCondition": - detectCondition = this.core.GetAttributeValue(sourceLineNumbers, attrib); + detectCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu); break; case "Protocol": - protocol = this.core.GetAttributeValue(sourceLineNumbers, attrib); + protocol = this.Core.GetAttributeValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Exe); break; case "InstallSize": - installSize = this.core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + installSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); break; case "KB": - msuKB = this.core.GetAttributeValue(sourceLineNumbers, attrib); + msuKB = this.Core.GetAttributeValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msu); break; case "Compressed": - compressed = this.core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; case "SuppressLooseFilePayloadGeneration": - this.core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); - suppressLooseFilePayloadGeneration = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + suppressLooseFilePayloadGeneration = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msi); break; case "EnableSignatureVerification": - enableSignatureVerification = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; case "Slipstream": - slipstream = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); allowed = (packageType == WixBundlePackageType.Msp); break; default: @@ -19602,7 +19549,7 @@ namespace WixToolset if (!allowed) { - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); } } else @@ -19619,13 +19566,13 @@ namespace WixToolset if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage" && node.Name.LocalName != "MsuPackage") { - this.core.OnMessage(WixErrors.RemotePayloadUnsupported(childSourceLineNumbers)); + this.Core.OnMessage(WixErrors.RemotePayloadUnsupported(childSourceLineNumbers)); continue; } if (null != remotePayload) { - this.core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); + this.Core.OnMessage(WixErrors.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); } remotePayload = this.ParseRemotePayloadElement(child); @@ -19635,7 +19582,7 @@ namespace WixToolset { if (String.IsNullOrEmpty(name)) { - this.core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", "SourceFile")); + this.Core.OnMessage(WixErrors.ExpectedAttributesWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Name", "SourceFile")); } else if (null == remotePayload) { @@ -19648,13 +19595,13 @@ namespace WixToolset } else if (null != remotePayload) { - this.core.OnMessage(WixErrors.UnexpectedElementWithAttribute(sourceLineNumbers, node.Name.LocalName, "RemotePayload", "SourceFile")); + this.Core.OnMessage(WixErrors.UnexpectedElementWithAttribute(sourceLineNumbers, node.Name.LocalName, "RemotePayload", "SourceFile")); } else if (sourceFile.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) { if (String.IsNullOrEmpty(name)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name", "SourceFile", sourceFile)); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name", "SourceFile", sourceFile)); } else { @@ -19664,34 +19611,34 @@ namespace WixToolset if (null == downloadUrl && null != remotePayload) { - this.core.OnMessage(WixErrors.ExpectedAttributeWithElement(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "RemotePayload")); + this.Core.OnMessage(WixErrors.ExpectedAttributeWithElement(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "RemotePayload")); } if (YesNoDefaultType.No != compressed && null != remotePayload) { compressed = YesNoDefaultType.No; - this.core.OnMessage(WixWarnings.RemotePayloadsMustNotAlsoBeCompressed(sourceLineNumbers, node.Name.LocalName)); + this.Core.OnMessage(WixWarnings.RemotePayloadsMustNotAlsoBeCompressed(sourceLineNumbers, node.Name.LocalName)); } if (null == id) { if (!String.IsNullOrEmpty(name)) { - id = this.core.CreateIdentifierFromFilename(Path.GetFileName(name)); + id = this.Core.CreateIdentifierFromFilename(Path.GetFileName(name)); } else if (!String.IsNullOrEmpty(sourceFile)) { - id = this.core.CreateIdentifierFromFilename(Path.GetFileName(sourceFile)); + id = this.Core.CreateIdentifierFromFilename(Path.GetFileName(sourceFile)); } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } else if (!Common.IsIdentifier(id.Id)) { - this.core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + this.Core.OnMessage(WixErrors.IllegalIdentifier(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); } } @@ -19707,7 +19654,7 @@ namespace WixToolset if (!String.IsNullOrEmpty(protocol) && !protocol.Equals("burn", StringComparison.Ordinal) && !protocol.Equals("netfx4", StringComparison.Ordinal) && !protocol.Equals("none", StringComparison.Ordinal)) { - this.core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Protocol", protocol, "none, burn, netfx4")); + this.Core.OnMessage(WixErrors.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Protocol", protocol, "none, burn, netfx4")); } if (!String.IsNullOrEmpty(protocol) && protocol.Equals("netfx4", StringComparison.Ordinal)) @@ -19716,17 +19663,17 @@ namespace WixToolset { if (null == installCommand || -1 == installCommand.IndexOf(expectedArgument, StringComparison.OrdinalIgnoreCase)) { - this.core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "InstallCommand", installCommand, expectedArgument, "Protocol", "netfx4")); + this.Core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "InstallCommand", installCommand, expectedArgument, "Protocol", "netfx4")); } if (null == repairCommand || -1 == repairCommand.IndexOf(expectedArgument, StringComparison.OrdinalIgnoreCase)) { - this.core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "RepairCommand", repairCommand, expectedArgument, "Protocol", "netfx4")); + this.Core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "RepairCommand", repairCommand, expectedArgument, "Protocol", "netfx4")); } if (null == uninstallCommand || -1 == uninstallCommand.IndexOf(expectedArgument, StringComparison.OrdinalIgnoreCase)) { - this.core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "UninstallCommand", uninstallCommand, expectedArgument, "Protocol", "netfx4")); + this.Core.OnMessage(WixWarnings.AttributeShouldContain(sourceLineNumbers, node.Name.LocalName, "UninstallCommand", uninstallCommand, expectedArgument, "Protocol", "netfx4")); } } } @@ -19741,7 +19688,7 @@ namespace WixToolset Dictionary contextValues = new Dictionary() { { "PackageId", id.Id } }; foreach (XAttribute attribute in extensionAttributes) { - this.core.ParseExtensionAttribute(node, attribute, contextValues); + this.Core.ParseExtensionAttribute(node, attribute, contextValues); } foreach (XElement child in node.Elements()) @@ -19795,31 +19742,31 @@ namespace WixToolset if (!allowed) { - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); } } else { Dictionary context = new Dictionary() { { "Id", id.Id } }; - this.core.ParseExtensionElement(node, child, context); + this.Core.ParseExtensionElement(node, child, context); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { // We create the package contents as a payload with this package as the parent this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null, compressed, enableSignatureVerification, displayName, description, remotePayload); - WixChainItemRow chainItemRow = (WixChainItemRow)this.core.CreateRow(sourceLineNumbers, "WixChainItem", id); + var chainItemRow = (WixChainItemTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChainItem, id); WixBundlePackageAttributes attributes = 0; attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0; attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0; - WixBundlePackageRow chainPackageRow = (WixBundlePackageRow)this.core.CreateRow(sourceLineNumbers, "WixBundlePackage", id); + var chainPackageRow = (WixBundlePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackage, id); chainPackageRow.Type = packageType; - chainPackageRow.PackagePayload = id.Id; + chainPackageRow.Payload_ = id.Id; chainPackageRow.Attributes = attributes; chainPackageRow.InstallCondition = installCondition; @@ -19833,7 +19780,7 @@ namespace WixToolset if (YesNoType.NotSet != vital) { - chainPackageRow.Vital = vital; + chainPackageRow.Vital = (vital == YesNoType.Yes); } if (YesNoDefaultType.NotSet != perMachine) @@ -19855,7 +19802,7 @@ namespace WixToolset WixBundleExePackageAttributes exeAttributes = 0; exeAttributes |= (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0; - WixBundleExePackageRow exeRow = (WixBundleExePackageRow)this.core.CreateRow(sourceLineNumbers, "WixBundleExePackage", id); + var exeRow = (WixBundleExePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleExePackage, id); exeRow.Attributes = exeAttributes; exeRow.DetectCondition = detectCondition; exeRow.InstallCommand = installCommand; @@ -19871,7 +19818,7 @@ namespace WixToolset msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0; - WixBundleMsiPackageRow msiRow = (WixBundleMsiPackageRow)this.core.CreateRow(sourceLineNumbers, "WixBundleMsiPackage", id); + var msiRow = (WixBundleMsiPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiPackage, id); msiRow.Attributes = msiAttributes; break; @@ -19880,12 +19827,12 @@ namespace WixToolset mspAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMspPackageAttributes.DisplayInternalUI : 0; mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; - WixBundleMspPackageRow mspRow = (WixBundleMspPackageRow)this.core.CreateRow(sourceLineNumbers, "WixBundleMspPackage", id); + var mspRow = (WixBundleMspPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMspPackage, id); mspRow.Attributes = mspAttributes; break; case WixBundlePackageType.Msu: - WixBundleMsuPackageRow msuRow = (WixBundleMsuPackageRow)this.core.CreateRow(sourceLineNumbers, "WixBundleMsuPackage", id); + var msuRow = (WixBundleMsuPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsuPackage, id); msuRow.DetectCondition = detectCondition; msuRow.MsuKB = msuKB; break; @@ -19916,39 +19863,39 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "InstallArgument": - installArgument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + installArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "UninstallArgument": - uninstallArgument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + uninstallArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "RepairArgument": - repairArgument = this.core.GetAttributeValue(sourceLineNumbers, attrib); + repairArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Condition": - condition = this.core.GetAttributeValue(sourceLineNumbers, attrib); + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (String.IsNullOrEmpty(condition)) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Condition")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Condition")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundlePackageCommandLineRow row = (WixBundlePackageCommandLineRow)this.core.CreateRow(sourceLineNumbers, "WixBundlePackageCommandLine"); - row.ChainPackageId = packageId; + var row = (WixBundlePackageCommandLineTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageCommandLine); + row.WixBundlePackage_ = packageId; row.InstallArgument = installArgument; row.UninstallArgument = uninstallArgument; row.RepairArgument = repairArgument; @@ -19972,22 +19919,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); id = Identifier.Invalid; } @@ -20024,20 +19971,20 @@ namespace WixToolset previousType = ComplexReferenceChildType.PackageGroup; break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - this.core.CreateRow(sourceLineNumbers, "WixBundlePackageGroup", id); + this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageGroup, id); } } @@ -20078,39 +20025,39 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id); break; case "After": - after = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null != after && ComplexReferenceParentType.Container == parentType) { - this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "After", parentId)); + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "After", parentId)); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); if (ComplexReferenceParentType.Container == parentType) { - this.core.CreateWixGroupRow(sourceLineNumbers, ComplexReferenceParentType.Container, parentId, ComplexReferenceChildType.PackageGroup, id); + this.Core.CreateWixGroupRow(sourceLineNumbers, ComplexReferenceParentType.Container, parentId, ComplexReferenceChildType.PackageGroup, id); } else { @@ -20132,17 +20079,17 @@ namespace WixToolset /// Identifier of previous item, if any. private void CreateRollbackBoundary(SourceLineNumber sourceLineNumbers, Identifier id, YesNoType vital, YesNoType transaction, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) { - WixChainItemRow row = (WixChainItemRow)this.core.CreateRow(sourceLineNumbers, "WixChainItem", id); + var row = (WixChainItemTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChainItem, id); - WixBundleRollbackBoundaryRow rollbackBoundary = (WixBundleRollbackBoundaryRow)this.core.CreateRow(sourceLineNumbers, "WixBundleRollbackBoundary", id); + var rollbackBoundary = (WixBundleRollbackBoundaryTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleRollbackBoundary, id); if (YesNoType.NotSet != vital) { - rollbackBoundary.Vital = vital; + rollbackBoundary.Vital = (vital == YesNoType.Yes); } if (YesNoType.NotSet != transaction) { - rollbackBoundary.Transaction = transaction; + rollbackBoundary.Transaction = (transaction == YesNoType.Yes); } this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null); @@ -20181,13 +20128,13 @@ namespace WixToolset ComplexReferenceChildType itemType, string itemId, ComplexReferenceChildType dependsOnType, string dependsOnId) { - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixOrdering"); - row[0] = itemType.ToString(); - row[1] = itemId; - row[2] = dependsOnType.ToString(); - row[3] = dependsOnId; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixOrdering); + row.Set(0, itemType.ToString()); + row.Set(1, itemId); + row.Set(2, dependsOnType.ToString()); + row.Set(3, dependsOnId); } } @@ -20210,41 +20157,41 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Name": - name = this.core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Condition": - condition = this.core.GetAttributeValue(sourceLineNumbers, attrib); + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundleMsiPropertyRow row = (WixBundleMsiPropertyRow)this.core.CreateRow(sourceLineNumbers, "WixBundleMsiProperty"); - row.ChainPackageId = packageId; + var row = (WixBundleMsiPropertyTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiProperty); + row.WixBundlePackage_ = packageId; row.Name = name; row.Value = value; @@ -20272,32 +20219,32 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id); + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundleSlipstreamMspRow row = (WixBundleSlipstreamMspRow)this.core.CreateRow(sourceLineNumbers, "WixBundleSlipstreamMsp"); - row.ChainPackageId = packageId; - row.MspPackageId = id; + var row = (WixBundleSlipstreamMspTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleSlipstreamMsp); + row.WixBundlePackage_ = packageId; + row.WixBundlePackage_Msp = id; } } @@ -20319,25 +20266,25 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; case "Action": - action = this.core.GetAttributeValue(sourceLineNumbers, attrib); + action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (!String.IsNullOrEmpty(action)) @@ -20354,18 +20301,18 @@ namespace WixToolset case Wix.RelatedBundle.ActionType.Patch: break; default: - this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch")); + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch")); break; } } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixRelatedBundle"); - row[0] = id; - row[1] = (int)actionType; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixRelatedBundle); + row.Set(0, id); + row.Set(1, (int)actionType); } } @@ -20385,30 +20332,30 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Location": - location = this.core.GetAttributeValue(sourceLineNumbers, attrib); + location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == location) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Location")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Location")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - Row row = this.core.CreateRow(sourceLineNumbers, "WixBundleUpdate"); - row[0] = location; + var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleUpdate); + row.Set(0, location); } } @@ -20432,44 +20379,44 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Hidden": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { hidden = true; } break; case "Name": - name = this.core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib); + name = this.Core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib); break; case "Persisted": - if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { persisted = true; } break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; case "Type": - type = this.core.GetAttributeValue(sourceLineNumbers, attrib); + type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == name) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } else if (name.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) { - this.core.OnMessage(WixErrors.ReservedNamespaceViolation(sourceLineNumbers, node.Name.LocalName, "Name", "Wix")); + this.Core.OnMessage(WixErrors.ReservedNamespaceViolation(sourceLineNumbers, node.Name.LocalName, "Name", "Wix")); } if (null == type && null != value) @@ -20515,15 +20462,15 @@ namespace WixToolset if (null == value && null != type) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, "Variable", "Value", "Type")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, "Variable", "Value", "Type")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixBundleVariableRow row = (WixBundleVariableRow)this.core.CreateRow(sourceLineNumbers, "WixBundleVariable"); - row.Id = name; + var row = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); + row.WixBundleVariable = name; row.Value = value; row.Type = type; row.Hidden = hidden; @@ -20549,22 +20496,22 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "RequiredVersion": - requiredVersion = this.core.GetAttributeVersionValue(sourceLineNumbers, attrib); + requiredVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null != requiredVersion) { - this.core.VerifyRequiredVersion(sourceLineNumbers, requiredVersion); + this.Core.VerifyRequiredVersion(sourceLineNumbers, requiredVersion); } foreach (XElement child in node.Elements()) @@ -20592,13 +20539,13 @@ namespace WixToolset this.ParsePatchElement(child); break; default: - this.core.UnexpectedElement(node, child); + this.Core.UnexpectedElement(node, child); break; } } else { - this.core.ParseExtensionElement(node, child); + this.Core.ParseExtensionElement(node, child); } } } @@ -20621,40 +20568,40 @@ namespace WixToolset switch (attrib.Name.LocalName) { case "Id": - id = this.core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Overridable": - overridable = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); + overridable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); break; case "Value": - value = this.core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); break; default: - this.core.UnexpectedAttribute(node, attrib); + this.Core.UnexpectedAttribute(node, attrib); break; } } else { - this.core.ParseExtensionAttribute(node, attrib); + this.Core.ParseExtensionAttribute(node, attrib); } } if (null == id) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } if (null == value) { - this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value")); } - this.core.ParseForExtensionElements(node); + this.Core.ParseForExtensionElements(node); - if (!this.core.EncounteredError) + if (!this.Core.EncounteredError) { - WixVariableRow wixVariableRow = (WixVariableRow)this.core.CreateRow(sourceLineNumbers, "WixVariable", id); + var wixVariableRow = (WixVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixVariable, id); wixVariableRow.Value = value; wixVariableRow.Overridable = overridable; } diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 8f4703f7..46a2e435 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs @@ -15,7 +15,7 @@ namespace WixToolset using System.Text.RegularExpressions; using System.Xml.Linq; using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Extensibility; using Wix = WixToolset.Data.Serialize; @@ -40,7 +40,7 @@ namespace WixToolset /// /// Core class for the compiler. /// - internal sealed class CompilerCore : ICompilerCore + internal sealed class CompilerCore //: ICompilerCore { internal static readonly XNamespace W3SchemaPrefix = "http://www.w3.org/"; internal static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs"; @@ -140,10 +140,9 @@ namespace WixToolset "REMOVE" }); - private TableDefinitionCollection tableDefinitions; private Dictionary extensions; + private ITupleDefinitionCreator creator; private Intermediate intermediate; - private bool showPedanticMessages; private HashSet activeSectionInlinedDirectoryIds; private HashSet activeSectionSimpleReferences; @@ -152,12 +151,11 @@ namespace WixToolset /// Constructor for all compiler core. /// /// The Intermediate object representing compiled source document. - /// The loaded table definition collection. /// The WiX extensions collection. - internal CompilerCore(Intermediate intermediate, TableDefinitionCollection tableDefinitions, Dictionary extensions) + internal CompilerCore(Intermediate intermediate, ITupleDefinitionCreator creator, Dictionary extensions) { - this.tableDefinitions = tableDefinitions; this.extensions = extensions; + this.creator = creator; this.intermediate = intermediate; } @@ -165,7 +163,7 @@ namespace WixToolset /// Gets the section the compiler is currently emitting symbols into. /// /// The section the compiler is currently emitting symbols into. - public Section ActiveSection { get; private set; } + public IntermediateSection ActiveSection { get; private set; } /// /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. @@ -177,29 +175,13 @@ namespace WixToolset /// Gets whether the compiler core encountered an error while processing. /// /// Flag if core encountered an error during processing. - public bool EncounteredError - { - get { return Messaging.Instance.EncounteredError; } - } + public bool EncounteredError => Messaging.Instance.EncounteredError; /// /// Gets or sets the option to show pedantic messages. /// /// The option to show pedantic messages. - public bool ShowPedanticMessages - { - get { return this.showPedanticMessages; } - set { this.showPedanticMessages = value; } - } - - /// - /// Gets the table definitions used by the compiler core. - /// - /// Table definition collection. - public TableDefinitionCollection TableDefinitions - { - get { return this.tableDefinitions; } - } + public bool ShowPedanticMessages { get; set; } /// /// Convert a bit array into an int value. @@ -483,32 +465,39 @@ namespace WixToolset /// Creates a row in the active section. /// /// Source and line number of current row. - /// Name of table to create row in. + /// Name of table to create row in. /// New row. - public Row CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null) + public IntermediateTuple CreateRow(SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null) { - return this.CreateRow(sourceLineNumbers, tableName, this.ActiveSection, identifier); + return this.CreateRow(sourceLineNumbers, tupleType, this.ActiveSection, identifier); } /// /// Creates a row in the active given . /// /// Source and line number of current row. - /// Name of table to create row in. + /// Name of table to create row in. /// The section to which the row is added. If null, the row is added to the active section. /// New row. - internal Row CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Section section, Identifier identifier = null) + internal IntermediateTuple CreateRow(SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, IntermediateSection section, Identifier identifier = null) { - TableDefinition tableDefinition = this.tableDefinitions[tableName]; - Table table = section.EnsureTable(tableDefinition); - Row row = table.CreateRow(sourceLineNumbers); + var tupleDefinition = TupleDefinitions.ByType(tupleType); + var row = tupleDefinition.CreateTuple(sourceLineNumbers, identifier); if (null != identifier) { - row.Access = identifier.Access; - row[0] = identifier.Id; + if (row.Definition.FieldDefinitions[0].Type == IntermediateFieldType.Number) + { + row.Set(0, Convert.ToInt32(identifier.Id)); + } + else + { + row.Set(0, identifier.Id); + } } + section.Tuples.Add(row); + return row; } @@ -572,9 +561,9 @@ namespace WixToolset /// New row. public void CreatePatchFamilyChildReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys) { - Row patchReferenceRow = this.CreateRow(sourceLineNumbers, "WixPatchRef"); - patchReferenceRow[0] = tableName; - patchReferenceRow[1] = String.Join("/", primaryKeys); + var patchReferenceRow = this.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchRef); + patchReferenceRow.Set(0, tableName); + patchReferenceRow.Set(1, String.Join("/", primaryKeys)); } /// @@ -615,12 +604,13 @@ namespace WixToolset } id = this.CreateIdentifier("reg", componentId, root.ToString(CultureInfo.InvariantCulture.NumberFormat), key.ToLowerInvariant(), (null != name ? name.ToLowerInvariant() : name)); - Row row = this.CreateRow(sourceLineNumbers, "Registry", id); - row[1] = root; - row[2] = key; - row[3] = name; - row[4] = value; - row[5] = componentId; + + var row = this.CreateRow(sourceLineNumbers, TupleDefinitionType.Registry, id); + row.Set(1, root); + row.Set(2, key); + row.Set(3, name); + row.Set(4, value); + row.Set(5, componentId); } return id; @@ -656,8 +646,8 @@ namespace WixToolset // If this simple reference hasn't been added to the active section already, add it. if (this.activeSectionSimpleReferences.Add(id)) { - WixSimpleReferenceRow wixSimpleReferenceRow = (WixSimpleReferenceRow)this.CreateRow(sourceLineNumbers, "WixSimpleReference"); - wixSimpleReferenceRow.TableName = tableName; + var wixSimpleReferenceRow = (WixSimpleReferenceTuple)this.CreateRow(sourceLineNumbers, TupleDefinitionType.WixSimpleReference); + wixSimpleReferenceRow.Table = tableName; wixSimpleReferenceRow.PrimaryKeys = joinedKeys; } } @@ -685,11 +675,11 @@ namespace WixToolset throw new ArgumentNullException("childId"); } - WixGroupRow WixGroupRow = (WixGroupRow)this.CreateRow(sourceLineNumbers, "WixGroup"); - WixGroupRow.ParentId = parentId; - WixGroupRow.ParentType = parentType; - WixGroupRow.ChildId = childId; - WixGroupRow.ChildType = childType; + var row = (WixGroupTuple)this.CreateRow(sourceLineNumbers, TupleDefinitionType.WixGroup); + row.ParentId = parentId; + row.ParentType = parentType; + row.ChildId = childId; + row.ChildType = childType; } } @@ -703,13 +693,13 @@ namespace WixToolset { if (!this.EncounteredError) { - Row row = this.CreateRow(sourceLineNumbers, "WixEnsureTable"); - row[0] = tableName; + var row = this.CreateRow(sourceLineNumbers, TupleDefinitionType.WixEnsureTable); + row.Set(0, tableName); // We don't add custom table definitions to the tableDefinitions collection, // so if it's not in there, it better be a custom table. If the Id is just wrong, // instead of a custom table, we get an unresolved reference at link time. - if (!this.tableDefinitions.Contains(tableName)) + if (!this.creator.TryGetTupleDefinitionByName(tableName, out var ignored)) { this.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableName); } @@ -1016,7 +1006,7 @@ namespace WixToolset string uppercaseGuid = guid.ToString().ToUpper(CultureInfo.InvariantCulture); - if (this.showPedanticMessages) + if (this.ShowPedanticMessages) { if (uppercaseGuid != value) { @@ -1505,8 +1495,7 @@ namespace WixToolset return; } - ICompilerExtension extension; - if (this.TryFindExtension(attribute.Name.NamespaceName, out extension)) + if (this.TryFindExtension(attribute.Name.NamespaceName, out var extension)) { extension.ParseAttribute(element, attribute, context); } @@ -1525,8 +1514,7 @@ namespace WixToolset /// Extra information about the context in which this element is being parsed. public void ParseExtensionElement(XElement parentElement, XElement element, IDictionary context = null) { - ICompilerExtension extension; - if (this.TryFindExtension(element.Name.Namespace, out extension)) + if (this.TryFindExtension(element.Name.Namespace, out var extension)) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); extension.ParseElement(parentElement, element, context); @@ -1651,9 +1639,9 @@ namespace WixToolset /// Type of section to create. /// Codepage for the resulting database for this ection. /// New section. - internal Section CreateActiveSection(string id, SectionType type, int codepage) + internal IntermediateSection CreateActiveSection(string id, SectionType type, int codepage, string compilationId) { - this.ActiveSection = this.CreateSection(id, type, codepage); + this.ActiveSection = this.CreateSection(id, type, codepage, compilationId); this.activeSectionInlinedDirectoryIds = new HashSet(); this.activeSectionSimpleReferences = new HashSet(); @@ -1668,12 +1656,14 @@ namespace WixToolset /// Type of section to create. /// Codepage for the resulting database for this ection. /// New section. - internal Section CreateSection(string id, SectionType type, int codepage) + internal IntermediateSection CreateSection(string id, SectionType type, int codepage, string compilationId) { - Section newSection = new Section(id, type, codepage); - this.intermediate.AddSection(newSection); + var section = new IntermediateSection(id, type, codepage); + section.CompilationId = compilationId; + + this.intermediate.Sections.Add(section); - return newSection; + return section; } /// @@ -1690,11 +1680,11 @@ namespace WixToolset { if (!this.EncounteredError) { - WixComplexReferenceRow wixComplexReferenceRow = (WixComplexReferenceRow)this.CreateRow(sourceLineNumbers, "WixComplexReference"); - wixComplexReferenceRow.ParentId = parentId; + var wixComplexReferenceRow = (WixComplexReferenceTuple)this.CreateRow(sourceLineNumbers, TupleDefinitionType.WixComplexReference); + wixComplexReferenceRow.Parent = parentId; wixComplexReferenceRow.ParentType = parentType; wixComplexReferenceRow.ParentLanguage = parentLanguage; - wixComplexReferenceRow.ChildId = childId; + wixComplexReferenceRow.Child = childId; wixComplexReferenceRow.ChildType = childType; wixComplexReferenceRow.IsPrimary = isPrimary; } @@ -1775,9 +1765,9 @@ namespace WixToolset } } - Row row = this.CreateRow(sourceLineNumbers, "Directory", id); - row[1] = parentId; - row[2] = defaultDir; + var row = this.CreateRow(sourceLineNumbers, TupleDefinitionType.Directory, id); + row.Set(1, parentId); + row.Set(2, defaultDir); return id; } diff --git a/src/WixToolset.Core/Decompiler.cs b/src/WixToolset.Core/Decompiler.cs deleted file mode 100644 index e72b0104..00000000 --- a/src/WixToolset.Core/Decompiler.cs +++ /dev/null @@ -1,9356 +0,0 @@ -// 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 -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.IO; - using System.Text; - using System.Text.RegularExpressions; - using WixToolset.Data; - using WixToolset.Data.Rows; - using WixToolset.Extensibility; - using WixToolset.Core.Native; - using Wix = WixToolset.Data.Serialize; - using WixToolset.Core; - - /// - /// Decompiles an msi database into WiX source. - /// - public class Decompiler - { - private static readonly Regex NullSplitter = new Regex(@"\[~]"); - - private int codepage; - private bool compressed; - private bool shortNames; - private DecompilerCore core; - private string exportFilePath; - private List extensions; - private Dictionary extensionsByTableName; - private string modularizationGuid; - private OutputType outputType; - private Hashtable patchTargetFiles; - private Hashtable sequenceElements; - private bool showPedanticMessages; - private WixActionRowCollection standardActions; - private bool suppressCustomTables; - private bool suppressDroppingEmptyTables; - private bool suppressRelativeActionSequencing; - private bool suppressUI; - private TableDefinitionCollection tableDefinitions; - // private TempFileCollection tempFiles; - private bool treatProductAsModule; - - /// - /// Creates a new decompiler object with a default set of table definitions. - /// - public Decompiler() - { - this.standardActions = WindowsInstallerStandard.GetStandardActions(); - - this.extensions = new List(); - this.extensionsByTableName = new Dictionary(); - this.patchTargetFiles = new Hashtable(); - this.sequenceElements = new Hashtable(); - this.tableDefinitions = new TableDefinitionCollection(); - this.exportFilePath = "SourceDir"; - } - - /// - /// Gets or sets the base source file path. - /// - /// Base source file path. - public string ExportFilePath - { - get { return this.exportFilePath; } - set { this.exportFilePath = value; } - } - - /// - /// Gets or sets the option to show pedantic messages. - /// - /// The option to show pedantic messages. - public bool ShowPedanticMessages - { - get { return this.showPedanticMessages; } - set { this.showPedanticMessages = value; } - } - - /// - /// Gets or sets the option to suppress custom tables. - /// - /// The option to suppress dropping empty tables. - public bool SuppressCustomTables - { - get { return this.suppressCustomTables; } - set { this.suppressCustomTables = value; } - } - - /// - /// Gets or sets the option to suppress dropping empty tables. - /// - /// The option to suppress dropping empty tables. - public bool SuppressDroppingEmptyTables - { - get { return this.suppressDroppingEmptyTables; } - set { this.suppressDroppingEmptyTables = value; } - } - - /// - /// Gets or sets the option to suppress decompiling with relative action sequencing (uses sequence numbers). - /// - /// The option to suppress decompiling with relative action sequencing (uses sequence numbers). - public bool SuppressRelativeActionSequencing - { - get { return this.suppressRelativeActionSequencing; } - set { this.suppressRelativeActionSequencing = value; } - } - - /// - /// Gets or sets the option to suppress decompiling UI-related tables. - /// - /// The option to suppress decompiling UI-related tables. - public bool SuppressUI - { - get { return this.suppressUI; } - set { this.suppressUI = value; } - } - - /// - /// Gets or sets the temporary path for the Decompiler. If left null, the decompiler - /// will use %TEMP% environment variable. - /// - /// Path to temp files. - public string TempFilesLocation - { - get - { - // return null == this.tempFiles ? String.Empty : this.tempFiles.BasePath; - return Path.GetTempPath(); - } - - // set - // { - // if (null == value) - // { - // this.tempFiles = new TempFileCollection(); - // } - // else - // { - // this.tempFiles = new TempFileCollection(value); - // } - // } - } - - /// - /// Gets or sets whether the decompiler should use module logic on a product output. - /// - /// The option to treat a product like a module - public bool TreatProductAsModule - { - get { return this.treatProductAsModule; } - set { this.treatProductAsModule = value; } - } - - /// - /// Decompile the database file. - /// - /// The output to decompile. - /// The serialized WiX source code. - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] - public Wix.Wix Decompile(Output output) - { - if (null == output) - { - throw new ArgumentNullException("output"); - } - - this.codepage = output.Codepage; - this.outputType = output.Type; - - // collect the table definitions from the output - this.tableDefinitions.Clear(); - foreach (Table table in output.Tables) - { - this.tableDefinitions.Add(table.Definition); - } - - // add any missing standard and wix-specific table definitions - foreach (TableDefinition tableDefinition in WindowsInstallerStandard.GetTableDefinitions()) - { - if (!this.tableDefinitions.Contains(tableDefinition.Name)) - { - this.tableDefinitions.Add(tableDefinition); - } - } - - // add any missing extension table definitions - foreach (IDecompilerExtension extension in this.extensions) - { - if (null != extension.TableDefinitions) - { - foreach (TableDefinition tableDefinition in extension.TableDefinitions) - { - if (!this.tableDefinitions.Contains(tableDefinition.Name)) - { - this.tableDefinitions.Add(tableDefinition); - } - } - } - } - - // if we don't have the temporary files object yet, get one -#if REDO_IN_NETCORE - if (null == this.tempFiles) - { - this.TempFilesLocation = null; - } -#endif - Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there - - bool encounteredError = false; - Wix.IParentElement rootElement; - Wix.Wix wixElement = new Wix.Wix(); - - switch (this.outputType) - { - case OutputType.Module: - rootElement = new Wix.Module(); - break; - case OutputType.PatchCreation: - rootElement = new Wix.PatchCreation(); - break; - case OutputType.Product: - rootElement = new Wix.Product(); - break; - default: - throw new InvalidOperationException(WixStrings.EXP_UnknownOutputType); - } - wixElement.AddChild((Wix.ISchemaElement)rootElement); - - // try to decompile the database file - try - { - this.core = new DecompilerCore(rootElement); - this.core.ShowPedanticMessages = this.showPedanticMessages; - - // stop processing if an error previously occurred - if (this.core.EncounteredError) - { - return null; - } - - // initialize the decompiler and its extensions - foreach (IDecompilerExtension extension in this.extensions) - { - extension.Core = this.core; - extension.Initialize(output.Tables); - } - this.InitializeDecompile(output.Tables); - - // stop processing if an error previously occurred - if (this.core.EncounteredError) - { - return null; - } - - // decompile the tables - this.DecompileTables(output); - - // finalize the decompiler and its extensions - this.FinalizeDecompile(output.Tables); - foreach (IDecompilerExtension extension in this.extensions) - { - extension.Finish(output.Tables); - } - } - finally - { - encounteredError = this.core.EncounteredError; - - this.core = null; - foreach (IDecompilerExtension extension in this.extensions) - { - extension.Core = null; - } - } - - // return the root element only if decompilation completed successfully - return (encounteredError ? null : wixElement); - } - - /// - /// Adds an extension. - /// - /// The extension to add. - public void AddExtension(IDecompilerExtension extension) - { - this.extensions.Add(extension); - - if (null != extension.TableDefinitions) - { - foreach (TableDefinition tableDefinition in extension.TableDefinitions) - { - if (!this.extensionsByTableName.ContainsKey(tableDefinition.Name)) - { - this.extensionsByTableName.Add(tableDefinition.Name, extension); - } - else - { - Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); - } - } - } - } - - /// - /// Cleans up the temp files used by the Decompiler. - /// - /// True if all files were deleted, false otherwise. - /// - /// This should be called after every call to Decompile to ensure there - /// are no conflicts between each decompiled database. - /// - public bool DeleteTempFiles() - { -#if REDO_IN_NETCORE - if (null == this.tempFiles) - { - return true; // no work to do - } - else - { - bool deleted = Common.DeleteTempFiles(this.tempFiles.BasePath, this.core); - - if (deleted) - { - this.tempFiles = null; // temp files have been deleted, no need to remember this now - } - - return deleted; - } -#endif - return true; - } - - /// - /// Set the common control attributes in a control element. - /// - /// The control attributes. - /// The control element. - private static void SetControlAttributes(int attributes, Wix.Control control) - { - if (0 == (attributes & MsiInterop.MsidbControlAttributesEnabled)) - { - control.Disabled = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesIndirect == (attributes & MsiInterop.MsidbControlAttributesIndirect)) - { - control.Indirect = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesInteger == (attributes & MsiInterop.MsidbControlAttributesInteger)) - { - control.Integer = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesLeftScroll == (attributes & MsiInterop.MsidbControlAttributesLeftScroll)) - { - control.LeftScroll = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesRightAligned == (attributes & MsiInterop.MsidbControlAttributesRightAligned)) - { - control.RightAligned = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesRTLRO == (attributes & MsiInterop.MsidbControlAttributesRTLRO)) - { - control.RightToLeft = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbControlAttributesSunken == (attributes & MsiInterop.MsidbControlAttributesSunken)) - { - control.Sunken = Wix.YesNoType.yes; - } - - if (0 == (attributes & MsiInterop.MsidbControlAttributesVisible)) - { - control.Hidden = Wix.YesNoType.yes; - } - } - - /// - /// Creates an action element. - /// - /// The action row from which the element should be created. - private void CreateActionElement(WixActionRow actionRow) - { - Wix.ISchemaElement actionElement = null; - - if (null != this.core.GetIndexedElement("CustomAction", actionRow.Action)) // custom action - { - Wix.Custom custom = new Wix.Custom(); - - custom.Action = actionRow.Action; - - if (null != actionRow.Condition) - { - custom.Content = actionRow.Condition; - } - - switch (actionRow.Sequence) - { - case (-4): - custom.OnExit = Wix.ExitType.suspend; - break; - case (-3): - custom.OnExit = Wix.ExitType.error; - break; - case (-2): - custom.OnExit = Wix.ExitType.cancel; - break; - case (-1): - custom.OnExit = Wix.ExitType.success; - break; - default: - if (null != actionRow.Before) - { - custom.Before = actionRow.Before; - } - else if (null != actionRow.After) - { - custom.After = actionRow.After; - } - else if (0 < actionRow.Sequence) - { - custom.Sequence = actionRow.Sequence; - } - break; - } - - actionElement = custom; - } - else if (null != this.core.GetIndexedElement("Dialog", actionRow.Action)) // dialog - { - Wix.Show show = new Wix.Show(); - - show.Dialog = actionRow.Action; - - if (null != actionRow.Condition) - { - show.Content = actionRow.Condition; - } - - switch (actionRow.Sequence) - { - case (-4): - show.OnExit = Wix.ExitType.suspend; - break; - case (-3): - show.OnExit = Wix.ExitType.error; - break; - case (-2): - show.OnExit = Wix.ExitType.cancel; - break; - case (-1): - show.OnExit = Wix.ExitType.success; - break; - default: - if (null != actionRow.Before) - { - show.Before = actionRow.Before; - } - else if (null != actionRow.After) - { - show.After = actionRow.After; - } - else if (0 < actionRow.Sequence) - { - show.Sequence = actionRow.Sequence; - } - break; - } - - actionElement = show; - } - else // possibly a standard action without suggested sequence information - { - actionElement = this.CreateStandardActionElement(actionRow); - } - - // add the action element to the appropriate sequence element - if (null != actionElement) - { - string sequenceTable = actionRow.SequenceTable.ToString(); - Wix.IParentElement sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable]; - - if (null == sequenceElement) - { - switch (actionRow.SequenceTable) - { - case SequenceTable.AdminExecuteSequence: - sequenceElement = new Wix.AdminExecuteSequence(); - break; - case SequenceTable.AdminUISequence: - sequenceElement = new Wix.AdminUISequence(); - break; - case SequenceTable.AdvtExecuteSequence: - sequenceElement = new Wix.AdvertiseExecuteSequence(); - break; - case SequenceTable.InstallExecuteSequence: - sequenceElement = new Wix.InstallExecuteSequence(); - break; - case SequenceTable.InstallUISequence: - sequenceElement = new Wix.InstallUISequence(); - break; - default: - throw new InvalidOperationException(WixStrings.EXP_UnknowSequenceTable); - } - - this.core.RootElement.AddChild((Wix.ISchemaElement)sequenceElement); - this.sequenceElements.Add(sequenceTable, sequenceElement); - } - - try - { - sequenceElement.AddChild(actionElement); - } - catch (System.ArgumentException) // action/dialog is not valid for this sequence - { - this.core.OnMessage(WixWarnings.IllegalActionInSequence(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); - } - } - } - - /// - /// Creates a standard action element. - /// - /// The action row from which the element should be created. - /// The created element. - private Wix.ISchemaElement CreateStandardActionElement(WixActionRow actionRow) - { - Wix.ActionSequenceType actionElement = null; - - switch (actionRow.Action) - { - case "AllocateRegistrySpace": - actionElement = new Wix.AllocateRegistrySpace(); - break; - case "AppSearch": - WixActionRow appSearchActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; - - if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence)) - { - Wix.AppSearch appSearch = new Wix.AppSearch(); - - if (null != actionRow.Condition) - { - appSearch.Content = actionRow.Condition; - } - - if (null != actionRow.Before) - { - appSearch.Before = actionRow.Before; - } - else if (null != actionRow.After) - { - appSearch.After = actionRow.After; - } - else if (0 < actionRow.Sequence) - { - appSearch.Sequence = actionRow.Sequence; - } - - return appSearch; - } - break; - case "BindImage": - actionElement = new Wix.BindImage(); - break; - case "CCPSearch": - Wix.CCPSearch ccpSearch = new Wix.CCPSearch(); - Decompiler.SequenceRelativeAction(actionRow, ccpSearch); - return ccpSearch; - case "CostFinalize": - actionElement = new Wix.CostFinalize(); - break; - case "CostInitialize": - actionElement = new Wix.CostInitialize(); - break; - case "CreateFolders": - actionElement = new Wix.CreateFolders(); - break; - case "CreateShortcuts": - actionElement = new Wix.CreateShortcuts(); - break; - case "DeleteServices": - actionElement = new Wix.DeleteServices(); - break; - case "DisableRollback": - Wix.DisableRollback disableRollback = new Wix.DisableRollback(); - Decompiler.SequenceRelativeAction(actionRow, disableRollback); - return disableRollback; - case "DuplicateFiles": - actionElement = new Wix.DuplicateFiles(); - break; - case "ExecuteAction": - actionElement = new Wix.ExecuteAction(); - break; - case "FileCost": - actionElement = new Wix.FileCost(); - break; - case "FindRelatedProducts": - Wix.FindRelatedProducts findRelatedProducts = new Wix.FindRelatedProducts(); - Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts); - return findRelatedProducts; - case "ForceReboot": - Wix.ForceReboot forceReboot = new Wix.ForceReboot(); - Decompiler.SequenceRelativeAction(actionRow, forceReboot); - return forceReboot; - case "InstallAdminPackage": - actionElement = new Wix.InstallAdminPackage(); - break; - case "InstallExecute": - Wix.InstallExecute installExecute = new Wix.InstallExecute(); - Decompiler.SequenceRelativeAction(actionRow, installExecute); - return installExecute; - case "InstallExecuteAgain": - Wix.InstallExecuteAgain installExecuteAgain = new Wix.InstallExecuteAgain(); - Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain); - return installExecuteAgain; - case "InstallFiles": - actionElement = new Wix.InstallFiles(); - break; - case "InstallFinalize": - actionElement = new Wix.InstallFinalize(); - break; - case "InstallInitialize": - actionElement = new Wix.InstallInitialize(); - break; - case "InstallODBC": - actionElement = new Wix.InstallODBC(); - break; - case "InstallServices": - actionElement = new Wix.InstallServices(); - break; - case "InstallValidate": - actionElement = new Wix.InstallValidate(); - break; - case "IsolateComponents": - actionElement = new Wix.IsolateComponents(); - break; - case "LaunchConditions": - Wix.LaunchConditions launchConditions = new Wix.LaunchConditions(); - Decompiler.SequenceRelativeAction(actionRow, launchConditions); - return launchConditions; - case "MigrateFeatureStates": - actionElement = new Wix.MigrateFeatureStates(); - break; - case "MoveFiles": - actionElement = new Wix.MoveFiles(); - break; - case "MsiPublishAssemblies": - actionElement = new Wix.MsiPublishAssemblies(); - break; - case "MsiUnpublishAssemblies": - actionElement = new Wix.MsiUnpublishAssemblies(); - break; - case "PatchFiles": - actionElement = new Wix.PatchFiles(); - break; - case "ProcessComponents": - actionElement = new Wix.ProcessComponents(); - break; - case "PublishComponents": - actionElement = new Wix.PublishComponents(); - break; - case "PublishFeatures": - actionElement = new Wix.PublishFeatures(); - break; - case "PublishProduct": - actionElement = new Wix.PublishProduct(); - break; - case "RegisterClassInfo": - actionElement = new Wix.RegisterClassInfo(); - break; - case "RegisterComPlus": - actionElement = new Wix.RegisterComPlus(); - break; - case "RegisterExtensionInfo": - actionElement = new Wix.RegisterExtensionInfo(); - break; - case "RegisterFonts": - actionElement = new Wix.RegisterFonts(); - break; - case "RegisterMIMEInfo": - actionElement = new Wix.RegisterMIMEInfo(); - break; - case "RegisterProduct": - actionElement = new Wix.RegisterProduct(); - break; - case "RegisterProgIdInfo": - actionElement = new Wix.RegisterProgIdInfo(); - break; - case "RegisterTypeLibraries": - actionElement = new Wix.RegisterTypeLibraries(); - break; - case "RegisterUser": - actionElement = new Wix.RegisterUser(); - break; - case "RemoveDuplicateFiles": - actionElement = new Wix.RemoveDuplicateFiles(); - break; - case "RemoveEnvironmentStrings": - actionElement = new Wix.RemoveEnvironmentStrings(); - break; - case "RemoveExistingProducts": - Wix.RemoveExistingProducts removeExistingProducts = new Wix.RemoveExistingProducts(); - Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts); - return removeExistingProducts; - case "RemoveFiles": - actionElement = new Wix.RemoveFiles(); - break; - case "RemoveFolders": - actionElement = new Wix.RemoveFolders(); - break; - case "RemoveIniValues": - actionElement = new Wix.RemoveIniValues(); - break; - case "RemoveODBC": - actionElement = new Wix.RemoveODBC(); - break; - case "RemoveRegistryValues": - actionElement = new Wix.RemoveRegistryValues(); - break; - case "RemoveShortcuts": - actionElement = new Wix.RemoveShortcuts(); - break; - case "ResolveSource": - Wix.ResolveSource resolveSource = new Wix.ResolveSource(); - Decompiler.SequenceRelativeAction(actionRow, resolveSource); - return resolveSource; - case "RMCCPSearch": - Wix.RMCCPSearch rmccpSearch = new Wix.RMCCPSearch(); - Decompiler.SequenceRelativeAction(actionRow, rmccpSearch); - return rmccpSearch; - case "ScheduleReboot": - Wix.ScheduleReboot scheduleReboot = new Wix.ScheduleReboot(); - Decompiler.SequenceRelativeAction(actionRow, scheduleReboot); - return scheduleReboot; - case "SelfRegModules": - actionElement = new Wix.SelfRegModules(); - break; - case "SelfUnregModules": - actionElement = new Wix.SelfUnregModules(); - break; - case "SetODBCFolders": - actionElement = new Wix.SetODBCFolders(); - break; - case "StartServices": - actionElement = new Wix.StartServices(); - break; - case "StopServices": - actionElement = new Wix.StopServices(); - break; - case "UnpublishComponents": - actionElement = new Wix.UnpublishComponents(); - break; - case "UnpublishFeatures": - actionElement = new Wix.UnpublishFeatures(); - break; - case "UnregisterClassInfo": - actionElement = new Wix.UnregisterClassInfo(); - break; - case "UnregisterComPlus": - actionElement = new Wix.UnregisterComPlus(); - break; - case "UnregisterExtensionInfo": - actionElement = new Wix.UnregisterExtensionInfo(); - break; - case "UnregisterFonts": - actionElement = new Wix.UnregisterFonts(); - break; - case "UnregisterMIMEInfo": - actionElement = new Wix.UnregisterMIMEInfo(); - break; - case "UnregisterProgIdInfo": - actionElement = new Wix.UnregisterProgIdInfo(); - break; - case "UnregisterTypeLibraries": - actionElement = new Wix.UnregisterTypeLibraries(); - break; - case "ValidateProductID": - actionElement = new Wix.ValidateProductID(); - break; - case "WriteEnvironmentStrings": - actionElement = new Wix.WriteEnvironmentStrings(); - break; - case "WriteIniValues": - actionElement = new Wix.WriteIniValues(); - break; - case "WriteRegistryValues": - actionElement = new Wix.WriteRegistryValues(); - break; - default: - this.core.OnMessage(WixWarnings.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); - return null; - } - - if (actionElement != null) - { - this.SequenceStandardAction(actionRow, actionElement); - } - - return actionElement; - } - - /// - /// Applies the condition and sequence to a standard action element based on the action row data. - /// - /// Action row data from the database. - /// Element to be sequenced. - private void SequenceStandardAction(WixActionRow actionRow, Wix.ActionSequenceType actionElement) - { - if (null != actionRow.Condition) - { - actionElement.Content = actionRow.Condition; - } - - if ((null != actionRow.Before || null != actionRow.After) && 0 == actionRow.Sequence) - { - this.core.OnMessage(WixWarnings.DecompiledStandardActionRelativelyScheduledInModule(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); - } - else if (0 < actionRow.Sequence) - { - actionElement.Sequence = actionRow.Sequence; - } - } - - /// - /// Applies the condition and relative sequence to an action element based on the action row data. - /// - /// Action row data from the database. - /// Element to be sequenced. - private static void SequenceRelativeAction(WixActionRow actionRow, Wix.ActionModuleSequenceType actionElement) - { - if (null != actionRow.Condition) - { - actionElement.Content = actionRow.Condition; - } - - if (null != actionRow.Before) - { - actionElement.Before = actionRow.Before; - } - else if (null != actionRow.After) - { - actionElement.After = actionRow.After; - } - else if (0 < actionRow.Sequence) - { - actionElement.Sequence = actionRow.Sequence; - } - } - - /// - /// Ensure that a particular property exists in the decompiled output. - /// - /// The identifier of the property. - /// The property element. - private Wix.Property EnsureProperty(string id) - { - Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", id); - - if (null == property) - { - property = new Wix.Property(); - property.Id = id; - - // create a dummy row for indexing - Row row = new Row(null, this.tableDefinitions["Property"]); - row[0] = id; - - this.core.RootElement.AddChild(property); - this.core.IndexElement(row, property); - } - - return property; - } - - /// - /// Finalize decompilation. - /// - /// The collection of all tables. - private void FinalizeDecompile(TableIndexedCollection tables) - { - if (OutputType.PatchCreation == this.outputType) - { - this.FinalizeFamilyFileRangesTable(tables); - } - else - { - this.FinalizeCheckBoxTable(tables); - this.FinalizeComponentTable(tables); - this.FinalizeDialogTable(tables); - this.FinalizeDuplicateMoveFileTables(tables); - this.FinalizeFeatureComponentsTable(tables); - this.FinalizeFileTable(tables); - this.FinalizeMIMETable(tables); - this.FinalizeMsiLockPermissionsExTable(tables); - this.FinalizeLockPermissionsTable(tables); - this.FinalizeProgIdTable(tables); - this.FinalizePropertyTable(tables); - this.FinalizeRemoveFileTable(tables); - this.FinalizeSearchTables(tables); - this.FinalizeUpgradeTable(tables); - this.FinalizeSequenceTables(tables); - this.FinalizeVerbTable(tables); - } - } - - /// - /// Finalize the CheckBox table. - /// - /// The collection of all tables. - /// - /// Enumerates through all the Control rows, looking for controls of type "CheckBox" with - /// a value in the Property column. This is then possibly matched up with a CheckBox row - /// to retrieve a CheckBoxValue. There is no foreign key from the Control to CheckBox table. - /// - private void FinalizeCheckBoxTable(TableIndexedCollection tables) - { - // if the user has requested to suppress the UI elements, we have nothing to do - if (this.suppressUI) - { - return; - } - - Table checkBoxTable = tables["CheckBox"]; - Table controlTable = tables["Control"]; - - Hashtable checkBoxes = new Hashtable(); - Hashtable checkBoxProperties = new Hashtable(); - - // index the CheckBox table - if (null != checkBoxTable) - { - foreach (Row row in checkBoxTable.Rows) - { - checkBoxes.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); - checkBoxProperties.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), false); - } - } - - // enumerate through the Control table, adding CheckBox values where appropriate - if (null != controlTable) - { - foreach (Row row in controlTable.Rows) - { - Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); - - if ("CheckBox" == Convert.ToString(row[2]) && null != row[8]) - { - Row checkBoxRow = (Row)checkBoxes[row[8]]; - - if (null == checkBoxRow) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Property", Convert.ToString(row[8]), "CheckBox")); - } - else - { - // if we've seen this property already, create a reference to it - if (Convert.ToBoolean(checkBoxProperties[row[8]])) - { - control.CheckBoxPropertyRef = Convert.ToString(row[8]); - } - else - { - control.Property = Convert.ToString(row[8]); - checkBoxProperties[row[8]] = true; - } - - if (null != checkBoxRow[1]) - { - control.CheckBoxValue = Convert.ToString(checkBoxRow[1]); - } - } - } - } - } - } - - /// - /// Finalize the Component table. - /// - /// The collection of all tables. - /// - /// Set the keypaths for each component. - /// - private void FinalizeComponentTable(TableIndexedCollection tables) - { - Table componentTable = tables["Component"]; - Table fileTable = tables["File"]; - Table odbcDataSourceTable = tables["ODBCDataSource"]; - Table registryTable = tables["Registry"]; - - // set the component keypaths - if (null != componentTable) - { - foreach (Row row in componentTable.Rows) - { - int attributes = Convert.ToInt32(row[3]); - - if (null == row[5]) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); - - component.KeyPath = Wix.YesNoType.yes; - } - else if (MsiInterop.MsidbComponentAttributesRegistryKeyPath == (attributes & MsiInterop.MsidbComponentAttributesRegistryKeyPath)) - { - object registryObject = this.core.GetIndexedElement("Registry", Convert.ToString(row[5])); - - if (null != registryObject) - { - Wix.RegistryValue registryValue = registryObject as Wix.RegistryValue; - - if (null != registryValue) - { - registryValue.KeyPath = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.IllegalRegistryKeyPath(row.SourceLineNumbers, "Component", Convert.ToString(row[5]))); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry")); - } - } - else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource)) - { - Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5])); - - if (null != odbcDataSource) - { - odbcDataSource.KeyPath = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "ODBCDataSource")); - } - } - else - { - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[5])); - - if (null != file) - { - file.KeyPath = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "File")); - } - } - } - } - - // add the File children elements - if (null != fileTable) - { - foreach (FileRow fileRow in fileTable.Rows) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component); - Wix.File file = (Wix.File)this.core.GetIndexedElement(fileRow); - - if (null != component) - { - component.AddChild(file); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(fileRow.SourceLineNumbers, "File", fileRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", fileRow.Component, "Component")); - } - } - } - - // add the ODBCDataSource children elements - if (null != odbcDataSourceTable) - { - foreach (Row row in odbcDataSourceTable.Rows) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row); - - if (null != component) - { - component.AddChild(odbcDataSource); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ODBCDataSource", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - } - - // add the Registry children elements - if (null != registryTable) - { - foreach (Row row in registryTable.Rows) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); - Wix.ISchemaElement registryElement = (Wix.ISchemaElement)this.core.GetIndexedElement(row); - - if (null != component) - { - component.AddChild(registryElement); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Registry", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); - } - } - } - } - - /// - /// Finalize the Dialog table. - /// - /// The collection of all tables. - /// - /// Sets the first, default, and cancel control for each dialog and adds all child control - /// elements to the dialog. - /// - private void FinalizeDialogTable(TableIndexedCollection tables) - { - // if the user has requested to suppress the UI elements, we have nothing to do - if (this.suppressUI) - { - return; - } - - Table controlTable = tables["Control"]; - Table dialogTable = tables["Dialog"]; - - Hashtable addedControls = new Hashtable(); - Hashtable controlRows = new Hashtable(); - - // index the rows in the control rows (because we need the Control_Next value) - if (null != controlTable) - { - foreach (Row row in controlTable.Rows) - { - controlRows.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); - } - } - - if (null != dialogTable) - { - foreach (Row row in dialogTable.Rows) - { - Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement(row); - string dialogId = Convert.ToString(row[0]); - - Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[7])); - if (null == control) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_First", Convert.ToString(row[7]), "Control")); - } - - // add tabbable controls - while (null != control) - { - Row controlRow = (Row)controlRows[String.Concat(dialogId, DecompilerConstants.PrimaryKeyDelimiter, control.Id)]; - - control.TabSkip = Wix.YesNoType.no; - dialog.AddChild(control); - addedControls.Add(control, null); - - if (null != controlRow[10]) - { - control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(controlRow[10])); - if (null != control) - { - // looped back to the first control in the dialog - if (addedControls.Contains(control)) - { - control = null; - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(controlRow.SourceLineNumbers, "Control", controlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", dialogId, "Control_Next", Convert.ToString(controlRow[10]), "Control")); - } - } - else - { - control = null; - } - } - - // set default control - if (null != row[8]) - { - Wix.Control defaultControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[8])); - - if (null != defaultControl) - { - defaultControl.Default = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Default", Convert.ToString(row[8]), "Control")); - } - } - - // set cancel control - if (null != row[9]) - { - Wix.Control cancelControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[9])); - - if (null != cancelControl) - { - cancelControl.Cancel = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Cancel", Convert.ToString(row[9]), "Control")); - } - } - } - } - - // add the non-tabbable controls to the dialog - if (null != controlTable) - { - foreach (Row row in controlTable.Rows) - { - Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); - Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0])); - - if (null == dialog) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Dialog")); - continue; - } - - if (!addedControls.Contains(control)) - { - control.TabSkip = Wix.YesNoType.yes; - dialog.AddChild(control); - } - } - } - } - - /// - /// Finalize the DuplicateFile and MoveFile tables. - /// - /// The collection of all tables. - /// - /// Sets the source/destination property/directory for each DuplicateFile or - /// MoveFile row. - /// - private void FinalizeDuplicateMoveFileTables(TableIndexedCollection tables) - { - Table duplicateFileTable = tables["DuplicateFile"]; - Table moveFileTable = tables["MoveFile"]; - - if (null != duplicateFileTable) - { - foreach (Row row in duplicateFileTable.Rows) - { - Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); - - if (null != row[4]) - { - if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[4]))) - { - copyFile.DestinationDirectory = Convert.ToString(row[4]); - } - else - { - copyFile.DestinationProperty = Convert.ToString(row[4]); - } - } - } - } - - if (null != moveFileTable) - { - foreach (Row row in moveFileTable.Rows) - { - Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); - - if (null != row[4]) - { - if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[4]))) - { - copyFile.SourceDirectory = Convert.ToString(row[4]); - } - else - { - copyFile.SourceProperty = Convert.ToString(row[4]); - } - } - - if (null != this.core.GetIndexedElement("Directory", Convert.ToString(row[5]))) - { - copyFile.DestinationDirectory = Convert.ToString(row[5]); - } - else - { - copyFile.DestinationProperty = Convert.ToString(row[5]); - } - } - } - } - - /// - /// Finalize the FamilyFileRanges table. - /// - /// The collection of all tables. - private void FinalizeFamilyFileRangesTable(TableIndexedCollection tables) - { - Table externalFilesTable = tables["ExternalFiles"]; - Table familyFileRangesTable = tables["FamilyFileRanges"]; - Table targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"]; - - Hashtable usedProtectRanges = new Hashtable(); - - if (null != familyFileRangesTable) - { - foreach (Row row in familyFileRangesTable.Rows) - { - Wix.ProtectRange protectRange = new Wix.ProtectRange(); - - if (null != row[2] && null != row[3]) - { - string[] retainOffsets = (Convert.ToString(row[2])).Split(','); - string[] retainLengths = (Convert.ToString(row[3])).Split(','); - - if (retainOffsets.Length == retainLengths.Length) - { - for (int i = 0; i < retainOffsets.Length; i++) - { - if (retainOffsets[i].StartsWith("0x", StringComparison.Ordinal)) - { - protectRange.Offset = Convert.ToInt32(retainOffsets[i].Substring(2), 16); - } - else - { - protectRange.Offset = Convert.ToInt32(retainOffsets[i], CultureInfo.InvariantCulture); - } - - if (retainLengths[i].StartsWith("0x", StringComparison.Ordinal)) - { - protectRange.Length = Convert.ToInt32(retainLengths[i].Substring(2), 16); - } - else - { - protectRange.Length = Convert.ToInt32(retainLengths[i], CultureInfo.InvariantCulture); - } - } - } - else - { - // TODO: warn - } - } - else if (null != row[2] || null != row[3]) - { - // TODO: warn about mismatch between columns - } - - this.core.IndexElement(row, protectRange); - } - } - - if (null != externalFilesTable) - { - foreach (Row row in externalFilesTable.Rows) - { - Wix.ExternalFile externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row); - - Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(row[0]), Convert.ToString(row[1])); - if (null != protectRange) - { - externalFile.AddChild(protectRange); - usedProtectRanges[protectRange] = null; - } - } - } - - if (null != targetFiles_OptionalDataTable) - { - Table targetImagesTable = tables["TargetImages"]; - Table upgradedImagesTable = tables["UpgradedImages"]; - - Hashtable targetImageRows = new Hashtable(); - Hashtable upgradedImagesRows = new Hashtable(); - - // index the TargetImages table - if (null != targetImagesTable) - { - foreach (Row row in targetImagesTable.Rows) - { - targetImageRows.Add(row[0], row); - } - } - - // index the UpgradedImages table - if (null != upgradedImagesTable) - { - foreach (Row row in upgradedImagesTable.Rows) - { - upgradedImagesRows.Add(row[0], row); - } - } - - foreach (Row row in targetFiles_OptionalDataTable.Rows) - { - Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)]; - - Row targetImageRow = (Row)targetImageRows[row[0]]; - if (null == targetImageRow) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, targetFiles_OptionalDataTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); - continue; - } - - Row upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]]; - if (null == upgradedImagesRow) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(targetImageRow.SourceLineNumbers, targetImageRow.Table.Name, targetImageRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); - continue; - } - - Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(upgradedImagesRow[4]), Convert.ToString(row[1])); - if (null != protectRange) - { - targetFile.AddChild(protectRange); - usedProtectRanges[protectRange] = null; - } - } - } - - if (null != familyFileRangesTable) - { - foreach (Row row in familyFileRangesTable.Rows) - { - Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row); - - if (!usedProtectRanges.Contains(protectRange)) - { - Wix.ProtectFile protectFile = new Wix.ProtectFile(); - - protectFile.File = Convert.ToString(row[1]); - - protectFile.AddChild(protectRange); - - Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); - if (null != family) - { - family.AddChild(protectFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, familyFileRangesTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); - } - } - } - } - } - - /// - /// Finalize the FeatureComponents table. - /// - /// The collection of all tables. - /// - /// Since tables specifying references to the FeatureComponents table have references to - /// the Feature and Component table separately, but not the FeatureComponents table specifically, - /// the FeatureComponents table and primary features must be decompiled during finalization. - /// - private void FinalizeFeatureComponentsTable(TableIndexedCollection tables) - { - Table classTable = tables["Class"]; - Table extensionTable = tables["Extension"]; - Table msiAssemblyTable = tables["MsiAssembly"]; - Table publishComponentTable = tables["PublishComponent"]; - Table shortcutTable = tables["Shortcut"]; - Table typeLibTable = tables["TypeLib"]; - - if (null != classTable) - { - foreach (Row row in classTable.Rows) - { - this.SetPrimaryFeature(row, 11, 2); - } - } - - if (null != extensionTable) - { - foreach (Row row in extensionTable.Rows) - { - this.SetPrimaryFeature(row, 4, 1); - } - } - - if (null != msiAssemblyTable) - { - foreach (Row row in msiAssemblyTable.Rows) - { - this.SetPrimaryFeature(row, 1, 0); - } - } - - if (null != publishComponentTable) - { - foreach (Row row in publishComponentTable.Rows) - { - this.SetPrimaryFeature(row, 4, 2); - } - } - - if (null != shortcutTable) - { - foreach (Row row in shortcutTable.Rows) - { - string target = Convert.ToString(row[4]); - - if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal)) - { - this.SetPrimaryFeature(row, 4, 3); - } - } - } - - if (null != typeLibTable) - { - foreach (Row row in typeLibTable.Rows) - { - this.SetPrimaryFeature(row, 6, 2); - } - } - } - - /// - /// Finalize the File table. - /// - /// The collection of all tables. - /// - /// Sets the source, diskId, and assembly information for each file. - /// - private void FinalizeFileTable(TableIndexedCollection tables) - { - Table fileTable = tables["File"]; - Table mediaTable = tables["Media"]; - Table msiAssemblyTable = tables["MsiAssembly"]; - Table typeLibTable = tables["TypeLib"]; - - // index the media table by media id - RowDictionary mediaRows; - if (null != mediaTable) - { - mediaRows = new RowDictionary(mediaTable); - } - - // set the disk identifiers and sources for files - if (null != fileTable) - { - foreach (FileRow fileRow in fileTable.Rows) - { - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File); - - // Don't bother processing files that are orphaned (and won't show up in the output anyway) - if (null != file.ParentElement) - { - // set the diskid - if (null != mediaTable) - { - foreach (MediaRow mediaRow in mediaTable.Rows) - { - if (fileRow.Sequence <= mediaRow.LastSequence) - { - file.DiskId = Convert.ToString(mediaRow.DiskId); - break; - } - } - } - - // set the source (done here because it requires information from the Directory table) - if (OutputType.Module == this.outputType) - { - file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id, '.', this.modularizationGuid.Substring(1, 36).Replace('-', '_')); - } - else if (Wix.YesNoDefaultType.yes == file.Compressed || (Wix.YesNoDefaultType.no != file.Compressed && this.compressed)) - { - file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id); - } - else // uncompressed - { - string fileName = (null != file.ShortName ? file.ShortName : file.Name); - - if (!this.shortNames && null != file.Name) - { - fileName = file.Name; - } - - if (this.compressed) // uncompressed at the root of the source image - { - file.Source = String.Concat("SourceDir", Path.DirectorySeparatorChar, fileName); - } - else - { - string sourcePath = this.GetSourcePath(file); - - file.Source = Path.Combine(sourcePath, fileName); - } - } - } - } - } - - // set the file assemblies and manifests - if (null != msiAssemblyTable) - { - foreach (Row row in msiAssemblyTable.Rows) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); - - if (null == component) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiAssembly", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); - } - else - { - foreach (Wix.ISchemaElement element in component.Children) - { - Wix.File file = element as Wix.File; - - if (null != file && Wix.YesNoType.yes == file.KeyPath) - { - if (null != row[2]) - { - file.AssemblyManifest = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - file.AssemblyApplication = Convert.ToString(row[3]); - } - - if (null == row[4] || 0 == Convert.ToInt32(row[4])) - { - file.Assembly = Wix.File.AssemblyType.net; - } - else - { - file.Assembly = Wix.File.AssemblyType.win32; - } - } - } - } - } - } - - // nest the TypeLib elements - if (null != typeLibTable) - { - foreach (Row row in typeLibTable.Rows) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); - Wix.TypeLib typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row); - - foreach (Wix.ISchemaElement element in component.Children) - { - Wix.File file = element as Wix.File; - - if (null != file && Wix.YesNoType.yes == file.KeyPath) - { - file.AddChild(typeLib); - } - } - } - } - } - - /// - /// Finalize the MIME table. - /// - /// The collection of all tables. - /// - /// There is a foreign key shared between the MIME and Extension - /// tables so either one would be valid to be decompiled first, so - /// the only safe way to nest the MIME elements is to do it during finalize. - /// - private void FinalizeMIMETable(TableIndexedCollection tables) - { - Table extensionTable = tables["Extension"]; - Table mimeTable = tables["MIME"]; - - Hashtable comExtensions = new Hashtable(); - - if (null != extensionTable) - { - foreach (Row row in extensionTable.Rows) - { - Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); - - // index the extension - if (!comExtensions.Contains(row[0])) - { - comExtensions.Add(row[0], new ArrayList()); - } - ((ArrayList)comExtensions[row[0]]).Add(extension); - - // set the default MIME element for this extension - if (null != row[3]) - { - Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); - - if (null != mime) - { - mime.Default = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); - } - } - } - } - - if (null != mimeTable) - { - foreach (Row row in mimeTable.Rows) - { - Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement(row); - - if (comExtensions.Contains(row[1])) - { - ArrayList extensionElements = (ArrayList)comExtensions[row[1]]; - - foreach (Wix.Extension extension in extensionElements) - { - extension.AddChild(mime); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MIME", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[1]), "Extension")); - } - } - } - } - - /// - /// Finalize the ProgId table. - /// - /// The collection of all tables. - /// - /// Enumerates through all the Class rows, looking for child ProgIds (these are the - /// default ProgIds for a given Class). Then go through the ProgId table and add any - /// remaining ProgIds for each Class. This happens during finalize because there is - /// a circular dependency between the Class and ProgId tables. - /// - private void FinalizeProgIdTable(TableIndexedCollection tables) - { - Table classTable = tables["Class"]; - Table progIdTable = tables["ProgId"]; - Table extensionTable = tables["Extension"]; - Table componentTable = tables["Component"]; - - Hashtable addedProgIds = new Hashtable(); - Hashtable classes = new Hashtable(); - Hashtable components = new Hashtable(); - - // add the default ProgIds for each class (and index the class table) - if (null != classTable) - { - foreach (Row row in classTable.Rows) - { - Wix.Class wixClass = (Wix.Class)this.core.GetIndexedElement(row); - - if (null != row[3]) - { - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[3])); - - if (null != progId) - { - if (addedProgIds.Contains(progId)) - { - this.core.OnMessage(WixWarnings.TooManyProgIds(row.SourceLineNumbers, Convert.ToString(row[0]), Convert.ToString(row[3]), Convert.ToString(addedProgIds[progId]))); - } - else - { - wixClass.AddChild(progId); - addedProgIds.Add(progId, wixClass.Id); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Class", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Default", Convert.ToString(row[3]), "ProgId")); - } - } - - // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key) - if (!classes.Contains(wixClass.Id)) - { - classes.Add(wixClass.Id, new ArrayList()); - } - ((ArrayList)classes[wixClass.Id]).Add(wixClass); - } - } - - // add the remaining non-default ProgId entries for each class - if (null != progIdTable) - { - foreach (Row row in progIdTable.Rows) - { - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); - - if (!addedProgIds.Contains(progId) && null != row[2] && null == progId.ParentElement) - { - ArrayList classElements = (ArrayList)classes[row[2]]; - - if (null != classElements) - { - foreach (Wix.Class wixClass in classElements) - { - wixClass.AddChild(progId); - addedProgIds.Add(progId, wixClass.Id); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ProgId", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Class_", Convert.ToString(row[2]), "Class")); - } - } - } - } - - if (null != componentTable) - { - foreach (Row row in componentTable.Rows) - { - Wix.Component wixComponent = (Wix.Component)this.core.GetIndexedElement(row); - - // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key) - if (!components.Contains(wixComponent.Id)) - { - components.Add(wixComponent.Id, new ArrayList()); - } - ((ArrayList)components[wixComponent.Id]).Add(wixComponent); - } - } - - // Check for any progIds that are not hooked up to a class and hook them up to the component specified by the extension - if (null != extensionTable) - { - foreach (Row row in extensionTable.Rows) - { - // ignore the extension if it isn't associated with a progId - if (null == row[2]) - { - continue; - } - - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); - - // Haven't added the progId yet and it doesn't have a parent progId - if (!addedProgIds.Contains(progId) && null == progId.ParentElement) - { - ArrayList componentElements = (ArrayList)components[row[1]]; - - if (null != componentElements) - { - foreach (Wix.Component wixComponent in componentElements) - { - wixComponent.AddChild(progId); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - } - } - } - - /// - /// Finalize the Property table. - /// - /// The collection of all tables. - /// - /// Removes properties that are generated from other entries. - /// - private void FinalizePropertyTable(TableIndexedCollection tables) - { - Table propertyTable = tables["Property"]; - Table customActionTable = tables["CustomAction"]; - - if (null != propertyTable && null != customActionTable) - { - foreach (Row row in customActionTable.Rows) - { - int bits = Convert.ToInt32(row[1]); - if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) && - MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript)) - { - Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0])); - - // If no other fields on the property are set we must have created it during link - if (null != property && null == property.Value && Wix.YesNoType.yes != property.Secure && Wix.YesNoType.yes != property.SuppressModularization) - { - this.core.RootElement.RemoveChild(property); - } - } - } - } - } - - /// - /// Finalize the RemoveFile table. - /// - /// The collection of all tables. - /// - /// Sets the directory/property for each RemoveFile row. - /// - private void FinalizeRemoveFileTable(TableIndexedCollection tables) - { - Table removeFileTable = tables["RemoveFile"]; - - if (null != removeFileTable) - { - foreach (Row row in removeFileTable.Rows) - { - bool isDirectory = false; - string property = Convert.ToString(row[3]); - - // determine if the property is actually authored as a directory - if (null != this.core.GetIndexedElement("Directory", property)) - { - isDirectory = true; - } - - Wix.ISchemaElement element = this.core.GetIndexedElement(row); - - Wix.RemoveFile removeFile = element as Wix.RemoveFile; - if (null != removeFile) - { - if (isDirectory) - { - removeFile.Directory = property; - } - else - { - removeFile.Property = property; - } - } - else - { - Wix.RemoveFolder removeFolder = (Wix.RemoveFolder)element; - - if (isDirectory) - { - removeFolder.Directory = property; - } - else - { - removeFolder.Property = property; - } - } - } - } - } - - /// - /// Finalize the LockPermissions table. - /// - /// The collection of all tables. - /// - /// Nests the Permission elements below their parent elements. There are no declared foreign - /// keys for the parents of the LockPermissions table. - /// - private void FinalizeLockPermissionsTable(TableIndexedCollection tables) - { - Table createFolderTable = tables["CreateFolder"]; - Table lockPermissionsTable = tables["LockPermissions"]; - - Hashtable createFolders = new Hashtable(); - - // index the CreateFolder table because the foreign key to this table from the - // LockPermissions table is only part of the primary key of this table - if (null != createFolderTable) - { - foreach (Row row in createFolderTable.Rows) - { - Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); - string directoryId = Convert.ToString(row[0]); - - if (!createFolders.Contains(directoryId)) - { - createFolders.Add(directoryId, new ArrayList()); - } - ((ArrayList)createFolders[directoryId]).Add(createFolder); - } - } - - if (null != lockPermissionsTable) - { - foreach (Row row in lockPermissionsTable.Rows) - { - string id = Convert.ToString(row[0]); - string table = Convert.ToString(row[1]); - - Wix.Permission permission = (Wix.Permission)this.core.GetIndexedElement(row); - - if ("CreateFolder" == table) - { - ArrayList createFolderElements = (ArrayList)createFolders[id]; - - if (null != createFolderElements) - { - foreach (Wix.CreateFolder createFolder in createFolderElements) - { - createFolder.AddChild(permission); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); - } - } - else - { - Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); - - if (null != parentElement) - { - parentElement.AddChild(permission); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); - } - } - } - } - } - - /// - /// Finalize the MsiLockPermissionsEx table. - /// - /// The collection of all tables. - /// - /// Nests the PermissionEx elements below their parent elements. There are no declared foreign - /// keys for the parents of the MsiLockPermissionsEx table. - /// - private void FinalizeMsiLockPermissionsExTable(TableIndexedCollection tables) - { - Table createFolderTable = tables["CreateFolder"]; - Table msiLockPermissionsExTable = tables["MsiLockPermissionsEx"]; - - Hashtable createFolders = new Hashtable(); - - // index the CreateFolder table because the foreign key to this table from the - // MsiLockPermissionsEx table is only part of the primary key of this table - if (null != createFolderTable) - { - foreach (Row row in createFolderTable.Rows) - { - Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); - string directoryId = Convert.ToString(row[0]); - - if (!createFolders.Contains(directoryId)) - { - createFolders.Add(directoryId, new ArrayList()); - } - ((ArrayList)createFolders[directoryId]).Add(createFolder); - } - } - - if (null != msiLockPermissionsExTable) - { - foreach (Row row in msiLockPermissionsExTable.Rows) - { - string id = Convert.ToString(row[1]); - string table = Convert.ToString(row[2]); - - Wix.PermissionEx permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row); - - if ("CreateFolder" == table) - { - ArrayList createFolderElements = (ArrayList)createFolders[id]; - - if (null != createFolderElements) - { - foreach (Wix.CreateFolder createFolder in createFolderElements) - { - createFolder.AddChild(permissionEx); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); - } - } - else - { - Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); - - if (null != parentElement) - { - parentElement.AddChild(permissionEx); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); - } - } - } - } - } - - /// - /// Finalize the search tables. - /// - /// The collection of all tables. - /// Does all the complex linking required for the search tables. - private void FinalizeSearchTables(TableIndexedCollection tables) - { - Table appSearchTable = tables["AppSearch"]; - Table ccpSearchTable = tables["CCPSearch"]; - Table drLocatorTable = tables["DrLocator"]; - - Hashtable appSearches = new Hashtable(); - Hashtable ccpSearches = new Hashtable(); - Hashtable drLocators = new Hashtable(); - Hashtable locators = new Hashtable(); - Hashtable usedSearchElements = new Hashtable(); - ArrayList unusedSearchElements = new ArrayList(); - - Wix.ComplianceCheck complianceCheck = null; - - // index the AppSearch table by signatures - if (null != appSearchTable) - { - foreach (Row row in appSearchTable.Rows) - { - string property = Convert.ToString(row[0]); - string signature = Convert.ToString(row[1]); - - if (!appSearches.Contains(signature)) - { - appSearches.Add(signature, new StringCollection()); - } - - ((StringCollection)appSearches[signature]).Add(property); - } - } - - // index the CCPSearch table by signatures - if (null != ccpSearchTable) - { - foreach (Row row in ccpSearchTable.Rows) - { - string signature = Convert.ToString(row[0]); - - if (!ccpSearches.Contains(signature)) - { - ccpSearches.Add(signature, new StringCollection()); - } - - ((StringCollection)ccpSearches[signature]).Add(null); - - if (null == complianceCheck && !appSearches.Contains(signature)) - { - complianceCheck = new Wix.ComplianceCheck(); - this.core.RootElement.AddChild(complianceCheck); - } - } - } - - // index the directory searches by their search elements (to get back the original row) - if (null != drLocatorTable) - { - foreach (Row row in drLocatorTable.Rows) - { - drLocators.Add(this.core.GetIndexedElement(row), row); - } - } - - // index the locator tables by their signatures - string[] locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" }; - foreach (string locatorTableName in locatorTableNames) - { - Table locatorTable = tables[locatorTableName]; - - if (null != locatorTable) - { - foreach (Row row in locatorTable.Rows) - { - string signature = Convert.ToString(row[0]); - - if (!locators.Contains(signature)) - { - locators.Add(signature, new ArrayList()); - } - - ((ArrayList)locators[signature]).Add(row); - } - } - } - - // move the DrLocator rows with a parent of CCP_DRIVE first to ensure they get FileSearch children (not FileSearchRef) - foreach (ArrayList locatorRows in locators.Values) - { - int firstDrLocator = -1; - - for (int i = 0; i < locatorRows.Count; i++) - { - Row locatorRow = (Row)locatorRows[i]; - - if ("DrLocator" == locatorRow.TableDefinition.Name) - { - if (-1 == firstDrLocator) - { - firstDrLocator = i; - } - - if ("CCP_DRIVE" == Convert.ToString(locatorRow[1])) - { - locatorRows.RemoveAt(i); - locatorRows.Insert(firstDrLocator, locatorRow); - break; - } - } - } - } - - foreach (string signature in locators.Keys) - { - ArrayList locatorRows = (ArrayList)locators[signature]; - ArrayList signatureSearchElements = new ArrayList(); - - foreach (Row locatorRow in locatorRows) - { - bool used = true; - Wix.ISchemaElement searchElement = this.core.GetIndexedElement(locatorRow); - - if ("Signature" == locatorRow.TableDefinition.Name && 0 < signatureSearchElements.Count) - { - foreach (Wix.IParentElement searchParentElement in signatureSearchElements) - { - if (!usedSearchElements.Contains(searchElement)) - { - searchParentElement.AddChild(searchElement); - usedSearchElements[searchElement] = null; - } - else - { - Wix.FileSearchRef fileSearchRef = new Wix.FileSearchRef(); - - fileSearchRef.Id = signature; - - searchParentElement.AddChild(fileSearchRef); - } - } - } - else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1]) - { - string parentSignature = Convert.ToString(locatorRow[1]); - - if ("CCP_DRIVE" == parentSignature) - { - if (appSearches.Contains(signature)) - { - StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; - - foreach (string propertyId in appSearchPropertyIds) - { - Wix.Property property = this.EnsureProperty(propertyId); - Wix.ComplianceDrive complianceDrive = null; - - if (ccpSearches.Contains(signature)) - { - property.ComplianceCheck = Wix.YesNoType.yes; - } - - foreach (Wix.ISchemaElement element in property.Children) - { - complianceDrive = element as Wix.ComplianceDrive; - if (null != complianceDrive) - { - break; - } - } - - if (null == complianceDrive) - { - complianceDrive = new Wix.ComplianceDrive(); - property.AddChild(complianceDrive); - } - - if (!usedSearchElements.Contains(searchElement)) - { - complianceDrive.AddChild(searchElement); - usedSearchElements[searchElement] = null; - } - else - { - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); - - directorySearchRef.Id = signature; - - if (null != locatorRow[1]) - { - directorySearchRef.Parent = Convert.ToString(locatorRow[1]); - } - - if (null != locatorRow[2]) - { - directorySearchRef.Path = Convert.ToString(locatorRow[2]); - } - - complianceDrive.AddChild(directorySearchRef); - signatureSearchElements.Add(directorySearchRef); - } - } - } - else if (ccpSearches.Contains(signature)) - { - Wix.ComplianceDrive complianceDrive = null; - - foreach (Wix.ISchemaElement element in complianceCheck.Children) - { - complianceDrive = element as Wix.ComplianceDrive; - if (null != complianceDrive) - { - break; - } - } - - if (null == complianceDrive) - { - complianceDrive = new Wix.ComplianceDrive(); - complianceCheck.AddChild(complianceDrive); - } - - if (!usedSearchElements.Contains(searchElement)) - { - complianceDrive.AddChild(searchElement); - usedSearchElements[searchElement] = null; - } - else - { - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); - - directorySearchRef.Id = signature; - - if (null != locatorRow[1]) - { - directorySearchRef.Parent = Convert.ToString(locatorRow[1]); - } - - if (null != locatorRow[2]) - { - directorySearchRef.Path = Convert.ToString(locatorRow[2]); - } - - complianceDrive.AddChild(directorySearchRef); - signatureSearchElements.Add(directorySearchRef); - } - } - } - else - { - bool usedDrLocator = false; - ArrayList parentLocatorRows = (ArrayList)locators[parentSignature]; - - if (null != parentLocatorRows) - { - foreach (Row parentLocatorRow in parentLocatorRows) - { - if ("DrLocator" == parentLocatorRow.TableDefinition.Name) - { - Wix.IParentElement parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow); - - if (parentSearchElement.Children.GetEnumerator().MoveNext()) - { - Row parentDrLocatorRow = (Row)drLocators[parentSearchElement]; - Wix.DirectorySearchRef directorySeachRef = new Wix.DirectorySearchRef(); - - directorySeachRef.Id = parentSignature; - - if (null != parentDrLocatorRow[1]) - { - directorySeachRef.Parent = Convert.ToString(parentDrLocatorRow[1]); - } - - if (null != parentDrLocatorRow[2]) - { - directorySeachRef.Path = Convert.ToString(parentDrLocatorRow[2]); - } - - parentSearchElement = directorySeachRef; - unusedSearchElements.Add(directorySeachRef); - } - - if (!usedSearchElements.Contains(searchElement)) - { - parentSearchElement.AddChild(searchElement); - usedSearchElements[searchElement] = null; - usedDrLocator = true; - } - else - { - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); - - directorySearchRef.Id = signature; - - directorySearchRef.Parent = parentSignature; - - if (null != locatorRow[2]) - { - directorySearchRef.Path = Convert.ToString(locatorRow[2]); - } - - parentSearchElement.AddChild(searchElement); - usedDrLocator = true; - } - } - } - - // keep track of unused DrLocator rows - if (!usedDrLocator) - { - unusedSearchElements.Add(searchElement); - } - } - else - { - // TODO: warn - } - } - } - else if (appSearches.Contains(signature)) - { - StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; - - foreach (string propertyId in appSearchPropertyIds) - { - Wix.Property property = this.EnsureProperty(propertyId); - - if (ccpSearches.Contains(signature)) - { - property.ComplianceCheck = Wix.YesNoType.yes; - } - - if (!usedSearchElements.Contains(searchElement)) - { - property.AddChild(searchElement); - usedSearchElements[searchElement] = null; - } - else if ("RegLocator" == locatorRow.TableDefinition.Name) - { - Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); - - registrySearchRef.Id = signature; - - property.AddChild(registrySearchRef); - signatureSearchElements.Add(registrySearchRef); - } - else - { - // TODO: warn about unavailable Ref element - } - } - } - else if (ccpSearches.Contains(signature)) - { - if (!usedSearchElements.Contains(searchElement)) - { - complianceCheck.AddChild(searchElement); - usedSearchElements[searchElement] = null; - } - else if ("RegLocator" == locatorRow.TableDefinition.Name) - { - Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); - - registrySearchRef.Id = signature; - - complianceCheck.AddChild(registrySearchRef); - signatureSearchElements.Add(registrySearchRef); - } - else - { - // TODO: warn about unavailable Ref element - } - } - else - { - if ("DrLocator" == locatorRow.TableDefinition.Name) - { - unusedSearchElements.Add(searchElement); - } - else - { - // TODO: warn - used = false; - } - } - - // keep track of the search elements for this signature so that nested searches go in the proper parents - if (used) - { - signatureSearchElements.Add(searchElement); - } - } - } - - foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements) - { - bool used = false; - - foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children) - { - Wix.DirectorySearch directorySearch = schemaElement as Wix.DirectorySearch; - if (null != directorySearch) - { - StringCollection appSearchProperties = (StringCollection)appSearches[directorySearch.Id]; - - Wix.ISchemaElement unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement; - if (null != appSearchProperties) - { - Wix.Property property = this.EnsureProperty(appSearchProperties[0]); - - property.AddChild(unusedSearchSchemaElement); - used = true; - break; - } - else if (ccpSearches.Contains(directorySearch.Id)) - { - complianceCheck.AddChild(unusedSearchSchemaElement); - used = true; - break; - } - else - { - // TODO: warn - } - } - } - - if (!used) - { - // TODO: warn - } - } - } - - /// - /// Finalize the sequence tables. - /// - /// The collection of all tables. - /// - /// Creates the sequence elements. Occurs during finalization because its - /// not known if sequences refer to custom actions or dialogs during decompilation. - /// - private void FinalizeSequenceTables(TableIndexedCollection tables) - { - // finalize the normal sequence tables - if (OutputType.Product == this.outputType && !this.treatProductAsModule) - { - foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) - { - // if suppressing UI elements, skip UI-related sequence tables - if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) - { - continue; - } - - Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); - Table table = tables[sequenceTable.ToString()]; - - if (null != table) - { - ArrayList actionRows = new ArrayList(); - bool needAbsoluteScheduling = this.suppressRelativeActionSequencing; - WixActionRowCollection nonSequencedActionRows = new WixActionRowCollection(); - WixActionRowCollection suppressedRelativeActionRows = new WixActionRowCollection(); - - // create a sorted array of actions in this table - foreach (Row row in table.Rows) - { - WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); - - actionRow.Action = Convert.ToString(row[0]); - - if (null != row[1]) - { - actionRow.Condition = Convert.ToString(row[1]); - } - - actionRow.Sequence = Convert.ToInt32(row[2]); - - actionRow.SequenceTable = sequenceTable; - - actionRows.Add(actionRow); - } - actionRows.Sort(); - - for (int i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++) - { - WixActionRow actionRow = (WixActionRow)actionRows[i]; - WixActionRow standardActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; - - // create actions for custom actions, dialogs, AppSearch when its moved, and standard actions with non-standard conditions - if ("AppSearch" == actionRow.Action || null == standardActionRow || actionRow.Condition != standardActionRow.Condition) - { - WixActionRow previousActionRow = null; - WixActionRow nextActionRow = null; - - // find the previous action row if there is one - if (0 <= i - 1) - { - previousActionRow = (WixActionRow)actionRows[i - 1]; - } - - // find the next action row if there is one - if (actionRows.Count > i + 1) - { - nextActionRow = (WixActionRow)actionRows[i + 1]; - } - - // the logic for setting the before or after attribute for an action: - // 1. If more than one action shares the same sequence number, everything must be absolutely sequenced. - // 2. If the next action is a standard action and is 1 sequence number higher, this action occurs before it. - // 3. If the previous action is a standard action and is 1 sequence number lower, this action occurs after it. - // 4. If this action is not standard and the previous action is 1 sequence number lower and does not occur before this action, this action occurs after it. - // 5. If this action is not standard and the previous action does not have the same sequence number and the next action is 1 sequence number higher, this action occurs before it. - // 6. If this action is AppSearch and has all standard information, ignore it. - // 7. If this action is standard and has a non-standard condition, create the action without any scheduling information. - // 8. Everything must be absolutely sequenced. - if ((null != previousActionRow && actionRow.Sequence == previousActionRow.Sequence) || (null != nextActionRow && actionRow.Sequence == nextActionRow.Sequence)) - { - needAbsoluteScheduling = true; - } - else if (null != nextActionRow && null != this.standardActions[sequenceTable, nextActionRow.Action] && actionRow.Sequence + 1 == nextActionRow.Sequence) - { - actionRow.Before = nextActionRow.Action; - } - else if (null != previousActionRow && null != this.standardActions[sequenceTable, previousActionRow.Action] && actionRow.Sequence - 1 == previousActionRow.Sequence) - { - actionRow.After = previousActionRow.Action; - } - else if (null == standardActionRow && null != previousActionRow && actionRow.Sequence - 1 == previousActionRow.Sequence && previousActionRow.Before != actionRow.Action) - { - actionRow.After = previousActionRow.Action; - } - else if (null == standardActionRow && null != previousActionRow && actionRow.Sequence != previousActionRow.Sequence && null != nextActionRow && actionRow.Sequence + 1 == nextActionRow.Sequence) - { - actionRow.Before = nextActionRow.Action; - } - else if ("AppSearch" == actionRow.Action && null != standardActionRow && actionRow.Sequence == standardActionRow.Sequence && actionRow.Condition == standardActionRow.Condition) - { - // ignore an AppSearch row which has the WiX standard sequence and a standard condition - } - else if (null != standardActionRow && actionRow.Condition != standardActionRow.Condition) // standard actions get their standard sequence numbers - { - nonSequencedActionRows.Add(actionRow); - } - else if (0 < actionRow.Sequence) - { - needAbsoluteScheduling = true; - } - } - else - { - suppressedRelativeActionRows.Add(actionRow); - } - } - - // create the actions now that we know if they must be absolutely or relatively scheduled - foreach (WixActionRow actionRow in actionRows) - { - if (needAbsoluteScheduling) - { - // remove any before/after information to ensure this is absolutely sequenced - actionRow.Before = null; - actionRow.After = null; - } - else if (nonSequencedActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) - { - // clear the sequence attribute to ensure this action is scheduled without a sequence number (or before/after) - actionRow.Sequence = 0; - } - else if (suppressedRelativeActionRows.Contains(actionRow.SequenceTable, actionRow.Action)) - { - // skip the suppressed relatively scheduled action rows - continue; - } - - // create the action element - this.CreateActionElement(actionRow); - } - } - } - } - else if (OutputType.Module == this.outputType || this.treatProductAsModule) // finalize the Module sequence tables - { - foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) - { - // if suppressing UI elements, skip UI-related sequence tables - if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) - { - continue; - } - - Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); - Table table = tables[String.Concat("Module", sequenceTable.ToString())]; - - if (null != table) - { - foreach (Row row in table.Rows) - { - WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); - - actionRow.Action = Convert.ToString(row[0]); - - if (null != row[1]) - { - actionRow.Sequence = Convert.ToInt32(row[1]); - } - - if (null != row[2] && null != row[3]) - { - switch (Convert.ToInt32(row[3])) - { - case 0: - actionRow.Before = Convert.ToString(row[2]); - break; - case 1: - actionRow.After = Convert.ToString(row[2]); - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3])); - break; - } - } - - if (null != row[4]) - { - actionRow.Condition = Convert.ToString(row[4]); - } - - actionRow.SequenceTable = sequenceTable; - - // create action elements for non-standard actions - if (null == this.standardActions[actionRow.SequenceTable, actionRow.Action] || null != actionRow.After || null != actionRow.Before) - { - this.CreateActionElement(actionRow); - } - } - } - } - } - } - - /// - /// Finalize the Upgrade table. - /// - /// The collection of all tables. - /// - /// Decompile the rows from the Upgrade and LaunchCondition tables - /// created by the MajorUpgrade element. - /// - private void FinalizeUpgradeTable(TableIndexedCollection tables) - { - Table launchConditionTable = tables["LaunchCondition"]; - Table upgradeTable = tables["Upgrade"]; - string downgradeErrorMessage = null; - string disallowUpgradeErrorMessage = null; - Wix.MajorUpgrade majorUpgrade = new Wix.MajorUpgrade(); - - // find the DowngradePreventedCondition launch condition message - if (null != launchConditionTable && 0 < launchConditionTable.Rows.Count) - { - foreach (Row launchRow in launchConditionTable.Rows) - { - if (Compiler.DowngradePreventedCondition == Convert.ToString(launchRow[0])) - { - downgradeErrorMessage = Convert.ToString(launchRow[1]); - } - else if (Compiler.UpgradePreventedCondition == Convert.ToString(launchRow[0])) - { - disallowUpgradeErrorMessage = Convert.ToString(launchRow[1]); - } - } - } - - if (null != upgradeTable && 0 < upgradeTable.Rows.Count) - { - bool hasMajorUpgrade = false; - - foreach (Row row in upgradeTable.Rows) - { - UpgradeRow upgradeRow = (UpgradeRow)row; - - if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty) - { - hasMajorUpgrade = true; - int attr = upgradeRow.Attributes; - string removeFeatures = upgradeRow.Remove; - - if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) - { - majorUpgrade.AllowSameVersionUpgrades = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures != (attr & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) - { - majorUpgrade.MigrateFeatures = Wix.YesNoType.no; - } - - if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (attr & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) - { - majorUpgrade.IgnoreRemoveFailure = Wix.YesNoType.yes; - } - - if (!String.IsNullOrEmpty(removeFeatures)) - { - majorUpgrade.RemoveFeatures = removeFeatures; - } - } - else if (Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) - { - hasMajorUpgrade = true; - majorUpgrade.DowngradeErrorMessage = downgradeErrorMessage; - } - } - - if (hasMajorUpgrade) - { - if (String.IsNullOrEmpty(downgradeErrorMessage)) - { - majorUpgrade.AllowDowngrades = Wix.YesNoType.yes; - } - - if (!String.IsNullOrEmpty(disallowUpgradeErrorMessage)) - { - majorUpgrade.Disallow = Wix.YesNoType.yes; - majorUpgrade.DisallowUpgradeErrorMessage = disallowUpgradeErrorMessage; - } - - majorUpgrade.Schedule = DetermineMajorUpgradeScheduling(tables); - this.core.RootElement.AddChild(majorUpgrade); - } - } - } - - /// - /// Finalize the Verb table. - /// - /// The collection of all tables. - /// - /// The Extension table is a foreign table for the Verb table, but the - /// foreign key is only part of the primary key of the Extension table, - /// so it needs special logic to be nested properly. - /// - private void FinalizeVerbTable(TableIndexedCollection tables) - { - Table extensionTable = tables["Extension"]; - Table verbTable = tables["Verb"]; - - Hashtable extensionElements = new Hashtable(); - - if (null != extensionTable) - { - foreach (Row row in extensionTable.Rows) - { - Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); - - if (!extensionElements.Contains(row[0])) - { - extensionElements.Add(row[0], new ArrayList()); - } - - ((ArrayList)extensionElements[row[0]]).Add(extension); - } - } - - if (null != verbTable) - { - foreach (Row row in verbTable.Rows) - { - Wix.Verb verb = (Wix.Verb)this.core.GetIndexedElement(row); - - ArrayList extensionsArray = (ArrayList)extensionElements[row[0]]; - if (null != extensionsArray) - { - foreach (Wix.Extension extension in extensionsArray) - { - extension.AddChild(verb); - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, verbTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[0]), "Extension")); - } - } - } - } - - /// - /// Get the path to a file in the source image. - /// - /// The file. - /// The path to the file in the source image. - private string GetSourcePath(Wix.File file) - { - StringBuilder sourcePath = new StringBuilder(); - - Wix.Component component = (Wix.Component)file.ParentElement; - - for (Wix.Directory directory = (Wix.Directory)component.ParentElement; null != directory; directory = directory.ParentElement as Wix.Directory) - { - string name; - - if (!this.shortNames && null != directory.SourceName) - { - name = directory.SourceName; - } - else if (null != directory.ShortSourceName) - { - name = directory.ShortSourceName; - } - else if (!this.shortNames || null == directory.ShortName) - { - name = directory.Name; - } - else - { - name = directory.ShortName; - } - - if (0 == sourcePath.Length) - { - sourcePath.Append(name); - } - else - { - sourcePath.Insert(0, Path.DirectorySeparatorChar); - sourcePath.Insert(0, name); - } - } - - return sourcePath.ToString(); - } - - /// - /// Resolve the dependencies for a table (this is a helper method for GetSortedTableNames). - /// - /// The name of the table to resolve. - /// The unsorted table names. - /// The sorted table names. - private void ResolveTableDependencies(string tableName, SortedList unsortedTableNames, StringCollection sortedTableNames) - { - unsortedTableNames.Remove(tableName); - - foreach (ColumnDefinition columnDefinition in this.tableDefinitions[tableName].Columns) - { - // no dependency to resolve because this column doesn't reference another table - if (null == columnDefinition.KeyTable) - { - continue; - } - - foreach (string keyTable in columnDefinition.KeyTable.Split(';')) - { - if (tableName == keyTable) - { - continue; // self-referencing dependency - } - else if (sortedTableNames.Contains(keyTable)) - { - continue; // dependent table has already been sorted - } - else if (!this.tableDefinitions.Contains(keyTable)) - { - this.core.OnMessage(WixErrors.MissingTableDefinition(keyTable)); - } - else if (unsortedTableNames.Contains(keyTable)) - { - this.ResolveTableDependencies(keyTable, unsortedTableNames, sortedTableNames); - } - else - { - // found a circular dependency, so ignore it (this assumes that the tables will - // use a finalize method to nest their elements since the ordering will not be - // deterministic - } - } - } - - sortedTableNames.Add(tableName); - } - - /// - /// Get the names of the tables to process in the order they should be processed, according to their dependencies. - /// - /// A StringCollection containing the ordered table names. - private StringCollection GetSortedTableNames() - { - StringCollection sortedTableNames = new StringCollection(); - SortedList unsortedTableNames = new SortedList(); - - // index the table names - foreach (TableDefinition tableDefinition in this.tableDefinitions) - { - unsortedTableNames.Add(tableDefinition.Name, tableDefinition.Name); - } - - // resolve the dependencies for each table - while (0 < unsortedTableNames.Count) - { - this.ResolveTableDependencies(Convert.ToString(unsortedTableNames.GetByIndex(0)), unsortedTableNames, sortedTableNames); - } - - return sortedTableNames; - } - - /// - /// Initialize decompilation. - /// - /// The collection of all tables. - private void InitializeDecompile(TableIndexedCollection tables) - { - // reset all the state information - this.compressed = false; - this.patchTargetFiles.Clear(); - this.sequenceElements.Clear(); - this.shortNames = false; - - // set the codepage if its not neutral (0) - if (0 != this.codepage) - { - switch (this.outputType) - { - case OutputType.Module: - ((Wix.Module)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); - break; - case OutputType.PatchCreation: - ((Wix.PatchCreation)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); - break; - case OutputType.Product: - ((Wix.Product)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); - break; - } - } - - // index the rows from the extension libraries - Dictionary> indexedExtensionTables = new Dictionary>(); - foreach (IDecompilerExtension extension in this.extensions) - { - // Get the optional library from the extension with the rows to be removed. - Library library = extension.GetLibraryToRemove(this.tableDefinitions); - if (null != library) - { - foreach (Section section in library.Sections) - { - foreach (Table table in section.Tables) - { - foreach (Row row in table.Rows) - { - string primaryKey; - string tableName; - - // the Actions table needs to be handled specially - if ("WixAction" == table.Name) - { - primaryKey = Convert.ToString(row[1]); - - if (OutputType.Module == this.outputType) - { - tableName = String.Concat("Module", Convert.ToString(row[0])); - } - else - { - tableName = Convert.ToString(row[0]); - } - } - else - { - primaryKey = row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter); - tableName = table.Name; - } - - if (null != primaryKey) - { - HashSet indexedExtensionRows; - if (!indexedExtensionTables.TryGetValue(tableName, out indexedExtensionRows)) - { - indexedExtensionRows = new HashSet(); - indexedExtensionTables.Add(tableName, indexedExtensionRows); - } - - indexedExtensionRows.Add(primaryKey); - } - } - } - } - } - } - - // remove the rows from the extension libraries (to allow full round-tripping) - foreach (var kvp in indexedExtensionTables) - { - string tableName = kvp.Key; - HashSet indexedExtensionRows = kvp.Value; - - Table table = tables[tableName]; - if (null != table) - { - RowDictionary originalRows = new RowDictionary(table); - - // remove the original rows so that they can be added back if they should remain - table.Rows.Clear(); - - foreach (Row row in originalRows.Values) - { - if (!indexedExtensionRows.Contains(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter))) - { - table.Rows.Add(row); - } - } - } - } - } - - /// - /// Decompile the tables. - /// - /// The output being decompiled. - private void DecompileTables(Output output) - { - StringCollection sortedTableNames = this.GetSortedTableNames(); - - foreach (string tableName in sortedTableNames) - { - Table table = output.Tables[tableName]; - - // table does not exist in this database or should not be decompiled - if (null == table || !this.DecompilableTable(output, tableName)) - { - continue; - } - - this.core.OnMessage(WixVerboses.DecompilingTable(table.Name)); - - // empty tables may be kept with EnsureTable if the user set the proper option - if (0 == table.Rows.Count && this.suppressDroppingEmptyTables) - { - Wix.EnsureTable ensureTable = new Wix.EnsureTable(); - ensureTable.Id = table.Name; - this.core.RootElement.AddChild(ensureTable); - } - - switch (table.Name) - { - case "_SummaryInformation": - this.Decompile_SummaryInformationTable(table); - break; - case "AdminExecuteSequence": - case "AdminUISequence": - case "AdvtExecuteSequence": - case "InstallExecuteSequence": - case "InstallUISequence": - case "ModuleAdminExecuteSequence": - case "ModuleAdminUISequence": - case "ModuleAdvtExecuteSequence": - case "ModuleInstallExecuteSequence": - case "ModuleInstallUISequence": - // handled in FinalizeSequenceTables - break; - case "ActionText": - this.DecompileActionTextTable(table); - break; - case "AdvtUISequence": - this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name)); - break; - case "AppId": - this.DecompileAppIdTable(table); - break; - case "AppSearch": - // handled in FinalizeSearchTables - break; - case "BBControl": - this.DecompileBBControlTable(table); - break; - case "Billboard": - this.DecompileBillboardTable(table); - break; - case "Binary": - this.DecompileBinaryTable(table); - break; - case "BindImage": - this.DecompileBindImageTable(table); - break; - case "CCPSearch": - // handled in FinalizeSearchTables - break; - case "CheckBox": - // handled in FinalizeCheckBoxTable - break; - case "Class": - this.DecompileClassTable(table); - break; - case "ComboBox": - this.DecompileComboBoxTable(table); - break; - case "Control": - this.DecompileControlTable(table); - break; - case "ControlCondition": - this.DecompileControlConditionTable(table); - break; - case "ControlEvent": - this.DecompileControlEventTable(table); - break; - case "CreateFolder": - this.DecompileCreateFolderTable(table); - break; - case "CustomAction": - this.DecompileCustomActionTable(table); - break; - case "CompLocator": - this.DecompileCompLocatorTable(table); - break; - case "Complus": - this.DecompileComplusTable(table); - break; - case "Component": - this.DecompileComponentTable(table); - break; - case "Condition": - this.DecompileConditionTable(table); - break; - case "Dialog": - this.DecompileDialogTable(table); - break; - case "Directory": - this.DecompileDirectoryTable(table); - break; - case "DrLocator": - this.DecompileDrLocatorTable(table); - break; - case "DuplicateFile": - this.DecompileDuplicateFileTable(table); - break; - case "Environment": - this.DecompileEnvironmentTable(table); - break; - case "Error": - this.DecompileErrorTable(table); - break; - case "EventMapping": - this.DecompileEventMappingTable(table); - break; - case "Extension": - this.DecompileExtensionTable(table); - break; - case "ExternalFiles": - this.DecompileExternalFilesTable(table); - break; - case "FamilyFileRanges": - // handled in FinalizeFamilyFileRangesTable - break; - case "Feature": - this.DecompileFeatureTable(table); - break; - case "FeatureComponents": - this.DecompileFeatureComponentsTable(table); - break; - case "File": - this.DecompileFileTable(table); - break; - case "FileSFPCatalog": - this.DecompileFileSFPCatalogTable(table); - break; - case "Font": - this.DecompileFontTable(table); - break; - case "Icon": - this.DecompileIconTable(table); - break; - case "ImageFamilies": - this.DecompileImageFamiliesTable(table); - break; - case "IniFile": - this.DecompileIniFileTable(table); - break; - case "IniLocator": - this.DecompileIniLocatorTable(table); - break; - case "IsolatedComponent": - this.DecompileIsolatedComponentTable(table); - break; - case "LaunchCondition": - this.DecompileLaunchConditionTable(table); - break; - case "ListBox": - this.DecompileListBoxTable(table); - break; - case "ListView": - this.DecompileListViewTable(table); - break; - case "LockPermissions": - this.DecompileLockPermissionsTable(table); - break; - case "Media": - this.DecompileMediaTable(table); - break; - case "MIME": - this.DecompileMIMETable(table); - break; - case "ModuleAdvtUISequence": - this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name)); - break; - case "ModuleComponents": - // handled by DecompileComponentTable (since the ModuleComponents table - // rows are created by nesting components under the Module element) - break; - case "ModuleConfiguration": - this.DecompileModuleConfigurationTable(table); - break; - case "ModuleDependency": - this.DecompileModuleDependencyTable(table); - break; - case "ModuleExclusion": - this.DecompileModuleExclusionTable(table); - break; - case "ModuleIgnoreTable": - this.DecompileModuleIgnoreTableTable(table); - break; - case "ModuleSignature": - this.DecompileModuleSignatureTable(table); - break; - case "ModuleSubstitution": - this.DecompileModuleSubstitutionTable(table); - break; - case "MoveFile": - this.DecompileMoveFileTable(table); - break; - case "MsiAssembly": - // handled in FinalizeFileTable - break; - case "MsiDigitalCertificate": - this.DecompileMsiDigitalCertificateTable(table); - break; - case "MsiDigitalSignature": - this.DecompileMsiDigitalSignatureTable(table); - break; - case "MsiEmbeddedChainer": - this.DecompileMsiEmbeddedChainerTable(table); - break; - case "MsiEmbeddedUI": - this.DecompileMsiEmbeddedUITable(table); - break; - case "MsiLockPermissionsEx": - this.DecompileMsiLockPermissionsExTable(table); - break; - case "MsiPackageCertificate": - this.DecompileMsiPackageCertificateTable(table); - break; - case "MsiPatchCertificate": - this.DecompileMsiPatchCertificateTable(table); - break; - case "MsiShortcutProperty": - this.DecompileMsiShortcutPropertyTable(table); - break; - case "ODBCAttribute": - this.DecompileODBCAttributeTable(table); - break; - case "ODBCDataSource": - this.DecompileODBCDataSourceTable(table); - break; - case "ODBCDriver": - this.DecompileODBCDriverTable(table); - break; - case "ODBCSourceAttribute": - this.DecompileODBCSourceAttributeTable(table); - break; - case "ODBCTranslator": - this.DecompileODBCTranslatorTable(table); - break; - case "PatchMetadata": - this.DecompilePatchMetadataTable(table); - break; - case "PatchSequence": - this.DecompilePatchSequenceTable(table); - break; - case "ProgId": - this.DecompileProgIdTable(table); - break; - case "Properties": - this.DecompilePropertiesTable(table); - break; - case "Property": - this.DecompilePropertyTable(table); - break; - case "PublishComponent": - this.DecompilePublishComponentTable(table); - break; - case "RadioButton": - this.DecompileRadioButtonTable(table); - break; - case "Registry": - this.DecompileRegistryTable(table); - break; - case "RegLocator": - this.DecompileRegLocatorTable(table); - break; - case "RemoveFile": - this.DecompileRemoveFileTable(table); - break; - case "RemoveIniFile": - this.DecompileRemoveIniFileTable(table); - break; - case "RemoveRegistry": - this.DecompileRemoveRegistryTable(table); - break; - case "ReserveCost": - this.DecompileReserveCostTable(table); - break; - case "SelfReg": - this.DecompileSelfRegTable(table); - break; - case "ServiceControl": - this.DecompileServiceControlTable(table); - break; - case "ServiceInstall": - this.DecompileServiceInstallTable(table); - break; - case "SFPCatalog": - this.DecompileSFPCatalogTable(table); - break; - case "Shortcut": - this.DecompileShortcutTable(table); - break; - case "Signature": - this.DecompileSignatureTable(table); - break; - case "TargetFiles_OptionalData": - this.DecompileTargetFiles_OptionalDataTable(table); - break; - case "TargetImages": - this.DecompileTargetImagesTable(table); - break; - case "TextStyle": - this.DecompileTextStyleTable(table); - break; - case "TypeLib": - this.DecompileTypeLibTable(table); - break; - case "Upgrade": - this.DecompileUpgradeTable(table); - break; - case "UpgradedFiles_OptionalData": - this.DecompileUpgradedFiles_OptionalDataTable(table); - break; - case "UpgradedFilesToIgnore": - this.DecompileUpgradedFilesToIgnoreTable(table); - break; - case "UpgradedImages": - this.DecompileUpgradedImagesTable(table); - break; - case "UIText": - this.DecompileUITextTable(table); - break; - case "Verb": - this.DecompileVerbTable(table); - break; - default: - DecompilerExtension extension = (DecompilerExtension)this.extensionsByTableName[table.Name]; - - if (null != extension) - { - extension.DecompileTable(table); - } - else if (!this.suppressCustomTables) - { - this.DecompileCustomTable(table); - } - break; - } - } - } - - /// - /// Determine if a particular table should be decompiled with the current settings. - /// - /// The output being decompiled. - /// The name of a table. - /// true if the table should be decompiled; false otherwise. - private bool DecompilableTable(Output output, string tableName) - { - switch (tableName) - { - case "ActionText": - case "BBControl": - case "Billboard": - case "CheckBox": - case "Control": - case "ControlCondition": - case "ControlEvent": - case "Dialog": - case "Error": - case "EventMapping": - case "RadioButton": - case "TextStyle": - case "UIText": - return !this.suppressUI; - case "ModuleAdminExecuteSequence": - case "ModuleAdminUISequence": - case "ModuleAdvtExecuteSequence": - case "ModuleAdvtUISequence": - case "ModuleComponents": - case "ModuleConfiguration": - case "ModuleDependency": - case "ModuleIgnoreTable": - case "ModuleInstallExecuteSequence": - case "ModuleInstallUISequence": - case "ModuleExclusion": - case "ModuleSignature": - case "ModuleSubstitution": - if (OutputType.Module != output.Type) - { - this.core.OnMessage(WixWarnings.SkippingMergeModuleTable(output.SourceLineNumbers, tableName)); - return false; - } - else - { - return true; - } - case "ExternalFiles": - case "FamilyFileRanges": - case "ImageFamilies": - case "PatchMetadata": - case "PatchSequence": - case "Properties": - case "TargetFiles_OptionalData": - case "TargetImages": - case "UpgradedFiles_OptionalData": - case "UpgradedFilesToIgnore": - case "UpgradedImages": - if (OutputType.PatchCreation != output.Type) - { - this.core.OnMessage(WixWarnings.SkippingPatchCreationTable(output.SourceLineNumbers, tableName)); - return false; - } - else - { - return true; - } - case "MsiPatchHeaders": - case "MsiPatchMetadata": - case "MsiPatchOldAssemblyName": - case "MsiPatchOldAssemblyFile": - case "MsiPatchSequence": - case "Patch": - case "PatchPackage": - this.core.OnMessage(WixWarnings.PatchTable(output.SourceLineNumbers, tableName)); - return false; - case "_SummaryInformation": - return true; - case "_Validation": - case "MsiAssemblyName": - case "MsiFileHash": - return false; - default: // all other tables are allowed in any output except for a patch creation package - if (OutputType.PatchCreation == output.Type) - { - this.core.OnMessage(WixWarnings.IllegalPatchCreationTable(output.SourceLineNumbers, tableName)); - return false; - } - else - { - return true; - } - } - } - - /// - /// Decompile the _SummaryInformation table. - /// - /// The table to decompile. - private void Decompile_SummaryInformationTable(Table table) - { - if (OutputType.Module == this.outputType || OutputType.Product == this.outputType) - { - Wix.Package package = new Wix.Package(); - - foreach (Row row in table.Rows) - { - string value = Convert.ToString(row[1]); - - if (null != value && 0 < value.Length) - { - switch (Convert.ToInt32(row[0])) - { - case 1: - if ("1252" != value) - { - package.SummaryCodepage = value; - } - break; - case 3: - package.Description = value; - break; - case 4: - package.Manufacturer = value; - break; - case 5: - if ("Installer" != value) - { - package.Keywords = value; - } - break; - case 6: - package.Comments = value; - break; - case 7: - string[] template = value.Split(';'); - if (0 < template.Length && 0 < template[template.Length - 1].Length) - { - package.Languages = template[template.Length - 1]; - } - - if (1 < template.Length && null != template[0] && 0 < template[0].Length) - { - switch (template[0]) - { - case "Intel": - package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x86; - break; - case "Intel64": - package.Platform = WixToolset.Data.Serialize.Package.PlatformType.ia64; - break; - case "x64": - package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x64; - break; - } - } - break; - case 9: - if (OutputType.Module == this.outputType) - { - this.modularizationGuid = value; - package.Id = value; - } - break; - case 14: - package.InstallerVersion = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); - break; - case 15: - int wordCount = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); - if (0x1 == (wordCount & 0x1)) - { - this.shortNames = true; - package.ShortNames = Wix.YesNoType.yes; - } - - if (0x2 == (wordCount & 0x2)) - { - this.compressed = true; - - if (OutputType.Product == this.outputType) - { - package.Compressed = Wix.YesNoType.yes; - } - } - - if (0x4 == (wordCount & 0x4)) - { - package.AdminImage = Wix.YesNoType.yes; - } - - if (0x8 == (wordCount & 0x8)) - { - package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited; - } - - break; - case 19: - int security = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); - switch (security) - { - case 0: - package.ReadOnly = Wix.YesNoDefaultType.no; - break; - case 4: - package.ReadOnly = Wix.YesNoDefaultType.yes; - break; - } - break; - } - } - } - - this.core.RootElement.AddChild(package); - } - else - { - Wix.PatchInformation patchInformation = new Wix.PatchInformation(); - - foreach (Row row in table.Rows) - { - int propertyId = Convert.ToInt32(row[0]); - string value = Convert.ToString(row[1]); - - if (null != row[1] && 0 < value.Length) - { - switch (propertyId) - { - case 1: - if ("1252" != value) - { - patchInformation.SummaryCodepage = value; - } - break; - case 3: - patchInformation.Description = value; - break; - case 4: - patchInformation.Manufacturer = value; - break; - case 5: - if ("Installer,Patching,PCP,Database" != value) - { - patchInformation.Keywords = value; - } - break; - case 6: - patchInformation.Comments = value; - break; - case 7: - string[] template = value.Split(';'); - if (0 < template.Length && 0 < template[template.Length - 1].Length) - { - patchInformation.Languages = template[template.Length - 1]; - } - - if (1 < template.Length && null != template[0] && 0 < template[0].Length) - { - patchInformation.Platforms = template[0]; - } - break; - case 15: - int wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture); - if (0x1 == (wordCount & 0x1)) - { - patchInformation.ShortNames = Wix.YesNoType.yes; - } - - if (0x2 == (wordCount & 0x2)) - { - patchInformation.Compressed = Wix.YesNoType.yes; - } - - if (0x4 == (wordCount & 0x4)) - { - patchInformation.AdminImage = Wix.YesNoType.yes; - } - break; - case 19: - int security = Convert.ToInt32(value, CultureInfo.InvariantCulture); - switch (security) - { - case 0: - patchInformation.ReadOnly = Wix.YesNoDefaultType.no; - break; - case 4: - patchInformation.ReadOnly = Wix.YesNoDefaultType.yes; - break; - } - break; - } - } - } - - this.core.RootElement.AddChild(patchInformation); - } - } - - /// - /// Decompile the ActionText table. - /// - /// The table to decompile. - private void DecompileActionTextTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ProgressText progressText = new Wix.ProgressText(); - - progressText.Action = Convert.ToString(row[0]); - - if (null != row[1]) - { - progressText.Content = Convert.ToString(row[1]); - } - - if (null != row[2]) - { - progressText.Template = Convert.ToString(row[2]); - } - - this.core.UIElement.AddChild(progressText); - } - } - - /// - /// Decompile the AppId table. - /// - /// The table to decompile. - private void DecompileAppIdTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.AppId appId = new Wix.AppId(); - - appId.Advertise = Wix.YesNoType.yes; - - appId.Id = Convert.ToString(row[0]); - - if (null != row[1]) - { - appId.RemoteServerName = Convert.ToString(row[1]); - } - - if (null != row[2]) - { - appId.LocalService = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - appId.ServiceParameters = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - appId.DllSurrogate = Convert.ToString(row[4]); - } - - if (null != row[5] && Int32.Equals(row[5], 1)) - { - appId.ActivateAtStorage = Wix.YesNoType.yes; - } - - if (null != row[6] && Int32.Equals(row[6], 1)) - { - appId.RunAsInteractiveUser = Wix.YesNoType.yes; - } - - this.core.RootElement.AddChild(appId); - this.core.IndexElement(row, appId); - } - } - - /// - /// Decompile the BBControl table. - /// - /// The table to decompile. - private void DecompileBBControlTable(Table table) - { - foreach (BBControlRow bbControlRow in table.Rows) - { - Wix.Control control = new Wix.Control(); - - control.Id = bbControlRow.BBControl; - - control.Type = bbControlRow.Type; - - control.X = bbControlRow.X; - - control.Y = bbControlRow.Y; - - control.Width = bbControlRow.Width; - - control.Height = bbControlRow.Height; - - if (null != bbControlRow[7]) - { - SetControlAttributes(bbControlRow.Attributes, control); - } - - if (null != bbControlRow.Text) - { - control.Text = bbControlRow.Text; - } - - Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard); - if (null != billboard) - { - billboard.AddChild(control); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(bbControlRow.SourceLineNumbers, table.Name, bbControlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Billboard_", bbControlRow.Billboard, "Billboard")); - } - } - } - - /// - /// Decompile the Billboard table. - /// - /// The table to decompile. - private void DecompileBillboardTable(Table table) - { - Hashtable billboardActions = new Hashtable(); - SortedList billboards = new SortedList(); - - foreach (Row row in table.Rows) - { - Wix.Billboard billboard = new Wix.Billboard(); - - billboard.Id = Convert.ToString(row[0]); - - billboard.Feature = Convert.ToString(row[1]); - - this.core.IndexElement(row, billboard); - billboards.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1:0000000000}", row[0], row[3]), row); - } - - foreach (Row row in billboards.Values) - { - Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement(row); - Wix.BillboardAction billboardAction = (Wix.BillboardAction)billboardActions[row[2]]; - - if (null == billboardAction) - { - billboardAction = new Wix.BillboardAction(); - - billboardAction.Id = Convert.ToString(row[2]); - - this.core.UIElement.AddChild(billboardAction); - billboardActions.Add(row[2], billboardAction); - } - - billboardAction.AddChild(billboard); - } - } - - /// - /// Decompile the Binary table. - /// - /// The table to decompile. - private void DecompileBinaryTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Binary binary = new Wix.Binary(); - - binary.Id = Convert.ToString(row[0]); - - binary.SourceFile = Convert.ToString(row[1]); - - this.core.RootElement.AddChild(binary); - } - } - - /// - /// Decompile the BindImage table. - /// - /// The table to decompile. - private void DecompileBindImageTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); - - if (null != file) - { - file.BindPath = Convert.ToString(row[1]); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); - } - } - } - - /// - /// Decompile the Class table. - /// - /// The table to decompile. - private void DecompileClassTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Class wixClass = new Wix.Class(); - - wixClass.Advertise = Wix.YesNoType.yes; - - wixClass.Id = Convert.ToString(row[0]); - - switch (Convert.ToString(row[1])) - { - case "LocalServer": - wixClass.Context = Wix.Class.ContextType.LocalServer; - break; - case "LocalServer32": - wixClass.Context = Wix.Class.ContextType.LocalServer32; - break; - case "InprocServer": - wixClass.Context = Wix.Class.ContextType.InprocServer; - break; - case "InprocServer32": - wixClass.Context = Wix.Class.ContextType.InprocServer32; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - // ProgId children are handled in FinalizeProgIdTable - - if (null != row[4]) - { - wixClass.Description = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - wixClass.AppId = Convert.ToString(row[5]); - } - - if (null != row[6]) - { - string[] fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';'); - - try - { - foreach (string fileTypeMaskString in fileTypeMaskStrings) - { - string[] fileTypeMaskParts = fileTypeMaskString.Split(','); - - if (4 == fileTypeMaskParts.Length) - { - Wix.FileTypeMask fileTypeMask = new Wix.FileTypeMask(); - - fileTypeMask.Offset = Convert.ToInt32(fileTypeMaskParts[0], CultureInfo.InvariantCulture); - - fileTypeMask.Mask = fileTypeMaskParts[2]; - - fileTypeMask.Value = fileTypeMaskParts[3]; - - wixClass.AddChild(fileTypeMask); - } - else - { - // TODO: warn - } - } - } - catch (FormatException) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); - } - catch (OverflowException) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); - } - } - - if (null != row[7]) - { - wixClass.Icon = Convert.ToString(row[7]); - } - - if (null != row[8]) - { - wixClass.IconIndex = Convert.ToInt32(row[8]); - } - - if (null != row[9]) - { - wixClass.Handler = Convert.ToString(row[9]); - } - - if (null != row[10]) - { - wixClass.Argument = Convert.ToString(row[10]); - } - - if (null != row[12]) - { - if (1 == Convert.ToInt32(row[12])) - { - wixClass.RelativePath = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[12].Column.Name, row[12])); - } - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); - if (null != component) - { - component.AddChild(wixClass); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); - } - - this.core.IndexElement(row, wixClass); - } - } - - /// - /// Decompile the ComboBox table. - /// - /// The table to decompile. - private void DecompileComboBoxTable(Table table) - { - Wix.ComboBox comboBox = null; - SortedList comboBoxRows = new SortedList(); - - // sort the combo boxes by their property and order - foreach (Row row in table.Rows) - { - comboBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); - } - - foreach (Row row in comboBoxRows.Values) - { - if (null == comboBox || Convert.ToString(row[0]) != comboBox.Property) - { - comboBox = new Wix.ComboBox(); - - comboBox.Property = Convert.ToString(row[0]); - - this.core.UIElement.AddChild(comboBox); - } - - Wix.ListItem listItem = new Wix.ListItem(); - - listItem.Value = Convert.ToString(row[2]); - - if (null != row[3]) - { - listItem.Text = Convert.ToString(row[3]); - } - - comboBox.AddChild(listItem); - } - } - - /// - /// Decompile the Control table. - /// - /// The table to decompile. - private void DecompileControlTable(Table table) - { - foreach (ControlRow controlRow in table.Rows) - { - Wix.Control control = new Wix.Control(); - - control.Id = controlRow.Control; - - control.Type = controlRow.Type; - - control.X = controlRow.X; - - control.Y = controlRow.Y; - - control.Width = controlRow.Width; - - control.Height = controlRow.Height; - - if (null != controlRow[7]) - { - string[] specialAttributes; - - // sets various common attributes like Disabled, Indirect, Integer, ... - SetControlAttributes(controlRow.Attributes, control); - - switch (control.Type) - { - case "Bitmap": - specialAttributes = MsiInterop.BitmapControlAttributes; - break; - case "CheckBox": - specialAttributes = MsiInterop.CheckboxControlAttributes; - break; - case "ComboBox": - specialAttributes = MsiInterop.ComboboxControlAttributes; - break; - case "DirectoryCombo": - specialAttributes = MsiInterop.VolumeControlAttributes; - break; - case "Edit": - specialAttributes = MsiInterop.EditControlAttributes; - break; - case "Icon": - specialAttributes = MsiInterop.IconControlAttributes; - break; - case "ListBox": - specialAttributes = MsiInterop.ListboxControlAttributes; - break; - case "ListView": - specialAttributes = MsiInterop.ListviewControlAttributes; - break; - case "MaskedEdit": - specialAttributes = MsiInterop.EditControlAttributes; - break; - case "PathEdit": - specialAttributes = MsiInterop.EditControlAttributes; - break; - case "ProgressBar": - specialAttributes = MsiInterop.ProgressControlAttributes; - break; - case "PushButton": - specialAttributes = MsiInterop.ButtonControlAttributes; - break; - case "RadioButtonGroup": - specialAttributes = MsiInterop.RadioControlAttributes; - break; - case "Text": - specialAttributes = MsiInterop.TextControlAttributes; - break; - case "VolumeCostList": - specialAttributes = MsiInterop.VolumeControlAttributes; - break; - case "VolumeSelectCombo": - specialAttributes = MsiInterop.VolumeControlAttributes; - break; - default: - specialAttributes = null; - break; - } - - if (null != specialAttributes) - { - bool iconSizeSet = false; - - for (int i = 16; 32 > i; i++) - { - if (1 == ((controlRow.Attributes >> i) & 1)) - { - string attribute = null; - - if (specialAttributes.Length > (i - 16)) - { - attribute = specialAttributes[i - 16]; - } - - // unknown attribute - if (null == attribute) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); - continue; - } - - switch (attribute) - { - case "Bitmap": - control.Bitmap = Wix.YesNoType.yes; - break; - case "CDROM": - control.CDROM = Wix.YesNoType.yes; - break; - case "ComboList": - control.ComboList = Wix.YesNoType.yes; - break; - case "ElevationShield": - control.ElevationShield = Wix.YesNoType.yes; - break; - case "Fixed": - control.Fixed = Wix.YesNoType.yes; - break; - case "FixedSize": - control.FixedSize = Wix.YesNoType.yes; - break; - case "Floppy": - control.Floppy = Wix.YesNoType.yes; - break; - case "FormatSize": - control.FormatSize = Wix.YesNoType.yes; - break; - case "HasBorder": - control.HasBorder = Wix.YesNoType.yes; - break; - case "Icon": - control.Icon = Wix.YesNoType.yes; - break; - case "Icon16": - if (iconSizeSet) - { - control.IconSize = Wix.Control.IconSizeType.Item48; - } - else - { - iconSizeSet = true; - control.IconSize = Wix.Control.IconSizeType.Item16; - } - break; - case "Icon32": - if (iconSizeSet) - { - control.IconSize = Wix.Control.IconSizeType.Item48; - } - else - { - iconSizeSet = true; - control.IconSize = Wix.Control.IconSizeType.Item32; - } - break; - case "Image": - control.Image = Wix.YesNoType.yes; - break; - case "Multiline": - control.Multiline = Wix.YesNoType.yes; - break; - case "NoPrefix": - control.NoPrefix = Wix.YesNoType.yes; - break; - case "NoWrap": - control.NoWrap = Wix.YesNoType.yes; - break; - case "Password": - control.Password = Wix.YesNoType.yes; - break; - case "ProgressBlocks": - control.ProgressBlocks = Wix.YesNoType.yes; - break; - case "PushLike": - control.PushLike = Wix.YesNoType.yes; - break; - case "RAMDisk": - control.RAMDisk = Wix.YesNoType.yes; - break; - case "Remote": - control.Remote = Wix.YesNoType.yes; - break; - case "Removable": - control.Removable = Wix.YesNoType.yes; - break; - case "ShowRollbackCost": - control.ShowRollbackCost = Wix.YesNoType.yes; - break; - case "Sorted": - control.Sorted = Wix.YesNoType.yes; - break; - case "Transparent": - control.Transparent = Wix.YesNoType.yes; - break; - case "UserLanguage": - control.UserLanguage = Wix.YesNoType.yes; - break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknowControlAttribute, attribute)); - } - } - } - } - else if (0 < (controlRow.Attributes & 0xFFFF0000)) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); - } - } - - // FinalizeCheckBoxTable adds Control/@Property|@CheckBoxPropertyRef - if (null != controlRow.Property && 0 != String.CompareOrdinal("CheckBox", control.Type)) - { - control.Property = controlRow.Property; - } - - if (null != controlRow.Text) - { - control.Text = controlRow.Text; - } - - if (null != controlRow.Help) - { - string[] help = controlRow.Help.Split('|'); - - if (2 == help.Length) - { - if (0 < help[0].Length) - { - control.ToolTip = help[0]; - } - - if (0 < help[1].Length) - { - control.Help = help[1]; - } - } - } - - this.core.IndexElement(controlRow, control); - } - } - - /// - /// Decompile the ControlCondition table. - /// - /// The table to decompile. - private void DecompileControlConditionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Condition condition = new Wix.Condition(); - - switch (Convert.ToString(row[2])) - { - case "Default": - condition.Action = Wix.Condition.ActionType.@default; - break; - case "Disable": - condition.Action = Wix.Condition.ActionType.disable; - break; - case "Enable": - condition.Action = Wix.Condition.ActionType.enable; - break; - case "Hide": - condition.Action = Wix.Condition.ActionType.hide; - break; - case "Show": - condition.Action = Wix.Condition.ActionType.show; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); - break; - } - - condition.Content = Convert.ToString(row[3]); - - Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); - if (null != control) - { - control.AddChild(condition); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); - } - } - } - - /// - /// Decompile the ControlEvent table. - /// - /// The table to decompile. - private void DecompileControlEventTable(Table table) - { - SortedList controlEvents = new SortedList(); - - foreach (Row row in table.Rows) - { - Wix.Publish publish = new Wix.Publish(); - - string publishEvent = Convert.ToString(row[2]); - if (publishEvent.StartsWith("[", StringComparison.Ordinal) && publishEvent.EndsWith("]", StringComparison.Ordinal)) - { - publish.Property = publishEvent.Substring(1, publishEvent.Length - 2); - - if ("{}" != Convert.ToString(row[3])) - { - publish.Value = Convert.ToString(row[3]); - } - } - else - { - publish.Event = publishEvent; - publish.Value = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - publish.Content = Convert.ToString(row[4]); - } - - controlEvents.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2:0000000000}|{3}|{4}|{5}", row[0], row[1], (null == row[5] ? 0 : Convert.ToInt32(row[5])), row[2], row[3], row[4]), row); - - this.core.IndexElement(row, publish); - } - - foreach (Row row in controlEvents.Values) - { - Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); - Wix.Publish publish = (Wix.Publish)this.core.GetIndexedElement(row); - - if (null != control) - { - control.AddChild(publish); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); - } - } - } - - /// - /// Decompile a custom table. - /// - /// The table to decompile. - private void DecompileCustomTable(Table table) - { - if (0 < table.Rows.Count || this.suppressDroppingEmptyTables) - { - Wix.CustomTable customTable = new Wix.CustomTable(); - - this.core.OnMessage(WixWarnings.DecompilingAsCustomTable(table.Rows[0].SourceLineNumbers, table.Name)); - - customTable.Id = table.Name; - - foreach (ColumnDefinition columnDefinition in table.Definition.Columns) - { - Wix.Column column = new Wix.Column(); - - column.Id = columnDefinition.Name; - - if (ColumnCategory.Unknown != columnDefinition.Category) - { - switch (columnDefinition.Category) - { - case ColumnCategory.Text: - column.Category = Wix.Column.CategoryType.Text; - break; - case ColumnCategory.UpperCase: - column.Category = Wix.Column.CategoryType.UpperCase; - break; - case ColumnCategory.LowerCase: - column.Category = Wix.Column.CategoryType.LowerCase; - break; - case ColumnCategory.Integer: - column.Category = Wix.Column.CategoryType.Integer; - break; - case ColumnCategory.DoubleInteger: - column.Category = Wix.Column.CategoryType.DoubleInteger; - break; - case ColumnCategory.TimeDate: - column.Category = Wix.Column.CategoryType.TimeDate; - break; - case ColumnCategory.Identifier: - column.Category = Wix.Column.CategoryType.Identifier; - break; - case ColumnCategory.Property: - column.Category = Wix.Column.CategoryType.Property; - break; - case ColumnCategory.Filename: - column.Category = Wix.Column.CategoryType.Filename; - break; - case ColumnCategory.WildCardFilename: - column.Category = Wix.Column.CategoryType.WildCardFilename; - break; - case ColumnCategory.Path: - column.Category = Wix.Column.CategoryType.Path; - break; - case ColumnCategory.Paths: - column.Category = Wix.Column.CategoryType.Paths; - break; - case ColumnCategory.AnyPath: - column.Category = Wix.Column.CategoryType.AnyPath; - break; - case ColumnCategory.DefaultDir: - column.Category = Wix.Column.CategoryType.DefaultDir; - break; - case ColumnCategory.RegPath: - column.Category = Wix.Column.CategoryType.RegPath; - break; - case ColumnCategory.Formatted: - column.Category = Wix.Column.CategoryType.Formatted; - break; - case ColumnCategory.FormattedSDDLText: - column.Category = Wix.Column.CategoryType.FormattedSddl; - break; - case ColumnCategory.Template: - column.Category = Wix.Column.CategoryType.Template; - break; - case ColumnCategory.Condition: - column.Category = Wix.Column.CategoryType.Condition; - break; - case ColumnCategory.Guid: - column.Category = Wix.Column.CategoryType.Guid; - break; - case ColumnCategory.Version: - column.Category = Wix.Column.CategoryType.Version; - break; - case ColumnCategory.Language: - column.Category = Wix.Column.CategoryType.Language; - break; - case ColumnCategory.Binary: - column.Category = Wix.Column.CategoryType.Binary; - break; - case ColumnCategory.CustomSource: - column.Category = Wix.Column.CategoryType.CustomSource; - break; - case ColumnCategory.Cabinet: - column.Category = Wix.Column.CategoryType.Cabinet; - break; - case ColumnCategory.Shortcut: - column.Category = Wix.Column.CategoryType.Shortcut; - break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnCategory, columnDefinition.Category.ToString())); - } - } - - if (null != columnDefinition.Description) - { - column.Description = columnDefinition.Description; - } - - if (columnDefinition.IsKeyColumnSet) - { - column.KeyColumn = columnDefinition.KeyColumn; - } - - if (null != columnDefinition.KeyTable) - { - column.KeyTable = columnDefinition.KeyTable; - } - - if (columnDefinition.IsLocalizable) - { - column.Localizable = Wix.YesNoType.yes; - } - - if (columnDefinition.IsMaxValueSet) - { - column.MaxValue = columnDefinition.MaxValue; - } - - if (columnDefinition.IsMinValueSet) - { - column.MinValue = columnDefinition.MinValue; - } - - if (ColumnModularizeType.None != columnDefinition.ModularizeType) - { - switch (columnDefinition.ModularizeType) - { - case ColumnModularizeType.Column: - column.Modularize = Wix.Column.ModularizeType.Column; - break; - case ColumnModularizeType.Condition: - column.Modularize = Wix.Column.ModularizeType.Condition; - break; - case ColumnModularizeType.Icon: - column.Modularize = Wix.Column.ModularizeType.Icon; - break; - case ColumnModularizeType.Property: - column.Modularize = Wix.Column.ModularizeType.Property; - break; - case ColumnModularizeType.SemicolonDelimited: - column.Modularize = Wix.Column.ModularizeType.SemicolonDelimited; - break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnModularizationType, columnDefinition.ModularizeType.ToString())); - } - } - - if (columnDefinition.Nullable) - { - column.Nullable = Wix.YesNoType.yes; - } - - if (columnDefinition.PrimaryKey) - { - column.PrimaryKey = Wix.YesNoType.yes; - } - - if (null != columnDefinition.Possibilities) - { - column.Set = columnDefinition.Possibilities; - } - - if (ColumnType.Unknown != columnDefinition.Type) - { - switch (columnDefinition.Type) - { - case ColumnType.Localized: - column.Localizable = Wix.YesNoType.yes; - column.Type = Wix.Column.TypeType.@string; - break; - case ColumnType.Number: - column.Type = Wix.Column.TypeType.@int; - break; - case ColumnType.Object: - column.Type = Wix.Column.TypeType.binary; - break; - case ColumnType.Preserved: - case ColumnType.String: - column.Type = Wix.Column.TypeType.@string; - break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnType, columnDefinition.Type.ToString())); - } - } - - column.Width = columnDefinition.Length; - - customTable.AddChild(column); - } - - foreach (Row row in table.Rows) - { - Wix.Row wixRow = new Wix.Row(); - - foreach (Field field in row.Fields) - { - Wix.Data data = new Wix.Data(); - - data.Column = field.Column.Name; - - data.Content = Convert.ToString(field.Data, CultureInfo.InvariantCulture); - - wixRow.AddChild(data); - } - - customTable.AddChild(wixRow); - } - - this.core.RootElement.AddChild(customTable); - } - } - - /// - /// Decompile the CreateFolder table. - /// - /// The table to decompile. - private void DecompileCreateFolderTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.CreateFolder createFolder = new Wix.CreateFolder(); - - createFolder.Directory = Convert.ToString(row[0]); - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(createFolder); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, createFolder); - } - } - - /// - /// Decompile the CustomAction table. - /// - /// The table to decompile. - private void DecompileCustomActionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.CustomAction customAction = new Wix.CustomAction(); - - customAction.Id = Convert.ToString(row[0]); - - int type = Convert.ToInt32(row[1]); - - if (MsiInterop.MsidbCustomActionTypeHideTarget == (type & MsiInterop.MsidbCustomActionTypeHideTarget)) - { - customAction.HideTarget = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbCustomActionTypeNoImpersonate == (type & MsiInterop.MsidbCustomActionTypeNoImpersonate)) - { - customAction.Impersonate = Wix.YesNoType.no; - } - - if (MsiInterop.MsidbCustomActionTypeTSAware == (type & MsiInterop.MsidbCustomActionTypeTSAware)) - { - customAction.TerminalServerAware = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbCustomActionType64BitScript == (type & MsiInterop.MsidbCustomActionType64BitScript)) - { - customAction.Win64 = Wix.YesNoType.yes; - } - - switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits) - { - case 0: - // this is the default value - break; - case MsiInterop.MsidbCustomActionTypeFirstSequence: - customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence; - break; - case MsiInterop.MsidbCustomActionTypeOncePerProcess: - customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess; - break; - case MsiInterop.MsidbCustomActionTypeClientRepeat: - customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence; - break; - case MsiInterop.MsidbCustomActionTypeInScript: - customAction.Execute = Wix.CustomAction.ExecuteType.deferred; - break; - case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeRollback: - customAction.Execute = Wix.CustomAction.ExecuteType.rollback; - break; - case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeCommit: - customAction.Execute = Wix.CustomAction.ExecuteType.commit; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - switch (type & MsiInterop.MsidbCustomActionTypeReturnBits) - { - case 0: - // this is the default value - break; - case MsiInterop.MsidbCustomActionTypeContinue: - customAction.Return = Wix.CustomAction.ReturnType.ignore; - break; - case MsiInterop.MsidbCustomActionTypeAsync: - customAction.Return = Wix.CustomAction.ReturnType.asyncWait; - break; - case MsiInterop.MsidbCustomActionTypeAsync + MsiInterop.MsidbCustomActionTypeContinue: - customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - int source = type & MsiInterop.MsidbCustomActionTypeSourceBits; - switch (source) - { - case MsiInterop.MsidbCustomActionTypeBinaryData: - customAction.BinaryKey = Convert.ToString(row[2]); - break; - case MsiInterop.MsidbCustomActionTypeSourceFile: - if (null != row[2]) - { - customAction.FileKey = Convert.ToString(row[2]); - } - break; - case MsiInterop.MsidbCustomActionTypeDirectory: - if (null != row[2]) - { - customAction.Directory = Convert.ToString(row[2]); - } - break; - case MsiInterop.MsidbCustomActionTypeProperty: - customAction.Property = Convert.ToString(row[2]); - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - switch (type & MsiInterop.MsidbCustomActionTypeTargetBits) - { - case MsiInterop.MsidbCustomActionTypeDll: - customAction.DllEntry = Convert.ToString(row[3]); - break; - case MsiInterop.MsidbCustomActionTypeExe: - customAction.ExeCommand = Convert.ToString(row[3]); - break; - case MsiInterop.MsidbCustomActionTypeTextData: - if (MsiInterop.MsidbCustomActionTypeSourceFile == source) - { - customAction.Error = Convert.ToString(row[3]); - } - else - { - customAction.Value = Convert.ToString(row[3]); - } - break; - case MsiInterop.MsidbCustomActionTypeJScript: - if (MsiInterop.MsidbCustomActionTypeDirectory == source) - { - customAction.Script = Wix.CustomAction.ScriptType.jscript; - customAction.Content = Convert.ToString(row[3]); - } - else - { - customAction.JScriptCall = Convert.ToString(row[3]); - } - break; - case MsiInterop.MsidbCustomActionTypeVBScript: - if (MsiInterop.MsidbCustomActionTypeDirectory == source) - { - customAction.Script = Wix.CustomAction.ScriptType.vbscript; - customAction.Content = Convert.ToString(row[3]); - } - else - { - customAction.VBScriptCall = Convert.ToString(row[3]); - } - break; - case MsiInterop.MsidbCustomActionTypeInstall: - this.core.OnMessage(WixWarnings.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - continue; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - int extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0; - if (MsiInterop.MsidbCustomActionTypePatchUninstall == (extype & MsiInterop.MsidbCustomActionTypePatchUninstall)) - { - customAction.PatchUninstall = Wix.YesNoType.yes; - } - - this.core.RootElement.AddChild(customAction); - this.core.IndexElement(row, customAction); - } - } - - /// - /// Decompile the CompLocator table. - /// - /// The table to decompile. - private void DecompileCompLocatorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ComponentSearch componentSearch = new Wix.ComponentSearch(); - - componentSearch.Id = Convert.ToString(row[0]); - - componentSearch.Guid = Convert.ToString(row[1]); - - if (null != row[2]) - { - switch (Convert.ToInt32(row[2])) - { - case MsiInterop.MsidbLocatorTypeDirectory: - componentSearch.Type = Wix.ComponentSearch.TypeType.directory; - break; - case MsiInterop.MsidbLocatorTypeFileName: - // this is the default value - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); - break; - } - } - - this.core.IndexElement(row, componentSearch); - } - } - - /// - /// Decompile the Complus table. - /// - /// The table to decompile. - private void DecompileComplusTable(Table table) - { - foreach (Row row in table.Rows) - { - if (null != row[1]) - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); - - if (null != component) - { - component.ComPlusFlags = Convert.ToInt32(row[1]); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); - } - } - } - } - - /// - /// Decompile the Component table. - /// - /// The table to decompile. - private void DecompileComponentTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Component component = new Wix.Component(); - - component.Id = Convert.ToString(row[0]); - - component.Guid = Convert.ToString(row[1]); - - int attributes = Convert.ToInt32(row[3]); - - if (MsiInterop.MsidbComponentAttributesSourceOnly == (attributes & MsiInterop.MsidbComponentAttributesSourceOnly)) - { - component.Location = Wix.Component.LocationType.source; - } - else if (MsiInterop.MsidbComponentAttributesOptional == (attributes & MsiInterop.MsidbComponentAttributesOptional)) - { - component.Location = Wix.Component.LocationType.either; - } - - if (MsiInterop.MsidbComponentAttributesSharedDllRefCount == (attributes & MsiInterop.MsidbComponentAttributesSharedDllRefCount)) - { - component.SharedDllRefCount = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesPermanent == (attributes & MsiInterop.MsidbComponentAttributesPermanent)) - { - component.Permanent = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesTransitive == (attributes & MsiInterop.MsidbComponentAttributesTransitive)) - { - component.Transitive = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesNeverOverwrite == (attributes & MsiInterop.MsidbComponentAttributesNeverOverwrite)) - { - component.NeverOverwrite = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributes64bit == (attributes & MsiInterop.MsidbComponentAttributes64bit)) - { - component.Win64 = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesDisableRegistryReflection == (attributes & MsiInterop.MsidbComponentAttributesDisableRegistryReflection)) - { - component.DisableRegistryReflection = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesUninstallOnSupersedence == (attributes & MsiInterop.MsidbComponentAttributesUninstallOnSupersedence)) - { - component.UninstallWhenSuperseded = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbComponentAttributesShared == (attributes & MsiInterop.MsidbComponentAttributesShared)) - { - component.Shared = Wix.YesNoType.yes; - } - - if (null != row[4]) - { - Wix.Condition condition = new Wix.Condition(); - - condition.Content = Convert.ToString(row[4]); - - component.AddChild(condition); - } - - Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[2])); - if (null != directory) - { - directory.AddChild(component); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_", Convert.ToString(row[2]), "Directory")); - } - this.core.IndexElement(row, component); - } - } - - /// - /// Decompile the Condition table. - /// - /// The table to decompile. - private void DecompileConditionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Condition condition = new Wix.Condition(); - - condition.Level = Convert.ToInt32(row[1]); - - if (null != row[2]) - { - condition.Content = Convert.ToString(row[2]); - } - - Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); - if (null != feature) - { - feature.AddChild(condition); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); - } - } - } - - /// - /// Decompile the Dialog table. - /// - /// The table to decompile. - private void DecompileDialogTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Dialog dialog = new Wix.Dialog(); - - dialog.Id = Convert.ToString(row[0]); - - dialog.X = Convert.ToInt32(row[1]); - - dialog.Y = Convert.ToInt32(row[2]); - - dialog.Width = Convert.ToInt32(row[3]); - - dialog.Height = Convert.ToInt32(row[4]); - - if (null != row[5]) - { - int attributes = Convert.ToInt32(row[5]); - - if (0 == (attributes & MsiInterop.MsidbDialogAttributesVisible)) - { - dialog.Hidden = Wix.YesNoType.yes; - } - - if (0 == (attributes & MsiInterop.MsidbDialogAttributesModal)) - { - dialog.Modeless = Wix.YesNoType.yes; - } - - if (0 == (attributes & MsiInterop.MsidbDialogAttributesMinimize)) - { - dialog.NoMinimize = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesSysModal == (attributes & MsiInterop.MsidbDialogAttributesSysModal)) - { - dialog.SystemModal = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesKeepModeless == (attributes & MsiInterop.MsidbDialogAttributesKeepModeless)) - { - dialog.KeepModeless = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesTrackDiskSpace == (attributes & MsiInterop.MsidbDialogAttributesTrackDiskSpace)) - { - dialog.TrackDiskSpace = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesUseCustomPalette == (attributes & MsiInterop.MsidbDialogAttributesUseCustomPalette)) - { - dialog.CustomPalette = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesRTLRO == (attributes & MsiInterop.MsidbDialogAttributesRTLRO)) - { - dialog.RightToLeft = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesRightAligned == (attributes & MsiInterop.MsidbDialogAttributesRightAligned)) - { - dialog.RightAligned = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesLeftScroll == (attributes & MsiInterop.MsidbDialogAttributesLeftScroll)) - { - dialog.LeftScroll = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbDialogAttributesError == (attributes & MsiInterop.MsidbDialogAttributesError)) - { - dialog.ErrorDialog = Wix.YesNoType.yes; - } - } - - if (null != row[6]) - { - dialog.Title = Convert.ToString(row[6]); - } - - this.core.UIElement.AddChild(dialog); - this.core.IndexElement(row, dialog); - } - } - - /// - /// Decompile the Directory table. - /// - /// The table to decompile. - private void DecompileDirectoryTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Directory directory = new Wix.Directory(); - - directory.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[2])); - - if (String.Equals(directory.Id, "TARGETDIR", StringComparison.Ordinal) && !String.Equals(names[0], "SourceDir", StringComparison.Ordinal)) - { - this.core.OnMessage(WixWarnings.TargetDirCorrectedDefaultDir()); - directory.Name = "SourceDir"; - } - else - { - if (null != names[0] && "." != names[0]) - { - if (null != names[1]) - { - directory.ShortName = names[0]; - } - else - { - directory.Name = names[0]; - } - } - - if (null != names[1]) - { - directory.Name = names[1]; - } - } - - if (null != names[2]) - { - if (null != names[3]) - { - directory.ShortSourceName = names[2]; - } - else - { - directory.SourceName = names[2]; - } - } - - if (null != names[3]) - { - directory.SourceName = names[3]; - } - - this.core.IndexElement(row, directory); - } - - // nest the directories - foreach (Row row in table.Rows) - { - Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement(row); - - if (null == row[1]) - { - this.core.RootElement.AddChild(directory); - } - else - { - Wix.Directory parentDirectory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[1])); - - if (null == parentDirectory) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_Parent", Convert.ToString(row[1]), "Directory")); - } - else if (parentDirectory == directory) // another way to specify a root directory - { - this.core.RootElement.AddChild(directory); - } - else - { - parentDirectory.AddChild(directory); - } - } - } - } - - /// - /// Decompile the DrLocator table. - /// - /// The table to decompile. - private void DecompileDrLocatorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.DirectorySearch directorySearch = new Wix.DirectorySearch(); - - directorySearch.Id = Convert.ToString(row[0]); - - if (null != row[2]) - { - directorySearch.Path = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - directorySearch.Depth = Convert.ToInt32(row[3]); - } - - this.core.IndexElement(row, directorySearch); - } - } - - /// - /// Decompile the DuplicateFile table. - /// - /// The table to decompile. - private void DecompileDuplicateFileTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.CopyFile copyFile = new Wix.CopyFile(); - - copyFile.Id = Convert.ToString(row[0]); - - copyFile.FileId = Convert.ToString(row[2]); - - if (null != row[3]) - { - string[] names = Common.GetNames(Convert.ToString(row[3])); - if (null != names[0] && null != names[1]) - { - copyFile.DestinationShortName = names[0]; - copyFile.DestinationName = names[1]; - } - else if (null != names[0]) - { - copyFile.DestinationName = names[0]; - } - } - - // destination directory/property is set in FinalizeDuplicateMoveFileTables - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(copyFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, copyFile); - } - } - - /// - /// Decompile the Environment table. - /// - /// The table to decompile. - private void DecompileEnvironmentTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Environment environment = new Wix.Environment(); - - environment.Id = Convert.ToString(row[0]); - - bool done = false; - bool permanent = true; - string name = Convert.ToString(row[1]); - for (int i = 0; i < name.Length && !done; i++) - { - switch (name[i]) - { - case '=': - environment.Action = Wix.Environment.ActionType.set; - break; - case '+': - environment.Action = Wix.Environment.ActionType.create; - break; - case '-': - permanent = false; - break; - case '!': - environment.Action = Wix.Environment.ActionType.remove; - break; - case '*': - environment.System = Wix.YesNoType.yes; - break; - default: - environment.Name = name.Substring(i); - done = true; - break; - } - } - - if (permanent) - { - environment.Permanent = Wix.YesNoType.yes; - } - - if (null != row[2]) - { - string value = Convert.ToString(row[2]); - - if (value.StartsWith("[~]", StringComparison.Ordinal)) - { - environment.Part = Wix.Environment.PartType.last; - - if (3 < value.Length) - { - environment.Separator = value.Substring(3, 1); - environment.Value = value.Substring(4); - } - } - else if (value.EndsWith("[~]", StringComparison.Ordinal)) - { - environment.Part = Wix.Environment.PartType.first; - - if (3 < value.Length) - { - environment.Separator = value.Substring(value.Length - 4, 1); - environment.Value = value.Substring(0, value.Length - 4); - } - } - else - { - environment.Value = value; - } - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); - if (null != component) - { - component.AddChild(environment); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); - } - } - } - - /// - /// Decompile the Error table. - /// - /// The table to decompile. - private void DecompileErrorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Error error = new Wix.Error(); - - error.Id = Convert.ToInt32(row[0]); - - error.Content = Convert.ToString(row[1]); - - this.core.UIElement.AddChild(error); - } - } - - /// - /// Decompile the EventMapping table. - /// - /// The table to decompile. - private void DecompileEventMappingTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Subscribe subscribe = new Wix.Subscribe(); - - subscribe.Event = Convert.ToString(row[2]); - - subscribe.Attribute = Convert.ToString(row[3]); - - Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); - if (null != control) - { - control.AddChild(subscribe); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); - } - } - } - - /// - /// Decompile the Extension table. - /// - /// The table to decompile. - private void DecompileExtensionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Extension extension = new Wix.Extension(); - - extension.Advertise = Wix.YesNoType.yes; - - extension.Id = Convert.ToString(row[0]); - - if (null != row[3]) - { - Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); - - if (null != mime) - { - mime.Default = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); - } - } - - if (null != row[2]) - { - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); - - if (null != progId) - { - progId.AddChild(extension); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_", Convert.ToString(row[2]), "ProgId")); - } - } - else - { - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - - if (null != component) - { - component.AddChild(extension); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - - this.core.IndexElement(row, extension); - } - } - - /// - /// Decompile the ExternalFiles table. - /// - /// The table to decompile. - private void DecompileExternalFilesTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ExternalFile externalFile = new Wix.ExternalFile(); - - externalFile.File = Convert.ToString(row[1]); - - externalFile.Source = Convert.ToString(row[2]); - - if (null != row[3]) - { - string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); - - foreach (string symbolPathString in symbolPaths) - { - Wix.SymbolPath symbolPath = new Wix.SymbolPath(); - - symbolPath.Path = symbolPathString; - - externalFile.AddChild(symbolPath); - } - } - - if (null != row[4] && null != row[5]) - { - string[] ignoreOffsets = (Convert.ToString(row[4])).Split(','); - string[] ignoreLengths = (Convert.ToString(row[5])).Split(','); - - if (ignoreOffsets.Length == ignoreLengths.Length) - { - for (int i = 0; i < ignoreOffsets.Length; i++) - { - Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); - - if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) - { - ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i].Substring(2), 16); - } - else - { - ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i], CultureInfo.InvariantCulture); - } - - if (ignoreLengths[i].StartsWith("0x", StringComparison.Ordinal)) - { - ignoreRange.Length = Convert.ToInt32(ignoreLengths[i].Substring(2), 16); - } - else - { - ignoreRange.Length = Convert.ToInt32(ignoreLengths[i], CultureInfo.InvariantCulture); - } - - externalFile.AddChild(ignoreRange); - } - } - else - { - // TODO: warn - } - } - else if (null != row[4] || null != row[5]) - { - // TODO: warn about mismatch between columns - } - - // the RetainOffsets column is handled in FinalizeFamilyFileRangesTable - - if (null != row[7]) - { - externalFile.Order = Convert.ToInt32(row[7]); - } - - Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); - if (null != family) - { - family.AddChild(externalFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); - } - this.core.IndexElement(row, externalFile); - } - } - - /// - /// Decompile the Feature table. - /// - /// The table to decompile. - private void DecompileFeatureTable(Table table) - { - SortedList sortedFeatures = new SortedList(); - - foreach (Row row in table.Rows) - { - Wix.Feature feature = new Wix.Feature(); - - feature.Id = Convert.ToString(row[0]); - - if (null != row[2]) - { - feature.Title = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - feature.Description = Convert.ToString(row[3]); - } - - if (null == row[4]) - { - feature.Display = "hidden"; - } - else - { - int display = Convert.ToInt32(row[4]); - - if (0 == display) - { - feature.Display = "hidden"; - } - else if (1 == display % 2) - { - feature.Display = "expand"; - } - } - - feature.Level = Convert.ToInt32(row[5]); - - if (null != row[6]) - { - feature.ConfigurableDirectory = Convert.ToString(row[6]); - } - - int attributes = Convert.ToInt32(row[7]); - - if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource) && MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) - { - // TODO: display a warning for setting favor local and follow parent together - } - else if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource)) - { - feature.InstallDefault = Wix.Feature.InstallDefaultType.source; - } - else if (MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) - { - feature.InstallDefault = Wix.Feature.InstallDefaultType.followParent; - } - - if (MsiInterop.MsidbFeatureAttributesFavorAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesFavorAdvertise)) - { - feature.TypicalDefault = Wix.Feature.TypicalDefaultType.advertise; - } - - if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise) && - MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) - { - this.core.OnMessage(WixWarnings.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no")); - feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; - } - else if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise)) - { - feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; - } - else if (MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) - { - feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.system; - } - - if (MsiInterop.MsidbFeatureAttributesUIDisallowAbsent == (attributes & MsiInterop.MsidbFeatureAttributesUIDisallowAbsent)) - { - feature.Absent = Wix.Feature.AbsentType.disallow; - } - - this.core.IndexElement(row, feature); - - // sort the features by their display column (and append the identifier to ensure unique keys) - sortedFeatures.Add(String.Format(CultureInfo.InvariantCulture, "{0:00000}|{1}", Convert.ToInt32(row[4], CultureInfo.InvariantCulture), row[0]), row); - } - - // nest the features - foreach (Row row in sortedFeatures.Values) - { - Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); - - if (null == row[1]) - { - this.core.RootElement.AddChild(feature); - } - else - { - Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[1])); - - if (null == parentFeature) - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_Parent", Convert.ToString(row[1]), "Feature")); - } - else if (parentFeature == feature) - { - // TODO: display a warning about self-nesting - } - else - { - parentFeature.AddChild(feature); - } - } - } - } - - /// - /// Decompile the FeatureComponents table. - /// - /// The table to decompile. - private void DecompileFeatureComponentsTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ComponentRef componentRef = new Wix.ComponentRef(); - - componentRef.Id = Convert.ToString(row[1]); - - Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); - if (null != parentFeature) - { - parentFeature.AddChild(componentRef); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); - } - this.core.IndexElement(row, componentRef); - } - } - - /// - /// Decompile the File table. - /// - /// The table to decompile. - private void DecompileFileTable(Table table) - { - foreach (FileRow fileRow in table.Rows) - { - Wix.File file = new Wix.File(); - - file.Id = fileRow.File; - - string[] names = Common.GetNames(fileRow.FileName); - if (null != names[0] && null != names[1]) - { - file.ShortName = names[0]; - file.Name = names[1]; - } - else if (null != names[0]) - { - file.Name = names[0]; - } - - if (null != fileRow.Version && 0 < fileRow.Version.Length) - { - if (!Char.IsDigit(fileRow.Version[0])) - { - file.CompanionFile = fileRow.Version; - } - } - - if (MsiInterop.MsidbFileAttributesReadOnly == (fileRow.Attributes & MsiInterop.MsidbFileAttributesReadOnly)) - { - file.ReadOnly = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbFileAttributesHidden == (fileRow.Attributes & MsiInterop.MsidbFileAttributesHidden)) - { - file.Hidden = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbFileAttributesSystem == (fileRow.Attributes & MsiInterop.MsidbFileAttributesSystem)) - { - file.System = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbFileAttributesVital != (fileRow.Attributes & MsiInterop.MsidbFileAttributesVital)) - { - file.Vital = Wix.YesNoType.no; - } - - if (MsiInterop.MsidbFileAttributesChecksum == (fileRow.Attributes & MsiInterop.MsidbFileAttributesChecksum)) - { - file.Checksum = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed) && - MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) - { - // TODO: error - } - else if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed)) - { - file.Compressed = Wix.YesNoDefaultType.no; - } - else if (MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) - { - file.Compressed = Wix.YesNoDefaultType.yes; - } - - this.core.IndexElement(fileRow, file); - } - } - - /// - /// Decompile the FileSFPCatalog table. - /// - /// The table to decompile. - private void DecompileFileSFPCatalogTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.SFPFile sfpFile = new Wix.SFPFile(); - - sfpFile.Id = Convert.ToString(row[0]); - - Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[1])); - if (null != sfpCatalog) - { - sfpCatalog.AddChild(sfpFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SFPCatalog_", Convert.ToString(row[1]), "SFPCatalog")); - } - } - } - - /// - /// Decompile the Font table. - /// - /// The table to decompile. - private void DecompileFontTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); - - if (null != file) - { - if (null != row[1]) - { - file.FontTitle = Convert.ToString(row[1]); - } - else - { - file.TrueType = Wix.YesNoType.yes; - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); - } - } - } - - /// - /// Decompile the Icon table. - /// - /// The table to decompile. - private void DecompileIconTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Icon icon = new Wix.Icon(); - - icon.Id = Convert.ToString(row[0]); - - icon.SourceFile = Convert.ToString(row[1]); - - this.core.RootElement.AddChild(icon); - } - } - - /// - /// Decompile the ImageFamilies table. - /// - /// The table to decompile. - private void DecompileImageFamiliesTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Family family = new Wix.Family(); - - family.Name = Convert.ToString(row[0]); - - if (null != row[1]) - { - family.MediaSrcProp = Convert.ToString(row[1]); - } - - if (null != row[2]) - { - family.DiskId = Convert.ToString(Convert.ToInt32(row[2])); - } - - if (null != row[3]) - { - family.SequenceStart = Convert.ToInt32(row[3]); - } - - if (null != row[4]) - { - family.DiskPrompt = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - family.VolumeLabel = Convert.ToString(row[5]); - } - - this.core.RootElement.AddChild(family); - this.core.IndexElement(row, family); - } - } - - /// - /// Decompile the IniFile table. - /// - /// The table to decompile. - private void DecompileIniFileTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.IniFile iniFile = new Wix.IniFile(); - - iniFile.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[1])); - - if (null != names[0]) - { - if (null == names[1]) - { - iniFile.Name = names[0]; - } - else - { - iniFile.ShortName = names[0]; - } - } - - if (null != names[1]) - { - iniFile.Name = names[1]; - } - - if (null != row[2]) - { - iniFile.Directory = Convert.ToString(row[2]); - } - - iniFile.Section = Convert.ToString(row[3]); - - iniFile.Key = Convert.ToString(row[4]); - - iniFile.Value = Convert.ToString(row[5]); - - switch (Convert.ToInt32(row[6])) - { - case MsiInterop.MsidbIniFileActionAddLine: - iniFile.Action = Wix.IniFile.ActionType.addLine; - break; - case MsiInterop.MsidbIniFileActionCreateLine: - iniFile.Action = Wix.IniFile.ActionType.createLine; - break; - case MsiInterop.MsidbIniFileActionAddTag: - iniFile.Action = Wix.IniFile.ActionType.addTag; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); - break; - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); - if (null != component) - { - component.AddChild(iniFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); - } - } - } - - /// - /// Decompile the IniLocator table. - /// - /// The table to decompile. - private void DecompileIniLocatorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.IniFileSearch iniFileSearch = new Wix.IniFileSearch(); - - iniFileSearch.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[1])); - if (null != names[0] && null != names[1]) - { - iniFileSearch.ShortName = names[0]; - iniFileSearch.Name = names[1]; - } - else if (null != names[0]) - { - iniFileSearch.Name = names[0]; - } - - iniFileSearch.Section = Convert.ToString(row[2]); - - iniFileSearch.Key = Convert.ToString(row[3]); - - if (null != row[4]) - { - int field = Convert.ToInt32(row[4]); - - if (0 != field) - { - iniFileSearch.Field = field; - } - } - - if (null != row[5]) - { - switch (Convert.ToInt32(row[5])) - { - case MsiInterop.MsidbLocatorTypeDirectory: - iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory; - break; - case MsiInterop.MsidbLocatorTypeFileName: - // this is the default value - break; - case MsiInterop.MsidbLocatorTypeRawValue: - iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); - break; - } - } - - this.core.IndexElement(row, iniFileSearch); - } - } - - /// - /// Decompile the IsolatedComponent table. - /// - /// The table to decompile. - private void DecompileIsolatedComponentTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.IsolateComponent isolateComponent = new Wix.IsolateComponent(); - - isolateComponent.Shared = Convert.ToString(row[0]); - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(isolateComponent); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - } - - /// - /// Decompile the LaunchCondition table. - /// - /// The table to decompile. - private void DecompileLaunchConditionTable(Table table) - { - foreach (Row row in table.Rows) - { - if (Compiler.DowngradePreventedCondition == Convert.ToString(row[0]) || Compiler.UpgradePreventedCondition == Convert.ToString(row[0])) - { - continue; // MajorUpgrade rows processed in FinalizeUpgradeTable - } - - Wix.Condition condition = new Wix.Condition(); - - condition.Content = Convert.ToString(row[0]); - - condition.Message = Convert.ToString(row[1]); - - this.core.RootElement.AddChild(condition); - } - } - - /// - /// Decompile the ListBox table. - /// - /// The table to decompile. - private void DecompileListBoxTable(Table table) - { - Wix.ListBox listBox = null; - SortedList listBoxRows = new SortedList(); - - // sort the list boxes by their property and order - foreach (Row row in table.Rows) - { - listBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); - } - - foreach (Row row in listBoxRows.Values) - { - if (null == listBox || Convert.ToString(row[0]) != listBox.Property) - { - listBox = new Wix.ListBox(); - - listBox.Property = Convert.ToString(row[0]); - - this.core.UIElement.AddChild(listBox); - } - - Wix.ListItem listItem = new Wix.ListItem(); - - listItem.Value = Convert.ToString(row[2]); - - if (null != row[3]) - { - listItem.Text = Convert.ToString(row[3]); - } - - listBox.AddChild(listItem); - } - } - - /// - /// Decompile the ListView table. - /// - /// The table to decompile. - private void DecompileListViewTable(Table table) - { - Wix.ListView listView = null; - SortedList listViewRows = new SortedList(); - - // sort the list views by their property and order - foreach (Row row in table.Rows) - { - listViewRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); - } - - foreach (Row row in listViewRows.Values) - { - if (null == listView || Convert.ToString(row[0]) != listView.Property) - { - listView = new Wix.ListView(); - - listView.Property = Convert.ToString(row[0]); - - this.core.UIElement.AddChild(listView); - } - - Wix.ListItem listItem = new Wix.ListItem(); - - listItem.Value = Convert.ToString(row[2]); - - if (null != row[3]) - { - listItem.Text = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - listItem.Icon = Convert.ToString(row[4]); - } - - listView.AddChild(listItem); - } - } - - /// - /// Decompile the LockPermissions table. - /// - /// The table to decompile. - private void DecompileLockPermissionsTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Permission permission = new Wix.Permission(); - string[] specialPermissions; - - switch (Convert.ToString(row[1])) - { - case "CreateFolder": - specialPermissions = Common.FolderPermissions; - break; - case "File": - specialPermissions = Common.FilePermissions; - break; - case "Registry": - specialPermissions = Common.RegistryPermissions; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); - return; - } - - int permissionBits = Convert.ToInt32(row[4]); - for (int i = 0; i < 32; i++) - { - if (0 != ((permissionBits >> i) & 1)) - { - string name = null; - - if (specialPermissions.Length > i) - { - name = specialPermissions[i]; - } - else if (16 > i && specialPermissions.Length <= i) - { - name = "SpecificRightsAll"; - } - else if (28 > i && Common.StandardPermissions.Length > (i - 16)) - { - name = Common.StandardPermissions[i - 16]; - } - else if (0 <= (i - 28) && Common.GenericPermissions.Length > (i - 28)) - { - name = Common.GenericPermissions[i - 28]; - } - - if (null == name) - { - this.core.OnMessage(WixWarnings.UnknownPermission(row.SourceLineNumbers, row.Table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), i)); - } - else - { - switch (name) - { - case "Append": - permission.Append = Wix.YesNoType.yes; - break; - case "ChangePermission": - permission.ChangePermission = Wix.YesNoType.yes; - break; - case "CreateChild": - permission.CreateChild = Wix.YesNoType.yes; - break; - case "CreateFile": - permission.CreateFile = Wix.YesNoType.yes; - break; - case "CreateLink": - permission.CreateLink = Wix.YesNoType.yes; - break; - case "CreateSubkeys": - permission.CreateSubkeys = Wix.YesNoType.yes; - break; - case "Delete": - permission.Delete = Wix.YesNoType.yes; - break; - case "DeleteChild": - permission.DeleteChild = Wix.YesNoType.yes; - break; - case "EnumerateSubkeys": - permission.EnumerateSubkeys = Wix.YesNoType.yes; - break; - case "Execute": - permission.Execute = Wix.YesNoType.yes; - break; - case "FileAllRights": - permission.FileAllRights = Wix.YesNoType.yes; - break; - case "GenericAll": - permission.GenericAll = Wix.YesNoType.yes; - break; - case "GenericExecute": - permission.GenericExecute = Wix.YesNoType.yes; - break; - case "GenericRead": - permission.GenericRead = Wix.YesNoType.yes; - break; - case "GenericWrite": - permission.GenericWrite = Wix.YesNoType.yes; - break; - case "Notify": - permission.Notify = Wix.YesNoType.yes; - break; - case "Read": - permission.Read = Wix.YesNoType.yes; - break; - case "ReadAttributes": - permission.ReadAttributes = Wix.YesNoType.yes; - break; - case "ReadExtendedAttributes": - permission.ReadExtendedAttributes = Wix.YesNoType.yes; - break; - case "ReadPermission": - permission.ReadPermission = Wix.YesNoType.yes; - break; - case "SpecificRightsAll": - permission.SpecificRightsAll = Wix.YesNoType.yes; - break; - case "Synchronize": - permission.Synchronize = Wix.YesNoType.yes; - break; - case "TakeOwnership": - permission.TakeOwnership = Wix.YesNoType.yes; - break; - case "Traverse": - permission.Traverse = Wix.YesNoType.yes; - break; - case "Write": - permission.Write = Wix.YesNoType.yes; - break; - case "WriteAttributes": - permission.WriteAttributes = Wix.YesNoType.yes; - break; - case "WriteExtendedAttributes": - permission.WriteExtendedAttributes = Wix.YesNoType.yes; - break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownPermissionAttribute, name)); - } - } - } - } - - if (null != row[2]) - { - permission.Domain = Convert.ToString(row[2]); - } - - permission.User = Convert.ToString(row[3]); - - this.core.IndexElement(row, permission); - } - } - - /// - /// Decompile the Media table. - /// - /// The table to decompile. - private void DecompileMediaTable(Table table) - { - foreach (MediaRow mediaRow in table.Rows) - { - Wix.Media media = new Wix.Media(); - - media.Id = Convert.ToString(mediaRow.DiskId); - - if (null != mediaRow.DiskPrompt) - { - media.DiskPrompt = mediaRow.DiskPrompt; - } - - if (null != mediaRow.Cabinet) - { - string cabinet = mediaRow.Cabinet; - - if (cabinet.StartsWith("#", StringComparison.Ordinal)) - { - media.EmbedCab = Wix.YesNoType.yes; - cabinet = cabinet.Substring(1); - } - - media.Cabinet = cabinet; - } - - if (null != mediaRow.VolumeLabel) - { - media.VolumeLabel = mediaRow.VolumeLabel; - } - - this.core.RootElement.AddChild(media); - this.core.IndexElement(mediaRow, media); - } - } - - /// - /// Decompile the MIME table. - /// - /// The table to decompile. - private void DecompileMIMETable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.MIME mime = new Wix.MIME(); - - mime.ContentType = Convert.ToString(row[0]); - - if (null != row[2]) - { - mime.Class = Convert.ToString(row[2]); - } - - this.core.IndexElement(row, mime); - } - } - - /// - /// Decompile the ModuleConfiguration table. - /// - /// The table to decompile. - private void DecompileModuleConfigurationTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Configuration configuration = new Wix.Configuration(); - - configuration.Name = Convert.ToString(row[0]); - - switch (Convert.ToInt32(row[1])) - { - case 0: - configuration.Format = Wix.Configuration.FormatType.Text; - break; - case 1: - configuration.Format = Wix.Configuration.FormatType.Key; - break; - case 2: - configuration.Format = Wix.Configuration.FormatType.Integer; - break; - case 3: - configuration.Format = Wix.Configuration.FormatType.Bitfield; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - if (null != row[2]) - { - configuration.Type = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - configuration.ContextData = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - configuration.DefaultValue = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - int attributes = Convert.ToInt32(row[5]); - - if (MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan)) - { - configuration.KeyNoOrphan = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbMsmConfigurableOptionNonNullable == (attributes & MsiInterop.MsidbMsmConfigurableOptionNonNullable)) - { - configuration.NonNullable = Wix.YesNoType.yes; - } - - if (3 < attributes) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); - } - } - - if (null != row[6]) - { - configuration.DisplayName = Convert.ToString(row[6]); - } - - if (null != row[7]) - { - configuration.Description = Convert.ToString(row[7]); - } - - if (null != row[8]) - { - configuration.HelpLocation = Convert.ToString(row[8]); - } - - if (null != row[9]) - { - configuration.HelpKeyword = Convert.ToString(row[9]); - } - - this.core.RootElement.AddChild(configuration); - } - } - - /// - /// Decompile the ModuleDependency table. - /// - /// The table to decompile. - private void DecompileModuleDependencyTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Dependency dependency = new Wix.Dependency(); - - dependency.RequiredId = Convert.ToString(row[2]); - - dependency.RequiredLanguage = Convert.ToInt32(row[3], CultureInfo.InvariantCulture); - - if (null != row[4]) - { - dependency.RequiredVersion = Convert.ToString(row[4]); - } - - this.core.RootElement.AddChild(dependency); - } - } - - /// - /// Decompile the ModuleExclusion table. - /// - /// The table to decompile. - private void DecompileModuleExclusionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Exclusion exclusion = new Wix.Exclusion(); - - exclusion.ExcludedId = Convert.ToString(row[2]); - - int excludedLanguage = Convert.ToInt32(Convert.ToString(row[3]), CultureInfo.InvariantCulture); - if (0 < excludedLanguage) - { - exclusion.ExcludeLanguage = excludedLanguage; - } - else if (0 > excludedLanguage) - { - exclusion.ExcludeExceptLanguage = -excludedLanguage; - } - - if (null != row[4]) - { - exclusion.ExcludedMinVersion = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - exclusion.ExcludedMinVersion = Convert.ToString(row[5]); - } - - this.core.RootElement.AddChild(exclusion); - } - } - - /// - /// Decompile the ModuleIgnoreTable table. - /// - /// The table to decompile. - private void DecompileModuleIgnoreTableTable(Table table) - { - foreach (Row row in table.Rows) - { - string tableName = Convert.ToString(row[0]); - - // the linker automatically adds a ModuleIgnoreTable row for some tables - if ("ModuleConfiguration" != tableName && "ModuleSubstitution" != tableName) - { - Wix.IgnoreTable ignoreTable = new Wix.IgnoreTable(); - - ignoreTable.Id = tableName; - - this.core.RootElement.AddChild(ignoreTable); - } - } - } - - /// - /// Decompile the ModuleSignature table. - /// - /// The table to decompile. - private void DecompileModuleSignatureTable(Table table) - { - if (1 == table.Rows.Count) - { - Row row = table.Rows[0]; - - Wix.Module module = (Wix.Module)this.core.RootElement; - - module.Id = Convert.ToString(row[0]); - - // support Language columns that are treated as integers as well as strings (the WiX default, to support localizability) - module.Language = Convert.ToString(row[1], CultureInfo.InvariantCulture); - - module.Version = Convert.ToString(row[2]); - } - else - { - // TODO: warn - } - } - - /// - /// Decompile the ModuleSubstitution table. - /// - /// The table to decompile. - private void DecompileModuleSubstitutionTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Substitution substitution = new Wix.Substitution(); - - substitution.Table = Convert.ToString(row[0]); - - substitution.Row = Convert.ToString(row[1]); - - substitution.Column = Convert.ToString(row[2]); - - if (null != row[3]) - { - substitution.Value = Convert.ToString(row[3]); - } - - this.core.RootElement.AddChild(substitution); - } - } - - /// - /// Decompile the MoveFile table. - /// - /// The table to decompile. - private void DecompileMoveFileTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.CopyFile copyFile = new Wix.CopyFile(); - - copyFile.Id = Convert.ToString(row[0]); - - if (null != row[2]) - { - copyFile.SourceName = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - string[] names = Common.GetNames(Convert.ToString(row[3])); - if (null != names[0] && null != names[1]) - { - copyFile.DestinationShortName = names[0]; - copyFile.DestinationName = names[1]; - } - else if (null != names[0]) - { - copyFile.DestinationName = names[0]; - } - } - - // source/destination directory/property is set in FinalizeDuplicateMoveFileTables - - switch (Convert.ToInt32(row[6])) - { - case 0: - break; - case MsiInterop.MsidbMoveFileOptionsMove: - copyFile.Delete = Wix.YesNoType.yes; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); - break; - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(copyFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, copyFile); - } - } - - /// - /// Decompile the MsiDigitalCertificate table. - /// - /// The table to decompile. - private void DecompileMsiDigitalCertificateTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.DigitalCertificate digitalCertificate = new Wix.DigitalCertificate(); - - digitalCertificate.Id = Convert.ToString(row[0]); - - digitalCertificate.SourceFile = Convert.ToString(row[1]); - - this.core.IndexElement(row, digitalCertificate); - } - } - - /// - /// Decompile the MsiDigitalSignature table. - /// - /// The table to decompile. - private void DecompileMsiDigitalSignatureTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.DigitalSignature digitalSignature = new Wix.DigitalSignature(); - - if (null != row[3]) - { - digitalSignature.SourceFile = Convert.ToString(row[3]); - } - - Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[2])); - if (null != digitalCertificate) - { - digitalSignature.AddChild(digitalCertificate); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[2]), "MsiDigitalCertificate")); - } - - Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(Convert.ToString(row[0]), Convert.ToString(row[1])); - if (null != parentElement) - { - parentElement.AddChild(digitalSignature); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SignObject", Convert.ToString(row[1]), Convert.ToString(row[0]))); - } - } - } - - /// - /// Decompile the MsiEmbeddedChainer table. - /// - /// The table to decompile. - private void DecompileMsiEmbeddedChainerTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.EmbeddedChainer embeddedChainer = new Wix.EmbeddedChainer(); - - embeddedChainer.Id = Convert.ToString(row[0]); - - embeddedChainer.Content = Convert.ToString(row[1]); - - if (null != row[2]) - { - embeddedChainer.CommandLine = Convert.ToString(row[2]); - } - - switch (Convert.ToInt32(row[4])) - { - case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData: - embeddedChainer.BinarySource = Convert.ToString(row[3]); - break; - case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile: - embeddedChainer.FileSource = Convert.ToString(row[3]); - break; - case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty: - embeddedChainer.PropertySource = Convert.ToString(row[3]); - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - break; - } - - this.core.RootElement.AddChild(embeddedChainer); - } - } - - /// - /// Decompile the MsiEmbeddedUI table. - /// - /// The table to decompile. - private void DecompileMsiEmbeddedUITable(Table table) - { - Wix.EmbeddedUI embeddedUI = new Wix.EmbeddedUI(); - bool foundEmbeddedUI = false; - bool foundEmbeddedResources = false; - - foreach (Row row in table.Rows) - { - int attributes = Convert.ToInt32(row[2]); - - if (MsiInterop.MsidbEmbeddedUI == (attributes & MsiInterop.MsidbEmbeddedUI)) - { - if (foundEmbeddedUI) - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); - } - else - { - embeddedUI.Id = Convert.ToString(row[0]); - embeddedUI.Name = Convert.ToString(row[1]); - - int messageFilter = Convert.ToInt32(row[3]); - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FATALEXIT)) - { - embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ERROR)) - { - embeddedUI.IgnoreError = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_WARNING)) - { - embeddedUI.IgnoreWarning = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_USER)) - { - embeddedUI.IgnoreUser = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INFO)) - { - embeddedUI.IgnoreInfo = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FILESINUSE)) - { - embeddedUI.IgnoreFilesInUse = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RESOLVESOURCE)) - { - embeddedUI.IgnoreResolveSource = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE)) - { - embeddedUI.IgnoreOutOfDiskSpace = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONSTART)) - { - embeddedUI.IgnoreActionStart = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONDATA)) - { - embeddedUI.IgnoreActionData = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_PROGRESS)) - { - embeddedUI.IgnoreProgress = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_COMMONDATA)) - { - embeddedUI.IgnoreCommonData = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INITIALIZE)) - { - embeddedUI.IgnoreInitialize = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_TERMINATE)) - { - embeddedUI.IgnoreTerminate = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_SHOWDIALOG)) - { - embeddedUI.IgnoreShowDialog = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RMFILESINUSE)) - { - embeddedUI.IgnoreRMFilesInUse = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLSTART)) - { - embeddedUI.IgnoreInstallStart = Wix.YesNoType.yes; - } - - if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLEND)) - { - embeddedUI.IgnoreInstallEnd = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbEmbeddedHandlesBasic == (attributes & MsiInterop.MsidbEmbeddedHandlesBasic)) - { - embeddedUI.SupportBasicUI = Wix.YesNoType.yes; - } - - embeddedUI.SourceFile = Convert.ToString(row[4]); - - this.core.UIElement.AddChild(embeddedUI); - foundEmbeddedUI = true; - } - } - else - { - Wix.EmbeddedUIResource embeddedResource = new Wix.EmbeddedUIResource(); - - embeddedResource.Id = Convert.ToString(row[0]); - embeddedResource.Name = Convert.ToString(row[1]); - embeddedResource.SourceFile = Convert.ToString(row[4]); - - embeddedUI.AddChild(embeddedResource); - foundEmbeddedResources = true; - } - } - - if (!foundEmbeddedUI && foundEmbeddedResources) - { - // TODO: warn - } - } - - /// - /// Decompile the MsiLockPermissionsEx table. - /// - /// The table to decompile. - private void DecompileMsiLockPermissionsExTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.PermissionEx permissionEx = new Wix.PermissionEx(); - permissionEx.Id = Convert.ToString(row[0]); - permissionEx.Sddl = Convert.ToString(row[3]); - - if (null != row[4]) - { - Wix.Condition condition = new Wix.Condition(); - condition.Content = Convert.ToString(row[4]); - permissionEx.AddChild(condition); - } - - switch (Convert.ToString(row[2])) - { - case "CreateFolder": - case "File": - case "Registry": - case "ServiceInstall": - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); - return; - } - - this.core.IndexElement(row, permissionEx); - } - } - - /// - /// Decompile the MsiPackageCertificate table. - /// - /// The table to decompile. - private void DecompileMsiPackageCertificateTable(Table table) - { - if (0 < table.Rows.Count) - { - Wix.PackageCertificates packageCertificates = new Wix.PackageCertificates(); - this.core.RootElement.AddChild(packageCertificates); - AddCertificates(table, packageCertificates); - } - } - - /// - /// Decompile the MsiPatchCertificate table. - /// - /// The table to decompile. - private void DecompileMsiPatchCertificateTable(Table table) - { - if (0 < table.Rows.Count) - { - Wix.PatchCertificates patchCertificates = new Wix.PatchCertificates(); - this.core.RootElement.AddChild(patchCertificates); - AddCertificates(table, patchCertificates); - } - } - - /// - /// Insert DigitalCertificate records associated with passed msiPackageCertificate or msiPatchCertificate table. - /// - /// The table being decompiled. - /// DigitalCertificate parent - private void AddCertificates(Table table, Wix.IParentElement parent) - { - foreach (Row row in table.Rows) - { - Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[1])); - - if (null != digitalCertificate) - { - parent.AddChild(digitalCertificate); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[1]), "MsiDigitalCertificate")); - } - } - } - - /// - /// Decompile the MsiShortcutProperty table. - /// - /// The table to decompile. - private void DecompileMsiShortcutPropertyTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ShortcutProperty property = new Wix.ShortcutProperty(); - property.Id = Convert.ToString(row[0]); - property.Key = Convert.ToString(row[2]); - property.Value = Convert.ToString(row[3]); - - Wix.Shortcut shortcut = (Wix.Shortcut)this.core.GetIndexedElement("Shortcut", Convert.ToString(row[1])); - if (null != shortcut) - { - shortcut.AddChild(property); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Shortcut_", Convert.ToString(row[1]), "Shortcut")); - } - } - } - - /// - /// Decompile the ODBCAttribute table. - /// - /// The table to decompile. - private void DecompileODBCAttributeTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Property property = new Wix.Property(); - - property.Id = Convert.ToString(row[1]); - - if (null != row[2]) - { - property.Value = Convert.ToString(row[2]); - } - - Wix.ODBCDriver odbcDriver = (Wix.ODBCDriver)this.core.GetIndexedElement("ODBCDriver", Convert.ToString(row[0])); - if (null != odbcDriver) - { - odbcDriver.AddChild(property); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Driver_", Convert.ToString(row[0]), "ODBCDriver")); - } - } - } - - /// - /// Decompile the ODBCDataSource table. - /// - /// The table to decompile. - private void DecompileODBCDataSourceTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ODBCDataSource odbcDataSource = new Wix.ODBCDataSource(); - - odbcDataSource.Id = Convert.ToString(row[0]); - - odbcDataSource.Name = Convert.ToString(row[2]); - - odbcDataSource.DriverName = Convert.ToString(row[3]); - - switch (Convert.ToInt32(row[4])) - { - case MsiInterop.MsidbODBCDataSourceRegistrationPerMachine: - odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine; - break; - case MsiInterop.MsidbODBCDataSourceRegistrationPerUser: - odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - break; - } - - this.core.IndexElement(row, odbcDataSource); - } - } - - /// - /// Decompile the ODBCDriver table. - /// - /// The table to decompile. - private void DecompileODBCDriverTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ODBCDriver odbcDriver = new Wix.ODBCDriver(); - - odbcDriver.Id = Convert.ToString(row[0]); - - odbcDriver.Name = Convert.ToString(row[2]); - - odbcDriver.File = Convert.ToString(row[3]); - - if (null != row[4]) - { - odbcDriver.SetupFile = Convert.ToString(row[4]); - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(odbcDriver); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, odbcDriver); - } - } - - /// - /// Decompile the ODBCSourceAttribute table. - /// - /// The table to decompile. - private void DecompileODBCSourceAttributeTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Property property = new Wix.Property(); - - property.Id = Convert.ToString(row[1]); - - if (null != row[2]) - { - property.Value = Convert.ToString(row[2]); - } - - Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[0])); - if (null != odbcDataSource) - { - odbcDataSource.AddChild(property); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DataSource_", Convert.ToString(row[0]), "ODBCDataSource")); - } - } - } - - /// - /// Decompile the ODBCTranslator table. - /// - /// The table to decompile. - private void DecompileODBCTranslatorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ODBCTranslator odbcTranslator = new Wix.ODBCTranslator(); - - odbcTranslator.Id = Convert.ToString(row[0]); - - odbcTranslator.Name = Convert.ToString(row[2]); - - odbcTranslator.File = Convert.ToString(row[3]); - - if (null != row[4]) - { - odbcTranslator.SetupFile = Convert.ToString(row[4]); - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(odbcTranslator); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - } - - /// - /// Decompile the PatchMetadata table. - /// - /// The table to decompile. - private void DecompilePatchMetadataTable(Table table) - { - if (0 < table.Rows.Count) - { - Wix.PatchMetadata patchMetadata = new Wix.PatchMetadata(); - - foreach (Row row in table.Rows) - { - string value = Convert.ToString(row[2]); - - switch (Convert.ToString(row[1])) - { - case "AllowRemoval": - if ("1" == value) - { - patchMetadata.AllowRemoval = Wix.YesNoType.yes; - } - break; - case "Classification": - if (null != value) - { - patchMetadata.Classification = value; - } - break; - case "CreationTimeUTC": - if (null != value) - { - patchMetadata.CreationTimeUTC = value; - } - break; - case "Description": - if (null != value) - { - patchMetadata.Description = value; - } - break; - case "DisplayName": - if (null != value) - { - patchMetadata.DisplayName = value; - } - break; - case "ManufacturerName": - if (null != value) - { - patchMetadata.ManufacturerName = value; - } - break; - case "MinorUpdateTargetRTM": - if (null != value) - { - patchMetadata.MinorUpdateTargetRTM = value; - } - break; - case "MoreInfoURL": - if (null != value) - { - patchMetadata.MoreInfoURL = value; - } - break; - case "OptimizeCA": - Wix.OptimizeCustomActions optimizeCustomActions = new Wix.OptimizeCustomActions(); - int optimizeCA = Int32.Parse(value, CultureInfo.InvariantCulture); - if (0 != (Convert.ToInt32(OptimizeCA.SkipAssignment) & optimizeCA)) - { - optimizeCustomActions.SkipAssignment = Wix.YesNoType.yes; - } - - if (0 != (Convert.ToInt32(OptimizeCA.SkipImmediate) & optimizeCA)) - { - optimizeCustomActions.SkipImmediate = Wix.YesNoType.yes; - } - - if (0 != (Convert.ToInt32(OptimizeCA.SkipDeferred) & optimizeCA)) - { - optimizeCustomActions.SkipDeferred = Wix.YesNoType.yes; - } - - patchMetadata.AddChild(optimizeCustomActions); - break; - case "OptimizedInstallMode": - if ("1" == value) - { - patchMetadata.OptimizedInstallMode = Wix.YesNoType.yes; - } - break; - case "TargetProductName": - if (null != value) - { - patchMetadata.TargetProductName = value; - } - break; - default: - Wix.CustomProperty customProperty = new Wix.CustomProperty(); - - if (null != row[0]) - { - customProperty.Company = Convert.ToString(row[0]); - } - - customProperty.Property = Convert.ToString(row[1]); - - if (null != row[2]) - { - customProperty.Value = Convert.ToString(row[2]); - } - - patchMetadata.AddChild(customProperty); - break; - } - } - - this.core.RootElement.AddChild(patchMetadata); - } - } - - /// - /// Decompile the PatchSequence table. - /// - /// The table to decompile. - private void DecompilePatchSequenceTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.PatchSequence patchSequence = new Wix.PatchSequence(); - - patchSequence.PatchFamily = Convert.ToString(row[0]); - - if (null != row[1]) - { - try - { - Guid guid = new Guid(Convert.ToString(row[1])); - - patchSequence.ProductCode = Convert.ToString(row[1]); - } - catch // non-guid value - { - patchSequence.TargetImage = Convert.ToString(row[1]); - } - } - - if (null != row[2]) - { - patchSequence.Sequence = Convert.ToString(row[2]); - } - - if (null != row[3] && 0x1 == Convert.ToInt32(row[3])) - { - patchSequence.Supersede = Wix.YesNoType.yes; - } - - this.core.RootElement.AddChild(patchSequence); - } - } - - /// - /// Decompile the ProgId table. - /// - /// The table to decompile. - private void DecompileProgIdTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ProgId progId = new Wix.ProgId(); - - progId.Advertise = Wix.YesNoType.yes; - - progId.Id = Convert.ToString(row[0]); - - if (null != row[3]) - { - progId.Description = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - progId.Icon = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - progId.IconIndex = Convert.ToInt32(row[5]); - } - - this.core.IndexElement(row, progId); - } - - // nest the ProgIds - foreach (Row row in table.Rows) - { - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); - - if (null != row[1]) - { - Wix.ProgId parentProgId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[1])); - - if (null != parentProgId) - { - parentProgId.AddChild(progId); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Parent", Convert.ToString(row[1]), "ProgId")); - } - } - else if (null != row[2]) - { - // nesting is handled in FinalizeProgIdTable - } - else - { - // TODO: warn for orphaned ProgId - } - } - } - - /// - /// Decompile the Properties table. - /// - /// The table to decompile. - private void DecompilePropertiesTable(Table table) - { - Wix.PatchCreation patchCreation = (Wix.PatchCreation)this.core.RootElement; - - foreach (Row row in table.Rows) - { - string name = Convert.ToString(row[0]); - string value = Convert.ToString(row[1]); - - switch (name) - { - case "AllowProductCodeMismatches": - if ("1" == value) - { - patchCreation.AllowProductCodeMismatches = Wix.YesNoType.yes; - } - break; - case "AllowProductVersionMajorMismatches": - if ("1" == value) - { - patchCreation.AllowMajorVersionMismatches = Wix.YesNoType.yes; - } - break; - case "ApiPatchingSymbolFlags": - if (null != value) - { - try - { - // remove the leading "0x" if its present - if (value.StartsWith("0x", StringComparison.Ordinal)) - { - value = value.Substring(2); - } - - patchCreation.SymbolFlags = Convert.ToInt32(value, 16); - } - catch - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - } - } - break; - case "DontRemoveTempFolderWhenFinished": - if ("1" == value) - { - patchCreation.CleanWorkingFolder = Wix.YesNoType.no; - } - break; - case "IncludeWholeFilesOnly": - if ("1" == value) - { - patchCreation.WholeFilesOnly = Wix.YesNoType.yes; - } - break; - case "ListOfPatchGUIDsToReplace": - if (null != value) - { - Regex guidRegex = new Regex(@"\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}"); - MatchCollection guidMatches = guidRegex.Matches(value); - - foreach (Match guidMatch in guidMatches) - { - Wix.ReplacePatch replacePatch = new Wix.ReplacePatch(); - - replacePatch.Id = guidMatch.Value; - - this.core.RootElement.AddChild(replacePatch); - } - } - break; - case "ListOfTargetProductCodes": - if (null != value) - { - string[] targetProductCodes = value.Split(';'); - - foreach (string targetProductCodeString in targetProductCodes) - { - Wix.TargetProductCode targetProductCode = new Wix.TargetProductCode(); - - targetProductCode.Id = targetProductCodeString; - - this.core.RootElement.AddChild(targetProductCode); - } - } - break; - case "PatchGUID": - patchCreation.Id = value; - break; - case "PatchSourceList": - patchCreation.SourceList = value; - break; - case "PatchOutputPath": - patchCreation.OutputPath = value; - break; - default: - Wix.PatchProperty patchProperty = new Wix.PatchProperty(); - - patchProperty.Name = name; - - patchProperty.Value = value; - - this.core.RootElement.AddChild(patchProperty); - break; - } - } - } - - /// - /// Decompile the Property table. - /// - /// The table to decompile. - private void DecompilePropertyTable(Table table) - { - foreach (Row row in table.Rows) - { - string id = Convert.ToString(row[0]); - string value = Convert.ToString(row[1]); - - if ("AdminProperties" == id || "MsiHiddenProperties" == id || "SecureCustomProperties" == id) - { - if (0 < value.Length) - { - foreach (string propertyId in value.Split(';')) - { - string property = propertyId; - bool suppressModulularization = false; - if (OutputType.Module == this.outputType) - { - if (propertyId.EndsWith(this.modularizationGuid.Substring(1, 36).Replace('-', '_'), StringComparison.Ordinal)) - { - property = propertyId.Substring(0, propertyId.Length - this.modularizationGuid.Length + 1); - } - else - { - suppressModulularization = true; - } - } - - Wix.Property specialProperty = this.EnsureProperty(property); - if (suppressModulularization) - { - specialProperty.SuppressModularization = Wix.YesNoType.yes; - } - - switch (id) - { - case "AdminProperties": - specialProperty.Admin = Wix.YesNoType.yes; - break; - case "MsiHiddenProperties": - specialProperty.Hidden = Wix.YesNoType.yes; - break; - case "SecureCustomProperties": - specialProperty.Secure = Wix.YesNoType.yes; - break; - } - } - } - - continue; - } - else if (OutputType.Product == this.outputType) - { - Wix.Product product = (Wix.Product)this.core.RootElement; - - switch (id) - { - case "Manufacturer": - product.Manufacturer = value; - continue; - case "ProductCode": - product.Id = value.ToUpper(CultureInfo.InvariantCulture); - continue; - case "ProductLanguage": - product.Language = value; - continue; - case "ProductName": - product.Name = value; - continue; - case "ProductVersion": - product.Version = value; - continue; - case "UpgradeCode": - product.UpgradeCode = value; - continue; - } - } - - if (!this.suppressUI || "ErrorDialog" != id) - { - Wix.Property property = this.EnsureProperty(id); - - property.Value = value; - } - } - } - - /// - /// Decompile the PublishComponent table. - /// - /// The table to decompile. - private void DecompilePublishComponentTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Category category = new Wix.Category(); - - category.Id = Convert.ToString(row[0]); - - category.Qualifier = Convert.ToString(row[1]); - - if (null != row[3]) - { - category.AppData = Convert.ToString(row[3]); - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); - if (null != component) - { - component.AddChild(category); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); - } - } - } - - /// - /// Decompile the RadioButton table. - /// - /// The table to decompile. - private void DecompileRadioButtonTable(Table table) - { - SortedList radioButtons = new SortedList(); - Hashtable radioButtonGroups = new Hashtable(); - - foreach (Row row in table.Rows) - { - Wix.RadioButton radioButton = new Wix.RadioButton(); - - radioButton.Value = Convert.ToString(row[2]); - - radioButton.X = Convert.ToString(row[3], CultureInfo.InvariantCulture); - - radioButton.Y = Convert.ToString(row[4], CultureInfo.InvariantCulture); - - radioButton.Width = Convert.ToString(row[5], CultureInfo.InvariantCulture); - - radioButton.Height = Convert.ToString(row[6], CultureInfo.InvariantCulture); - - if (null != row[7]) - { - radioButton.Text = Convert.ToString(row[7]); - } - - if (null != row[8]) - { - string[] help = (Convert.ToString(row[8])).Split('|'); - - if (2 == help.Length) - { - if (0 < help[0].Length) - { - radioButton.ToolTip = help[0]; - } - - if (0 < help[1].Length) - { - radioButton.Help = help[1]; - } - } - } - - radioButtons.Add(String.Format(CultureInfo.InvariantCulture, "{0}|{1:0000000000}", row[0], row[1]), row); - this.core.IndexElement(row, radioButton); - } - - // nest the radio buttons - foreach (Row row in radioButtons.Values) - { - Wix.RadioButton radioButton = (Wix.RadioButton)this.core.GetIndexedElement(row); - Wix.RadioButtonGroup radioButtonGroup = (Wix.RadioButtonGroup)radioButtonGroups[Convert.ToString(row[0])]; - - if (null == radioButtonGroup) - { - radioButtonGroup = new Wix.RadioButtonGroup(); - - radioButtonGroup.Property = Convert.ToString(row[0]); - - this.core.UIElement.AddChild(radioButtonGroup); - radioButtonGroups.Add(Convert.ToString(row[0]), radioButtonGroup); - } - - radioButtonGroup.AddChild(radioButton); - } - } - - /// - /// Decompile the Registry table. - /// - /// The table to decompile. - private void DecompileRegistryTable(Table table) - { - foreach (Row row in table.Rows) - { - if (("-" == Convert.ToString(row[3]) || "+" == Convert.ToString(row[3]) || "*" == Convert.ToString(row[3])) && null == row[4]) - { - Wix.RegistryKey registryKey = new Wix.RegistryKey(); - - registryKey.Id = Convert.ToString(row[0]); - - Wix.RegistryRootType registryRootType; - if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) - { - registryKey.Root = registryRootType; - } - - registryKey.Key = Convert.ToString(row[2]); - - switch (Convert.ToString(row[3])) - { - case "+": - registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; - break; - case "-": - registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; - break; - case "*": - registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; - registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; - break; - } - - this.core.IndexElement(row, registryKey); - } - else - { - Wix.RegistryValue registryValue = new Wix.RegistryValue(); - - registryValue.Id = Convert.ToString(row[0]); - - Wix.RegistryRootType registryRootType; - if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) - { - registryValue.Root = registryRootType; - } - - registryValue.Key = Convert.ToString(row[2]); - - if (null != row[3]) - { - registryValue.Name = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - string value = Convert.ToString(row[4]); - - if (value.StartsWith("#x", StringComparison.Ordinal)) - { - registryValue.Type = Wix.RegistryValue.TypeType.binary; - registryValue.Value = value.Substring(2); - } - else if (value.StartsWith("#%", StringComparison.Ordinal)) - { - registryValue.Type = Wix.RegistryValue.TypeType.expandable; - registryValue.Value = value.Substring(2); - } - else if (value.StartsWith("#", StringComparison.Ordinal) && !value.StartsWith("##", StringComparison.Ordinal)) - { - registryValue.Type = Wix.RegistryValue.TypeType.integer; - registryValue.Value = value.Substring(1); - } - else - { - if (value.StartsWith("##", StringComparison.Ordinal)) - { - value = value.Substring(1); - } - - if (0 <= value.IndexOf("[~]", StringComparison.Ordinal)) - { - registryValue.Type = Wix.RegistryValue.TypeType.multiString; - - if ("[~]" == value) - { - value = string.Empty; - } - else if (value.StartsWith("[~]", StringComparison.Ordinal) && value.EndsWith("[~]", StringComparison.Ordinal)) - { - value = value.Substring(3, value.Length - 6); - } - else if (value.StartsWith("[~]", StringComparison.Ordinal)) - { - registryValue.Action = Wix.RegistryValue.ActionType.append; - value = value.Substring(3); - } - else if (value.EndsWith("[~]", StringComparison.Ordinal)) - { - registryValue.Action = Wix.RegistryValue.ActionType.prepend; - value = value.Substring(0, value.Length - 3); - } - - string[] multiValues = NullSplitter.Split(value); - foreach (string multiValue in multiValues) - { - Wix.MultiStringValue multiStringValue = new Wix.MultiStringValue(); - - multiStringValue.Content = multiValue; - - registryValue.AddChild(multiStringValue); - } - } - else - { - registryValue.Type = Wix.RegistryValue.TypeType.@string; - registryValue.Value = value; - } - } - } - else - { - registryValue.Type = Wix.RegistryValue.TypeType.@string; - registryValue.Value = String.Empty; - } - - this.core.IndexElement(row, registryValue); - } - } - } - - /// - /// Decompile the RegLocator table. - /// - /// The table to decompile. - private void DecompileRegLocatorTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.RegistrySearch registrySearch = new Wix.RegistrySearch(); - - registrySearch.Id = Convert.ToString(row[0]); - - switch (Convert.ToInt32(row[1])) - { - case MsiInterop.MsidbRegistryRootClassesRoot: - registrySearch.Root = Wix.RegistrySearch.RootType.HKCR; - break; - case MsiInterop.MsidbRegistryRootCurrentUser: - registrySearch.Root = Wix.RegistrySearch.RootType.HKCU; - break; - case MsiInterop.MsidbRegistryRootLocalMachine: - registrySearch.Root = Wix.RegistrySearch.RootType.HKLM; - break; - case MsiInterop.MsidbRegistryRootUsers: - registrySearch.Root = Wix.RegistrySearch.RootType.HKU; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); - break; - } - - registrySearch.Key = Convert.ToString(row[2]); - - if (null != row[3]) - { - registrySearch.Name = Convert.ToString(row[3]); - } - - if (null == row[4]) - { - registrySearch.Type = Wix.RegistrySearch.TypeType.file; - } - else - { - int type = Convert.ToInt32(row[4]); - - if (MsiInterop.MsidbLocatorType64bit == (type & MsiInterop.MsidbLocatorType64bit)) - { - registrySearch.Win64 = Wix.YesNoType.yes; - type &= ~MsiInterop.MsidbLocatorType64bit; - } - - switch (type) - { - case MsiInterop.MsidbLocatorTypeDirectory: - registrySearch.Type = Wix.RegistrySearch.TypeType.directory; - break; - case MsiInterop.MsidbLocatorTypeFileName: - registrySearch.Type = Wix.RegistrySearch.TypeType.file; - break; - case MsiInterop.MsidbLocatorTypeRawValue: - registrySearch.Type = Wix.RegistrySearch.TypeType.raw; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - break; - } - } - - this.core.IndexElement(row, registrySearch); - } - } - - /// - /// Decompile the RemoveFile table. - /// - /// The table to decompile. - private void DecompileRemoveFileTable(Table table) - { - foreach (Row row in table.Rows) - { - if (null == row[2]) - { - Wix.RemoveFolder removeFolder = new Wix.RemoveFolder(); - - removeFolder.Id = Convert.ToString(row[0]); - - // directory/property is set in FinalizeDecompile - - switch (Convert.ToInt32(row[4])) - { - case MsiInterop.MsidbRemoveFileInstallModeOnInstall: - removeFolder.On = Wix.InstallUninstallType.install; - break; - case MsiInterop.MsidbRemoveFileInstallModeOnRemove: - removeFolder.On = Wix.InstallUninstallType.uninstall; - break; - case MsiInterop.MsidbRemoveFileInstallModeOnBoth: - removeFolder.On = Wix.InstallUninstallType.both; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - break; - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(removeFolder); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, removeFolder); - } - else - { - Wix.RemoveFile removeFile = new Wix.RemoveFile(); - - removeFile.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[2])); - if (null != names[0] && null != names[1]) - { - removeFile.ShortName = names[0]; - removeFile.Name = names[1]; - } - else if (null != names[0]) - { - removeFile.Name = names[0]; - } - - // directory/property is set in FinalizeDecompile - - switch (Convert.ToInt32(row[4])) - { - case MsiInterop.MsidbRemoveFileInstallModeOnInstall: - removeFile.On = Wix.InstallUninstallType.install; - break; - case MsiInterop.MsidbRemoveFileInstallModeOnRemove: - removeFile.On = Wix.InstallUninstallType.uninstall; - break; - case MsiInterop.MsidbRemoveFileInstallModeOnBoth: - removeFile.On = Wix.InstallUninstallType.both; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - break; - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(removeFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - this.core.IndexElement(row, removeFile); - } - } - } - - /// - /// Decompile the RemoveIniFile table. - /// - /// The table to decompile. - private void DecompileRemoveIniFileTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.IniFile iniFile = new Wix.IniFile(); - - iniFile.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[1])); - if (null != names[0] && null != names[1]) - { - iniFile.ShortName = names[0]; - iniFile.Name = names[1]; - } - else if (null != names[0]) - { - iniFile.Name = names[0]; - } - - if (null != row[2]) - { - iniFile.Directory = Convert.ToString(row[2]); - } - - iniFile.Section = Convert.ToString(row[3]); - - iniFile.Key = Convert.ToString(row[4]); - - if (null != row[5]) - { - iniFile.Value = Convert.ToString(row[5]); - } - - switch (Convert.ToInt32(row[6])) - { - case MsiInterop.MsidbIniFileActionRemoveLine: - iniFile.Action = Wix.IniFile.ActionType.removeLine; - break; - case MsiInterop.MsidbIniFileActionRemoveTag: - iniFile.Action = Wix.IniFile.ActionType.removeTag; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); - break; - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); - if (null != component) - { - component.AddChild(iniFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); - } - } - } - - /// - /// Decompile the RemoveRegistry table. - /// - /// The table to decompile. - private void DecompileRemoveRegistryTable(Table table) - { - foreach (Row row in table.Rows) - { - if ("-" == Convert.ToString(row[3])) - { - Wix.RemoveRegistryKey removeRegistryKey = new Wix.RemoveRegistryKey(); - - removeRegistryKey.Id = Convert.ToString(row[0]); - - Wix.RegistryRootType registryRootType; - if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) - { - removeRegistryKey.Root = registryRootType; - } - - removeRegistryKey.Key = Convert.ToString(row[2]); - - removeRegistryKey.Action = Wix.RemoveRegistryKey.ActionType.removeOnInstall; - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); - if (null != component) - { - component.AddChild(removeRegistryKey); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); - } - } - else - { - Wix.RemoveRegistryValue removeRegistryValue = new Wix.RemoveRegistryValue(); - - removeRegistryValue.Id = Convert.ToString(row[0]); - - Wix.RegistryRootType registryRootType; - if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType)) - { - removeRegistryValue.Root = registryRootType; - } - - removeRegistryValue.Key = Convert.ToString(row[2]); - - if (null != row[3]) - { - removeRegistryValue.Name = Convert.ToString(row[3]); - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); - if (null != component) - { - component.AddChild(removeRegistryValue); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); - } - } - } - } - - /// - /// Decompile the ReserveCost table. - /// - /// The table to decompile. - private void DecompileReserveCostTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ReserveCost reserveCost = new Wix.ReserveCost(); - - reserveCost.Id = Convert.ToString(row[0]); - - if (null != row[2]) - { - reserveCost.Directory = Convert.ToString(row[2]); - } - - reserveCost.RunLocal = Convert.ToInt32(row[3]); - - reserveCost.RunFromSource = Convert.ToInt32(row[4]); - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); - if (null != component) - { - component.AddChild(reserveCost); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); - } - } - } - - /// - /// Decompile the SelfReg table. - /// - /// The table to decompile. - private void DecompileSelfRegTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); - - if (null != file) - { - if (null != row[1]) - { - file.SelfRegCost = Convert.ToInt32(row[1]); - } - else - { - file.SelfRegCost = 0; - } - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); - } - } - } - - /// - /// Decompile the ServiceControl table. - /// - /// The table to decompile. - private void DecompileServiceControlTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ServiceControl serviceControl = new Wix.ServiceControl(); - - serviceControl.Id = Convert.ToString(row[0]); - - serviceControl.Name = Convert.ToString(row[1]); - - int eventValue = Convert.ToInt32(row[2]); - if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart) && - MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) - { - serviceControl.Start = Wix.InstallUninstallType.both; - } - else if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart)) - { - serviceControl.Start = Wix.InstallUninstallType.install; - } - else if (MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) - { - serviceControl.Start = Wix.InstallUninstallType.uninstall; - } - - if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop) && - MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) - { - serviceControl.Stop = Wix.InstallUninstallType.both; - } - else if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop)) - { - serviceControl.Stop = Wix.InstallUninstallType.install; - } - else if (MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) - { - serviceControl.Stop = Wix.InstallUninstallType.uninstall; - } - - if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete) && - MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) - { - serviceControl.Remove = Wix.InstallUninstallType.both; - } - else if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete)) - { - serviceControl.Remove = Wix.InstallUninstallType.install; - } - else if (MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) - { - serviceControl.Remove = Wix.InstallUninstallType.uninstall; - } - - if (null != row[3]) - { - string[] arguments = NullSplitter.Split(Convert.ToString(row[3])); - - foreach (string argument in arguments) - { - Wix.ServiceArgument serviceArgument = new Wix.ServiceArgument(); - - serviceArgument.Content = argument; - - serviceControl.AddChild(serviceArgument); - } - } - - if (null != row[4]) - { - if (0 == Convert.ToInt32(row[4])) - { - serviceControl.Wait = Wix.YesNoType.no; - } - else - { - serviceControl.Wait = Wix.YesNoType.yes; - } - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); - if (null != component) - { - component.AddChild(serviceControl); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); - } - } - } - - /// - /// Decompile the ServiceInstall table. - /// - /// The table to decompile. - private void DecompileServiceInstallTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.ServiceInstall serviceInstall = new Wix.ServiceInstall(); - - serviceInstall.Id = Convert.ToString(row[0]); - - serviceInstall.Name = Convert.ToString(row[1]); - - if (null != row[2]) - { - serviceInstall.DisplayName = Convert.ToString(row[2]); - } - - int serviceType = Convert.ToInt32(row[3]); - if (MsiInterop.MsidbServiceInstallInteractive == (serviceType & MsiInterop.MsidbServiceInstallInteractive)) - { - serviceInstall.Interactive = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess) && - MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) - { - // TODO: warn - } - else if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess)) - { - serviceInstall.Type = Wix.ServiceInstall.TypeType.ownProcess; - } - else if (MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) - { - serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess; - } - - int startType = Convert.ToInt32(row[4]); - if (MsiInterop.MsidbServiceInstallDisabled == startType) - { - serviceInstall.Start = Wix.ServiceInstall.StartType.disabled; - } - else if (MsiInterop.MsidbServiceInstallDemandStart == startType) - { - serviceInstall.Start = Wix.ServiceInstall.StartType.demand; - } - else if (MsiInterop.MsidbServiceInstallAutoStart == startType) - { - serviceInstall.Start = Wix.ServiceInstall.StartType.auto; - } - else - { - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); - } - - int errorControl = Convert.ToInt32(row[5]); - if (MsiInterop.MsidbServiceInstallErrorCritical == (errorControl & MsiInterop.MsidbServiceInstallErrorCritical)) - { - serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical; - } - else if (MsiInterop.MsidbServiceInstallErrorNormal == (errorControl & MsiInterop.MsidbServiceInstallErrorNormal)) - { - serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.normal; - } - else - { - serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.ignore; - } - - if (MsiInterop.MsidbServiceInstallErrorControlVital == (errorControl & MsiInterop.MsidbServiceInstallErrorControlVital)) - { - serviceInstall.Vital = Wix.YesNoType.yes; - } - - if (null != row[6]) - { - serviceInstall.LoadOrderGroup = Convert.ToString(row[6]); - } - - if (null != row[7]) - { - string[] dependencies = NullSplitter.Split(Convert.ToString(row[7])); - - foreach (string dependency in dependencies) - { - if (0 < dependency.Length) - { - Wix.ServiceDependency serviceDependency = new Wix.ServiceDependency(); - - if (dependency.StartsWith("+", StringComparison.Ordinal)) - { - serviceDependency.Group = Wix.YesNoType.yes; - serviceDependency.Id = dependency.Substring(1); - } - else - { - serviceDependency.Id = dependency; - } - - serviceInstall.AddChild(serviceDependency); - } - } - } - - if (null != row[8]) - { - serviceInstall.Account = Convert.ToString(row[8]); - } - - if (null != row[9]) - { - serviceInstall.Password = Convert.ToString(row[9]); - } - - if (null != row[10]) - { - serviceInstall.Arguments = Convert.ToString(row[10]); - } - - if (null != row[12]) - { - serviceInstall.Description = Convert.ToString(row[12]); - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[11])); - if (null != component) - { - component.AddChild(serviceInstall); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[11]), "Component")); - } - this.core.IndexElement(row, serviceInstall); - } - } - - /// - /// Decompile the SFPCatalog table. - /// - /// The table to decompile. - private void DecompileSFPCatalogTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.SFPCatalog sfpCatalog = new Wix.SFPCatalog(); - - sfpCatalog.Name = Convert.ToString(row[0]); - - sfpCatalog.SourceFile = Convert.ToString(row[1]); - - this.core.IndexElement(row, sfpCatalog); - } - - // nest the SFPCatalog elements - foreach (Row row in table.Rows) - { - Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement(row); - - if (null != row[2]) - { - Wix.SFPCatalog parentSFPCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[2])); - - if (null != parentSFPCatalog) - { - parentSFPCatalog.AddChild(sfpCatalog); - } - else - { - sfpCatalog.Dependency = Convert.ToString(row[2]); - - this.core.RootElement.AddChild(sfpCatalog); - } - } - else - { - this.core.RootElement.AddChild(sfpCatalog); - } - } - } - - /// - /// Decompile the Shortcut table. - /// - /// The table to decompile. - private void DecompileShortcutTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Shortcut shortcut = new Wix.Shortcut(); - - shortcut.Id = Convert.ToString(row[0]); - - shortcut.Directory = Convert.ToString(row[1]); - - string[] names = Common.GetNames(Convert.ToString(row[2])); - if (null != names[0] && null != names[1]) - { - shortcut.ShortName = names[0]; - shortcut.Name = names[1]; - } - else if (null != names[0]) - { - shortcut.Name = names[0]; - } - - string target = Convert.ToString(row[4]); - if (target.StartsWith("[", StringComparison.Ordinal) && target.EndsWith("]", StringComparison.Ordinal)) - { - // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element - shortcut.Target = target; - } - else - { - shortcut.Advertise = Wix.YesNoType.yes; - - // primary feature is set in FinalizeFeatureComponentsTable - } - - if (null != row[5]) - { - shortcut.Arguments = Convert.ToString(row[5]); - } - - if (null != row[6]) - { - shortcut.Description = Convert.ToString(row[6]); - } - - if (null != row[7]) - { - shortcut.Hotkey = Convert.ToInt32(row[7]); - } - - if (null != row[8]) - { - shortcut.Icon = Convert.ToString(row[8]); - } - - if (null != row[9]) - { - shortcut.IconIndex = Convert.ToInt32(row[9]); - } - - if (null != row[10]) - { - switch (Convert.ToInt32(row[10])) - { - case 1: - shortcut.Show = Wix.Shortcut.ShowType.normal; - break; - case 3: - shortcut.Show = Wix.Shortcut.ShowType.maximized; - break; - case 7: - shortcut.Show = Wix.Shortcut.ShowType.minimized; - break; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[10].Column.Name, row[10])); - break; - } - } - - if (null != row[11]) - { - shortcut.WorkingDirectory = Convert.ToString(row[11]); - } - - // Only try to read the MSI 4.0-specific columns if they actually exist - if (15 < row.Fields.Length) - { - if (null != row[12]) - { - shortcut.DisplayResourceDll = Convert.ToString(row[12]); - } - - if (null != row[13]) - { - shortcut.DisplayResourceId = Convert.ToInt32(row[13]); - } - - if (null != row[14]) - { - shortcut.DescriptionResourceDll = Convert.ToString(row[14]); - } - - if (null != row[15]) - { - shortcut.DescriptionResourceId = Convert.ToInt32(row[15]); - } - } - - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); - if (null != component) - { - component.AddChild(shortcut); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); - } - - this.core.IndexElement(row, shortcut); - } - } - - /// - /// Decompile the Signature table. - /// - /// The table to decompile. - private void DecompileSignatureTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.FileSearch fileSearch = new Wix.FileSearch(); - - fileSearch.Id = Convert.ToString(row[0]); - - string[] names = Common.GetNames(Convert.ToString(row[1])); - if (null != names[0]) - { - // it is permissable to just have a long name - if (!this.core.IsValidShortFilename(names[0], false) && null == names[1]) - { - fileSearch.Name = names[0]; - } - else - { - fileSearch.ShortName = names[0]; - } - } - - if (null != names[1]) - { - fileSearch.Name = names[1]; - } - - if (null != row[2]) - { - fileSearch.MinVersion = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - fileSearch.MaxVersion = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - fileSearch.MinSize = Convert.ToInt32(row[4]); - } - - if (null != row[5]) - { - fileSearch.MaxSize = Convert.ToInt32(row[5]); - } - - if (null != row[6]) - { - fileSearch.MinDate = this.core.ConvertIntegerToDateTime(Convert.ToInt32(row[6])); - } - - if (null != row[7]) - { - fileSearch.MaxDate = this.core.ConvertIntegerToDateTime(Convert.ToInt32(row[7])); - } - - if (null != row[8]) - { - fileSearch.Languages = Convert.ToString(row[8]); - } - - this.core.IndexElement(row, fileSearch); - } - } - - /// - /// Decompile the TargetFiles_OptionalData table. - /// - /// The table to decompile. - private void DecompileTargetFiles_OptionalDataTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row[0]]; - if (null == targetFile) - { - targetFile = new Wix.TargetFile(); - - targetFile.Id = Convert.ToString(row[1]); - - Wix.TargetImage targetImage = (Wix.TargetImage)this.core.GetIndexedElement("TargetImages", Convert.ToString(row[0])); - if (null != targetImage) - { - targetImage.AddChild(targetFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); - } - this.patchTargetFiles.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), targetFile); - } - - if (null != row[2]) - { - string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); - - foreach (string symbolPathString in symbolPaths) - { - Wix.SymbolPath symbolPath = new Wix.SymbolPath(); - - symbolPath.Path = symbolPathString; - - targetFile.AddChild(symbolPath); - } - } - - if (null != row[3] && null != row[4]) - { - string[] ignoreOffsets = (Convert.ToString(row[3])).Split(','); - string[] ignoreLengths = (Convert.ToString(row[4])).Split(','); - - if (ignoreOffsets.Length == ignoreLengths.Length) - { - for (int i = 0; i < ignoreOffsets.Length; i++) - { - Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); - - if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) - { - ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i].Substring(2), 16); - } - else - { - ignoreRange.Offset = Convert.ToInt32(ignoreOffsets[i], CultureInfo.InvariantCulture); - } - - if (ignoreLengths[i].StartsWith("0x", StringComparison.Ordinal)) - { - ignoreRange.Length = Convert.ToInt32(ignoreLengths[i].Substring(2), 16); - } - else - { - ignoreRange.Length = Convert.ToInt32(ignoreLengths[i], CultureInfo.InvariantCulture); - } - - targetFile.AddChild(ignoreRange); - } - } - else - { - // TODO: warn - } - } - else if (null != row[3] || null != row[4]) - { - // TODO: warn about mismatch between columns - } - - // the RetainOffsets column is handled in FinalizeFamilyFileRangesTable - } - } - - /// - /// Decompile the TargetImages table. - /// - /// The table to decompile. - private void DecompileTargetImagesTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.TargetImage targetImage = new Wix.TargetImage(); - - targetImage.Id = Convert.ToString(row[0]); - - targetImage.SourceFile = Convert.ToString(row[1]); - - if (null != row[2]) - { - string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); - - foreach (string symbolPathString in symbolPaths) - { - Wix.SymbolPath symbolPath = new Wix.SymbolPath(); - - symbolPath.Path = symbolPathString; - - targetImage.AddChild(symbolPath); - } - } - - targetImage.Order = Convert.ToInt32(row[4]); - - if (null != row[5]) - { - targetImage.Validation = Convert.ToString(row[5]); - } - - if (0 != Convert.ToInt32(row[6])) - { - targetImage.IgnoreMissingFiles = Wix.YesNoType.yes; - } - - Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[3])); - if (null != upgradeImage) - { - upgradeImage.AddChild(targetImage); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); - } - this.core.IndexElement(row, targetImage); - } - } - - /// - /// Decompile the TextStyle table. - /// - /// The table to decompile. - private void DecompileTextStyleTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.TextStyle textStyle = new Wix.TextStyle(); - - textStyle.Id = Convert.ToString(row[0]); - - textStyle.FaceName = Convert.ToString(row[1]); - - textStyle.Size = Convert.ToString(row[2]); - - if (null != row[3]) - { - int color = Convert.ToInt32(row[3]); - - textStyle.Red = color & 0xFF; - - textStyle.Green = (color & 0xFF00) >> 8; - - textStyle.Blue = (color & 0xFF0000) >> 16; - } - - if (null != row[4]) - { - int styleBits = Convert.ToInt32(row[4]); - - if (MsiInterop.MsidbTextStyleStyleBitsBold == (styleBits & MsiInterop.MsidbTextStyleStyleBitsBold)) - { - textStyle.Bold = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbTextStyleStyleBitsItalic == (styleBits & MsiInterop.MsidbTextStyleStyleBitsItalic)) - { - textStyle.Italic = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbTextStyleStyleBitsUnderline == (styleBits & MsiInterop.MsidbTextStyleStyleBitsUnderline)) - { - textStyle.Underline = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbTextStyleStyleBitsStrike == (styleBits & MsiInterop.MsidbTextStyleStyleBitsStrike)) - { - textStyle.Strike = Wix.YesNoType.yes; - } - } - - this.core.UIElement.AddChild(textStyle); - } - } - - /// - /// Decompile the TypeLib table. - /// - /// The table to decompile. - private void DecompileTypeLibTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.TypeLib typeLib = new Wix.TypeLib(); - - typeLib.Id = Convert.ToString(row[0]); - - typeLib.Advertise = Wix.YesNoType.yes; - - typeLib.Language = Convert.ToInt32(row[1]); - - if (null != row[3]) - { - int version = Convert.ToInt32(row[3]); - - if (65536 == version) - { - this.core.OnMessage(WixWarnings.PossiblyIncorrectTypelibVersion(row.SourceLineNumbers, typeLib.Id)); - } - - typeLib.MajorVersion = ((version & 0xFFFF00) >> 8); - typeLib.MinorVersion = (version & 0xFF); - } - - if (null != row[4]) - { - typeLib.Description = Convert.ToString(row[4]); - } - - if (null != row[5]) - { - typeLib.HelpDirectory = Convert.ToString(row[5]); - } - - if (null != row[7]) - { - typeLib.Cost = Convert.ToInt32(row[7]); - } - - // nested under the appropriate File element in FinalizeFileTable - this.core.IndexElement(row, typeLib); - } - } - - /// - /// Decompile the Upgrade table. - /// - /// The table to decompile. - private void DecompileUpgradeTable(Table table) - { - Hashtable upgradeElements = new Hashtable(); - - foreach (UpgradeRow upgradeRow in table.Rows) - { - if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty || Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) - { - continue; // MajorUpgrade rows processed in FinalizeUpgradeTable - } - - Wix.Upgrade upgrade = (Wix.Upgrade)upgradeElements[upgradeRow.UpgradeCode]; - - // create the parent Upgrade element if it doesn't already exist - if (null == upgrade) - { - upgrade = new Wix.Upgrade(); - - upgrade.Id = upgradeRow.UpgradeCode; - - this.core.RootElement.AddChild(upgrade); - upgradeElements.Add(upgrade.Id, upgrade); - } - - Wix.UpgradeVersion upgradeVersion = new Wix.UpgradeVersion(); - - if (null != upgradeRow.VersionMin) - { - upgradeVersion.Minimum = upgradeRow.VersionMin; - } - - if (null != upgradeRow.VersionMax) - { - upgradeVersion.Maximum = upgradeRow.VersionMax; - } - - if (null != upgradeRow.Language) - { - upgradeVersion.Language = upgradeRow.Language; - } - - if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) - { - upgradeVersion.MigrateFeatures = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesOnlyDetect == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesOnlyDetect)) - { - upgradeVersion.OnlyDetect = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) - { - upgradeVersion.IgnoreRemoveFailure = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesVersionMinInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMinInclusive)) - { - upgradeVersion.IncludeMinimum = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) - { - upgradeVersion.IncludeMaximum = Wix.YesNoType.yes; - } - - if (MsiInterop.MsidbUpgradeAttributesLanguagesExclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesLanguagesExclusive)) - { - upgradeVersion.ExcludeLanguages = Wix.YesNoType.yes; - } - - if (null != upgradeRow.Remove) - { - upgradeVersion.RemoveFeatures = upgradeRow.Remove; - } - - upgradeVersion.Property = upgradeRow.ActionProperty; - - upgrade.AddChild(upgradeVersion); - } - } - - /// - /// Decompile the UpgradedFiles_OptionalData table. - /// - /// The table to decompile. - private void DecompileUpgradedFiles_OptionalDataTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); - - upgradeFile.File = Convert.ToString(row[1]); - - if (null != row[2]) - { - string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); - - foreach (string symbolPathString in symbolPaths) - { - Wix.SymbolPath symbolPath = new Wix.SymbolPath(); - - symbolPath.Path = symbolPathString; - - upgradeFile.AddChild(symbolPath); - } - } - - if (null != row[3] && 1 == Convert.ToInt32(row[3])) - { - upgradeFile.AllowIgnoreOnError = Wix.YesNoType.yes; - } - - if (null != row[4] && 0 != Convert.ToInt32(row[4])) - { - upgradeFile.WholeFile = Wix.YesNoType.yes; - } - - upgradeFile.Ignore = Wix.YesNoType.no; - - Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); - if (null != upgradeImage) - { - upgradeImage.AddChild(upgradeFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); - } - } - } - - /// - /// Decompile the UpgradedFilesToIgnore table. - /// - /// The table to decompile. - private void DecompileUpgradedFilesToIgnoreTable(Table table) - { - foreach (Row row in table.Rows) - { - if ("*" != Convert.ToString(row[0])) - { - Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); - - upgradeFile.File = Convert.ToString(row[1]); - - upgradeFile.Ignore = Wix.YesNoType.yes; - - Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); - if (null != upgradeImage) - { - upgradeImage.AddChild(upgradeFile); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); - } - } - else - { - this.core.OnMessage(WixWarnings.UnrepresentableColumnValue(row.SourceLineNumbers, table.Name, row.Fields[0].Column.Name, row[0])); - } - } - } - - /// - /// Decompile the UpgradedImages table. - /// - /// The table to decompile. - private void DecompileUpgradedImagesTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.UpgradeImage upgradeImage = new Wix.UpgradeImage(); - - upgradeImage.Id = Convert.ToString(row[0]); - - upgradeImage.SourceFile = Convert.ToString(row[1]); - - if (null != row[2]) - { - upgradeImage.SourcePatch = Convert.ToString(row[2]); - } - - if (null != row[3]) - { - string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); - - foreach (string symbolPathString in symbolPaths) - { - Wix.SymbolPath symbolPath = new Wix.SymbolPath(); - - symbolPath.Path = symbolPathString; - - upgradeImage.AddChild(symbolPath); - } - } - - Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[4])); - if (null != family) - { - family.AddChild(upgradeImage); - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[4]), "ImageFamilies")); - } - this.core.IndexElement(row, upgradeImage); - } - } - - /// - /// Decompile the UIText table. - /// - /// The table to decompile. - private void DecompileUITextTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.UIText uiText = new Wix.UIText(); - - uiText.Id = Convert.ToString(row[0]); - - uiText.Content = Convert.ToString(row[1]); - - this.core.UIElement.AddChild(uiText); - } - } - - /// - /// Decompile the Verb table. - /// - /// The table to decompile. - private void DecompileVerbTable(Table table) - { - foreach (Row row in table.Rows) - { - Wix.Verb verb = new Wix.Verb(); - - verb.Id = Convert.ToString(row[1]); - - if (null != row[2]) - { - verb.Sequence = Convert.ToInt32(row[2]); - } - - if (null != row[3]) - { - verb.Command = Convert.ToString(row[3]); - } - - if (null != row[4]) - { - verb.Argument = Convert.ToString(row[4]); - } - - this.core.IndexElement(row, verb); - } - } - - /// - /// Gets the RegistryRootType from an integer representation of the root. - /// - /// The source line information for the root. - /// The name of the table containing the field. - /// The field containing the root value. - /// The strongly-typed representation of the root. - /// true if the value could be converted; false otherwise. - private bool GetRegistryRootType(SourceLineNumber sourceLineNumbers, string tableName, Field field, out Wix.RegistryRootType registryRootType) - { - switch (Convert.ToInt32(field.Data)) - { - case (-1): - registryRootType = Wix.RegistryRootType.HKMU; - return true; - case MsiInterop.MsidbRegistryRootClassesRoot: - registryRootType = Wix.RegistryRootType.HKCR; - return true; - case MsiInterop.MsidbRegistryRootCurrentUser: - registryRootType = Wix.RegistryRootType.HKCU; - return true; - case MsiInterop.MsidbRegistryRootLocalMachine: - registryRootType = Wix.RegistryRootType.HKLM; - return true; - case MsiInterop.MsidbRegistryRootUsers: - registryRootType = Wix.RegistryRootType.HKU; - return true; - default: - this.core.OnMessage(WixWarnings.IllegalColumnValue(sourceLineNumbers, tableName, field.Column.Name, field.Data)); - registryRootType = Wix.RegistryRootType.HKCR; // assign anything to satisfy the out parameter - return false; - } - } - - /// - /// Set the primary feature for a component. - /// - /// The row which specifies a primary feature. - /// The index of the column contaning the feature identifier. - /// The index of the column containing the component identifier. - private void SetPrimaryFeature(Row row, int featureColumnIndex, int componentColumnIndex) - { - // only products contain primary features - if (OutputType.Product == this.outputType) - { - Field featureField = row.Fields[featureColumnIndex]; - Field componentField = row.Fields[componentColumnIndex]; - - Wix.ComponentRef componentRef = (Wix.ComponentRef)this.core.GetIndexedElement("FeatureComponents", Convert.ToString(featureField.Data), Convert.ToString(componentField.Data)); - - if (null != componentRef) - { - componentRef.Primary = Wix.YesNoType.yes; - } - else - { - this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), featureField.Column.Name, Convert.ToString(featureField.Data), componentField.Column.Name, Convert.ToString(componentField.Data), "FeatureComponents")); - } - } - } - - /// - /// Checks the InstallExecuteSequence table to determine where RemoveExistingProducts is scheduled and removes it. - /// - /// The collection of all tables. - private static Wix.MajorUpgrade.ScheduleType DetermineMajorUpgradeScheduling(TableIndexedCollection tables) - { - int sequenceRemoveExistingProducts = 0; - int sequenceInstallValidate = 0; - int sequenceInstallInitialize = 0; - int sequenceInstallFinalize = 0; - int sequenceInstallExecute = 0; - int sequenceInstallExecuteAgain = 0; - - Table installExecuteSequenceTable = tables["InstallExecuteSequence"]; - if (null != installExecuteSequenceTable) - { - int removeExistingProductsRow = -1; - for (int i = 0; i < installExecuteSequenceTable.Rows.Count; i++) - { - Row row = installExecuteSequenceTable.Rows[i]; - string action = Convert.ToString(row[0]); - int sequence = Convert.ToInt32(row[2]); - - switch (action) - { - case "RemoveExistingProducts": - sequenceRemoveExistingProducts = sequence; - removeExistingProductsRow = i; - break; - case "InstallValidate": - sequenceInstallValidate = sequence; - break; - case "InstallInitialize": - sequenceInstallInitialize = sequence; - break; - case "InstallExecute": - sequenceInstallExecute = sequence; - break; - case "InstallExecuteAgain": - sequenceInstallExecuteAgain = sequence; - break; - case "InstallFinalize": - sequenceInstallFinalize = sequence; - break; - } - } - - installExecuteSequenceTable.Rows.RemoveAt(removeExistingProductsRow); - } - - if (0 != sequenceInstallValidate && sequenceInstallValidate < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallInitialize) - { - return Wix.MajorUpgrade.ScheduleType.afterInstallValidate; - } - else if (0 != sequenceInstallInitialize && sequenceInstallInitialize < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallExecute) - { - return Wix.MajorUpgrade.ScheduleType.afterInstallInitialize; - } - else if (0 != sequenceInstallExecute && sequenceInstallExecute < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallExecuteAgain) - { - return Wix.MajorUpgrade.ScheduleType.afterInstallExecute; - } - else if (0 != sequenceInstallExecuteAgain && sequenceInstallExecuteAgain < sequenceRemoveExistingProducts && sequenceRemoveExistingProducts < sequenceInstallFinalize) - { - return Wix.MajorUpgrade.ScheduleType.afterInstallExecuteAgain; - } - else - { - return Wix.MajorUpgrade.ScheduleType.afterInstallFinalize; - } - } - } -} diff --git a/src/WixToolset.Core/DecompilerCore.cs b/src/WixToolset.Core/DecompilerCore.cs deleted file mode 100644 index 203f2bc4..00000000 --- a/src/WixToolset.Core/DecompilerCore.cs +++ /dev/null @@ -1,152 +0,0 @@ -// 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 -{ - using System; - using System.Collections; - using WixToolset.Data; - using WixToolset.Extensibility; - using Wix = WixToolset.Data.Serialize; - - /// - /// The base of the decompiler. Holds some variables used by the decompiler and extensions, - /// as well as some utility methods. - /// - internal class DecompilerCore : IDecompilerCore - { - private Hashtable elements; - private Wix.IParentElement rootElement; - private bool showPedanticMessages; - private Wix.UI uiElement; - - /// - /// Instantiate a new decompiler core. - /// - /// The root element of the decompiled database. - /// The message handler. - internal DecompilerCore(Wix.IParentElement rootElement) - { - this.elements = new Hashtable(); - this.rootElement = rootElement; - } - - /// - /// Gets whether the decompiler core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - public bool EncounteredError - { - get { return Messaging.Instance.EncounteredError; } - } - - /// - /// Gets the root element of the decompiled output. - /// - /// The root element of the decompiled output. - public Wix.IParentElement RootElement - { - get { return this.rootElement; } - } - - /// - /// Gets or sets the option to show pedantic messages. - /// - /// The option to show pedantic messages. - public bool ShowPedanticMessages - { - get { return this.showPedanticMessages; } - set { this.showPedanticMessages = value; } - } - - /// - /// Gets the UI element. - /// - /// The UI element. - public Wix.UI UIElement - { - get - { - if (null == this.uiElement) - { - this.uiElement = new Wix.UI(); - this.rootElement.AddChild(this.uiElement); - } - - return this.uiElement; - } - } - - /// - /// Verifies if a filename is a valid short filename. - /// - /// Filename to verify. - /// true if wildcards are allowed in the filename. - /// True if the filename is a valid short filename - public virtual bool IsValidShortFilename(string filename, bool allowWildcards) - { - return false; - } - - /// - /// Convert an Int32 into a DateTime. - /// - /// The Int32 value. - /// The DateTime. - public DateTime ConvertIntegerToDateTime(int value) - { - int date = value / 65536; - int time = value % 65536; - - return new DateTime(1980 + (date / 512), (date % 512) / 32, date % 32, time / 2048, (time % 2048) / 32, (time % 32) * 2); - } - - /// - /// Gets the element corresponding to the row it came from. - /// - /// The row corresponding to the element. - /// The indexed element. - public Wix.ISchemaElement GetIndexedElement(Row row) - { - return this.GetIndexedElement(row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); - } - - /// - /// Gets the element corresponding to the primary key of the given table. - /// - /// The table corresponding to the element. - /// The primary key corresponding to the element. - /// The indexed element. - public Wix.ISchemaElement GetIndexedElement(string table, params string[] primaryKey) - { - return (Wix.ISchemaElement)this.elements[String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey))]; - } - - /// - /// Index an element by its corresponding row. - /// - /// The row corresponding to the element. - /// The element to index. - public void IndexElement(Row row, Wix.ISchemaElement element) - { - this.elements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element); - } - - /// - /// Indicates the decompiler encountered and unexpected table to decompile. - /// - /// Unknown decompiled table. - public void UnexpectedTable(Table table) - { - this.OnMessage(WixErrors.TableDecompilationUnimplemented(table.Name)); - } - - /// - /// Sends a message to the message delegate if there is one. - /// - /// Message event arguments. - public void OnMessage(MessageEventArgs e) - { - Messaging.Instance.OnMessage(e); - } - } -} diff --git a/src/WixToolset.Core/Inscriber.cs b/src/WixToolset.Core/Inscriber.cs index f01e0629..81781ad4 100644 --- a/src/WixToolset.Core/Inscriber.cs +++ b/src/WixToolset.Core/Inscriber.cs @@ -10,14 +10,6 @@ namespace WixToolset /// public sealed class Inscriber : IMessageHandler { - // private TempFileCollection tempFiles; - private TableDefinitionCollection tableDefinitions; - - public Inscriber() - { - this.tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - } - /// /// Gets or sets the temp files collection. /// diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs index 092d81dc..50357d8a 100644 --- a/src/WixToolset.Core/Librarian.cs +++ b/src/WixToolset.Core/Librarian.cs @@ -6,40 +6,50 @@ namespace WixToolset.Core using System.Collections.Generic; using System.Linq; using WixToolset.Core.Bind; + using WixToolset.Core.Link; using WixToolset.Data; - using WixToolset.Link; + using WixToolset.Extensibility; /// /// Core librarian tool. /// public sealed class Librarian { - public Librarian(LibraryContext context) - { - this.Context = context; - } - - private LibraryContext Context { get; } + private ILibraryContext Context { get; set; } /// /// Create a library by combining several intermediates (objects). /// /// The sections to combine into a library. /// Returns the new library. - public Library Combine() + public Intermediate Combine(ILibraryContext context) { + this.Context = context ?? throw new ArgumentNullException(nameof(context)); + + if (String.IsNullOrEmpty(this.Context.LibraryId)) + { + this.Context.LibraryId = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).TrimEnd('=').Replace('+', '.').Replace('/', '_'); + } + foreach (var extension in this.Context.Extensions) { extension.PreCombine(this.Context); } + var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); + var fileResolver = new FileResolver(this.Context.BindPaths, this.Context.Extensions); + var embedFilePaths = ResolveFilePathsToEmbed(sections, fileResolver); + var localizationsByCulture = CollateLocalizations(this.Context.Localizations); - var embedFilePaths = ResolveFilePathsToEmbed(this.Context.Sections, fileResolver); + foreach (var section in sections) + { + section.LibraryId = this.Context.LibraryId; + } - var library = new Library(this.Context.Sections, localizationsByCulture, embedFilePaths); + var library = new Intermediate(this.Context.LibraryId, sections, localizationsByCulture, embedFilePaths); this.Validate(library); @@ -55,7 +65,7 @@ namespace WixToolset.Core /// Validate that a library contains one entry section and no duplicate symbols. /// /// Library to validate. - private Library Validate(Library library) + private Intermediate Validate(Intermediate library) { FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(library.Sections); find.Execute(); @@ -92,39 +102,35 @@ namespace WixToolset.Core return localizationsByCulture; } - private List ResolveFilePathsToEmbed(IEnumerable
sections, FileResolver fileResolver) + private List ResolveFilePathsToEmbed(IEnumerable sections, FileResolver fileResolver) { var embedFilePaths = new List(); // Resolve paths to files that are to be embedded in the library. if (this.Context.BindFiles) { - foreach (Table table in sections.SelectMany(s => s.Tables)) + foreach (var tuple in sections.SelectMany(s => s.Tuples)) { - foreach (Row row in table.Rows) + foreach (var field in tuple.Fields.Where(f => f.Type == IntermediateFieldType.Path)) { - foreach (ObjectField objectField in row.Fields.OfType()) + var pathField = field.AsPath(); + + if (pathField != null) { - if (null != objectField.Data) + var resolvedPath = this.Context.WixVariableResolver.ResolveVariables(tuple.SourceLineNumbers, pathField.Path, false); + + var file = fileResolver.Resolve(tuple.SourceLineNumbers, tuple.Definition.Name, resolvedPath); + + if (!String.IsNullOrEmpty(file)) { - string resolvedPath = this.Context.WixVariableResolver.ResolveVariables(row.SourceLineNumbers, (string)objectField.Data, false); - - string file = fileResolver.Resolve(row.SourceLineNumbers, table.Name, resolvedPath); - - if (!String.IsNullOrEmpty(file)) - { - // File was successfully resolved so track the embedded index as the embedded file index. - objectField.EmbeddedFileIndex = embedFilePaths.Count; - embedFilePaths.Add(file); - } - else - { - Messaging.Instance.OnMessage(WixDataErrors.FileNotFound(row.SourceLineNumbers, (string)objectField.Data, table.Name)); - } + // File was successfully resolved so track the embedded index as the embedded file index. + field.Set(new IntermediateFieldPathValue { EmbeddedFileIndex = embedFilePaths.Count }); + + embedFilePaths.Add(file); } - else // clear out embedded file id in case there was one there before. + else { - objectField.EmbeddedFileIndex = null; + this.Context.Messaging.OnMessage(WixDataErrors.FileNotFound(tuple.SourceLineNumbers, pathField.Path, tuple.Definition.Name)); } } } diff --git a/src/WixToolset.Core/LibraryContext.cs b/src/WixToolset.Core/LibraryContext.cs index 36e38739..b3efbffa 100644 --- a/src/WixToolset.Core/LibraryContext.cs +++ b/src/WixToolset.Core/LibraryContext.cs @@ -2,21 +2,28 @@ namespace WixToolset.Core { + using System; using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; public class LibraryContext : ILibraryContext { + public IServiceProvider ServiceProvider { get; } + + public Messaging Messaging { get; set; } + public bool BindFiles { get; set; } public IEnumerable BindPaths { get; set; } public IEnumerable Extensions { get; set; } + public string LibraryId { get; set; } + public IEnumerable Localizations { get; set; } - public IEnumerable
Sections { get; set; } + public IEnumerable Intermediates { get; set; } public IBindVariableResolver WixVariableResolver { get; set; } } diff --git a/src/WixToolset.Core/Link/ConnectToFeature.cs b/src/WixToolset.Core/Link/ConnectToFeature.cs index 6e046b89..bc85426a 100644 --- a/src/WixToolset.Core/Link/ConnectToFeature.cs +++ b/src/WixToolset.Core/Link/ConnectToFeature.cs @@ -2,7 +2,7 @@ namespace WixToolset.Link { - using System.Collections.Specialized; + using System.Collections.Generic; using WixToolset.Data; /// @@ -10,19 +10,12 @@ namespace WixToolset.Link /// public sealed class ConnectToFeature { - private Section section; - private string childId; - - private string primaryFeature; - private bool explicitPrimaryFeature; - private StringCollection connectFeatures; - /// /// Creates a new connect to feature. /// /// Section this connect belongs to. /// Id of the child. - public ConnectToFeature(Section section, string childId) : + public ConnectToFeature(IntermediateSection section, string childId) : this(section, childId, null, false) { } @@ -34,62 +27,43 @@ namespace WixToolset.Link /// Id of the child. /// Sets the primary feature for the connection. /// Sets if this is explicit primary. - public ConnectToFeature(Section section, string childId, string primaryFeature, bool explicitPrimaryFeature) + public ConnectToFeature(IntermediateSection section, string childId, string primaryFeature, bool explicitPrimaryFeature) { - this.section = section; - this.childId = childId; + this.Section = section; + this.ChildId = childId; - this.primaryFeature = primaryFeature; - this.explicitPrimaryFeature = explicitPrimaryFeature; - - this.connectFeatures = new StringCollection(); + this.PrimaryFeature = primaryFeature; + this.IsExplicitPrimaryFeature = explicitPrimaryFeature; } /// /// Gets the section. /// /// Section. - public Section Section - { - get { return this.section; } - } + public IntermediateSection Section { get; } /// /// Gets the child identifier. /// /// The child identifier. - public string ChildId - { - get { return this.childId; } - } + public string ChildId { get; } /// /// Gets or sets if the flag for if the primary feature was set explicitly. /// /// The flag for if the primary feature was set explicitly. - public bool IsExplicitPrimaryFeature - { - get { return this.explicitPrimaryFeature; } - set { this.explicitPrimaryFeature = value; } - } + public bool IsExplicitPrimaryFeature { get; set; } /// /// Gets or sets the primary feature. /// /// The primary feature. - public string PrimaryFeature - { - get { return this.primaryFeature; } - set { this.primaryFeature = value; } - } + public string PrimaryFeature { get; set; } /// /// Gets the features connected to. /// /// Features connected to. - public StringCollection ConnectFeatures - { - get { return this.connectFeatures; } - } + public List ConnectFeatures { get; } = new List(); } } diff --git a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs index effb06e4..00613ca1 100644 --- a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs +++ b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs @@ -1,6 +1,6 @@ // 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.Link +namespace WixToolset.Core.Link { using System; using System.Collections.Generic; @@ -9,13 +9,13 @@ namespace WixToolset.Link internal class FindEntrySectionAndLoadSymbolsCommand : ICommand { - private IEnumerable
sections; - - public FindEntrySectionAndLoadSymbolsCommand(IEnumerable
sections) + public FindEntrySectionAndLoadSymbolsCommand(IEnumerable sections) { - this.sections = sections; + this.Sections = sections; } + private IEnumerable Sections { get; } + /// /// Sets the expected entry output type, based on output file extension provided to the linker. /// @@ -24,13 +24,16 @@ namespace WixToolset.Link /// /// Gets the located entry section after the command is executed. /// - public Section EntrySection { get; private set; } + public IntermediateSection EntrySection { get; private set; } /// /// Gets the collection of loaded symbols. /// public IDictionary Symbols { get; private set; } + /// + /// Gets the collection of possibly conflicting symbols. + /// public IEnumerable PossiblyConflictingSymbols { get; private set; } public void Execute() @@ -38,22 +41,22 @@ namespace WixToolset.Link Dictionary symbols = new Dictionary(); HashSet possibleConflicts = new HashSet(); - SectionType expectedEntrySectionType; - if (!Enum.TryParse(this.ExpectedOutputType.ToString(), out expectedEntrySectionType)) + if (!Enum.TryParse(this.ExpectedOutputType.ToString(), out SectionType expectedEntrySectionType)) { expectedEntrySectionType = SectionType.Unknown; } - foreach (Section section in this.sections) + foreach (var section in this.Sections) { // Try to find the one and only entry section. if (SectionType.Product == section.Type || SectionType.Module == section.Type || SectionType.PatchCreation == section.Type || SectionType.Patch == section.Type || SectionType.Bundle == section.Type) { - if (SectionType.Unknown != expectedEntrySectionType && section.Type != expectedEntrySectionType) - { - string outputExtension = Output.GetExtension(this.ExpectedOutputType); - Messaging.Instance.OnMessage(WixWarnings.UnexpectedEntrySection(section.SourceLineNumbers, section.Type.ToString(), expectedEntrySectionType.ToString(), outputExtension)); - } + // TODO: remove this? + //if (SectionType.Unknown != expectedEntrySectionType && section.Type != expectedEntrySectionType) + //{ + // string outputExtension = Output.GetExtension(this.ExpectedOutputType); + // Messaging.Instance.OnMessage(WixWarnings.UnexpectedEntrySection(section.SourceLineNumbers, section.Type.ToString(), expectedEntrySectionType.ToString(), outputExtension)); + //} if (null == this.EntrySection) { @@ -61,42 +64,38 @@ namespace WixToolset.Link } else { - Messaging.Instance.OnMessage(WixErrors.MultipleEntrySections(this.EntrySection.SourceLineNumbers, this.EntrySection.Id, section.Id)); - Messaging.Instance.OnMessage(WixErrors.MultipleEntrySections2(section.SourceLineNumbers)); + Messaging.Instance.OnMessage(WixErrors.MultipleEntrySections(this.EntrySection.Tuples.FirstOrDefault()?.SourceLineNumbers, this.EntrySection.Id, section.Id)); + Messaging.Instance.OnMessage(WixErrors.MultipleEntrySections2(section.Tuples.FirstOrDefault()?.SourceLineNumbers)); } } // Load all the symbols from the section's tables that create symbols. - foreach (Table table in section.Tables.Where(t => t.Definition.CreateSymbols)) + foreach (var row in section.Tuples.Where(t => t.Id != null)) { - foreach (Row row in table.Rows) - { - Symbol symbol = new Symbol(row); + var symbol = new Symbol(section, row); - Symbol existingSymbol; - if (!symbols.TryGetValue(symbol.Name, out existingSymbol)) + if (!symbols.TryGetValue(symbol.Name, out var existingSymbol)) + { + symbols.Add(symbol.Name, symbol); + } + else // uh-oh, duplicate symbols. + { + // If the duplicate symbols are both private directories, there is a chance that they + // point to identical tuples. Identical directory tuples are redundant and will not cause + // conflicts. + if (AccessModifier.Private == existingSymbol.Access && AccessModifier.Private == symbol.Access && + TupleDefinitionType.Directory == existingSymbol.Row.Definition.Type && existingSymbol.Row.IsIdentical(symbol.Row)) { - symbols.Add(symbol.Name, symbol); + // Ensure identical symbol's tuple is marked redundant to ensure (should the tuple be + // referenced into the final output) it will not add duplicate primary keys during + // the .IDT importing. + //symbol.Row.Redundant = true; - TODO: remove this + existingSymbol.AddRedundant(symbol); } - else // uh-oh, duplicate symbols. + else { - // If the duplicate symbols are both private directories, there is a chance that they - // point to identical rows. Identical directory rows are redundant and will not cause - // conflicts. - if (AccessModifier.Private == existingSymbol.Access && AccessModifier.Private == symbol.Access && - "Directory" == existingSymbol.Row.Table.Name && existingSymbol.Row.IsIdentical(symbol.Row)) - { - // Ensure identical symbol's row is marked redundant to ensure (should the row be - // referenced into the final output) it will not add duplicate primary keys during - // the .IDT importing. - symbol.Row.Redundant = true; - existingSymbol.AddRedundant(symbol); - } - else - { - existingSymbol.AddPossibleConflict(symbol); - possibleConflicts.Add(existingSymbol); - } + existingSymbol.AddPossibleConflict(symbol); + possibleConflicts.Add(existingSymbol); } } } diff --git a/src/WixToolset.Core/Link/IntermediateTupleExtensions.cs b/src/WixToolset.Core/Link/IntermediateTupleExtensions.cs new file mode 100644 index 00000000..c4c12e81 --- /dev/null +++ b/src/WixToolset.Core/Link/IntermediateTupleExtensions.cs @@ -0,0 +1,26 @@ +// 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.Core.Link +{ + using WixToolset.Data; + + internal static class IntermediateTupleExtensions + { + public static bool IsIdentical(this IntermediateTuple first, IntermediateTuple second) + { + var identical = (first.Definition.Type == second.Definition.Type && + first.Definition.Name == second.Definition.Name && + first.Definition.FieldDefinitions.Length == second.Definition.FieldDefinitions.Length); + + for (int i = 0; identical && i < first.Definition.FieldDefinitions.Length; ++i) + { + var firstField = first[i]; + var secondField = second[i]; + + identical = (firstField.AsString() == secondField.AsString()); + } + + return identical; + } + } +} diff --git a/src/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs b/src/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs index 39c3a5c2..ac0dd7ec 100644 --- a/src/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs +++ b/src/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs @@ -6,17 +6,18 @@ namespace WixToolset.Link using System.Linq; using WixToolset.Data; - public class ReportConflictingSymbolsCommand : ICommand + public class ReportConflictingSymbolsCommand { - private IEnumerable possibleConflicts; - private IEnumerable
resolvedSections; - - public ReportConflictingSymbolsCommand(IEnumerable possibleConflicts, IEnumerable
resolvedSections) + public ReportConflictingSymbolsCommand(IEnumerable possibleConflicts, IEnumerable resolvedSections) { - this.possibleConflicts = possibleConflicts; - this.resolvedSections = resolvedSections; + this.PossibleConflicts = possibleConflicts; + this.ResolvedSections = resolvedSections; } + private IEnumerable PossibleConflicts { get; } + + private IEnumerable ResolvedSections { get; } + public void Execute() { // Do a quick check if there are any possibly conflicting symbols that don't come from tables that allow @@ -25,10 +26,11 @@ namespace WixToolset.Link // symbols are in sections we actually referenced. From the resulting set, show an error for each duplicate // (aka: conflicting) symbol. This should catch any rows with colliding primary keys (since symbols are based // on the primary keys of rows). - List illegalDuplicates = possibleConflicts.Where(s => "WixAction" != s.Row.Table.Name && "WixVariable" != s.Row.Table.Name).ToList(); + var illegalDuplicates = this.PossibleConflicts.Where(s => s.Row.Definition.Type != TupleDefinitionType.WixAction && s.Row.Definition.Type != TupleDefinitionType.WixVariable).ToList(); if (0 < illegalDuplicates.Count) { - HashSet
referencedSections = new HashSet
(resolvedSections); + var referencedSections = new HashSet(this.ResolvedSections); + foreach (Symbol referencedDuplicateSymbol in illegalDuplicates.Where(s => referencedSections.Contains(s.Section))) { List actuallyReferencedDuplicateSymbols = referencedDuplicateSymbol.PossiblyConflictingSymbols.Where(s => referencedSections.Contains(s.Section)).ToList(); diff --git a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs index 5a985f3f..9c3b2765 100644 --- a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs +++ b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs @@ -4,22 +4,21 @@ namespace WixToolset.Link { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; /// /// Resolves all the simple references in a section. /// internal class ResolveReferencesCommand : ICommand { - private Section entrySection; + private IntermediateSection entrySection; private IDictionary symbols; private HashSet referencedSymbols; - private HashSet
resolvedSections; + private HashSet resolvedSections; - public ResolveReferencesCommand(Section entrySection, IDictionary symbols) + public ResolveReferencesCommand(IntermediateSection entrySection, IDictionary symbols) { this.entrySection = entrySection; this.symbols = symbols; @@ -29,14 +28,14 @@ namespace WixToolset.Link public IEnumerable ReferencedSymbols { get { return this.referencedSymbols; } } - public IEnumerable
ResolvedSections { get { return this.resolvedSections; } } + public IEnumerable ResolvedSections { get { return this.resolvedSections; } } /// /// Resolves all the simple references in a section. /// public void Execute() { - this.resolvedSections = new HashSet
(); + this.resolvedSections = new HashSet(); this.referencedSymbols = new HashSet(); this.RecursivelyResolveReferences(this.entrySection); @@ -47,7 +46,7 @@ namespace WixToolset.Link ///
/// Section with references to resolve. /// Note: recursive function. - private void RecursivelyResolveReferences(Section section) + private void RecursivelyResolveReferences(IntermediateSection section) { // If we already resolved this section, move on to the next. if (!this.resolvedSections.Add(section)) @@ -59,59 +58,53 @@ namespace WixToolset.Link // symbols provided. Then recursively call this method to process the // located symbol's section. All in all this is a very simple depth-first // search of the references per-section. - Table wixSimpleReferenceTable; - if (section.Tables.TryGetTable("WixSimpleReference", out wixSimpleReferenceTable)) + foreach (var wixSimpleReferenceRow in section.Tuples.OfType()) { - foreach (WixSimpleReferenceRow wixSimpleReferenceRow in wixSimpleReferenceTable.Rows) + // If we're building a Merge Module, ignore all references to the Media table + // because Merge Modules don't have Media tables. + if (this.BuildingMergeModule && wixSimpleReferenceRow.Definition.Type == TupleDefinitionType.Media) { - Debug.Assert(wixSimpleReferenceRow.Section == section); + continue; + } - // If we're building a Merge Module, ignore all references to the Media table - // because Merge Modules don't have Media tables. - if (this.BuildingMergeModule && "Media" == wixSimpleReferenceRow.TableName) + if (!this.symbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol)) + { + Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName)); + } + else // see if the symbol (and any of its duplicates) are appropriately accessible. + { + IList accessible = DetermineAccessibleSymbols(section, symbol); + if (!accessible.Any()) { - continue; + Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access)); } - - Symbol symbol; - if (!this.symbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out symbol)) + else if (1 == accessible.Count) { - Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName)); + var accessibleSymbol = accessible[0]; + this.referencedSymbols.Add(accessibleSymbol); + + if (null != accessibleSymbol.Section) + { + RecursivelyResolveReferences(accessibleSymbol.Section); + } } - else // see if the symbol (and any of its duplicates) are appropriately accessible. + else // display errors for the duplicate symbols. { - IList accessible = DetermineAccessibleSymbols(section, symbol); - if (!accessible.Any()) + var accessibleSymbol = accessible[0]; + var referencingSourceLineNumber = wixSimpleReferenceRow.SourceLineNumbers.ToString(); + + if (String.IsNullOrEmpty(referencingSourceLineNumber)) { - Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access)); + Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name)); } - else if (1 == accessible.Count) + else { - Symbol accessibleSymbol = accessible[0]; - this.referencedSymbols.Add(accessibleSymbol); - - if (null != accessibleSymbol.Section) - { - RecursivelyResolveReferences(accessibleSymbol.Section); - } + Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber)); } - else // display errors for the duplicate symbols. + + foreach (Symbol accessibleDuplicate in accessible.Skip(1)) { - Symbol accessibleSymbol = accessible[0]; - string referencingSourceLineNumber = wixSimpleReferenceRow.SourceLineNumbers.ToString(); - if (String.IsNullOrEmpty(referencingSourceLineNumber)) - { - Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name)); - } - else - { - Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber)); - } - - foreach (Symbol accessibleDuplicate in accessible.Skip(1)) - { - Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol2(accessibleDuplicate.Row.SourceLineNumbers)); - } + Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol2(accessibleDuplicate.Row.SourceLineNumbers)); } } } @@ -124,7 +117,7 @@ namespace WixToolset.Link /// Section referencing the symbol. /// Symbol being referenced. /// List of symbols accessible by referencing section. - private IList DetermineAccessibleSymbols(Section referencingSection, Symbol symbol) + private IList DetermineAccessibleSymbols(IntermediateSection referencingSection, Symbol symbol) { List symbols = new List(); @@ -158,20 +151,20 @@ namespace WixToolset.Link /// Section referencing the symbol. /// Symbol being referenced. /// True if symbol is accessible. - private bool AccessibleSymbol(Section referencingSection, Symbol symbol) + private bool AccessibleSymbol(IntermediateSection referencingSection, Symbol symbol) { switch (symbol.Access) { case AccessModifier.Public: return true; case AccessModifier.Internal: - return symbol.Row.Section.IntermediateId.Equals(referencingSection.IntermediateId) || (null != symbol.Row.Section.LibraryId && symbol.Row.Section.LibraryId.Equals(referencingSection.LibraryId)); + return symbol.Section.CompilationId.Equals(referencingSection.CompilationId) || (null != symbol.Section.LibraryId && symbol.Section.LibraryId.Equals(referencingSection.LibraryId)); case AccessModifier.Protected: - return symbol.Row.Section.IntermediateId.Equals(referencingSection.IntermediateId); + return symbol.Section.CompilationId.Equals(referencingSection.CompilationId); case AccessModifier.Private: return referencingSection == symbol.Section; default: - throw new InvalidOperationException(); + throw new ArgumentOutOfRangeException(nameof(symbol.Access)); } } } diff --git a/src/WixToolset.Core/Link/WixComplexReferenceTupleExtensions.cs b/src/WixToolset.Core/Link/WixComplexReferenceTupleExtensions.cs new file mode 100644 index 00000000..80cafa50 --- /dev/null +++ b/src/WixToolset.Core/Link/WixComplexReferenceTupleExtensions.cs @@ -0,0 +1,73 @@ +// 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.Core.Link +{ + using System; + using WixToolset.Data.Tuples; + + internal static class WixComplexReferenceTupleExtensions + { + /// + /// Creates a shallow copy of the ComplexReference. + /// + /// A shallow copy of the ComplexReference. + public static WixComplexReferenceTuple Clone(this WixComplexReferenceTuple source) + { + var clone = new WixComplexReferenceTuple(source.SourceLineNumbers, source.Id); + clone.ParentType = source.ParentType; + clone.Parent = source.Parent; + clone.ParentLanguage = source.ParentLanguage; + clone.ChildType = source.ChildType; + clone.Child = source.Child; + clone.IsPrimary = source.IsPrimary; + + return clone; + } + + /// + /// 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. + public static int CompareToWithoutConsideringPrimary(this WixComplexReferenceTuple tuple, WixComplexReferenceTuple other) + { + var comparison = tuple.ChildType - other.ChildType; + if (0 == comparison) + { + comparison = String.Compare(tuple.Child, other.Child, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = tuple.ParentType - other.ParentType; + if (0 == comparison) + { + string thisParentLanguage = null == tuple.ParentLanguage ? String.Empty : tuple.ParentLanguage; + string otherParentLanguage = null == other.ParentLanguage ? String.Empty : other.ParentLanguage; + comparison = String.Compare(thisParentLanguage, otherParentLanguage, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = String.Compare(tuple.Parent, other.Parent, StringComparison.Ordinal); + } + } + } + } + + return comparison; + } + + /// + /// Changes all of the parent references to point to the passed in parent reference. + /// + /// New parent complex reference. + public static void Reparent(this WixComplexReferenceTuple tuple, WixComplexReferenceTuple parent) + { + tuple.Parent = parent.Parent; + tuple.ParentLanguage = parent.ParentLanguage; + tuple.ParentType = parent.ParentType; + + if (!tuple.IsPrimary) + { + tuple.IsPrimary = parent.IsPrimary; + } + } + } +} diff --git a/src/WixToolset.Core/Link/WixGroupingOrdering.cs b/src/WixToolset.Core/Link/WixGroupingOrdering.cs index fc0ce43b..4dd1596c 100644 --- a/src/WixToolset.Core/Link/WixGroupingOrdering.cs +++ b/src/WixToolset.Core/Link/WixGroupingOrdering.cs @@ -12,13 +12,13 @@ namespace WixToolset.Link using System.Text; using WixToolset.Extensibility; using WixToolset.Data; + using WixToolset.Data.Tuples; /// /// Grouping and Ordering class of the WiX toolset. /// internal sealed class WixGroupingOrdering : IMessageHandler { - private Output output; private IMessageHandler messageHandler; private List groupTypes; private List itemTypes; @@ -34,9 +34,9 @@ namespace WixToolset.Link /// Handler for any error messages. /// Group types to include. /// Item types to include. - public WixGroupingOrdering(Output output, IMessageHandler messageHandler) + public WixGroupingOrdering(IntermediateSection entrySections, IMessageHandler messageHandler) { - this.output = output; + this.EntrySection = entrySections; this.messageHandler = messageHandler; this.rowsUsed = new List(); @@ -44,6 +44,8 @@ namespace WixToolset.Link this.encounteredError = false; } + private IntermediateSection EntrySection { get; } + /// /// Switches a WixGroupingOrdering object to operate on a new set of groups/items. /// @@ -91,8 +93,7 @@ namespace WixToolset.Link { Debug.Assert(this.groupTypes.Contains(parentType)); - List orderedItems; - this.CreateOrderedList(parentType, parentId, out orderedItems); + this.CreateOrderedList(parentType, parentId, out var orderedItems); if (this.encounteredError) { return; @@ -170,15 +171,16 @@ namespace WixToolset.Link ///
public void RemoveUsedGroupRows() { - List sortedIndexes = this.rowsUsed.Distinct().OrderByDescending(i => i).ToList(); + var sortedIndexes = this.rowsUsed.Distinct().OrderByDescending(i => i).ToList(); - Table wixGroupTable = this.output.Tables["WixGroup"]; - Debug.Assert(null != wixGroupTable); - Debug.Assert(sortedIndexes[0] < wixGroupTable.Rows.Count); + //Table wixGroupTable = this.output.Tables["WixGroup"]; + //Debug.Assert(null != wixGroupTable); + //Debug.Assert(sortedIndexes[0] < wixGroupTable.Rows.Count); foreach (int rowIndex in sortedIndexes) { - wixGroupTable.Rows.RemoveAt(rowIndex); + //wixGroupTable.Rows.RemoveAt(rowIndex); + this.EntrySection.Tuples.RemoveAt(rowIndex); } } @@ -194,16 +196,15 @@ namespace WixToolset.Link // does WiX (although they do, currently). We probably want to "upgrade" this to a new // table that includes a sequence number, and then change the code that uses ordered // groups to read from that table instead. - Table wixGroupTable = this.output.Tables["WixGroup"]; - Debug.Assert(null != wixGroupTable); - foreach (Item item in orderedItems) { - Row row = wixGroupTable.CreateRow(item.Row.SourceLineNumbers); - row[0] = parentId; - row[1] = parentType; - row[2] = item.Id; - row[3] = item.Type; + var row = new WixGroupTuple(item.Row.SourceLineNumbers); + row.ParentId = parentId; + row.ParentType = (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), parentType); + row.ChildId = item.Id; + row.ChildType = (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), item.Type); + + this.EntrySection.Tuples.Add(row); } } @@ -254,47 +255,47 @@ namespace WixToolset.Link ///
private void LoadGroups() { - Table wixGroupTable = this.output.Tables["WixGroup"]; - if (null == wixGroupTable || 0 == wixGroupTable.Rows.Count) - { - // TODO: Change message name to make it *not* Bundle specific? - this.OnMessage(WixErrors.MissingBundleInformation("WixGroup")); - } + //Table wixGroupTable = this.output.Tables["WixGroup"]; + //if (null == wixGroupTable || 0 == wixGroupTable.Rows.Count) + //{ + // // TODO: Change message name to make it *not* Bundle specific? + // this.OnMessage(WixErrors.MissingBundleInformation("WixGroup")); + //} // Collect all of the groups - for (int rowIndex = 0; rowIndex < wixGroupTable.Rows.Count; ++rowIndex) - { - Row row = wixGroupTable.Rows[rowIndex]; - string rowParentName = (string)row[0]; - string rowParentType = (string)row[1]; - string rowChildName = (string)row[2]; - string rowChildType = (string)row[3]; - - // If this row specifies a parent or child type that's not in our - // lists, we assume it's not a row that we're concerned about. - if (!this.groupTypes.Contains(rowParentType) || - !this.itemTypes.Contains(rowChildType)) + for (int rowIndex = 0; rowIndex < this.EntrySection.Tuples.Count; ++rowIndex) + { + if (this.EntrySection.Tuples[rowIndex] is WixGroupTuple row) { - continue; - } + var rowParentName = row.ParentId; + var rowParentType = row.ParentType.ToString(); + var rowChildName = row.ChildId; + var rowChildType = row.ChildType.ToString(); + + // If this row specifies a parent or child type that's not in our + // lists, we assume it's not a row that we're concerned about. + if (!this.groupTypes.Contains(rowParentType) || + !this.itemTypes.Contains(rowChildType)) + { + continue; + } - this.rowsUsed.Add(rowIndex); + this.rowsUsed.Add(rowIndex); - Item parentItem; - if (!this.items.TryGetValue(rowParentType, rowParentName, out parentItem)) - { - parentItem = new Item(row, rowParentType, rowParentName); - this.items.Add(parentItem); - } + if (!this.items.TryGetValue(rowParentType, rowParentName, out var parentItem)) + { + parentItem = new Item(row, rowParentType, rowParentName); + this.items.Add(parentItem); + } - Item childItem; - if (!this.items.TryGetValue(rowChildType, rowChildName, out childItem)) - { - childItem = new Item(row, rowChildType, rowChildName); - this.items.Add(childItem); - } + if (!this.items.TryGetValue(rowChildType, rowChildName, out var childItem)) + { + childItem = new Item(row, rowChildType, rowChildName); + this.items.Add(childItem); + } - parentItem.ChildItems.Add(childItem); + parentItem.ChildItems.Add(childItem); + } } } @@ -374,19 +375,19 @@ namespace WixToolset.Link ///
private void LoadOrdering() { - Table wixOrderingTable = output.Tables["WixOrdering"]; - if (null == wixOrderingTable || 0 == wixOrderingTable.Rows.Count) - { - // TODO: Do we need a message here? - return; - } + //Table wixOrderingTable = output.Tables["WixOrdering"]; + //if (null == wixOrderingTable || 0 == wixOrderingTable.Rows.Count) + //{ + // // TODO: Do we need a message here? + // return; + //} - foreach (Row row in wixOrderingTable.Rows) + foreach (var row in this.EntrySection.Tuples.OfType()) { - string rowItemType = (string)row[0]; - string rowItemName = (string)row[1]; - string rowDependsOnType = (string)row[2]; - string rowDependsOnName = (string)row[3]; + var rowItemType = row.ItemType; + var rowItemName = row.ItemId_; + var rowDependsOnType = row.DependsOnType; + var rowDependsOnName = row.DependsOnId_; // If this row specifies some other (unknown) type in either // position, we assume it's not a row that we're concerned about. @@ -397,15 +398,12 @@ namespace WixToolset.Link continue; } - Item item = null; - Item dependsOn = null; - - if (!this.items.TryGetValue(rowItemType, rowItemName, out item)) + if (!this.items.TryGetValue(rowItemType, rowItemName, out var item)) { this.OnMessage(WixErrors.IdentifierNotFound(rowItemType, rowItemName)); } - if (!this.items.TryGetValue(rowDependsOnType, rowDependsOnName, out dependsOn)) + if (!this.items.TryGetValue(rowDependsOnType, rowDependsOnName, out var dependsOn)) { this.OnMessage(WixErrors.IdentifierNotFound(rowDependsOnType, rowDependsOnName)); } @@ -540,7 +538,7 @@ namespace WixToolset.Link private ItemCollection beforeItems; // for checking for circular references private bool flattenedAfterItems; - public Item(Row row, string type, string id) + public Item(IntermediateTuple row, string type, string id) { this.Row = row; this.Type = type; @@ -553,7 +551,7 @@ namespace WixToolset.Link flattenedAfterItems = false; } - public Row Row { get; private set; } + public IntermediateTuple Row { get; private set; } public string Type { get; private set; } public string Id { get; private set; } public string Key { get; private set; } @@ -718,7 +716,7 @@ namespace WixToolset.Link return -1; } - return string.CompareOrdinal(x.Id, y.Id); + return String.CompareOrdinal(x.Id, y.Id); } } } diff --git a/src/WixToolset.Core/LinkContext.cs b/src/WixToolset.Core/LinkContext.cs new file mode 100644 index 00000000..c3631f72 --- /dev/null +++ b/src/WixToolset.Core/LinkContext.cs @@ -0,0 +1,28 @@ +// 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.Core +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensibility.Services; + + public class LinkContext : ILinkContext + { + internal LinkContext(IServiceProvider serviceProvider) + { + this.ServiceProvider = serviceProvider; + } + + public IServiceProvider ServiceProvider { get; } + + public Messaging Messaging { get; set; } + + public IEnumerable Extensions { get; set; } + + public OutputType ExpectedOutputType { get; set; } + + public IEnumerable Intermediates { get; set; } + } +} diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index c1c9f848..59481387 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs @@ -1,21 +1,18 @@ // 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 +namespace WixToolset.Core { using System; using System.Collections; using System.Collections.Generic; - using System.Collections.Specialized; using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; - using System.Text; using WixToolset.Data; - using WixToolset.Data.Rows; - using WixToolset.Extensibility; using WixToolset.Link; - using WixToolset.Core.Native; + using WixToolset.Core.Link; + using WixToolset.Data.Tuples; + using WixToolset.Extensibility.Services; /// /// Linker core of the WiX toolset. @@ -25,13 +22,10 @@ namespace WixToolset private static readonly char[] colonCharacter = ":".ToCharArray(); private static readonly string emptyGuid = Guid.Empty.ToString("B"); - private List extensionData; - - private List inspectorExtensions; private bool sectionIdOnRows; - private WixActionRowCollection standardActions; - private Output activeOutput; - private TableDefinitionCollection tableDefinitions; + //private WixActionRowCollection standardActions; + //private Output activeOutput; + //private TableDefinitionCollection tableDefinitions; /// /// Creates a linker. @@ -40,18 +34,14 @@ namespace WixToolset { this.sectionIdOnRows = true; // TODO: what is the correct value for this? - this.standardActions = WindowsInstallerStandard.GetStandardActions(); - this.tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); + //this.standardActions = WindowsInstallerStandard.GetStandardActions(); + //this.tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - this.extensionData = new List(); - this.inspectorExtensions = new List(); + //this.extensionData = new List(); + //this.inspectorExtensions = new List(); } - /// - /// Gets or sets the localizer. - /// - /// The localizer. - public Localizer Localizer { get; set; } + private ILinkContext Context { get; set; } /// /// Gets or sets the path to output unreferenced symbols to. If null or empty, there is no output. @@ -65,46 +55,37 @@ namespace WixToolset /// The option to show pedantic messages. public bool ShowPedanticMessages { get; set; } - /// - /// Gets the table definitions used by the linker. - /// - /// Table definitions used by the linker. - public TableDefinitionCollection TableDefinitions - { - get { return this.tableDefinitions; } - } - /// /// Gets or sets the Wix variable resolver. /// /// The Wix variable resolver. - internal IBindVariableResolver WixVariableResolver { get; set; } + //internal IBindVariableResolver WixVariableResolver { get; set; } /// /// Adds an extension. /// /// The extension to add. - public void AddExtensionData(IExtensionData extension) - { - if (null != extension.TableDefinitions) - { - foreach (TableDefinition tableDefinition in extension.TableDefinitions) - { - if (!this.tableDefinitions.Contains(tableDefinition.Name)) - { - this.tableDefinitions.Add(tableDefinition); - } - else - { - throw new WixException(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); - } - } - } - - // keep track of extension data so the libraries can be loaded from these later once all the table definitions - // are loaded; this will allow extensions to have cross table definition dependencies - this.extensionData.Add(extension); - } + //public void AddExtensionData(IExtensionData extension) + //{ + // if (null != extension.TableDefinitions) + // { + // foreach (TableDefinition tableDefinition in extension.TableDefinitions) + // { + // if (!this.tableDefinitions.Contains(tableDefinition.Name)) + // { + // this.tableDefinitions.Add(tableDefinition); + // } + // else + // { + // throw new WixException(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); + // } + // } + // } + + // // keep track of extension data so the libraries can be loaded from these later once all the table definitions + // // are loaded; this will allow extensions to have cross table definition dependencies + // this.extensionData.Add(extension); + //} /// /// Links a collection of sections into an output. @@ -112,31 +93,39 @@ namespace WixToolset /// The collection of sections to link together. /// Expected output type, based on output file extension provided to the linker. /// Output object from the linking. - public Output Link(IEnumerable
inputs, OutputType expectedOutputType) + public Intermediate Link(ILinkContext context) { - Output output = null; - List
sections = new List
(inputs); + this.Context = context ?? throw new ArgumentNullException(nameof(context)); - try - { + //IEnumerable
inputs, OutputType expectedOutputType + + var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); + +#if MOVE_TO_BACKEND bool containsModuleSubstitution = false; bool containsModuleConfiguration = false; +#endif - this.activeOutput = null; + //this.activeOutput = null; - List actionRows = new List(); - List suppressActionRows = new List(); +#if MOVE_TO_BACKEND + var actionRows = new List(); + var suppressActionRows = new List(); +#endif - TableDefinitionCollection customTableDefinitions = new TableDefinitionCollection(); - List customRows = new List(); + //TableDefinitionCollection customTableDefinitions = new TableDefinitionCollection(); + //IntermediateTuple customRows = new List(); +#if MOVE_TO_BACKEND StringCollection generatedShortFileNameIdentifiers = new StringCollection(); Hashtable generatedShortFileNames = new Hashtable(); +#endif - Hashtable multipleFeatureComponents = new Hashtable(); + Hashtable multipleFeatureComponents = new Hashtable(); - Hashtable wixVariables = new Hashtable(); + var wixVariables = new Dictionary(); +#if MOVE_TO_BACKEND // verify that modularization types match for foreign key relationships foreach (TableDefinition tableDefinition in this.tableDefinitions) { @@ -164,7 +153,9 @@ namespace WixToolset } } } +#endif +#if TODO // Add sections from the extensions with data. foreach (IExtensionData data in this.extensionData) { @@ -175,123 +166,118 @@ namespace WixToolset sections.AddRange(library.Sections); } } +#endif - // First find the entry section and while processing all sections load all the symbols from all of the sections. - // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); - FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(sections); - find.ExpectedOutputType = expectedOutputType; + // First find the entry section and while processing all sections load all the symbols from all of the sections. + // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); + var find = new FindEntrySectionAndLoadSymbolsCommand(sections); + find.ExpectedOutputType = this.Context.ExpectedOutputType; + find.Execute(); - find.Execute(); + // Must have found the entry section by now. + if (null == find.EntrySection) + { + throw new WixException(WixErrors.MissingEntrySection(this.Context.ExpectedOutputType.ToString())); + } - // Must have found the entry section by now. - if (null == find.EntrySection) - { - throw new WixException(WixErrors.MissingEntrySection(expectedOutputType.ToString())); - } + // Now that we know where we're starting from, create the section to hold the linked content. + var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage); + var allSymbols = find.Symbols; - IDictionary allSymbols = find.Symbols; + // Add the missing standard action symbols. + this.LoadStandardActionSymbols(resolvedSection, allSymbols); - // Add the missing standard action symbols. - this.LoadStandardActionSymbols(allSymbols); + // Resolve the symbol references to find the set of sections we care about for linking. + // Of course, we start with the entry section (that's how it got its name after all). + var resolve = new ResolveReferencesCommand(find.EntrySection, allSymbols); + resolve.BuildingMergeModule = (SectionType.Module == find.EntrySection.Type); - // now that we know where we're starting from, create the output object - output = new Output(null); - output.EntrySection = find.EntrySection; // Note: this entry section will get added to the Output.Sections collection later - if (null != this.Localizer && -1 != this.Localizer.Codepage) - { - output.Codepage = this.Localizer.Codepage; - } - this.activeOutput = output; + resolve.Execute(); - // Resolve the symbol references to find the set of sections we care about for linking. - // Of course, we start with the entry section (that's how it got its name after all). - ResolveReferencesCommand resolve = new ResolveReferencesCommand(output.EntrySection, allSymbols); - resolve.BuildingMergeModule = (OutputType.Module == output.Type); + if (Messaging.Instance.EncounteredError) + { + return null; + } - resolve.Execute(); + // Reset the sections to only those that were resolved then flatten the complex + // references that particpate in groups. + sections = resolve.ResolvedSections.ToList(); - if (Messaging.Instance.EncounteredError) - { - return null; - } + this.FlattenSectionsComplexReferences(sections); - // Add the resolved sections to the output then flatten the complex - // references that particpate in groups. - foreach (Section section in resolve.ResolvedSections) - { - output.Sections.Add(section); - } + if (Messaging.Instance.EncounteredError) + { + return null; + } - this.FlattenSectionsComplexReferences(output.Sections); + // The hard part in linking is processing the complex references. + var referencedComponents = new HashSet(); + var componentsToFeatures = new ConnectToFeatureCollection(); + var featuresToFeatures = new ConnectToFeatureCollection(); + var modulesToFeatures = new ConnectToFeatureCollection(); + this.ProcessComplexReferences(resolvedSection, sections, referencedComponents, componentsToFeatures, featuresToFeatures, modulesToFeatures); - if (Messaging.Instance.EncounteredError) + if (Messaging.Instance.EncounteredError) + { + return null; + } + + // Display an error message for Components that were not referenced by a Feature. + foreach (var symbol in resolve.ReferencedSymbols.Where(s => s.Row.Definition.Type == TupleDefinitionType.Component)) + { + if (!referencedComponents.Contains(symbol.Name)) { - return null; + this.OnMessage(WixErrors.OrphanedComponent(symbol.Row.SourceLineNumbers, symbol.Row.Id.Id)); } + } - // The hard part in linking is processing the complex references. - HashSet referencedComponents = new HashSet(); - ConnectToFeatureCollection componentsToFeatures = new ConnectToFeatureCollection(); - ConnectToFeatureCollection featuresToFeatures = new ConnectToFeatureCollection(); - ConnectToFeatureCollection modulesToFeatures = new ConnectToFeatureCollection(); - this.ProcessComplexReferences(output, output.Sections, referencedComponents, componentsToFeatures, featuresToFeatures, modulesToFeatures); + // Report duplicates that would ultimately end up being primary key collisions. + ReportConflictingSymbolsCommand reportDupes = new ReportConflictingSymbolsCommand(find.PossiblyConflictingSymbols, resolve.ResolvedSections); + reportDupes.Execute(); - if (Messaging.Instance.EncounteredError) - { - return null; - } + if (Messaging.Instance.EncounteredError) + { + return null; + } - // Display an error message for Components that were not referenced by a Feature. - foreach (Symbol symbol in resolve.ReferencedSymbols.Where(s => "Component".Equals(s.Row.TableDefinition.Name, StringComparison.Ordinal))) - { - if (!referencedComponents.Contains(symbol.Name)) - { - this.OnMessage(WixErrors.OrphanedComponent(symbol.Row.SourceLineNumbers, (string)symbol.Row[0])); - } - } + // resolve the feature to feature connects + this.ResolveFeatureToFeatureConnects(featuresToFeatures, allSymbols); - // Report duplicates that would ultimately end up being primary key collisions. - ReportConflictingSymbolsCommand reportDupes = new ReportConflictingSymbolsCommand(find.PossiblyConflictingSymbols, resolve.ResolvedSections); - reportDupes.Execute(); + // start generating OutputTables and OutputRows for all the sections in the output + var ensureTableRows = new List(); - if (Messaging.Instance.EncounteredError) + int sectionCount = 0; + foreach (var section in sections) + { + sectionCount++; + + string sectionId = section.Id; + if (null == sectionId && this.sectionIdOnRows) { - return null; + sectionId = "wix.section." + sectionCount.ToString(CultureInfo.InvariantCulture); } - // resolve the feature to feature connects - this.ResolveFeatureToFeatureConnects(featuresToFeatures, allSymbols); - - // start generating OutputTables and OutputRows for all the sections in the output - List ensureTableRows = new List(); - int sectionCount = 0; - foreach (Section section in output.Sections) + foreach (var tuple in section.Tuples) { - sectionCount++; - string sectionId = section.Id; - if (null == sectionId && this.sectionIdOnRows) - { - sectionId = "wix.section." + sectionCount.ToString(CultureInfo.InvariantCulture); - } + var copyTuple = true; // by default, copy tuples. - foreach (Table table in section.Tables) + // handle special tables + switch (tuple.Definition.Type) { - bool copyRows = true; // by default, copy rows. - - // handle special tables - switch (table.Name) - { +#if MOVE_TO_BACKEND case "AppSearch": this.activeOutput.EnsureTable(this.tableDefinitions["Signature"]); break; +#endif - case "Class": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 2, 11, componentsToFeatures, multipleFeatureComponents); - } - break; + case TupleDefinitionType.Class: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents); + } + break; +#if MOVE_TO_BACKEND case "CustomAction": if (OutputType.Module == this.activeOutput.Type) { @@ -342,29 +328,32 @@ namespace WixToolset } } break; +#endif + case TupleDefinitionType.Extension: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents); + } + break; - case "Extension": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 1, 4, componentsToFeatures, multipleFeatureComponents); - } - break; - - case "ModuleSubstitution": +#if MOVE_TO_BACKEND + case TupleDefinitionType.ModuleSubstitution: containsModuleSubstitution = true; break; - case "ModuleConfiguration": + case TupleDefinitionType.ModuleConfiguration: containsModuleConfiguration = true; break; +#endif - case "MsiAssembly": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 0, 1, componentsToFeatures, multipleFeatureComponents); - } - break; + case TupleDefinitionType.MsiAssembly: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents); + } + break; +#if MOVE_TO_BACKEND case "ProgId": // the Extension table is required with a ProgId table this.activeOutput.EnsureTable(this.tableDefinitions["Extension"]); @@ -382,42 +371,46 @@ namespace WixToolset } } break; +#endif - case "PublishComponent": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 2, 4, componentsToFeatures, multipleFeatureComponents); - } - break; - - case "Shortcut": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 3, 4, componentsToFeatures, multipleFeatureComponents); - } - break; + case TupleDefinitionType.PublishComponent: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents); + } + break; - case "TypeLib": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 2, 6, componentsToFeatures, multipleFeatureComponents); - } - break; + case TupleDefinitionType.Shortcut: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents); + } + break; - case "WixAction": - if (this.sectionIdOnRows) - { - foreach (Row row in table.Rows) - { - row.SectionId = sectionId; - } - } - actionRows.AddRange(table.Rows); + case TupleDefinitionType.TypeLib: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents); + } + break; + +#if MOVE_TO_BACKEND + case TupleDefinitionType.WixAction: + //if (this.sectionIdOnRows) + //{ + // foreach (Row row in table.Rows) + // { + // row.SectionId = sectionId; + // } + //} + actionRows.Add(tuple); break; +#endif +#if SOLVE_CUSTOM_TABLE case "WixCustomTable": this.LinkCustomTable(table, customTableDefinitions); - copyRows = false; // we've created table definitions from these rows, no need to process them any longer + copyTuple = false; // we've created table definitions from these rows, no need to process them any longer break; case "WixCustomRow": @@ -426,19 +419,22 @@ namespace WixToolset row.SectionId = (this.sectionIdOnRows ? sectionId : null); customRows.Add(row); } - copyRows = false; + copyTuple = false; break; +#endif + + case TupleDefinitionType.WixEnsureTable: + ensureTableRows.Add(tuple); + break; - case "WixEnsureTable": - ensureTableRows.AddRange(table.Rows); - break; +#if MOVE_TO_BACKEND case "WixFile": foreach (Row row in table.Rows) { // DiskId is not valid when creating a module, so set it to // 0 for all files to ensure proper sorting in the binder - if (OutputType.Module == this.activeOutput.Type) + if (SectionType.Module == entrySection.Type) { row[5] = 0; } @@ -450,61 +446,76 @@ namespace WixToolset } } break; +#endif - case "WixMerge": - if (OutputType.Product == output.Type) - { - this.ResolveFeatures(table.Rows, 0, 7, modulesToFeatures, null); - } - break; + case TupleDefinitionType.WixMerge: + if (SectionType.Product == resolvedSection.Type) + { + this.ResolveFeatures(tuple, 0, 7, modulesToFeatures, null); + } + break; - case "WixSuppressAction": - suppressActionRows.AddRange(table.Rows); +#if MOVE_TO_BACKEND + case TupleDefinitionType.WixSuppressAction: + suppressActionRows.Add(tuple); break; +#endif - case "WixVariable": - // check for colliding values and collect the wix variable rows - foreach (WixVariableRow row in table.Rows) - { - WixVariableRow collidingRow = (WixVariableRow)wixVariables[row.Id]; + case TupleDefinitionType.WixComplexReference: + copyTuple = false; + break; + + case TupleDefinitionType.WixSimpleReference: + copyTuple = false; + break; - if (null == collidingRow || (collidingRow.Overridable && !row.Overridable)) + case TupleDefinitionType.WixVariable: + // check for colliding values and collect the wix variable rows + { + var row = (WixVariableTuple)tuple; + + if (wixVariables.TryGetValue(row.WixVariable, out var collidingRow)) + { + if (collidingRow.Overridable && !row.Overridable) { - wixVariables[row.Id] = row; + wixVariables[row.WixVariable] = row; } else if (!row.Overridable || (collidingRow.Overridable && row.Overridable)) { - this.OnMessage(WixErrors.WixVariableCollision(row.SourceLineNumbers, row.Id)); + this.OnMessage(WixErrors.WixVariableCollision(row.SourceLineNumbers, row.WixVariable)); } } - copyRows = false; - break; - } + else + { + wixVariables.Add(row.WixVariable, row); + } + } - if (copyRows) - { - Table outputTable = this.activeOutput.EnsureTable(this.tableDefinitions[table.Name]); - this.CopyTableRowsToOutputTable(table, outputTable, sectionId); - } + copyTuple = false; + break; + } + + if (copyTuple) + { + resolvedSection.Tuples.Add(tuple); } } + } - // copy the module to feature connections into the output - if (0 < modulesToFeatures.Count) + // copy the module to feature connections into the output + foreach (ConnectToFeature connectToFeature in modulesToFeatures) + { + foreach (var feature in connectToFeature.ConnectFeatures) { - Table wixFeatureModulesTable = this.activeOutput.EnsureTable(this.tableDefinitions["WixFeatureModules"]); + var row = new WixFeatureModulesTuple(); + row.Feature_ = feature; + row.WixMerge_ = connectToFeature.ChildId; - foreach (ConnectToFeature connectToFeature in modulesToFeatures) - { - foreach (string feature in connectToFeature.ConnectFeatures) - { - Row row = wixFeatureModulesTable.CreateRow(null); - row[0] = feature; - row[1] = connectToFeature.ChildId; - } - } + resolvedSection.Tuples.Add(row); } + } +#if MOVE_TO_BACKEND // ensure the creation of tables that need to exist if (0 < ensureTableRows.Count) { @@ -525,17 +536,14 @@ namespace WixToolset this.activeOutput.EnsureTable(tableDef); } } +#endif - // copy all the suppress action rows to the output to suppress actions from merge modules - if (0 < suppressActionRows.Count) - { - Table suppressActionTable = this.activeOutput.EnsureTable(this.tableDefinitions["WixSuppressAction"]); - suppressActionRows.ForEach(r => suppressActionTable.Rows.Add(r)); - } - +#if MOVE_TO_BACKEND // sequence all the actions this.SequenceActions(actionRows, suppressActionRows); +#endif +#if MOVE_TO_BACKEND // check for missing table and add them or display an error as appropriate switch (this.activeOutput.Type) { @@ -576,7 +584,9 @@ namespace WixToolset } this.CheckForIllegalTables(this.activeOutput); +#endif +#if SOLVE_CUSTOM_TABLE // add the custom row data foreach (Row row in customRows) { @@ -649,35 +659,28 @@ namespace WixToolset } } } +#endif - //correct the section Id in FeatureComponents table - if (this.sectionIdOnRows) - { - Hashtable componentSectionIds = new Hashtable(); - Table componentTable = output.Tables["Component"]; - - if (null != componentTable) - { - foreach (Row componentRow in componentTable.Rows) - { - componentSectionIds.Add(componentRow.Fields[0].Data.ToString(), componentRow.SectionId); - } - } - - Table featureComponentsTable = output.Tables["FeatureComponents"]; - - if (null != featureComponentsTable) - { - foreach (Row featureComponentsRow in featureComponentsTable.Rows) - { - if (componentSectionIds.Contains(featureComponentsRow.Fields[1].Data.ToString())) - { - featureComponentsRow.SectionId = (string)componentSectionIds[featureComponentsRow.Fields[1].Data.ToString()]; - } - } - } - } + //correct the section Id in FeatureComponents table + if (this.sectionIdOnRows) + { + //var componentSectionIds = new Dictionary(); + + //foreach (var componentTuple in entrySection.Tuples.OfType()) + //{ + // componentSectionIds.Add(componentTuple.Id.Id, componentTuple.SectionId); + //} + + //foreach (var featureComponentTuple in entrySection.Tuples.OfType()) + //{ + // if (componentSectionIds.TryGetValue(featureComponentTuple.Component_, out var componentSectionId)) + // { + // featureComponentTuple.SectionId = componentSectionId; + // } + //} + } +#if MOVE_TO_BACKEND // add the ModuleSubstitution table to the ModuleIgnoreTable if (containsModuleSubstitution) { @@ -695,7 +698,9 @@ namespace WixToolset Row moduleIgnoreTableRow = moduleIgnoreTableTable.CreateRow(null); moduleIgnoreTableRow[0] = "ModuleConfiguration"; } +#endif +#if MOVE_TO_BACKEND // index all the file rows Table fileTable = this.activeOutput.Tables["File"]; RowDictionary indexedFileRows = (null == fileTable) ? new RowDictionary() : new RowDictionary(fileTable); @@ -740,47 +745,32 @@ namespace WixToolset } } } +#endif - // copy the wix variable rows to the output after all overriding has been accounted for. - if (0 < wixVariables.Count) - { - Table wixVariableTable = output.EnsureTable(this.tableDefinitions["WixVariable"]); + // copy the wix variable rows to the output after all overriding has been accounted for. + foreach (var row in wixVariables.Values) + { + resolvedSection.Tuples.Add(row); + } - foreach (WixVariableRow row in wixVariables.Values) - { - wixVariableTable.Rows.Add(row); - } - } + // Bundles have groups of data that must be flattened in a way different from other types. + this.FlattenBundleTables(resolvedSection); - // Bundles have groups of data that must be flattened in a way different from other types. - this.FlattenBundleTables(output); + if (Messaging.Instance.EncounteredError) + { + return null; + } - if (Messaging.Instance.EncounteredError) - { - return null; - } + var output = new Intermediate(resolvedSection.Id, new[] { resolvedSection }, null, null); +#if MOVE_TO_BACKEND this.CheckOutputConsistency(output); - - // inspect the output - InspectorCore inspectorCore = new InspectorCore(); - foreach (InspectorExtension inspectorExtension in this.inspectorExtensions) - { - inspectorExtension.Core = inspectorCore; - inspectorExtension.InspectOutput(output); - - // reset - inspectorExtension.Core = null; - } - } - finally - { - this.activeOutput = null; - } +#endif return Messaging.Instance.EncounteredError ? null : output; } +#if SOLVE_CUSTOM_TABLE /// /// Links the definition of a custom table. /// @@ -995,7 +985,9 @@ namespace WixToolset customTableDefinitions.Add(customTable); } } +#endif +#if MOVE_TO_BACKEND /// /// Checks for any tables in the output which are not allowed in the output type. /// @@ -1088,7 +1080,9 @@ namespace WixToolset } } } +#endif +#if MOVE_TO_BACKEND /// /// Performs various consistency checks on the output. /// @@ -1145,30 +1139,30 @@ namespace WixToolset } } } - +#endif /// /// Sends a message to the message delegate if there is one. /// /// Message event arguments. public void OnMessage(MessageEventArgs e) { - Messaging.Instance.OnMessage(e); + this.Context.Messaging.OnMessage(e); } /// /// Load the standard action symbols. /// - /// Collection of symbols. - private void LoadStandardActionSymbols(IDictionary allSymbols) + /// Collection of symbols. + private void LoadStandardActionSymbols(IntermediateSection section, IDictionary symbols) { - foreach (WixActionRow actionRow in this.standardActions) + foreach (var actionRow in WindowsInstallerStandard.StandardActions()) { - Symbol actionSymbol = new Symbol(actionRow); + var symbol = new Symbol(section, actionRow); // If the action's symbol has not already been defined (i.e. overriden by the user), add it now. - if (!allSymbols.ContainsKey(actionSymbol.Name)) + if (!symbols.ContainsKey(symbol.Name)) { - allSymbols.Add(actionSymbol.Name, actionSymbol); + symbols.Add(symbol.Name, symbol); } } } @@ -1176,186 +1170,180 @@ namespace WixToolset /// /// Process the complex references. /// - /// Active output to add sections to. + /// Active section to add tuples to. /// Sections that are referenced during the link process. /// Collection of all components referenced by complex reference. /// Component to feature complex references. /// Feature to feature complex references. /// Module to feature complex references. - private void ProcessComplexReferences(Output output, IEnumerable
sections, ISet referencedComponents, ConnectToFeatureCollection componentsToFeatures, ConnectToFeatureCollection featuresToFeatures, ConnectToFeatureCollection modulesToFeatures) + private void ProcessComplexReferences(IntermediateSection resolvedSection, IEnumerable sections, ISet referencedComponents, ConnectToFeatureCollection componentsToFeatures, ConnectToFeatureCollection featuresToFeatures, ConnectToFeatureCollection modulesToFeatures) { Hashtable componentsToModules = new Hashtable(); - foreach (Section section in sections) + foreach (var section in sections) { - Table wixComplexReferenceTable = section.Tables["WixComplexReference"]; + var featureComponents = new List(); - if (null != wixComplexReferenceTable) + foreach (var wixComplexReferenceRow in section.Tuples.OfType()) { - foreach (WixComplexReferenceRow wixComplexReferenceRow in wixComplexReferenceTable.Rows) + ConnectToFeature connection; + switch (wixComplexReferenceRow.ParentType) { - ConnectToFeature connection; - switch (wixComplexReferenceRow.ParentType) - { - case ComplexReferenceParentType.Feature: - switch (wixComplexReferenceRow.ChildType) - { - case ComplexReferenceChildType.Component: - connection = componentsToFeatures[wixComplexReferenceRow.ChildId]; - if (null == connection) - { - componentsToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentId, wixComplexReferenceRow.IsPrimary)); - } - else if (wixComplexReferenceRow.IsPrimary) + case ComplexReferenceParentType.Feature: + switch (wixComplexReferenceRow.ChildType) + { + case ComplexReferenceChildType.Component: + connection = componentsToFeatures[wixComplexReferenceRow.Child]; + if (null == connection) + { + componentsToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary)); + } + else if (wixComplexReferenceRow.IsPrimary) + { + if (connection.IsExplicitPrimaryFeature) { - if (connection.IsExplicitPrimaryFeature) - { - this.OnMessage(WixErrors.MultiplePrimaryReferences(section.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.ParentId, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : this.activeOutput.EntrySection.Id))); - continue; - } - else - { - connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects - connection.PrimaryFeature = wixComplexReferenceRow.ParentId; // set the new primary feature - connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again - } + this.OnMessage(WixErrors.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), connection.PrimaryFeature ?? resolvedSection.Id)); + continue; } else { - connection.ConnectFeatures.Add(wixComplexReferenceRow.ParentId); + connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects + connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature + connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again } + } + else + { + connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent); + } - // add a row to the FeatureComponents table - Table featureComponentsTable = output.EnsureTable(this.tableDefinitions["FeatureComponents"]); - Row row = featureComponentsTable.CreateRow(null); - if (this.sectionIdOnRows) - { - row.SectionId = section.Id; - } - row[0] = wixComplexReferenceRow.ParentId; - row[1] = wixComplexReferenceRow.ChildId; + // add a row to the FeatureComponents table + var featureComponent = new FeatureComponentsTuple(); + featureComponent.Feature_ = wixComplexReferenceRow.Parent; + featureComponent.Component_ = wixComplexReferenceRow.Child; - // index the component for finding orphaned records - string symbolName = String.Concat("Component:", wixComplexReferenceRow.ChildId); - referencedComponents.Add(symbolName); + featureComponents.Add(featureComponent); - break; + // index the component for finding orphaned records + var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child); + referencedComponents.Add(symbolName); - case ComplexReferenceChildType.Feature: - connection = featuresToFeatures[wixComplexReferenceRow.ChildId]; - if (null != connection) - { - this.OnMessage(WixErrors.MultiplePrimaryReferences(section.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.ParentId, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : this.activeOutput.EntrySection.Id))); - continue; - } + break; - featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentId, wixComplexReferenceRow.IsPrimary)); - break; + case ComplexReferenceChildType.Feature: + connection = featuresToFeatures[wixComplexReferenceRow.Child]; + if (null != connection) + { + this.OnMessage(WixErrors.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); + continue; + } - case ComplexReferenceChildType.Module: - connection = modulesToFeatures[wixComplexReferenceRow.ChildId]; - if (null == connection) - { - modulesToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentId, wixComplexReferenceRow.IsPrimary)); - } - else if (wixComplexReferenceRow.IsPrimary) + featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary)); + break; + + case ComplexReferenceChildType.Module: + connection = modulesToFeatures[wixComplexReferenceRow.Child]; + if (null == connection) + { + modulesToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, wixComplexReferenceRow.Parent, wixComplexReferenceRow.IsPrimary)); + } + else if (wixComplexReferenceRow.IsPrimary) + { + if (connection.IsExplicitPrimaryFeature) { - if (connection.IsExplicitPrimaryFeature) - { - this.OnMessage(WixErrors.MultiplePrimaryReferences(section.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.ParentId, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : this.activeOutput.EntrySection.Id))); - continue; - } - else - { - connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects - connection.PrimaryFeature = wixComplexReferenceRow.ParentId; // set the new primary feature - connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again - } + this.OnMessage(WixErrors.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); + continue; } else { - connection.ConnectFeatures.Add(wixComplexReferenceRow.ParentId); + connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects + connection.PrimaryFeature = wixComplexReferenceRow.Parent; // set the new primary feature + connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again } - break; + } + else + { + connection.ConnectFeatures.Add(wixComplexReferenceRow.Parent); + } + break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); - } - break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); + } + break; - case ComplexReferenceParentType.Module: - switch (wixComplexReferenceRow.ChildType) - { - case ComplexReferenceChildType.Component: - if (componentsToModules.ContainsKey(wixComplexReferenceRow.ChildId)) - { - this.OnMessage(WixErrors.ComponentReferencedTwice(section.SourceLineNumbers, wixComplexReferenceRow.ChildId)); - continue; - } - else - { - componentsToModules.Add(wixComplexReferenceRow.ChildId, wixComplexReferenceRow); // should always be new + case ComplexReferenceParentType.Module: + switch (wixComplexReferenceRow.ChildType) + { + case ComplexReferenceChildType.Component: + if (componentsToModules.ContainsKey(wixComplexReferenceRow.Child)) + { + this.OnMessage(WixErrors.ComponentReferencedTwice(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.Child)); + continue; + } + else + { + componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new - // add a row to the ModuleComponents table - Table moduleComponentsTable = output.EnsureTable(this.tableDefinitions["ModuleComponents"]); - Row row = moduleComponentsTable.CreateRow(null); - if (this.sectionIdOnRows) - { - row.SectionId = section.Id; - } - row[0] = wixComplexReferenceRow.ChildId; - row[1] = wixComplexReferenceRow.ParentId; - row[2] = wixComplexReferenceRow.ParentLanguage; - } + // add a row to the ModuleComponents table + var moduleComponent = new ModuleComponentsTuple(); + moduleComponent.Component = wixComplexReferenceRow.Child; + moduleComponent.ModuleID = wixComplexReferenceRow.Parent; + moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage); + } - // index the component for finding orphaned records - string componentSymbolName = String.Concat("Component:", wixComplexReferenceRow.ChildId); - referencedComponents.Add(componentSymbolName); + // index the component for finding orphaned records + string componentSymbolName = String.Concat("Component:", wixComplexReferenceRow.Child); + referencedComponents.Add(componentSymbolName); - break; + break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); - } - break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); + } + break; - case ComplexReferenceParentType.Patch: - switch (wixComplexReferenceRow.ChildType) - { - case ComplexReferenceChildType.PatchFamily: - case ComplexReferenceChildType.PatchFamilyGroup: - break; + case ComplexReferenceParentType.Patch: + switch (wixComplexReferenceRow.ChildType) + { + case ComplexReferenceChildType.PatchFamily: + case ComplexReferenceChildType.PatchFamilyGroup: + break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); - } - break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); + } + break; - case ComplexReferenceParentType.Product: - switch (wixComplexReferenceRow.ChildType) - { - case ComplexReferenceChildType.Feature: - connection = featuresToFeatures[wixComplexReferenceRow.ChildId]; - if (null != connection) - { - this.OnMessage(WixErrors.MultiplePrimaryReferences(section.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.ChildId, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.ParentId, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : this.activeOutput.EntrySection.Id))); - continue; - } + case ComplexReferenceParentType.Product: + switch (wixComplexReferenceRow.ChildType) + { + case ComplexReferenceChildType.Feature: + connection = featuresToFeatures[wixComplexReferenceRow.Child]; + if (null != connection) + { + this.OnMessage(WixErrors.MultiplePrimaryReferences(wixComplexReferenceRow.SourceLineNumbers, wixComplexReferenceRow.ChildType.ToString(), wixComplexReferenceRow.Child, wixComplexReferenceRow.ParentType.ToString(), wixComplexReferenceRow.Parent, (null != connection.PrimaryFeature ? "Feature" : "Product"), (null != connection.PrimaryFeature ? connection.PrimaryFeature : resolvedSection.Id))); + continue; + } - featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.ChildId, null, wixComplexReferenceRow.IsPrimary)); - break; + featuresToFeatures.Add(new ConnectToFeature(section, wixComplexReferenceRow.Child, null, wixComplexReferenceRow.IsPrimary)); + break; - default: - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); - } - break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceChildType), wixComplexReferenceRow.ChildType))); + } + break; - default: - // Note: Groups have been processed before getting here so they are not handled by any case above. - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType))); - } + default: + // Note: Groups have been processed before getting here so they are not handled by any case above. + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnexpectedComplexReferenceChildType, Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType))); } } + + foreach (var featureComponent in featureComponents) + { + section.Tuples.Add(featureComponent); + } } } @@ -1363,11 +1351,11 @@ namespace WixToolset /// Flattens all complex references in all sections in the collection. ///
/// Sections that are referenced during the link process. - private void FlattenSectionsComplexReferences(IEnumerable
sections) + private void FlattenSectionsComplexReferences(IEnumerable sections) { - Hashtable parentGroups = new Hashtable(); - Hashtable parentGroupsSections = new Hashtable(); - Hashtable parentGroupsNeedingProcessing = new Hashtable(); + var parentGroups = new Dictionary>(); + var parentGroupsSections = new Dictionary(); + var parentGroupsNeedingProcessing = new Dictionary(); // DisplaySectionComplexReferences("--- section's complex references before flattening ---", sections); @@ -1376,69 +1364,60 @@ namespace WixToolset // parents" of Features, Modules, and, of course, Groups. These references // that participate in a "grouping parent" will be removed from their section // now and after processing added back in Step 3 below. - foreach (Section section in sections) + foreach (var section in sections) { - Table wixComplexReferenceTable = section.Tables["WixComplexReference"]; - - if (null != wixComplexReferenceTable) + // Count down because we'll sometimes remove items from the list. + for (int i = section.Tuples.Count - 1; i >= 0; --i) { - // Count down because we'll sometimes remove items from the list. - for (int i = wixComplexReferenceTable.Rows.Count - 1; i >= 0; --i) + // Only process the "grouping parents" such as FeatureGroup, ComponentGroup, Feature, + // and Module. Non-grouping complex references are simple and + // resolved during normal complex reference resolutions. + if (section.Tuples[i] is WixComplexReferenceTuple wixComplexReferenceRow && + (ComplexReferenceParentType.FeatureGroup == wixComplexReferenceRow.ParentType || + ComplexReferenceParentType.ComponentGroup == wixComplexReferenceRow.ParentType || + ComplexReferenceParentType.Feature == wixComplexReferenceRow.ParentType || + ComplexReferenceParentType.Module == wixComplexReferenceRow.ParentType || + ComplexReferenceParentType.PatchFamilyGroup == wixComplexReferenceRow.ParentType || + ComplexReferenceParentType.Product == wixComplexReferenceRow.ParentType)) { - WixComplexReferenceRow wixComplexReferenceRow = (WixComplexReferenceRow)wixComplexReferenceTable.Rows[i]; - - // Only process the "grouping parents" such as FeatureGroup, ComponentGroup, Feature, - // and Module. Non-grouping complex references are simple and - // resolved during normal complex reference resolutions. - if (ComplexReferenceParentType.FeatureGroup == wixComplexReferenceRow.ParentType || - ComplexReferenceParentType.ComponentGroup == wixComplexReferenceRow.ParentType || - ComplexReferenceParentType.Feature == wixComplexReferenceRow.ParentType || - ComplexReferenceParentType.Module == wixComplexReferenceRow.ParentType || - ComplexReferenceParentType.PatchFamilyGroup == wixComplexReferenceRow.ParentType || - ComplexReferenceParentType.Product == wixComplexReferenceRow.ParentType) + var parentTypeAndId = CombineTypeAndId(wixComplexReferenceRow.ParentType, wixComplexReferenceRow.Parent); + + // Group all complex references with a common parent + // together so we can find them quickly while processing in + // Step 2. + if (!parentGroups.TryGetValue(parentTypeAndId, out var childrenComplexRefs)) { - string parentTypeAndId = CombineTypeAndId(wixComplexReferenceRow.ParentType, wixComplexReferenceRow.ParentId); + childrenComplexRefs = new List(); + parentGroups.Add(parentTypeAndId, childrenComplexRefs); + } - // Group all complex references with a common parent - // together so we can find them quickly while processing in - // Step 2. - ArrayList childrenComplexRefs = parentGroups[parentTypeAndId] as ArrayList; - if (null == childrenComplexRefs) - { - childrenComplexRefs = new ArrayList(); - parentGroups.Add(parentTypeAndId, childrenComplexRefs); - } + childrenComplexRefs.Add(wixComplexReferenceRow); + section.Tuples.RemoveAt(i); - childrenComplexRefs.Add(wixComplexReferenceRow); - wixComplexReferenceTable.Rows.RemoveAt(i); + // Remember the mapping from set of complex references with a common + // parent to their section. We'll need this to add them back to the + // correct section in Step 3. + if (!parentGroupsSections.TryGetValue(parentTypeAndId, out var parentSection)) + { + parentGroupsSections.Add(parentTypeAndId, section); + } - // Remember the mapping from set of complex references with a common - // parent to their section. We'll need this to add them back to the - // correct section in Step 3. - Section parentSection = parentGroupsSections[parentTypeAndId] as Section; - if (null == parentSection) - { - parentGroupsSections.Add(parentTypeAndId, section); - } - // Debug.Assert(section == (Section)parentGroupsSections[parentTypeAndId]); - - // If the child of the complex reference is another group, then in Step 2 - // we're going to have to process this complex reference again to copy - // the child group's references into the parent group. - if ((ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || - (ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || - (ComplexReferenceChildType.PatchFamilyGroup == wixComplexReferenceRow.ChildType)) + // If the child of the complex reference is another group, then in Step 2 + // we're going to have to process this complex reference again to copy + // the child group's references into the parent group. + if ((ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || + (ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || + (ComplexReferenceChildType.PatchFamilyGroup == wixComplexReferenceRow.ChildType)) + { + if (!parentGroupsNeedingProcessing.ContainsKey(parentTypeAndId)) { - if (!parentGroupsNeedingProcessing.ContainsKey(parentTypeAndId)) - { - parentGroupsNeedingProcessing.Add(parentTypeAndId, section); - } - // Debug.Assert(section == (Section)parentGroupsNeedingProcessing[parentTypeAndId]); + parentGroupsNeedingProcessing.Add(parentTypeAndId, section); } } } } } + Debug.Assert(parentGroups.Count == parentGroupsSections.Count); Debug.Assert(parentGroupsNeedingProcessing.Count <= parentGroups.Count); @@ -1447,14 +1426,13 @@ namespace WixToolset // Step 2: Loop through the parent groups that have nested groups removing // them from the hash table as they are processed. At the end of this the // complex references should all be flattened. - string[] keys = new string[parentGroupsNeedingProcessing.Keys.Count]; - parentGroupsNeedingProcessing.Keys.CopyTo(keys, 0); + var keys = parentGroupsNeedingProcessing.Keys.ToList(); foreach (string key in keys) { - if (parentGroupsNeedingProcessing.Contains(key)) + if (parentGroupsNeedingProcessing.ContainsKey(key)) { - Stack loopDetector = new Stack(); + var loopDetector = new Stack(); this.FlattenGroup(key, loopDetector, parentGroups, parentGroupsNeedingProcessing); } else @@ -1468,18 +1446,17 @@ namespace WixToolset // in Step 1 and flattened in Step 2 are added to their appropriate // section. This is where we will toss out the final no-longer-needed // groups. - foreach (string parentGroup in parentGroups.Keys) + foreach (var parentGroup in parentGroups.Keys) { - Section section = (Section)parentGroupsSections[parentGroup]; - Table wixComplexReferenceTable = section.Tables["WixComplexReference"]; + var section = parentGroupsSections[parentGroup]; - foreach (WixComplexReferenceRow wixComplexReferenceRow in (ArrayList)parentGroups[parentGroup]) + foreach (var wixComplexReferenceRow in parentGroups[parentGroup]) { if ((ComplexReferenceParentType.FeatureGroup != wixComplexReferenceRow.ParentType) && (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) && (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType)) { - wixComplexReferenceTable.Rows.Add(wixComplexReferenceRow); + section.Tuples.Add(wixComplexReferenceRow); } } } @@ -1504,46 +1481,39 @@ namespace WixToolset /// Stack of groups processed thus far. Used to detect loops. /// Hash table of complex references grouped by parent id. /// Hash table of parent groups that still have nested groups that need to be flattened. - private void FlattenGroup(string parentTypeAndId, Stack loopDetector, Hashtable parentGroups, Hashtable parentGroupsNeedingProcessing) + private void FlattenGroup(string parentTypeAndId, Stack loopDetector, Dictionary> parentGroups, Dictionary parentGroupsNeedingProcessing) { - Debug.Assert(parentGroupsNeedingProcessing.Contains(parentTypeAndId)); + Debug.Assert(parentGroupsNeedingProcessing.ContainsKey(parentTypeAndId)); loopDetector.Push(parentTypeAndId); // push this complex reference parent identfier into the stack for loop verifying - ArrayList allNewChildComplexReferences = new ArrayList(); - ArrayList referencesToParent = (ArrayList)parentGroups[parentTypeAndId]; - foreach (WixComplexReferenceRow wixComplexReferenceRow in referencesToParent) + var allNewChildComplexReferences = new List(); + + var referencesToParent = parentGroups[parentTypeAndId]; + foreach (var wixComplexReferenceRow in referencesToParent) { Debug.Assert(ComplexReferenceParentType.ComponentGroup == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.FeatureGroup == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.Feature == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.Module == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.Product == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.PatchFamilyGroup == wixComplexReferenceRow.ParentType || ComplexReferenceParentType.Patch == wixComplexReferenceRow.ParentType); - Debug.Assert(parentTypeAndId == CombineTypeAndId(wixComplexReferenceRow.ParentType, wixComplexReferenceRow.ParentId)); + Debug.Assert(parentTypeAndId == CombineTypeAndId(wixComplexReferenceRow.ParentType, wixComplexReferenceRow.Parent)); // We are only interested processing when the child is a group. if ((ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || (ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || (ComplexReferenceChildType.PatchFamilyGroup == wixComplexReferenceRow.ChildType)) { - string childTypeAndId = CombineTypeAndId(wixComplexReferenceRow.ChildType, wixComplexReferenceRow.ChildId); + string childTypeAndId = CombineTypeAndId(wixComplexReferenceRow.ChildType, wixComplexReferenceRow.Child); if (loopDetector.Contains(childTypeAndId)) { // Create a comma delimited list of the references that participate in the // loop for the error message. Start at the bottom of the stack and work the // way up to present the loop as a directed graph. - object[] stack = loopDetector.ToArray(); - StringBuilder loop = new StringBuilder(); - for (int i = stack.Length - 1; i >= 0; --i) - { - loop.Append((string)stack[i]); - if (0 < i) - { - loop.Append(" -> "); - } - } + var loop = String.Join(" -> ", loopDetector); - this.OnMessage(WixErrors.ReferenceLoopDetected(wixComplexReferenceRow.Table.Section == null ? null : wixComplexReferenceRow.Table.Section.SourceLineNumbers, loop.ToString())); + this.OnMessage(WixErrors.ReferenceLoopDetected(wixComplexReferenceRow?.SourceLineNumbers, loop)); // Cleanup the parentGroupsNeedingProcessing and the loopDetector just like the // exit of this method does at the end because we are exiting early. loopDetector.Pop(); parentGroupsNeedingProcessing.Remove(parentTypeAndId); + return; // bail } @@ -1560,10 +1530,9 @@ namespace WixToolset // complex reference (because we're moving references up the tree), and finally // add the cloned child's complex reference to the list of complex references // that we'll eventually add to the parent group. - ArrayList referencesToChild = (ArrayList)parentGroups[childTypeAndId]; - if (null != referencesToChild) + if (parentGroups.TryGetValue(childTypeAndId, out var referencesToChild)) { - foreach (WixComplexReferenceRow crefChild in referencesToChild) + foreach (var crefChild in referencesToChild) { // Only merge up the non-group items since groups are purged // after this part of the processing anyway (cloning them would @@ -1572,8 +1541,8 @@ namespace WixToolset (ComplexReferenceChildType.ComponentGroup != crefChild.ChildType) || (ComplexReferenceChildType.PatchFamilyGroup != crefChild.ChildType)) { - WixComplexReferenceRow crefChildClone = crefChild.Clone(); - Debug.Assert(crefChildClone.ParentId == wixComplexReferenceRow.ChildId); + var crefChildClone = crefChild.Clone(); + Debug.Assert(crefChildClone.Parent == wixComplexReferenceRow.Child); crefChildClone.Reparent(wixComplexReferenceRow); allNewChildComplexReferences.Add(crefChildClone); @@ -1587,10 +1556,11 @@ namespace WixToolset // group. Clean out any left over groups and quietly remove any // duplicate complex references that occurred during the merge. referencesToParent.AddRange(allNewChildComplexReferences); - referencesToParent.Sort(); + referencesToParent.Sort(ComplexReferenceComparision); for (int i = referencesToParent.Count - 1; i >= 0; --i) { - WixComplexReferenceRow wixComplexReferenceRow = (WixComplexReferenceRow)referencesToParent[i]; + var wixComplexReferenceRow = referencesToParent[i]; + if ((ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || (ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || (ComplexReferenceChildType.PatchFamilyGroup == wixComplexReferenceRow.ChildType)) @@ -1602,7 +1572,7 @@ namespace WixToolset // Since the list is already sorted, we can find duplicates by simply // looking at the next sibling in the list and tossing out one if they // match. - WixComplexReferenceRow crefCompare = (WixComplexReferenceRow)referencesToParent[i - 1]; + var crefCompare = referencesToParent[i - 1]; if (0 == wixComplexReferenceRow.CompareToWithoutConsideringPrimary(crefCompare)) { referencesToParent.RemoveAt(i); @@ -1610,6 +1580,29 @@ namespace WixToolset } } + int ComplexReferenceComparision(WixComplexReferenceTuple x, WixComplexReferenceTuple y) + { + var comparison = x.ChildType - y.ChildType; + if (0 == comparison) + { + comparison = String.Compare(x.Child, y.Child, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = x.ParentType - y.ParentType; + if (0 == comparison) + { + comparison = String.Compare(x.ParentLanguage ?? String.Empty, y.ParentLanguage ?? String.Empty, StringComparison.Ordinal); + if (0 == comparison) + { + comparison = String.Compare(x.Parent, y.Parent, StringComparison.Ordinal); + } + } + } + } + + return comparison; + } + loopDetector.Pop(); // pop this complex reference off the stack since we're done verify the loop here parentGroupsNeedingProcessing.Remove(parentTypeAndId); // remove the newly processed complex reference } @@ -1639,9 +1632,9 @@ namespace WixToolset /// Flattens the tables used in a Bundle. ///
/// Output containing the tables to process. - private void FlattenBundleTables(Output output) + private void FlattenBundleTables(IntermediateSection entrySection) { - if (OutputType.Bundle != output.Type) + if (SectionType.Bundle != entrySection.Type) { return; } @@ -1651,7 +1644,7 @@ namespace WixToolset // will hold Payloads under UX, ChainPackages (references?) under Chain, // and ChainPackages/Payloads under the attached and any detatched // Containers. - WixGroupingOrdering groups = new WixGroupingOrdering(output, this); + var groups = new WixGroupingOrdering(entrySection, this); // Create UX payloads and Package payloads groups.UseTypes(new string[] { "Container", "Layout", "PackageGroup", "PayloadGroup", "Package" }, new string[] { "PackageGroup", "Package", "PayloadGroup", "Payload" }); @@ -1675,21 +1668,21 @@ namespace WixToolset { foreach (ConnectToFeature connection in featuresToFeatures) { - WixSimpleReferenceRow wixSimpleReferenceRow = new WixSimpleReferenceRow(null, this.tableDefinitions["WixSimpleReference"]); - wixSimpleReferenceRow.TableName = "Feature"; + var wixSimpleReferenceRow = new WixSimpleReferenceTuple(); + wixSimpleReferenceRow.Table = "Feature"; wixSimpleReferenceRow.PrimaryKeys = connection.ChildId; - Symbol symbol; - if (!allSymbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out symbol)) + if (!allSymbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol)) { continue; } - Row row = symbol.Row; - row[1] = connection.PrimaryFeature; + var row = symbol.Row; + row.Set(1, connection.PrimaryFeature); } } +#if DEAD_CODE /// /// Copies a table's rows to an output table. /// @@ -1731,16 +1724,18 @@ namespace WixToolset outputTable.Rows.Add(row); } } +#endif +#if MOVE_TO_BACKEND /// /// Set sequence numbers for all the actions and create rows in the output object. /// /// Collection of actions to schedule. /// Collection of actions to suppress. - private void SequenceActions(List actionRows, List suppressActionRows) + private void SequenceActions(List actionRows, List suppressActionRows) { - WixActionRowCollection overridableActionRows = new WixActionRowCollection(); - WixActionRowCollection requiredActionRows = new WixActionRowCollection(); + var overridableActionRows = new WixActionRowCollection(); + var requiredActionRows = new WixActionRowCollection(); ArrayList scheduledActionRows = new ArrayList(); // gather the required actions for the output type @@ -2362,6 +2357,7 @@ namespace WixToolset WixActionRowCollection relatedRows = (after ? parentActionRow.NextActionRows : parentActionRow.PreviousActionRows); relatedRows.Add(actionRow); } +#endif /// /// Resolve features for columns that have null guid placeholders. @@ -2371,59 +2367,55 @@ namespace WixToolset /// Number of the column containing the feature. /// Connect to feature complex references. /// Hashtable of known components under multiple features. - private void ResolveFeatures(IEnumerable rows, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents) + private void ResolveFeatures(IntermediateTuple row, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents) { - foreach (Row row in rows) + var connectionId = row.AsString(connectionColumn); + var featureId = row.AsString(featureColumn); + + if (emptyGuid == featureId) { - string connectionId = (string)row[connectionColumn]; - string featureId = (string)row[featureColumn]; + ConnectToFeature connection = connectToFeatures[connectionId]; - if (emptyGuid == featureId) + if (null == connection) { - ConnectToFeature connection = connectToFeatures[connectionId]; - - if (null == connection) + // display an error for the component or merge module as approrpriate + if (null != multipleFeatureComponents) { - // display an error for the component or merge module as approrpriate - if (null != multipleFeatureComponents) - { - this.OnMessage(WixErrors.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Table.Name, row.GetPrimaryKey('/'))); - } - else - { - this.OnMessage(WixErrors.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId)); - } + this.OnMessage(WixErrors.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id)); } else { - // check for unique, implicit, primary feature parents with multiple possible parent features - if (this.ShowPedanticMessages && - !connection.IsExplicitPrimaryFeature && - 0 < connection.ConnectFeatures.Count) + this.OnMessage(WixErrors.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId)); + } + } + else + { + // check for unique, implicit, primary feature parents with multiple possible parent features + if (this.ShowPedanticMessages && + !connection.IsExplicitPrimaryFeature && + 0 < connection.ConnectFeatures.Count) + { + // display a warning for the component or merge module as approrpriate + if (null != multipleFeatureComponents) { - // display a warning for the component or merge module as approrpriate - if (null != multipleFeatureComponents) + if (!multipleFeatureComponents.Contains(connectionId)) { - if (!multipleFeatureComponents.Contains(connectionId)) - { - this.OnMessage(WixWarnings.ImplicitComponentPrimaryFeature(connectionId)); + this.OnMessage(WixWarnings.ImplicitComponentPrimaryFeature(connectionId)); - // remember this component so only one warning is generated for it - multipleFeatureComponents[connectionId] = null; - } - } - else - { - this.OnMessage(WixWarnings.ImplicitMergeModulePrimaryFeature(connectionId)); + // remember this component so only one warning is generated for it + multipleFeatureComponents[connectionId] = null; } } - - // set the feature - row[featureColumn] = connection.PrimaryFeature; + else + { + this.OnMessage(WixWarnings.ImplicitMergeModulePrimaryFeature(connectionId)); + } } + + // set the feature + row.Set(featureColumn, connection.PrimaryFeature); } } } - } } diff --git a/src/WixToolset.Core/Localizer.cs b/src/WixToolset.Core/Localizer.cs index 72d0955b..a19c32fb 100644 --- a/src/WixToolset.Core/Localizer.cs +++ b/src/WixToolset.Core/Localizer.cs @@ -18,7 +18,7 @@ namespace WixToolset public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; private static string XmlElementName = "WixLocalization"; - private Dictionary variables; + private Dictionary variables; private Dictionary localizedControls; /// @@ -27,7 +27,7 @@ namespace WixToolset public Localizer(IEnumerable localizations) { this.Codepage = -1; - this.variables = new Dictionary(); + this.variables = new Dictionary(); this.localizedControls = new Dictionary(); foreach (var localization in localizations) @@ -37,9 +37,9 @@ namespace WixToolset this.Codepage = localization.Codepage; } - foreach (WixVariableRow wixVariableRow in localization.Variables) + foreach (var variable in localization.Variables) { - Localizer.AddWixVariable(this.variables, wixVariableRow); + Localizer.AddWixVariable(this.variables, variable); } foreach (KeyValuePair localizedControl in localization.LocalizedControls) @@ -86,7 +86,7 @@ namespace WixToolset /// Collection containing TableDefinitions to use when loading the localization file. /// Suppress xml schema validation while loading. /// Returns the loaded localization file. - public static Localization ParseLocalizationFile(string path, TableDefinitionCollection tableDefinitions) + public static Localization ParseLocalizationFile(string path) { XElement root = XDocument.Load(path).Root; Localization localization = null; @@ -96,7 +96,7 @@ namespace WixToolset { if (Localizer.WxlNamespace == root.Name.Namespace) { - localization = ParseWixLocalizationElement(root, tableDefinitions); + localization = ParseWixLocalizationElement(root); } else // invalid or missing namespace { @@ -123,7 +123,7 @@ namespace WixToolset /// /// Dictionary of variable rows. /// Row to add to the variables dictionary. - private static void AddWixVariable(IDictionary variables, WixVariableRow wixVariableRow) + private static void AddWixVariable(IDictionary variables, BindVariable wixVariableRow) { if (!variables.TryGetValue(wixVariableRow.Id, out var existingWixVariableRow) || (existingWixVariableRow.Overridable && !wixVariableRow.Overridable)) { @@ -139,7 +139,7 @@ namespace WixToolset /// Parses the WixLocalization element. /// /// Element to parse. - private static Localization ParseWixLocalizationElement(XElement node, TableDefinitionCollection tableDefinitions) + private static Localization ParseWixLocalizationElement(XElement node) { int codepage = -1; string culture = null; @@ -171,7 +171,7 @@ namespace WixToolset } } - Dictionary variables = new Dictionary(); + Dictionary variables = new Dictionary(); Dictionary localizedControls = new Dictionary(); foreach (XElement child in node.Elements()) @@ -181,7 +181,7 @@ namespace WixToolset switch (child.Name.LocalName) { case "String": - Localizer.ParseString(child, variables, tableDefinitions); + Localizer.ParseString(child, variables); break; case "UI": @@ -206,7 +206,7 @@ namespace WixToolset /// Parse a localization string into a WixVariableRow. ///
/// Element to parse. - private static void ParseString(XElement node, IDictionary variables, TableDefinitionCollection tableDefinitions) + private static void ParseString(XElement node, IDictionary variables) { string id = null; bool overridable = false; @@ -251,12 +251,15 @@ namespace WixToolset if (!Messaging.Instance.EncounteredError) { - WixVariableRow wixVariableRow = new WixVariableRow(sourceLineNumbers, tableDefinitions["WixVariable"]); - wixVariableRow.Id = id; - wixVariableRow.Overridable = overridable; - wixVariableRow.Value = value; + var variable = new BindVariable + { + SourceLineNumbers = sourceLineNumbers, + Id = id, + Overridable = overridable, + Value = value, + }; - Localizer.AddWixVariable(variables, wixVariableRow); + Localizer.AddWixVariable(variables, variable); } } diff --git a/src/WixToolset.Core/Melter.cs b/src/WixToolset.Core/Melter.cs deleted file mode 100644 index ccc0cb6f..00000000 --- a/src/WixToolset.Core/Melter.cs +++ /dev/null @@ -1,398 +0,0 @@ -// 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 -{ - using System; - using System.CodeDom.Compiler; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Globalization; - using System.IO; - using System.Text; - using System.Text.RegularExpressions; - using WixToolset.Data; - using Wix = WixToolset.Data.Serialize; - - /// - /// Converts a wixout representation of an MSM database into a ComponentGroup the form of WiX source. - /// - public sealed class Melter - { - private MelterCore core; - private Decompiler decompiler; - - private Wix.ComponentGroup componentGroup; - private Wix.DirectoryRef primaryDirectoryRef; - private Wix.Fragment fragment; - - private string id; - private string moduleId; - private const string nullGuid = "{00000000-0000-0000-0000-000000000000}"; - - public string Id - { - get { return this.id; } - set { this.id = value; } - } - - public Decompiler Decompiler - { - get { return this.decompiler; } - set { this.decompiler = value; } - } - - /// - /// Creates a new melter object. - /// - /// The decompiler to use during the melting process. - /// The Id to use for the ComponentGroup, DirectoryRef, and WixVariables. If null, defaults to the Module's Id - public Melter(Decompiler decompiler, string id) - { - this.core = new MelterCore(); - - this.componentGroup = new Wix.ComponentGroup(); - this.fragment = new Wix.Fragment(); - this.primaryDirectoryRef = new Wix.DirectoryRef(); - - this.decompiler = decompiler; - this.id = id; - - if (null == this.decompiler) - { - this.core.OnMessage(WixErrors.ExpectedDecompiler("The melting process")); - } - } - - /// - /// Converts a Module wixout into a ComponentGroup. - /// - /// The output object representing the unbound merge module to melt. - /// The converted Module as a ComponentGroup. - public Wix.Wix Melt(Output wixout) - { - this.moduleId = GetModuleId(wixout); - - // Assign the default componentGroupId if none was specified - if (null == this.id) - { - this.id = this.moduleId; - } - - this.componentGroup.Id = this.id; - this.primaryDirectoryRef.Id = this.id; - - PreDecompile(wixout); - - wixout.Type = OutputType.Product; - this.decompiler.TreatProductAsModule = true; - Wix.Wix wix = this.decompiler.Decompile(wixout); - - if (null == wix) - { - return wix; - } - - ConvertModule(wix); - - return wix; - } - - /// - /// Converts a Module to a ComponentGroup and adds all of its relevant elements to the main fragment. - /// - /// The output object representing an unbound merge module. - private void ConvertModule(Wix.Wix wix) - { - Wix.Product product = Melter.GetProduct(wix); - - List customActionsRemoved = new List(); - Dictionary customsToRemove = new Dictionary(); - - foreach (Wix.ISchemaElement child in product.Children) - { - Wix.Directory childDir = child as Wix.Directory; - if (null != childDir) - { - bool isTargetDir = this.WalkDirectory(childDir); - if (isTargetDir) - { - continue; - } - } - else - { - Wix.Dependency childDep = child as Wix.Dependency; - if (null != childDep) - { - this.AddPropertyRef(childDep.RequiredId); - continue; - } - else if (child is Wix.Package) - { - continue; - } - else if (child is Wix.CustomAction) - { - Wix.CustomAction customAction = child as Wix.CustomAction; - string directoryId; - if (StartsWithStandardDirectoryId(customAction.Id, out directoryId) && customAction.Property == customAction.Id) - { - customActionsRemoved.Add(customAction.Id); - continue; - } - } - else if (child is Wix.InstallExecuteSequence) - { - Wix.InstallExecuteSequence installExecuteSequence = child as Wix.InstallExecuteSequence; - - foreach (Wix.ISchemaElement sequenceChild in installExecuteSequence.Children) - { - Wix.Custom custom = sequenceChild as Wix.Custom; - string directoryId; - if (custom != null && StartsWithStandardDirectoryId(custom.Action, out directoryId)) - { - customsToRemove.Add(custom, installExecuteSequence); - } - } - } - } - - this.fragment.AddChild(child); - } - - // For any customaction that we removed, also remove the scheduling of that action. - foreach (Wix.Custom custom in customsToRemove.Keys) - { - if (customActionsRemoved.Contains(custom.Action)) - { - ((Wix.InstallExecuteSequence)customsToRemove[custom]).RemoveChild(custom); - } - } - - AddProperty(this.moduleId, this.id); - - wix.RemoveChild(product); - wix.AddChild(this.fragment); - - this.fragment.AddChild(this.componentGroup); - this.fragment.AddChild(this.primaryDirectoryRef); - } - - /// - /// Gets the module from the Wix object. - /// - /// The Wix object. - /// The Module in the Wix object, null if no Module was found - private static Wix.Product GetProduct(Wix.Wix wix) - { - foreach (Wix.ISchemaElement element in wix.Children) - { - Wix.Product productElement = element as Wix.Product; - if (null != productElement) - { - return productElement; - } - } - return null; - } - - /// - /// Adds a PropertyRef to the main Fragment. - /// - /// Id of the PropertyRef. - private void AddPropertyRef(string propertyRefId) - { - Wix.PropertyRef propertyRef = new Wix.PropertyRef(); - propertyRef.Id = propertyRefId; - this.fragment.AddChild(propertyRef); - } - - /// - /// Adds a Property to the main Fragment. - /// - /// Id of the Property. - /// Value of the Property. - private void AddProperty(string propertyId, string value) - { - Wix.Property property = new Wix.Property(); - property.Id = propertyId; - property.Value = value; - this.fragment.AddChild(property); - } - - /// - /// Walks a directory structure obtaining Component Id's and Standard Directory Id's. - /// - /// The Directory to walk. - /// true if the directory is TARGETDIR. - private bool WalkDirectory(Wix.Directory directory) - { - bool isTargetDir = false; - if ("TARGETDIR" == directory.Id) - { - isTargetDir = true; - } - - string standardDirectoryId = null; - if (Melter.StartsWithStandardDirectoryId(directory.Id, out standardDirectoryId) && !isTargetDir) - { - this.AddSetPropertyCustomAction(directory.Id, String.Format(CultureInfo.InvariantCulture, "[{0}]", standardDirectoryId)); - } - - foreach (Wix.ISchemaElement child in directory.Children) - { - Wix.Directory childDir = child as Wix.Directory; - if (null != childDir) - { - if (isTargetDir) - { - this.primaryDirectoryRef.AddChild(child); - } - this.WalkDirectory(childDir); - } - else - { - Wix.Component childComponent = child as Wix.Component; - if (null != childComponent) - { - if (isTargetDir) - { - this.primaryDirectoryRef.AddChild(child); - } - this.AddComponentRef(childComponent); - } - } - } - - return isTargetDir; - } - - /// - /// Gets the module Id out of the Output object. - /// - /// The output object. - /// The module Id from the Output object. - private string GetModuleId(Output wixout) - { - // get the moduleId from the wixout - Table moduleSignatureTable = wixout.Tables["ModuleSignature"]; - if (null == moduleSignatureTable || 0 >= moduleSignatureTable.Rows.Count) - { - this.core.OnMessage(WixErrors.ExpectedTableInMergeModule("ModuleSignature")); - } - return moduleSignatureTable.Rows[0].Fields[0].Data.ToString(); - } - - /// - /// Determines if the directory Id starts with a standard directory id. - /// - /// The directory id. - /// The standard directory id. - /// true if the directory starts with a standard directory id. - private static bool StartsWithStandardDirectoryId(string directoryId, out string standardDirectoryId) - { - standardDirectoryId = null; - foreach (string id in WindowsInstallerStandard.GetStandardDirectories()) - { - if (directoryId.StartsWith(id, StringComparison.Ordinal)) - { - standardDirectoryId = id; - return true; - } - } - return false; - } - - /// - /// Adds a ComponentRef to the main ComponentGroup. - /// - /// The component to add. - private void AddComponentRef(Wix.Component component) - { - Wix.ComponentRef componentRef = new Wix.ComponentRef(); - componentRef.Id = component.Id; - this.componentGroup.AddChild(componentRef); - } - - /// - /// Adds a SetProperty CA for a Directory. - /// - /// The Id of the Property to set. - /// The value to set the Property to. - private void AddSetPropertyCustomAction(string propertyId, string value) - { - // Add the action - Wix.CustomAction customAction = new Wix.CustomAction(); - customAction.Id = propertyId; - customAction.Property = propertyId; - customAction.Value = value; - this.fragment.AddChild(customAction); - - // Schedule the action - Wix.InstallExecuteSequence installExecuteSequence = new Wix.InstallExecuteSequence(); - Wix.Custom custom = new Wix.Custom(); - custom.Action = customAction.Id; - custom.Before = "CostInitialize"; - installExecuteSequence.AddChild(custom); - this.fragment.AddChild(installExecuteSequence); - } - - /// - /// Does any operations to the wixout that would need to be done before decompiling. - /// - /// The output object representing the unbound merge module. - private void PreDecompile(Output wixout) - { - string wixVariable = String.Format(CultureInfo.InvariantCulture, "!(wix.{0}", this.id); - - foreach (Table table in wixout.Tables) - { - // Determine if the table has a feature foreign key - bool hasFeatureForeignKey = false; - foreach (ColumnDefinition columnDef in table.Definition.Columns) - { - if (null != columnDef.KeyTable) - { - string[] keyTables = columnDef.KeyTable.Split(';'); - foreach (string keyTable in keyTables) - { - if ("Feature" == keyTable) - { - hasFeatureForeignKey = true; - break; - } - } - } - } - - // If this table has no foreign keys to the feature table, skip it. - if (!hasFeatureForeignKey) - { - continue; - } - - // Go through all the rows and replace the null guid with the wix variable - // for columns that are foreign keys into the feature table. - foreach (Row row in table.Rows) - { - foreach (Field field in row.Fields) - { - if (null != field.Column.KeyTable) - { - string[] keyTables = field.Column.KeyTable.Split(';'); - foreach (string keyTable in keyTables) - { - if ("Feature" == keyTable) - { - field.Data = field.Data.ToString().Replace(nullGuid, wixVariable); - break; - } - } - } - } - } - } - } - } -} diff --git a/src/WixToolset.Core/MelterCore.cs b/src/WixToolset.Core/MelterCore.cs deleted file mode 100644 index 75d43619..00000000 --- a/src/WixToolset.Core/MelterCore.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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 -{ - using WixToolset.Data; - - /// - /// Melts a Module Wix document into a ComponentGroup representation. - /// - public sealed class MelterCore : IMessageHandler - { - /// - /// Gets whether the melter core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - public bool EncounteredError - { - get { return Messaging.Instance.EncounteredError; } - } - - /// - /// Sends a message to the message delegate if there is one. - /// - /// Message event arguments. - public void OnMessage(MessageEventArgs e) - { - Messaging.Instance.OnMessage(e); - } - } -} diff --git a/src/WixToolset.Core/PatchTransform.cs b/src/WixToolset.Core/PatchTransform.cs deleted file mode 100644 index 46e4e6d7..00000000 --- a/src/WixToolset.Core/PatchTransform.cs +++ /dev/null @@ -1,274 +0,0 @@ -// 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 -{ - using System; - using System.Collections; - using System.Globalization; - using System.Text; - using System.Text.RegularExpressions; - using WixToolset.Data; - using WixToolset.Extensibility; - - public class PatchTransform : IMessageHandler - { - private string baseline; - private Output transform; - private string transformPath; - - public string Baseline - { - get { return this.baseline; } - } - - public Output Transform - { - get - { - if (null == this.transform) - { - this.transform = Output.Load(this.transformPath, false); - } - - return this.transform; - } - } - - public string TransformPath - { - get { return this.transformPath; } - } - - public PatchTransform(string transformPath, string baseline) - { - this.transformPath = transformPath; - this.baseline = baseline; - } - - /// - /// Validates that the differences in the transform are valid for patch transforms. - /// - public void Validate() - { - // Changing the ProdocutCode in a patch transform is not recommended. - Table propertyTable = this.Transform.Tables["Property"]; - if (null != propertyTable) - { - foreach (Row row in propertyTable.Rows) - { - // Only interested in modified rows; fast check. - if (RowOperation.Modify == row.Operation) - { - if (0 == String.CompareOrdinal("ProductCode", (string)row[0])) - { - this.OnMessage(WixWarnings.MajorUpgradePatchNotRecommended()); - } - } - } - } - - // If there is nothing in the component table we can return early because the remaining checks are component based. - Table componentTable = this.Transform.Tables["Component"]; - if (null == componentTable) - { - return; - } - - // Index Feature table row operations - Table featureTable = this.Transform.Tables["Feature"]; - Table featureComponentsTable = this.Transform.Tables["FeatureComponents"]; - Hashtable featureOps = null; - if (null != featureTable) - { - int capacity = featureTable.Rows.Count; - featureOps = new Hashtable(capacity); - - foreach (Row row in featureTable.Rows) - { - featureOps[(string)row[0]] = row.Operation; - } - } - else - { - featureOps = new Hashtable(); - } - - // Index Component table and check for keypath modifications - Hashtable deletedComponent = new Hashtable(); - Hashtable componentKeyPath = new Hashtable(); - foreach (Row row in componentTable.Rows) - { - string id = row.Fields[0].Data.ToString(); - string keypath = (null == row.Fields[5].Data) ? String.Empty : row.Fields[5].Data.ToString(); - - componentKeyPath.Add(id, keypath); - if (RowOperation.Delete == row.Operation) - { - deletedComponent.Add(id, row); - } - else if (RowOperation.Modify == row.Operation) - { - if (row.Fields[1].Modified) - { - // Changing the guid of a component is equal to deleting the old one and adding a new one. - deletedComponent.Add(id, row); - } - - // If the keypath is modified its an error - if (row.Fields[5].Modified) - { - this.OnMessage(WixErrors.InvalidKeypathChange(row.SourceLineNumbers, id, this.transformPath)); - } - } - } - - // Verify changes in the file table - Table fileTable = this.Transform.Tables["File"]; - if (null != fileTable) - { - Hashtable componentWithChangedKeyPath = new Hashtable(); - foreach (Row row in fileTable.Rows) - { - if (RowOperation.None != row.Operation) - { - string fileId = row.Fields[0].Data.ToString(); - string componentId = row.Fields[1].Data.ToString(); - - // If this file is the keypath of a component - if (String.Equals((string)componentKeyPath[componentId], fileId, StringComparison.Ordinal)) - { - if (row.Fields[2].Modified) - { - // You cant change the filename of a file that is the keypath of a component. - this.OnMessage(WixErrors.InvalidKeypathChange(row.SourceLineNumbers, componentId, this.transformPath)); - } - - if (!componentWithChangedKeyPath.ContainsKey(componentId)) - { - componentWithChangedKeyPath.Add(componentId, fileId); - } - } - - if (RowOperation.Delete == row.Operation) - { - // If the file is removed from a component that is not deleted. - if (!deletedComponent.ContainsKey(componentId)) - { - bool foundRemoveFileEntry = false; - string filename = Common.GetName((string)row[2], false, true); - - Table removeFileTable = this.Transform.Tables["RemoveFile"]; - if (null != removeFileTable) - { - foreach (Row removeFileRow in removeFileTable.Rows) - { - if (RowOperation.Delete == removeFileRow.Operation) - { - continue; - } - - if (componentId == (string)removeFileRow[1]) - { - // Check if there is a RemoveFile entry for this file - if (null != removeFileRow[2]) - { - string removeFileName = Common.GetName((string)removeFileRow[2], false, true); - - // Convert the MSI format for a wildcard string to Regex format. - removeFileName = removeFileName.Replace('.', '|').Replace('?', '.').Replace("*", ".*").Replace("|", "\\."); - - Regex regex = new Regex(removeFileName, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (regex.IsMatch(filename)) - { - foundRemoveFileEntry = true; - break; - } - } - } - } - } - - if (!foundRemoveFileEntry) - { - this.OnMessage(WixWarnings.InvalidRemoveFile(row.SourceLineNumbers, fileId, componentId)); - } - } - } - } - } - } - - if (0 < deletedComponent.Count) - { - // Index FeatureComponents table. - Hashtable featureComponents = new Hashtable(); - - if (null != featureComponentsTable) - { - foreach (Row row in featureComponentsTable.Rows) - { - ArrayList features; - string componentId = row.Fields[1].Data.ToString(); - - if (featureComponents.Contains(componentId)) - { - features = (ArrayList)featureComponents[componentId]; - } - else - { - features = new ArrayList(); - featureComponents.Add(componentId, features); - } - features.Add(row.Fields[0].Data.ToString()); - } - } - - // Check to make sure if a component was deleted, the feature was too. - foreach (DictionaryEntry entry in deletedComponent) - { - if (featureComponents.Contains(entry.Key.ToString())) - { - ArrayList features = (ArrayList)featureComponents[entry.Key.ToString()]; - foreach (string featureId in features) - { - if (!featureOps.ContainsKey(featureId) || RowOperation.Delete != (RowOperation)featureOps[featureId]) - { - // The feature was not deleted. - this.OnMessage(WixErrors.InvalidRemoveComponent(((Row)entry.Value).SourceLineNumbers, entry.Key.ToString(), featureId, this.transformPath)); - } - } - } - } - } - - // Warn if new components are added to existing features - if (null != featureComponentsTable) - { - foreach (Row row in featureComponentsTable.Rows) - { - if (RowOperation.Add == row.Operation) - { - // Check if the feature is in the Feature table - string feature_ = (string)row[0]; - string component_ = (string)row[1]; - - // Features may not be present if not referenced - if (!featureOps.ContainsKey(feature_) || RowOperation.Add != (RowOperation)featureOps[feature_]) - { - this.OnMessage(WixWarnings.NewComponentAddedToExistingFeature(row.SourceLineNumbers, component_, feature_, this.transformPath)); - } - } - } - } - } - - /// - /// Sends a message to the message delegate if there is one. - /// - /// Message event arguments. - public void OnMessage(MessageEventArgs e) - { - Messaging.Instance.OnMessage(e); - } - } -} diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs index a9fbcbb7..85b3dab8 100644 --- a/src/WixToolset.Core/Preprocessor.cs +++ b/src/WixToolset.Core/Preprocessor.cs @@ -38,7 +38,6 @@ namespace WixToolset private List extensions; private Dictionary extensionsByPrefix; - private List inspectorExtensions; private SourceLineNumber currentLineNumber; private Stack sourceStack; @@ -60,7 +59,6 @@ namespace WixToolset this.extensions = new List(); this.extensionsByPrefix = new Dictionary(); - this.inspectorExtensions = new List(); this.sourceStack = new Stack(); @@ -201,27 +199,9 @@ namespace WixToolset public XDocument Process(string sourceFile, IDictionary variables) { using (Stream sourceStream = new FileStream(sourceFile, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (XmlReader reader = XmlReader.Create(sourceFile, DocumentXmlReaderSettings)) { - InspectorCore inspectorCore = new InspectorCore(); - foreach (InspectorExtension inspectorExtension in this.inspectorExtensions) - { - inspectorExtension.Core = inspectorCore; - inspectorExtension.InspectSource(sourceStream); - - // reset - inspectorExtension.Core = null; - sourceStream.Position = 0; - } - - if (inspectorCore.EncounteredError) - { - return null; - } - - using (XmlReader reader = XmlReader.Create(sourceFile, DocumentXmlReaderSettings)) - { - return Process(reader, variables, sourceFile); - } + return Process(reader, variables, sourceFile); } } diff --git a/src/WixToolset.Core/TupleDefinitionCreator.cs b/src/WixToolset.Core/TupleDefinitionCreator.cs new file mode 100644 index 00000000..8c9b9d29 --- /dev/null +++ b/src/WixToolset.Core/TupleDefinitionCreator.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.Core +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensibility.Services; + + internal class TupleDefinitionCreator : ITupleDefinitionCreator + { + public TupleDefinitionCreator(IServiceProvider serviceProvider) + { + this.ServiceProvider = serviceProvider; + } + + private IServiceProvider ServiceProvider { get; } + + private IEnumerable ExtensionData { get; set; } + + public bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) + { + tupleDefinition = TupleDefinitions.ByName(name); + + if (tupleDefinition == null) + { + if (this.ExtensionData == null) + { + this.LoadExtensionData(); + } + + foreach (var data in this.ExtensionData) + { + if (data.TryGetTupleDefinitionByName(name, out tupleDefinition)) + { + break; + } + } + } + + return tupleDefinition != null; + } + + private void LoadExtensionData() + { + var extensionManager = (IExtensionManager)this.ServiceProvider.GetService(typeof(IExtensionManager)); + + this.ExtensionData = extensionManager.Create(); + } + } +} diff --git a/src/WixToolset.Core/UnbindContext.cs b/src/WixToolset.Core/UnbindContext.cs deleted file mode 100644 index ed55f312..00000000 --- a/src/WixToolset.Core/UnbindContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Core -{ - using WixToolset.Data; - using WixToolset.Extensibility; - - internal class UnbindContext : IUnbindContext - { - public Messaging Messaging { get; } = Messaging.Instance; - - public string ExportBasePath { get; set; } - - public string InputFilePath { get; set; } - - public string IntermediateFolder { get; set; } - - public bool IsAdminImage { get; set; } - - public bool SuppressExtractCabinets { get; set; } - - public bool SuppressDemodularization { get; set; } - } -} diff --git a/src/WixToolset.Core/Unbinder.cs b/src/WixToolset.Core/Unbinder.cs deleted file mode 100644 index 2ff51997..00000000 --- a/src/WixToolset.Core/Unbinder.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.Core -{ - using System.Collections; - using System.IO; - using WixToolset.Data; - using WixToolset.Extensibility; - using System.Collections.Generic; - - /// - /// Unbinder core of the WiX toolset. - /// - public sealed class Unbinder - { - private TableDefinitionCollection tableDefinitions; - private ArrayList unbinderExtensions; - // private TempFileCollection tempFiles; - - /// - /// Creates a new unbinder object with a default set of table definitions. - /// - public Unbinder() - { - this.tableDefinitions = new TableDefinitionCollection(WindowsInstallerStandard.GetTableDefinitions()); - this.unbinderExtensions = new ArrayList(); - } - - public IEnumerable BackendFactories { get; } - - /// - /// Gets or sets whether the input msi is an admin image. - /// - /// Set to true if the input msi is part of an admin image. - public bool IsAdminImage { get; set; } - - /// - /// Gets or sets the option to suppress demodularizing values. - /// - /// The option to suppress demodularizing values. - public bool SuppressDemodularization { get; set; } - - /// - /// Gets or sets the option to suppress extracting cabinets. - /// - /// The option to suppress extracting cabinets. - public bool SuppressExtractCabinets { get; set; } - - /// - /// Gets or sets the temporary path for the Binder. If left null, the binder - /// will use %TEMP% environment variable. - /// - /// Path to temp files. - public string TempFilesLocation => Path.GetTempPath(); - - /// - /// Adds extension data. - /// - /// The extension data to add. - public void AddExtensionData(IExtensionData data) - { - if (null != data.TableDefinitions) - { - foreach (TableDefinition tableDefinition in data.TableDefinitions) - { - if (!this.tableDefinitions.Contains(tableDefinition.Name)) - { - this.tableDefinitions.Add(tableDefinition); - } - else - { - Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(data.GetType().ToString(), tableDefinition.Name)); - } - } - } - } - - /// - /// Adds an extension. - /// - /// The extension to add. - public void AddExtension(IUnbinderExtension extension) - { - this.unbinderExtensions.Add(extension); - } - - /// - /// Unbind a Windows Installer file. - /// - /// The Windows Installer file. - /// The type of output to create. - /// The path where files should be exported. - /// The output representing the database. - public Output Unbind(string file, OutputType outputType, string exportBasePath) - { - if (!File.Exists(file)) - { - if (OutputType.Transform == outputType) - { - throw new WixException(WixErrors.FileNotFound(null, file, "Transform")); - } - else - { - throw new WixException(WixErrors.FileNotFound(null, file, "Database")); - } - } - - // if we don't have the temporary files object yet, get one - Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there - - var context = new UnbindContext(); - context.InputFilePath = file; - context.ExportBasePath = exportBasePath; - context.IntermediateFolder = this.TempFilesLocation; - context.IsAdminImage = this.IsAdminImage; - context.SuppressDemodularization = this.SuppressDemodularization; - context.SuppressExtractCabinets = this.SuppressExtractCabinets; - - foreach (var factory in this.BackendFactories) - { - if (factory.TryCreateBackend(outputType.ToString(), file, null, out var backend)) - { - return backend.Unbind(context); - } - } - - // TODO: Display message that could not find a unbinder for output type? - - return null; - } - } -} diff --git a/src/WixToolset.Core/WindowsInstallerStandard.cs b/src/WixToolset.Core/WindowsInstallerStandard.cs new file mode 100644 index 00000000..90a53e6a --- /dev/null +++ b/src/WixToolset.Core/WindowsInstallerStandard.cs @@ -0,0 +1,260 @@ +// 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.Core +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Tuples; + + internal class WindowsInstallerStandard + { + private static readonly HashSet standardActionNames = new HashSet + { + "AllocateRegistrySpace", + "AppSearch", + "BindImage", + "CCPSearch", + "CostFinalize", + "CostInitialize", + "CreateFolders", + "CreateShortcuts", + "DeleteServices", + "DisableRollback", + "DuplicateFiles", + "ExecuteAction", + "FileCost", + "FindRelatedProducts", + "ForceReboot", + "InstallAdminPackage", + "InstallExecute", + "InstallExecuteAgain", + "InstallFiles", + "InstallFinalize", + "InstallInitialize", + "InstallODBC", + "InstallServices", + "InstallSFPCatalogFile", + "InstallValidate", + "IsolateComponents", + "LaunchConditions", + "MigrateFeatureStates", + "MoveFiles", + "MsiConfigureServices", + "MsiPublishAssemblies", + "MsiUnpublishAssemblies", + "PatchFiles", + "ProcessComponents", + "PublishComponents", + "PublishFeatures", + "PublishProduct", + "RegisterClassInfo", + "RegisterComPlus", + "RegisterExtensionInfo", + "RegisterFonts", + "RegisterMIMEInfo", + "RegisterProduct", + "RegisterProgIdInfo", + "RegisterTypeLibraries", + "RegisterUser", + "RemoveDuplicateFiles", + "RemoveEnvironmentStrings", + "RemoveExistingProducts", + "RemoveFiles", + "RemoveFolders", + "RemoveIniValues", + "RemoveODBC", + "RemoveRegistryValues", + "RemoveShortcuts", + "ResolveSource", + "RMCCPSearch", + "ScheduleReboot", + "SelfRegModules", + "SelfUnregModules", + "SetODBCFolders", + "StartServices", + "StopServices", + "UnpublishComponents", + "UnpublishFeatures", + "UnregisterClassInfo", + "UnregisterComPlus", + "UnregisterExtensionInfo", + "UnregisterFonts", + "UnregisterMIMEInfo", + "UnregisterProgIdInfo", + "UnregisterTypeLibraries", + "ValidateProductID", + "WriteEnvironmentStrings", + "WriteIniValues", + "WriteRegistryValues", + }; + + private static readonly WixActionTuple[] standardActions = new[] + { + new WixActionTuple(null, new Identifier("AdminExecuteSequence/InstallInitialize", AccessModifier.Public)) { Action="InstallInitialize", Sequence=1500, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/InstallInitialize", AccessModifier.Public)) { Action="InstallInitialize", Sequence=1500, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallInitialize", AccessModifier.Public)) { Action="InstallInitialize", Sequence=1500, SequenceTable=SequenceTable.InstallExecuteSequence }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallExecute", AccessModifier.Public)) { Action="InstallExecute", Sequence=6500, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="NOT Installed" }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallExecuteAgain", AccessModifier.Public)) { Action="InstallExecuteAgain", Sequence=6550, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="NOT Installed" }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/InstallFinalize", AccessModifier.Public)) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/InstallFinalize", AccessModifier.Public)) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallFinalize", AccessModifier.Public)) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.InstallExecuteSequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/InstallFiles", AccessModifier.Public)) { Action="InstallFiles", Sequence=4000, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallFiles", AccessModifier.Public)) { Action="InstallFiles", Sequence=4000, SequenceTable=SequenceTable.InstallExecuteSequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/InstallAdminPackage", AccessModifier.Public)) { Action="InstallAdminPackage", Sequence=3900, SequenceTable=SequenceTable.AdminExecuteSequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/FileCost", AccessModifier.Public)) { Action="FileCost", Sequence=900, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/FileCost", AccessModifier.Public)) { Action="FileCost", Sequence=900, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallUISequence/FileCost", AccessModifier.Public)) { Action="FileCost", Sequence=900, SequenceTable=SequenceTable.InstallUISequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/CostInitialize", AccessModifier.Public)) { Action="CostInitialize", Sequence=800, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("AdminUISequence/CostInitialize", AccessModifier.Public)) { Action="CostInitialize", Sequence=800, SequenceTable=SequenceTable.AdminUISequence }, + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/CostInitialize", AccessModifier.Public)) { Action="CostInitialize", Sequence=800, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/CostInitialize", AccessModifier.Public)) { Action="CostInitialize", Sequence=800, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallUISequence/CostInitialize", AccessModifier.Public)) { Action="CostInitialize", Sequence=800, SequenceTable=SequenceTable.InstallUISequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/CostFinalize", AccessModifier.Public)) { Action="CostFinalize", Sequence=1000, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("AdminUISequence/CostFinalize", AccessModifier.Public)) { Action="CostFinalize", Sequence=1000, SequenceTable=SequenceTable.AdminUISequence }, + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/CostFinalize", AccessModifier.Public)) { Action="CostFinalize", Sequence=1000, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/CostFinalize", AccessModifier.Public)) { Action="CostFinalize", Sequence=1000, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallUISequence/CostFinalize", AccessModifier.Public)) { Action="CostFinalize", Sequence=1000, SequenceTable=SequenceTable.InstallUISequence }, + + new WixActionTuple(null, new Identifier("AdminExecuteSequence/InstallValidate", AccessModifier.Public)) { Action="InstallValidate", Sequence=1400, SequenceTable=SequenceTable.AdminExecuteSequence }, + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/InstallValidate", AccessModifier.Public)) { Action="InstallValidate", Sequence=1400, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/InstallValidate", AccessModifier.Public)) { Action="InstallValidate", Sequence=1400, SequenceTable=SequenceTable.InstallExecuteSequence }, + + new WixActionTuple(null, new Identifier("AdminUISequence/ExecuteAction", AccessModifier.Public)) { Action="ExecuteAction", Sequence=1300, SequenceTable=SequenceTable.AdminUISequence }, + new WixActionTuple(null, new Identifier("InstallUISequence/ExecuteAction", AccessModifier.Public)) { Action="ExecuteAction", Sequence=1300, SequenceTable=SequenceTable.InstallUISequence }, + + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/CreateShortcuts", AccessModifier.Public)) { Action="CreateShortcuts", Sequence=4500, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/CreateShortcuts", AccessModifier.Public)) { Action="CreateShortcuts", Sequence=4500, SequenceTable=SequenceTable.InstallExecuteSequence }, + + new WixActionTuple(null, new Identifier("AdvtExecuteSequence/MsiPublishAssemblies", AccessModifier.Public)) { Action="MsiPublishAssemblies", Sequence=6250, SequenceTable=SequenceTable.AdvtExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/MsiPublishAssemblies", AccessModifier.Public)) { Action="MsiPublishAssemblies", Sequence=6250, SequenceTable=SequenceTable.InstallExecuteSequence }, + + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/CCPSearch", AccessModifier.Public)) { Action="CCPSearch", Sequence=500, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="NOT Installed" }, + new WixActionTuple(null, new Identifier("InstallUISequence/CCPSearch", AccessModifier.Public)) { Action="CCPSearch", Sequence=500, SequenceTable=SequenceTable.InstallUISequence, Condition="NOT Installed" }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/DeleteServices", AccessModifier.Public)) { Action="DeleteServices", Sequence=2000, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="VersionNT" }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/RMCCPSearch", AccessModifier.Public)) { Action="RMCCPSearch", Sequence=600, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="NOT Installed" }, + new WixActionTuple(null, new Identifier("InstallUISequence/RMCCPSearch", AccessModifier.Public)) { Action="RMCCPSearch", Sequence=600, SequenceTable=SequenceTable.InstallUISequence, Condition="NOT Installed" }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/StartServices", AccessModifier.Public)) { Action="StartServices", Sequence=5900, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="VersionNT" }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/StopServices", AccessModifier.Public)) { Action="StopServices", Sequence=1900, SequenceTable=SequenceTable.InstallExecuteSequence, Condition="VersionNT" }, + + new WixActionTuple(null, new Identifier("InstallExecuteSequence/MsiUnpublishAssemblies", AccessModifier.Public)) { Action="MsiUnpublishAssemblies", Sequence=1750, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnpublishComponents", AccessModifier.Public)) { Action="UnpublishComponents", Sequence=1700, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnpublishFeatures", AccessModifier.Public)) { Action="UnpublishFeatures", Sequence=1800, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterClassInfo", AccessModifier.Public)) { Action="UnregisterClassInfo", Sequence=2700, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterComPlus", AccessModifier.Public)) { Action="UnregisterComPlus", Sequence=2100, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterExtensionInfo", AccessModifier.Public)) { Action="UnregisterExtensionInfo", Sequence=2800, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterFonts", AccessModifier.Public)) { Action="UnregisterFonts", Sequence=2500, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterMIMEInfo", AccessModifier.Public)) { Action="UnregisterMIMEInfo", Sequence=3000, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterProgIdInfo", AccessModifier.Public)) { Action="UnregisterProgIdInfo", Sequence=2900, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/UnregisterTypeLibraries", AccessModifier.Public)) { Action="UnregisterTypeLibraries", Sequence=2300, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/ValidateProductID", AccessModifier.Public)) { Action="ValidateProductID", Sequence=700, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/WriteEnvironmentStrings", AccessModifier.Public)) { Action="WriteEnvironmentStrings", Sequence=5200, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/WriteIniValues", AccessModifier.Public)) { Action="WriteIniValues", Sequence=5100, SequenceTable=SequenceTable.InstallExecuteSequence }, + new WixActionTuple(null, new Identifier("InstallExecuteSequence/WriteRegistryValues", AccessModifier.Public)) { Action="WriteRegistryValues", Sequence=5000, SequenceTable=SequenceTable.InstallExecuteSequence }, + }; + + private static readonly HashSet standardDirectories = new HashSet + { + "TARGETDIR", + "AdminToolsFolder", + "AppDataFolder", + "CommonAppDataFolder", + "CommonFilesFolder", + "DesktopFolder", + "FavoritesFolder", + "FontsFolder", + "LocalAppDataFolder", + "MyPicturesFolder", + "PersonalFolder", + "ProgramFilesFolder", + "ProgramMenuFolder", + "SendToFolder", + "StartMenuFolder", + "StartupFolder", + "System16Folder", + "SystemFolder", + "TempFolder", + "TemplateFolder", + "WindowsFolder", + "CommonFiles64Folder", + "ProgramFiles64Folder", + "System64Folder", + "NetHoodFolder", + "PrintHoodFolder", + "RecentFolder", + "WindowsVolume", + }; + + /// + /// 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) + { + return standardActionNames.Contains(actionName); + } + + public static WixActionTuple[] StandardActions() => standardActions; + + /// + /// 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) + { + return standardDirectories.Contains(directoryName); + } + } +} diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs index c073c32b..dd49e7ed 100644 --- a/src/WixToolset.Core/WixToolsetServiceProvider.cs +++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs @@ -3,18 +3,30 @@ namespace WixToolset.Core { using System; + using WixToolset.Data; using WixToolset.Extensibility; using WixToolset.Extensibility.Services; public class WixToolsetServiceProvider : IServiceProvider { private ExtensionManager extensionManager; + private TupleDefinitionCreator tupleDefinitionCreator; public object GetService(Type serviceType) { if (serviceType == null) throw new ArgumentNullException(nameof(serviceType)); // Transients. + if (serviceType == typeof(ICompileContext)) + { + return new CompileContext(this); + } + + if (serviceType == typeof(ILinkContext)) + { + return new LinkContext(this); + } + if (serviceType == typeof(IBindContext)) { return new BindContext(this); @@ -38,7 +50,12 @@ namespace WixToolset.Core // Singletons. if (serviceType == typeof(IExtensionManager)) { - return extensionManager = extensionManager ?? new ExtensionManager(); + return this.extensionManager = this.extensionManager ?? new ExtensionManager(); + } + + if (serviceType == typeof(ITupleDefinitionCreator)) + { + return this.tupleDefinitionCreator = this.tupleDefinitionCreator ?? new TupleDefinitionCreator(this); } throw new ArgumentException($"Unknown service type: {serviceType.Name}", nameof(serviceType)); diff --git a/src/WixToolset.Core/WixVariableResolver.cs b/src/WixToolset.Core/WixVariableResolver.cs index 357ff700..c4572d33 100644 --- a/src/WixToolset.Core/WixVariableResolver.cs +++ b/src/WixToolset.Core/WixVariableResolver.cs @@ -9,7 +9,7 @@ namespace WixToolset.Core using System.Text; using System.Text.RegularExpressions; using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; using WixToolset.Extensibility; /// @@ -60,17 +60,17 @@ namespace WixToolset.Core /// Add a variable. /// /// The WixVariableRow to add. - public void AddVariable(WixVariableRow wixVariableRow) + public void AddVariable(WixVariableTuple wixVariableRow) { try { - this.wixVariables.Add(wixVariableRow.Id, wixVariableRow.Value); + this.wixVariables.Add(wixVariableRow.WixVariable, wixVariableRow.Value); } catch (ArgumentException) { if (!wixVariableRow.Overridable) // collision { - Messaging.Instance.OnMessage(WixErrors.WixVariableCollision(wixVariableRow.SourceLineNumbers, wixVariableRow.Id)); + Messaging.Instance.OnMessage(WixErrors.WixVariableCollision(wixVariableRow.SourceLineNumbers, wixVariableRow.WixVariable)); } } } 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 + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs index daa3da42..46d15ed8 100644 --- a/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegrationFixture/ProgramFixture.cs @@ -3,7 +3,10 @@ namespace WixToolsetTest.CoreIntegrationFixture { using System.IO; + using System.Linq; using WixToolset.Core; + using WixToolset.Data; + using WixToolset.Data.Tuples; using WixToolsetTest.CoreIntegrationFixture.Utility; using Xunit; @@ -23,9 +26,18 @@ namespace WixToolsetTest.CoreIntegrationFixture var result = program.Run(new WixToolsetServiceProvider(), new[] { "build", "Package.wxs", "PackageComponents.wxs", "-loc", "Package.en-us.wxl", "-bindpath", "data", "-intermediateFolder", intermediateFolder, "-o", $@"{intermediateFolder}\bin\test.msi" }); Assert.Equal(0, result); +#if FIXED_MSI_BACKEND Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\test.txt"))); +#else + var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.msi")); + Assert.Single(intermediate.Sections); + + var wixFile = intermediate.Sections.SelectMany(s => s.Tuples).OfType().Single(); + Assert.Equal(@"data\test.txt", wixFile[WixFileTupleFields.Source].AsPath().Path); + Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); +#endif } } } -- cgit v1.2.3-55-g6feb