From be43682720cf9c238aa1efba5940b8e2279c5bc4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 13 Apr 2022 10:13:10 -0500 Subject: Try to improve fields of bundle symbols. --- .../Symbols/WixApprovedExeForElevationSymbol.cs | 16 ++- .../Symbols/WixBundleBundlePackageSymbol.cs | 17 --- .../Symbols/WixBundleExePackageSymbol.cs | 16 ++- .../Symbols/WixBundleMsiFeatureSymbol.cs | 1 + .../Symbols/WixBundleMsiPackageSymbol.cs | 37 +++++- .../Symbols/WixBundleMspPackageSymbol.cs | 24 +++- .../Symbols/WixBundlePackageSymbol.cs | 96 +++++++++++---- .../Symbols/WixBundlePatchTargetCodeSymbol.cs | 22 +++- .../Symbols/WixBundlePayloadSymbol.cs | 39 ++++-- .../Symbols/WixBundleRelatedPackageSymbol.cs | 64 +++++++++- .../Symbols/WixBundleRollbackBoundarySymbol.cs | 62 +++++++--- .../wix/WixToolset.Data/Symbols/WixBundleSymbol.cs | 65 ++++++++-- .../WixToolset.Data/Symbols/WixBundleTagSymbol.cs | 14 ++- .../Symbols/WixBundleUpdateSymbol.cs | 16 ++- .../Symbols/WixBundleVariableSymbol.cs | 48 ++++++-- .../wix/WixToolset.Data/Symbols/WixChainSymbol.cs | 48 +++++++- .../Symbols/WixComponentSearchSymbol.cs | 19 ++- .../WixToolset.Data/Symbols/WixFileSearchSymbol.cs | 133 ++++++++++++++++++++- .../Symbols/WixProductSearchSymbol.cs | 43 ++++++- .../Symbols/WixRegistrySearchSymbol.cs | 55 ++++++++- .../WixToolsetTest.Util/UtilExtensionFixture.cs | 5 +- src/ext/Util/wixext/UtilCompiler.cs | 103 ++++++++-------- src/test/burn/WixTestTools/BundleVerifier.cs | 6 +- .../WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 12 +- .../Bind/LegacySearchFacade.cs | 119 ++++++++++-------- .../AutomaticallySlipstreamPatchesCommand.cs | 15 +-- ...CreateBootstrapperApplicationManifestCommand.cs | 6 +- .../Bundles/CreateBurnManifestCommand.cs | 43 +++---- .../OrderPackagesAndRollbackBoundariesCommand.cs | 2 +- .../Bundles/ProcessBundlePackageCommand.cs | 8 +- .../Bundles/ProcessMsiPackageCommand.cs | 22 ++-- .../Bundles/ProcessMspPackageCommand.cs | 28 +++-- .../Bundles/ProcessMsuPackageCommand.cs | 2 +- src/wix/WixToolset.Core/Compiler_Bundle.cs | 35 +++--- 34 files changed, 923 insertions(+), 318 deletions(-) (limited to 'src') diff --git a/src/api/wix/WixToolset.Data/Symbols/WixApprovedExeForElevationSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixApprovedExeForElevationSymbol.cs index 04c6e712..1813ce5a 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixApprovedExeForElevationSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixApprovedExeForElevationSymbol.cs @@ -66,6 +66,20 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixApprovedExeForElevationSymbolFields.Attributes, (int)value); } - public bool Win64 => (this.Attributes & WixApprovedExeForElevationAttributes.Win64) == WixApprovedExeForElevationAttributes.Win64; + public bool Win64 + { + get { return this.Attributes.HasFlag(WixApprovedExeForElevationAttributes.Win64); } + set + { + if (value) + { + this.Attributes |= WixApprovedExeForElevationAttributes.Win64; + } + else + { + this.Attributes &= ~WixApprovedExeForElevationAttributes.Win64; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleBundlePackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleBundlePackageSymbol.cs index dcf59e28..24e63881 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleBundlePackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleBundlePackageSymbol.cs @@ -40,7 +40,6 @@ namespace WixToolset.Data.Symbols { None = 0, SupportsBurnProtocol = 1, - Win64 = 2, } public class WixBundleBundlePackageSymbol : IntermediateSymbol @@ -106,21 +105,5 @@ namespace WixToolset.Data.Symbols } } } - - public bool Win64 - { - get { return this.Attributes.HasFlag(WixBundleBundlePackageAttributes.Win64); } - set - { - if (value) - { - this.Attributes |= WixBundleBundlePackageAttributes.Win64; - } - else - { - this.Attributes &= ~WixBundleBundlePackageAttributes.Win64; - } - } - } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs index fc891f13..6cf200c2 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs @@ -90,7 +90,21 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleExePackageSymbolFields.ExeProtocol, value); } - public bool IsBundle => this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle); + public bool IsBundle + { + get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle); } + set + { + if (value) + { + this.Attributes |= WixBundleExePackageAttributes.Bundle; + } + else + { + this.Attributes &= ~WixBundleExePackageAttributes.Bundle; + } + } + } public bool Repairable => this.RepairCommand != null; diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiFeatureSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiFeatureSymbol.cs index f81da5b8..829e81c0 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiFeatureSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiFeatureSymbol.cs @@ -107,6 +107,7 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleMsiFeatureSymbolFields.Directory, value); } + // Passthrough for Attributes column of Feature table. public int Attributes { get => (int)this.Fields[(int)WixBundleMsiFeatureSymbolFields.Attributes]; diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiPackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiPackageSymbol.cs index 21735f64..74d39c6c 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiPackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleMsiPackageSymbol.cs @@ -40,7 +40,8 @@ namespace WixToolset.Data.Symbols [Flags] public enum WixBundleMsiPackageAttributes { - EnableFeatureSelection = 0x4, + None = 0x0, + EnableFeatureSelection = 0x1, ForcePerMachine = 0x2, } @@ -98,8 +99,36 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleMsiPackageSymbolFields.Manufacturer, value); } - public bool EnableFeatureSelection => (this.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection) == WixBundleMsiPackageAttributes.EnableFeatureSelection; + public bool EnableFeatureSelection + { + get { return this.Attributes.HasFlag(WixBundleMsiPackageAttributes.EnableFeatureSelection); } + set + { + if (value) + { + this.Attributes |= WixBundleMsiPackageAttributes.EnableFeatureSelection; + } + else + { + this.Attributes &= ~WixBundleMsiPackageAttributes.EnableFeatureSelection; + } + } + } - public bool ForcePerMachine => (this.Attributes & WixBundleMsiPackageAttributes.ForcePerMachine) == WixBundleMsiPackageAttributes.ForcePerMachine; + public bool ForcePerMachine + { + get { return this.Attributes.HasFlag(WixBundleMsiPackageAttributes.ForcePerMachine); } + set + { + if (value) + { + this.Attributes |= WixBundleMsiPackageAttributes.ForcePerMachine; + } + else + { + this.Attributes &= ~WixBundleMsiPackageAttributes.ForcePerMachine; + } + } + } } -} \ No newline at end of file +} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleMspPackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleMspPackageSymbol.cs index 3784c2ff..46d604a8 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleMspPackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleMspPackageSymbol.cs @@ -34,8 +34,8 @@ namespace WixToolset.Data.Symbols [Flags] public enum WixBundleMspPackageAttributes { - Slipstream = 0x2, - TargetUnspecified = 0x4, + None = 0x0, + Slipstream = 0x1, } public class WixBundleMspPackageSymbol : IntermediateSymbol @@ -74,8 +74,20 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleMspPackageSymbolFields.PatchXml, value); } - public bool Slipstream => (this.Attributes & WixBundleMspPackageAttributes.Slipstream) == WixBundleMspPackageAttributes.Slipstream; - - public bool TargetUnspecified => (this.Attributes & WixBundleMspPackageAttributes.TargetUnspecified) == WixBundleMspPackageAttributes.TargetUnspecified; + public bool Slipstream + { + get { return this.Attributes.HasFlag(WixBundleMspPackageAttributes.Slipstream); } + set + { + if (value) + { + this.Attributes |= WixBundleMspPackageAttributes.Slipstream; + } + else + { + this.Attributes &= ~WixBundleMspPackageAttributes.Slipstream; + } + } + } } -} \ No newline at end of file +} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs index e68a9d09..6afe657e 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs @@ -16,8 +16,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.InstallCondition), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Cache), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.CacheId), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Vital), IntermediateFieldType.Bool), - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.Bool), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackLogPathVariable), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Size), IntermediateFieldType.LargeNumber), @@ -28,7 +27,6 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Description), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryRef), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Win64), IntermediateFieldType.Bool), }, typeof(WixBundlePackageSymbol)); } @@ -46,7 +44,6 @@ namespace WixToolset.Data.Symbols InstallCondition, Cache, CacheId, - Vital, PerMachine, LogPathVariable, RollbackLogPathVariable, @@ -58,7 +55,6 @@ namespace WixToolset.Data.Symbols Description, RollbackBoundaryRef, RollbackBoundaryBackwardRef, - Win64, } /// @@ -66,6 +62,7 @@ namespace WixToolset.Data.Symbols /// public enum WixBundlePackageType { + NotSet = -1, Bundle, Exe, Msi, @@ -76,10 +73,11 @@ namespace WixToolset.Data.Symbols [Flags] public enum WixBundlePackageAttributes { + None = 0x0, Permanent = 0x1, Visible = 0x2, - PerMachine = 0x4, - Win64 = 0x8, + Win64 = 0x4, + Vital = 0x8, } public class WixBundlePackageSymbol : IntermediateSymbol @@ -96,7 +94,15 @@ namespace WixToolset.Data.Symbols public WixBundlePackageType Type { - get => (WixBundlePackageType)Enum.Parse(typeof(WixBundlePackageType), (string)this.Fields[(int)WixBundlePackageSymbolFields.Type], true); + get + { + if (Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.Type], true, out WixBundlePackageType value)) + { + return value; + } + + return WixBundlePackageType.NotSet; + } set => this.Set((int)WixBundlePackageSymbolFields.Type, value.ToString()); } @@ -130,16 +136,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundlePackageSymbolFields.CacheId, value); } - public bool? Vital - { - get => (bool?)this.Fields[(int)WixBundlePackageSymbolFields.Vital]; - set => this.Set((int)WixBundlePackageSymbolFields.Vital, value); - } - - public YesNoDefaultType PerMachine + public bool? PerMachine { - get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.PerMachine], true, out YesNoDefaultType value) ? value : YesNoDefaultType.NotSet; - set => this.Set((int)WixBundlePackageSymbolFields.PerMachine, value.ToString().ToLowerInvariant()); + get => (bool?)this.Fields[(int)WixBundlePackageSymbolFields.PerMachine]; + set => this.Set((int)WixBundlePackageSymbolFields.PerMachine, value); } public string LogPathVariable @@ -202,12 +202,68 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef, value); } + public bool Permanent + { + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Permanent); } + set + { + if (value) + { + this.Attributes |= WixBundlePackageAttributes.Permanent; + } + else + { + this.Attributes &= ~WixBundlePackageAttributes.Permanent; + } + } + } + + public bool Visible + { + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Visible); } + set + { + if (value) + { + this.Attributes |= WixBundlePackageAttributes.Visible; + } + else + { + this.Attributes &= ~WixBundlePackageAttributes.Visible; + } + } + } + public bool Win64 { - get => (bool)this.Fields[(int)WixBundlePackageSymbolFields.Win64]; - set => this.Set((int)WixBundlePackageSymbolFields.Win64, value); + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Win64); } + set + { + if (value) + { + this.Attributes |= WixBundlePackageAttributes.Win64; + } + else + { + this.Attributes &= ~WixBundlePackageAttributes.Win64; + } + } } - public bool Permanent => (this.Attributes & WixBundlePackageAttributes.Permanent) == WixBundlePackageAttributes.Permanent; + public bool Vital + { + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Vital); } + set + { + if (value) + { + this.Attributes |= WixBundlePackageAttributes.Vital; + } + else + { + this.Attributes &= ~WixBundlePackageAttributes.Vital; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundlePatchTargetCodeSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundlePatchTargetCodeSymbol.cs index b1aa9c77..85f50602 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundlePatchTargetCodeSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundlePatchTargetCodeSymbol.cs @@ -13,6 +13,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.PackageRef), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.TargetCode), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.Type), IntermediateFieldType.Number), }, typeof(WixBundlePatchTargetCodeSymbol)); } @@ -27,22 +28,31 @@ namespace WixToolset.Data.Symbols PackageRef, TargetCode, Attributes, + Type, } [Flags] public enum WixBundlePatchTargetCodeAttributes : int { None = 0, + } + + public enum WixBundlePatchTargetCodeType + { + /// + /// The transform has no specific target. + /// + Unspecified, /// /// The transform targets a specific ProductCode. /// - TargetsProductCode = 1, + ProductCode, /// /// The transform targets a specific UpgradeCode. /// - TargetsUpgradeCode = 2, + UpgradeCode, } public class WixBundlePatchTargetCodeSymbol : IntermediateSymbol @@ -75,8 +85,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundlePatchTargetCodeSymbolFields.Attributes, (int)value); } - public bool TargetsProductCode => (this.Attributes & WixBundlePatchTargetCodeAttributes.TargetsProductCode) == WixBundlePatchTargetCodeAttributes.TargetsProductCode; - - public bool TargetsUpgradeCode => (this.Attributes & WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode) == WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode; + public WixBundlePatchTargetCodeType Type + { + get => (WixBundlePatchTargetCodeType)this.Fields[(int)WixBundlePatchTargetCodeSymbolFields.Type].AsNumber(); + set => this.Set((int)WixBundlePatchTargetCodeSymbolFields.Type, (int)value); + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundlePayloadSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundlePayloadSymbol.cs index be581fb3..ed2060b3 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundlePayloadSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundlePayloadSymbol.cs @@ -10,6 +10,7 @@ namespace WixToolset.Data SymbolDefinitionType.WixBundlePayload, new[] { + new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Attributes), IntermediateFieldType.Number), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Name), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.SourceFile), IntermediateFieldType.Path), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.DownloadUrl), IntermediateFieldType.String), @@ -21,7 +22,6 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Version), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Hash), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.ContainerRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.ContentFile), IntermediateFieldType.Bool), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.EmbeddedId), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.LayoutOnly), IntermediateFieldType.Bool), new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Packaging), IntermediateFieldType.Number), @@ -39,6 +39,7 @@ namespace WixToolset.Data.Symbols public enum WixBundlePayloadSymbolFields { + Attributes, Name, SourceFile, DownloadUrl, @@ -50,7 +51,6 @@ namespace WixToolset.Data.Symbols Version, Hash, ContainerRef, - ContentFile, EmbeddedId, LayoutOnly, Packaging, @@ -59,6 +59,13 @@ namespace WixToolset.Data.Symbols CertificateThumbprint, } + [Flags] + public enum WixBundlePayloadAttributes + { + None = 0x0, + ContentFile = 0x1, + } + public class WixBundlePayloadSymbol : IntermediateSymbol { public WixBundlePayloadSymbol() : base(SymbolDefinitions.WixBundlePayload, null, null) @@ -71,6 +78,12 @@ namespace WixToolset.Data.Symbols public IntermediateField this[WixBundlePayloadSymbolFields index] => this.Fields[(int)index]; + public WixBundlePayloadAttributes Attributes + { + get => (WixBundlePayloadAttributes)this.Fields[(int)WixBundlePayloadSymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixBundlePayloadSymbolFields.Attributes, (int)value); + } + public string Name { get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.Name]; @@ -137,12 +150,6 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundlePayloadSymbolFields.ContainerRef, value); } - public bool ContentFile - { - get => (bool)this.Fields[(int)WixBundlePayloadSymbolFields.ContentFile]; - set => this.Set((int)WixBundlePayloadSymbolFields.ContentFile, value); - } - public string EmbeddedId { get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.EmbeddedId]; @@ -178,5 +185,21 @@ namespace WixToolset.Data.Symbols get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.CertificateThumbprint]; set => this.Set((int)WixBundlePayloadSymbolFields.CertificateThumbprint, value); } + + public bool ContentFile + { + get { return this.Attributes.HasFlag(WixBundlePayloadAttributes.ContentFile); } + set + { + if (value) + { + this.Attributes |= WixBundlePayloadAttributes.ContentFile; + } + else + { + this.Attributes &= ~WixBundlePayloadAttributes.ContentFile; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleRelatedPackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleRelatedPackageSymbol.cs index 7bd67b7f..77789048 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleRelatedPackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleRelatedPackageSymbol.cs @@ -93,12 +93,68 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleRelatedPackageSymbolFields.Attributes, (int)value); } - public bool MinInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.MinInclusive) == WixBundleRelatedPackageAttributes.MinInclusive; + public bool MinInclusive + { + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.MinInclusive); } + set + { + if (value) + { + this.Attributes |= WixBundleRelatedPackageAttributes.MinInclusive; + } + else + { + this.Attributes &= ~WixBundleRelatedPackageAttributes.MinInclusive; + } + } + } - public bool MaxInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.MaxInclusive) == WixBundleRelatedPackageAttributes.MaxInclusive; + public bool MaxInclusive + { + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.MaxInclusive); } + set + { + if (value) + { + this.Attributes |= WixBundleRelatedPackageAttributes.MaxInclusive; + } + else + { + this.Attributes &= ~WixBundleRelatedPackageAttributes.MaxInclusive; + } + } + } - public bool OnlyDetect => (this.Attributes & WixBundleRelatedPackageAttributes.OnlyDetect) == WixBundleRelatedPackageAttributes.OnlyDetect; + public bool OnlyDetect + { + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.OnlyDetect); } + set + { + if (value) + { + this.Attributes |= WixBundleRelatedPackageAttributes.OnlyDetect; + } + else + { + this.Attributes &= ~WixBundleRelatedPackageAttributes.OnlyDetect; + } + } + } - public bool LangInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.LangInclusive) == WixBundleRelatedPackageAttributes.LangInclusive; + public bool LangInclusive + { + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.LangInclusive); } + set + { + if (value) + { + this.Attributes |= WixBundleRelatedPackageAttributes.LangInclusive; + } + else + { + this.Attributes &= ~WixBundleRelatedPackageAttributes.LangInclusive; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleRollbackBoundarySymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleRollbackBoundarySymbol.cs index 1f91cef2..a75e388b 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleRollbackBoundarySymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleRollbackBoundarySymbol.cs @@ -10,8 +10,7 @@ namespace WixToolset.Data SymbolDefinitionType.WixBundleRollbackBoundary, new[] { - new IntermediateFieldDefinition(nameof(WixBundleRollbackBoundarySymbolFields.Vital), IntermediateFieldType.Number), - new IntermediateFieldDefinition(nameof(WixBundleRollbackBoundarySymbolFields.Transaction), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.Attributes), IntermediateFieldType.Number), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String), }, typeof(WixBundleRollbackBoundarySymbol)); @@ -20,13 +19,22 @@ namespace WixToolset.Data namespace WixToolset.Data.Symbols { + using System; + public enum WixBundleRollbackBoundarySymbolFields { - Vital, - Transaction, + Attributes, LogPathVariable, } + [Flags] + public enum WixBundleRollbackBoundaryAttributes + { + None = 0x0, + Vital = 0x1, + Transaction = 0x2, + } + public class WixBundleRollbackBoundarySymbol : IntermediateSymbol { public WixBundleRollbackBoundarySymbol() : base(SymbolDefinitions.WixBundleRollbackBoundary, null, null) @@ -39,16 +47,10 @@ namespace WixToolset.Data.Symbols public IntermediateField this[WixBundleRollbackBoundarySymbolFields index] => this.Fields[(int)index]; - public bool? Vital + public WixBundleRollbackBoundaryAttributes Attributes { - get => (bool?)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Vital]; - set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Vital, value); - } - - public bool? Transaction - { - get => (bool?)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Transaction]; - set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Transaction, value); + get => (WixBundleRollbackBoundaryAttributes)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Attributes, (int)value); } public string LogPathVariable @@ -56,5 +58,37 @@ namespace WixToolset.Data.Symbols get => (string)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.LogPathVariable]; set => this.Set((int)WixBundleRollbackBoundarySymbolFields.LogPathVariable, value); } + + public bool Vital + { + get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Vital); } + set + { + if (value) + { + this.Attributes |= WixBundleRollbackBoundaryAttributes.Vital; + } + else + { + this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Vital; + } + } + } + + public bool Transaction + { + get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Transaction); } + set + { + if (value) + { + this.Attributes |= WixBundleRollbackBoundaryAttributes.Transaction; + } + else + { + this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Transaction; + } + } + } } -} \ No newline at end of file +} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs index 72192c15..c4db0c21 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs @@ -34,6 +34,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.ProviderKey), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.InProgressName), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.CommandLineVariables), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.DisableModify), IntermediateFieldType.String), }, typeof(WixBundleSymbol)); } @@ -69,16 +70,15 @@ namespace WixToolset.Data.Symbols ProviderKey, InProgressName, CommandLineVariables, + DisableModify, } [Flags] public enum WixBundleAttributes { None = 0x0, - DisableModify = 0x1, - DisableRemove = 0x2, - SingleChangeUninstallButton = 0x4, - PerMachine = 0x8, + DisableRemove = 0x1, + PerMachine = 0x2, } public enum WixBundleCommandLineVariables @@ -87,6 +87,13 @@ namespace WixToolset.Data.Symbols CaseSensitive, } + public enum WixBundleModifyType + { + Allowed = 0, + Disabled = 1, + SingleChangeUninstallButton = 2, + } + public class WixBundleSymbol : IntermediateSymbol { public WixBundleSymbol() : base(SymbolDefinitions.WixBundle, null, null) @@ -243,14 +250,52 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleSymbolFields.CommandLineVariables, (int)value); } - public PackagingType DefaultPackagingType => (this.Compressed.HasValue && !this.Compressed.Value) ? PackagingType.External : PackagingType.Embedded; - - public bool DisableModify => (this.Attributes & WixBundleAttributes.DisableModify) == WixBundleAttributes.DisableModify; + public WixBundleModifyType DisableModify + { + get + { + if (Enum.TryParse((string)this.Fields[(int)WixBundleSymbolFields.DisableModify], true, out WixBundleModifyType value)) + { + return value; + } + + return WixBundleModifyType.Allowed; + } + set => this.Set((int)WixBundleSymbolFields.DisableModify, value.ToString().ToLowerInvariant()); + } - public bool DisableRemove => (this.Attributes & WixBundleAttributes.DisableRemove) == WixBundleAttributes.DisableRemove; + public PackagingType DefaultPackagingType => (this.Compressed.HasValue && !this.Compressed.Value) ? PackagingType.External : PackagingType.Embedded; - public bool PerMachine => (this.Attributes & WixBundleAttributes.PerMachine) == WixBundleAttributes.PerMachine; + public bool DisableRemove + { + get { return this.Attributes.HasFlag(WixBundleAttributes.DisableRemove); } + set + { + if (value) + { + this.Attributes |= WixBundleAttributes.DisableRemove; + } + else + { + this.Attributes &= ~WixBundleAttributes.DisableRemove; + } + } + } - public bool SingleChangeUninstallButton => (this.Attributes & WixBundleAttributes.SingleChangeUninstallButton) == WixBundleAttributes.SingleChangeUninstallButton; + public bool PerMachine + { + get { return this.Attributes.HasFlag(WixBundleAttributes.PerMachine); } + set + { + if (value) + { + this.Attributes |= WixBundleAttributes.PerMachine; + } + else + { + this.Attributes &= ~WixBundleAttributes.PerMachine; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleTagSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleTagSymbol.cs index d550dae0..590484e0 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleTagSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleTagSymbol.cs @@ -23,6 +23,8 @@ namespace WixToolset.Data namespace WixToolset.Data.Symbols { + using System; + public enum WixBundleTagSymbolFields { Filename, @@ -33,6 +35,12 @@ namespace WixToolset.Data.Symbols Xml, } + [Flags] + public enum WixBundleTagAttributes + { + None = 0x0, + } + public class WixBundleTagSymbol : IntermediateSymbol { public WixBundleTagSymbol() : base(SymbolDefinitions.WixBundleTag, null, null) @@ -69,10 +77,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleTagSymbolFields.InstallPath, value); } - public int Attributes + public WixBundleTagAttributes Attributes { - get => this.Fields[(int)WixBundleTagSymbolFields.Attributes].AsNumber(); - set => this.Set((int)WixBundleTagSymbolFields.Attributes, value); + get => (WixBundleTagAttributes)this.Fields[(int)WixBundleTagSymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixBundleTagSymbolFields.Attributes, (int)value); } public string Xml diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleUpdateSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleUpdateSymbol.cs index d27bbc32..514f9e6c 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleUpdateSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleUpdateSymbol.cs @@ -19,12 +19,20 @@ namespace WixToolset.Data namespace WixToolset.Data.Symbols { + using System; + public enum WixBundleUpdateSymbolFields { Location, Attributes, } + [Flags] + public enum WixBundleUpdateAttributes + { + None = 0x0, + } + public class WixBundleUpdateSymbol : IntermediateSymbol { public WixBundleUpdateSymbol() : base(SymbolDefinitions.WixBundleUpdate, null, null) @@ -43,10 +51,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleUpdateSymbolFields.Location, value); } - public int Attributes + public WixBundleUpdateAttributes Attributes { - get => (int)this.Fields[(int)WixBundleUpdateSymbolFields.Attributes]; - set => this.Set((int)WixBundleUpdateSymbolFields.Attributes, value); + get => (WixBundleUpdateAttributes)this.Fields[(int)WixBundleUpdateSymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixBundleUpdateSymbolFields.Attributes, (int)value); } } -} \ No newline at end of file +} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs index d68ac682..b8a1923d 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs @@ -10,10 +10,9 @@ namespace WixToolset.Data SymbolDefinitionType.WixBundleVariable, new[] { + new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Attributes), IntermediateFieldType.Number), new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Value), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Type), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Hidden), IntermediateFieldType.Bool), - new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Persisted), IntermediateFieldType.Bool), }, typeof(WixBundleVariableSymbol)); } @@ -25,10 +24,17 @@ namespace WixToolset.Data.Symbols public enum WixBundleVariableSymbolFields { + Attributes, Value, Type, - Hidden, - Persisted, + } + + [Flags] + public enum WixBundleVariableAttributes + { + None = 0x0, + Hidden = 0x1, + Persisted = 0x2, } public enum WixBundleVariableType @@ -52,6 +58,12 @@ namespace WixToolset.Data.Symbols public IntermediateField this[WixBundleVariableSymbolFields index] => this.Fields[(int)index]; + public WixBundleVariableAttributes Attributes + { + get => (WixBundleVariableAttributes)this.Fields[(int)WixBundleVariableSymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixBundleVariableSymbolFields.Attributes, (int)value); + } + public string Value { get => (string)this.Fields[(int)WixBundleVariableSymbolFields.Value]; @@ -66,14 +78,34 @@ namespace WixToolset.Data.Symbols public bool Hidden { - get => (bool)this.Fields[(int)WixBundleVariableSymbolFields.Hidden]; - set => this.Set((int)WixBundleVariableSymbolFields.Hidden, value); + get { return this.Attributes.HasFlag(WixBundleVariableAttributes.Hidden); } + set + { + if (value) + { + this.Attributes |= WixBundleVariableAttributes.Hidden; + } + else + { + this.Attributes &= ~WixBundleVariableAttributes.Hidden; + } + } } public bool Persisted { - get => (bool)this.Fields[(int)WixBundleVariableSymbolFields.Persisted]; - set => this.Set((int)WixBundleVariableSymbolFields.Persisted, value); + get { return this.Attributes.HasFlag(WixBundleVariableAttributes.Persisted); } + set + { + if (value) + { + this.Attributes |= WixBundleVariableAttributes.Persisted; + } + else + { + this.Attributes &= ~WixBundleVariableAttributes.Persisted; + } + } } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixChainSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixChainSymbol.cs index 8ec5fc63..2ca1d512 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixChainSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixChainSymbol.cs @@ -52,10 +52,52 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixChainSymbolFields.Attributes, (int)value); } - public bool DisableRollback => (this.Attributes & WixChainAttributes.DisableRollback) == WixChainAttributes.DisableRollback; + public bool DisableRollback + { + get { return this.Attributes.HasFlag(WixChainAttributes.DisableRollback); } + set + { + if (value) + { + this.Attributes |= WixChainAttributes.DisableRollback; + } + else + { + this.Attributes &= ~WixChainAttributes.DisableRollback; + } + } + } - public bool DisableSystemRestore => (this.Attributes & WixChainAttributes.DisableSystemRestore) == WixChainAttributes.DisableSystemRestore; + public bool DisableSystemRestore + { + get { return this.Attributes.HasFlag(WixChainAttributes.DisableSystemRestore); } + set + { + if (value) + { + this.Attributes |= WixChainAttributes.DisableSystemRestore; + } + else + { + this.Attributes &= ~WixChainAttributes.DisableSystemRestore; + } + } + } - public bool ParallelCache => (this.Attributes & WixChainAttributes.ParallelCache) == WixChainAttributes.ParallelCache; + public bool ParallelCache + { + get { return this.Attributes.HasFlag(WixChainAttributes.ParallelCache); } + set + { + if (value) + { + this.Attributes |= WixChainAttributes.ParallelCache; + } + else + { + this.Attributes &= ~WixChainAttributes.ParallelCache; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixComponentSearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixComponentSearchSymbol.cs index 63f7179f..1a930c4e 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixComponentSearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixComponentSearchSymbol.cs @@ -13,6 +13,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Guid), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.ProductCode), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Type), IntermediateFieldType.Number), }, typeof(WixComponentSearchSymbol)); } @@ -27,14 +28,20 @@ namespace WixToolset.Data.Symbols Guid, ProductCode, Attributes, + Type, } [Flags] public enum WixComponentSearchAttributes { - KeyPath = 0x1, - State = 0x2, - WantDirectory = 0x4, + None = 0x0, + } + + public enum WixComponentSearchType + { + KeyPath, + State, + WantDirectory, } public class WixComponentSearchSymbol : IntermediateSymbol @@ -66,5 +73,11 @@ namespace WixToolset.Data.Symbols get => (WixComponentSearchAttributes)this.Fields[(int)WixComponentSearchSymbolFields.Attributes].AsNumber(); set => this.Set((int)WixComponentSearchSymbolFields.Attributes, (int)value); } + + public WixComponentSearchType Type + { + get => (WixComponentSearchType)this.Fields[(int)WixComponentSearchSymbolFields.Type].AsNumber(); + set => this.Set((int)WixComponentSearchSymbolFields.Type, (int)value); + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs index 027605c7..4f8a370e 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs @@ -19,6 +19,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.MaxDate), IntermediateFieldType.Number), new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Languages), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Type), IntermediateFieldType.Number), }, typeof(WixFileSearchSymbol)); } @@ -39,21 +40,27 @@ namespace WixToolset.Data.Symbols MaxDate, Languages, Attributes, + Type, } [Flags] public enum WixFileSearchAttributes { - Default = 0x001, + None = 0x000, + IsDirectory = 0x001, MinVersionInclusive = 0x002, MaxVersionInclusive = 0x004, MinSizeInclusive = 0x008, MaxSizeInclusive = 0x010, MinDateInclusive = 0x020, MaxDateInclusive = 0x040, - WantVersion = 0x080, - WantExists = 0x100, - IsDirectory = 0x200, + } + + public enum WixFileSearchType + { + Path, + Version, + Exists, } public class WixFileSearchSymbol : IntermediateSymbol @@ -121,5 +128,123 @@ namespace WixToolset.Data.Symbols get => (WixFileSearchAttributes)this.Fields[(int)WixFileSearchSymbolFields.Attributes].AsNumber(); set => this.Set((int)WixFileSearchSymbolFields.Attributes, (int)value); } + + public WixFileSearchType Type + { + get => (WixFileSearchType)this.Fields[(int)WixFileSearchSymbolFields.Type].AsNumber(); + set => this.Set((int)WixFileSearchSymbolFields.Type, (int)value); + } + + public bool IsDirectory + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.IsDirectory); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.IsDirectory; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.IsDirectory; + } + } + } + + public bool MinVersionInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinVersionInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MinVersionInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MinVersionInclusive; + } + } + } + + public bool MaxVersionInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxVersionInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MaxVersionInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MaxVersionInclusive; + } + } + } + + public bool MinSizeInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinSizeInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MinSizeInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MinSizeInclusive; + } + } + } + + public bool MaxSizeInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxSizeInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MaxSizeInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MaxSizeInclusive; + } + } + } + + public bool MinDateInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinDateInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MinDateInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MinDateInclusive; + } + } + } + + public bool MaxDateInclusive + { + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxDateInclusive); } + set + { + if (value) + { + this.Attributes |= WixFileSearchAttributes.MaxDateInclusive; + } + else + { + this.Attributes &= ~WixFileSearchAttributes.MaxDateInclusive; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixProductSearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixProductSearchSymbol.cs index f8a17b64..99360da5 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixProductSearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixProductSearchSymbol.cs @@ -12,6 +12,7 @@ namespace WixToolset.Data { new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Guid), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Type), IntermediateFieldType.Number), }, typeof(WixProductSearchSymbol)); } @@ -25,16 +26,26 @@ namespace WixToolset.Data.Symbols { Guid, Attributes, + Type, } [Flags] public enum WixProductSearchAttributes { - Version = 0x1, - Language = 0x2, - State = 0x4, - Assignment = 0x8, - UpgradeCode = 0x10, + None = 0x0, + + /// + /// Guid contains the UpgradeCode. If not set, it contains the ProductCode. + /// + UpgradeCode = 0x1, + } + + public enum WixProductSearchType + { + Version, + Language, + State, + Assignment, } public class WixProductSearchSymbol : IntermediateSymbol @@ -60,5 +71,27 @@ namespace WixToolset.Data.Symbols get => (WixProductSearchAttributes)this.Fields[(int)WixProductSearchSymbolFields.Attributes].AsNumber(); set => this.Set((int)WixProductSearchSymbolFields.Attributes, (int)value); } + + public WixProductSearchType Type + { + get => (WixProductSearchType)this.Fields[(int)WixProductSearchSymbolFields.Type].AsNumber(); + set => this.Set((int)WixProductSearchSymbolFields.Type, (int)value); + } + + public bool IsUpgradeCode + { + get { return this.Attributes.HasFlag(WixProductSearchAttributes.UpgradeCode); } + set + { + if (value) + { + this.Attributes |= WixProductSearchAttributes.UpgradeCode; + } + else + { + this.Attributes &= ~WixProductSearchAttributes.UpgradeCode; + } + } + } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixRegistrySearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixRegistrySearchSymbol.cs index dffa8410..f1da962b 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixRegistrySearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixRegistrySearchSymbol.cs @@ -14,6 +14,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Key), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Value), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Type), IntermediateFieldType.Number), }, typeof(WixRegistrySearchSymbol)); } @@ -29,17 +30,21 @@ namespace WixToolset.Data.Symbols Key, Value, Attributes, + Type, } [Flags] public enum WixRegistrySearchAttributes { - Raw = 0x01, - Compatible = 0x02, - ExpandEnvironmentVariables = 0x04, - WantValue = 0x08, - WantExists = 0x10, - Win64 = 0x20, + None = 0x0, + ExpandEnvironmentVariables = 0x01, + Win64 = 0x2, + } + + public enum WixRegistrySearchType + { + Value, + Exists, } public class WixRegistrySearchSymbol : IntermediateSymbol @@ -77,5 +82,43 @@ namespace WixToolset.Data.Symbols get => (WixRegistrySearchAttributes)this.Fields[(int)WixRegistrySearchSymbolFields.Attributes].AsNumber(); set => this.Set((int)WixRegistrySearchSymbolFields.Attributes, (int)value); } + + public WixRegistrySearchType Type + { + get => (WixRegistrySearchType)this.Fields[(int)WixRegistrySearchSymbolFields.Type].AsNumber(); + set => this.Set((int)WixRegistrySearchSymbolFields.Type, (int)value); + } + + public bool ExpandEnvironmentVariables + { + get { return this.Attributes.HasFlag(WixRegistrySearchAttributes.ExpandEnvironmentVariables); } + set + { + if (value) + { + this.Attributes |= WixRegistrySearchAttributes.ExpandEnvironmentVariables; + } + else + { + this.Attributes &= ~WixRegistrySearchAttributes.ExpandEnvironmentVariables; + } + } + } + + public bool Win64 + { + get { return this.Attributes.HasFlag(WixRegistrySearchAttributes.Win64); } + set + { + if (value) + { + this.Attributes |= WixRegistrySearchAttributes.Win64; + } + else + { + this.Attributes &= ~WixRegistrySearchAttributes.Win64; + } + } + } } } diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index d2a4e34b..32d18e9c 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs @@ -242,7 +242,6 @@ namespace WixToolsetTest.Util [Fact] public void CanBuildBundleWithSearches() { - var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); var folder = TestData.Get(@"TestData\BundleWithSearches"); var rootFolder = TestData.Get(); var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll"); @@ -269,9 +268,7 @@ namespace WixToolsetTest.Util result.AssertSuccess(); Assert.True(File.Exists(bundlePath)); -#if TODO Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); -#endif var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); extractResult.AssertSuccess(); @@ -293,7 +290,7 @@ namespace WixToolsetTest.Util Assert.Equal("", utilSearches[3].GetTestXml()); Assert.Equal("", utilSearches[4].GetTestXml()); + @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Win64='yes' Type='value' VariableType='string' />", utilSearches[4].GetTestXml()); } } diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 09a90928..323e0f6a 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs @@ -443,7 +443,8 @@ namespace WixToolset.Util string after = null; string guid = null; string productCode = null; - var attributes = WixComponentSearchAttributes.KeyPath; + var attributes = WixComponentSearchAttributes.None; + var type = WixComponentSearchType.KeyPath; foreach (var attrib in element.Attributes()) { @@ -468,13 +469,13 @@ namespace WixToolset.Util switch (result) { case "directory": - attributes = WixComponentSearchAttributes.WantDirectory; + type = WixComponentSearchType.WantDirectory; break; case "keyPath": - attributes = WixComponentSearchAttributes.KeyPath; + type = WixComponentSearchType.KeyPath; break; case "state": - attributes = WixComponentSearchAttributes.State; + type = WixComponentSearchType.State; break; default: this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "directory", "keyPath", "state")); @@ -499,7 +500,7 @@ namespace WixToolset.Util if (null == id) { - id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString()); + id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString(), type.ToString()); } this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); @@ -513,6 +514,7 @@ namespace WixToolset.Util Guid = guid, ProductCode = productCode, Attributes = attributes, + Type = type, }); } } @@ -983,6 +985,7 @@ namespace WixToolset.Util string after = null; string path = null; var attributes = WixFileSearchAttributes.IsDirectory; + var type = WixFileSearchType.Path; foreach (var attrib in element.Attributes()) { @@ -1004,7 +1007,7 @@ namespace WixToolset.Util switch (result) { case "exists": - attributes |= WixFileSearchAttributes.WantExists; + type = WixFileSearchType.Exists; break; default: this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists")); @@ -1029,7 +1032,7 @@ namespace WixToolset.Util if (null == id) { - id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString()); + id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString(), type.ToString()); } this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); @@ -1038,7 +1041,7 @@ namespace WixToolset.Util if (!this.Messaging.EncounteredError) { - this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes); + this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); } } @@ -1086,7 +1089,8 @@ namespace WixToolset.Util string condition = null; string after = null; string path = null; - var attributes = WixFileSearchAttributes.Default; + var attributes = WixFileSearchAttributes.None; + var type = WixFileSearchType.Path; foreach (var attrib in node.Attributes()) { @@ -1108,10 +1112,10 @@ namespace WixToolset.Util switch (result) { case "exists": - attributes |= WixFileSearchAttributes.WantExists; + type = WixFileSearchType.Exists; break; case "version": - attributes |= WixFileSearchAttributes.WantVersion; + type = WixFileSearchType.Version; break; default: this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "version")); @@ -1136,7 +1140,7 @@ namespace WixToolset.Util if (null == id) { - id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString()); + id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString(), type.ToString()); } this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); @@ -1145,7 +1149,7 @@ namespace WixToolset.Util if (!this.Messaging.EncounteredError) { - this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes); + this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); } } @@ -1156,12 +1160,14 @@ namespace WixToolset.Util /// Identifier of the search (key into the WixSearch table) /// File/directory path to search for. /// - private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes) + /// + private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes, WixFileSearchType type) { section.AddSymbol(new WixFileSearchSymbol(sourceLineNumbers, id) { Path = path, Attributes = attributes, + Type = type, }); } @@ -2545,7 +2551,8 @@ namespace WixToolset.Util string after = null; string productCode = null; string upgradeCode = null; - var attributes = WixProductSearchAttributes.Version; + var attributes = WixProductSearchAttributes.None; + var type = WixProductSearchType.Version; foreach (var attrib in element.Attributes()) { @@ -2570,16 +2577,16 @@ namespace WixToolset.Util switch (result) { case "version": - attributes = WixProductSearchAttributes.Version; + type = WixProductSearchType.Version; break; case "language": - attributes = WixProductSearchAttributes.Language; + type = WixProductSearchType.Language; break; case "state": - attributes = WixProductSearchAttributes.State; + type = WixProductSearchType.State; break; case "assignment": - attributes = WixProductSearchAttributes.Assignment; + type = WixProductSearchType.Assignment; break; default: this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "version", "language", "state", "assignment")); @@ -2607,9 +2614,21 @@ namespace WixToolset.Util this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "UpgradeCode", "ProductCode")); } + string guid; + if (upgradeCode != null) + { + // set an additional flag if this is an upgrade code + attributes |= WixProductSearchAttributes.UpgradeCode; + guid = upgradeCode; + } + else + { + guid = productCode; + } + if (null == id) { - id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, productCode ?? upgradeCode, attributes.ToString()); + id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, guid, attributes.ToString(), type.ToString()); } this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); @@ -2618,16 +2637,11 @@ namespace WixToolset.Util if (!this.Messaging.EncounteredError) { - // set an additional flag if this is an upgrade code - if (null != upgradeCode) - { - attributes |= WixProductSearchAttributes.UpgradeCode; - } - section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id) { - Guid = productCode ?? upgradeCode, + Guid = guid, Attributes = attributes, + Type = type, }); } } @@ -2648,7 +2662,8 @@ namespace WixToolset.Util string value = null; var expand = YesNoType.NotSet; var win64 = this.Context.IsCurrentPlatform64Bit; - var attributes = WixRegistrySearchAttributes.Raw | WixRegistrySearchAttributes.WantValue; + var attributes = WixRegistrySearchAttributes.None; + var type = WixRegistrySearchType.Value; foreach (var attrib in element.Attributes()) { @@ -2692,30 +2707,15 @@ namespace WixToolset.Util case "ExpandEnvironmentVariables": expand = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; - case "Format": - string format = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); - switch (format) - { - case "raw": - attributes |= WixRegistrySearchAttributes.Raw; - break; - case "compatible": - attributes |= WixRegistrySearchAttributes.Compatible; - break; - default: - this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, format, "raw", "compatible")); - break; - } - break; case "Result": var result = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); switch (result) { case "exists": - attributes |= WixRegistrySearchAttributes.WantExists; + type = WixRegistrySearchType.Exists; break; case "value": - attributes |= WixRegistrySearchAttributes.WantValue; + type = WixRegistrySearchType.Value; break; default: this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "value")); @@ -2743,14 +2743,9 @@ namespace WixToolset.Util this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Key")); } - if (null == id) - { - id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString()); - } - if (expand == YesNoType.Yes) { - if (0 != (attributes & WixRegistrySearchAttributes.WantExists)) + if (type == WixRegistrySearchType.Exists) { this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "ExpandEnvironmentVariables", expand.ToString(), "Result", "exists")); } @@ -2763,6 +2758,11 @@ namespace WixToolset.Util attributes |= WixRegistrySearchAttributes.Win64; } + if (null == id) + { + id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString(), type.ToString()); + } + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null); @@ -2775,6 +2775,7 @@ namespace WixToolset.Util Key = key, Value = value, Attributes = attributes, + Type = type, }); } } diff --git a/src/test/burn/WixTestTools/BundleVerifier.cs b/src/test/burn/WixTestTools/BundleVerifier.cs index a5dbe0ec..56044c5f 100644 --- a/src/test/burn/WixTestTools/BundleVerifier.cs +++ b/src/test/burn/WixTestTools/BundleVerifier.cs @@ -120,7 +120,7 @@ namespace WixTestTools var intermediate = Intermediate.Load(wixOutput); var section = intermediate.Sections.Single(); var packageSymbol = section.Symbols.OfType().Single(p => p.Id.Id == packageId); - var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes); + var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == true); if (Directory.Exists(cachePath)) { Directory.Delete(cachePath, true); @@ -133,7 +133,7 @@ namespace WixTestTools var intermediate = Intermediate.Load(wixOutput); var section = intermediate.Sections.Single(); var packageSymbol = section.Symbols.OfType().Single(p => p.Id.Id == packageId); - var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes); + var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == true); Assert.Equal(cached, Directory.Exists(cachePath)); } @@ -144,7 +144,7 @@ namespace WixTestTools var section = intermediate.Sections.Single(); var packageSymbol = section.Symbols.OfType().Single(p => p.Id.Id == packageId); var providerSymbol = section.Symbols.OfType().Single(p => p.ParentRef == packageId); - var registryRoot = packageSymbol.PerMachine == YesNoDefaultType.Yes ? Registry.LocalMachine : Registry.CurrentUser; + var registryRoot = packageSymbol.PerMachine == true ? Registry.LocalMachine : Registry.CurrentUser; var subkeyPath = Path.Combine(DependencyRegistryRoot, providerSymbol.ProviderKey); using var registryKey = registryRoot.OpenSubKey(subkeyPath); if (registryKey != null) diff --git a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index edcb0abf..201d2839 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -102,7 +102,7 @@ namespace WixToolset.Core.Burn bundleSymbol.ProviderKey = bundleSymbol.BundleId = Guid.NewGuid().ToString("B").ToUpperInvariant(); - bundleSymbol.Attributes |= WixBundleAttributes.PerMachine; // default to per-machine but the first-per user package wil flip the bundle per-user. + bundleSymbol.PerMachine = true; // default to per-machine but the first-per user package wil flip the bundle per-user. this.NormalizeRelatedBundles(bundleSymbol, section); @@ -608,11 +608,11 @@ namespace WixToolset.Core.Burn foreach (var facade in facades) { - if (bundleSymbol.PerMachine && YesNoDefaultType.No == facade.PackageSymbol.PerMachine) + if (bundleSymbol.PerMachine && facade.PackageSymbol.PerMachine.HasValue && !facade.PackageSymbol.PerMachine.Value) { this.Messaging.Write(VerboseMessages.SwitchingToPerUserPackage(facade.PackageSymbol.SourceLineNumbers, facade.PackageId)); - bundleSymbol.Attributes &= ~WixBundleAttributes.PerMachine; + bundleSymbol.PerMachine = false; break; } } @@ -620,15 +620,15 @@ namespace WixToolset.Core.Burn foreach (var facade in facades) { // Update package scope from bundle scope if default. - if (YesNoDefaultType.Default == facade.PackageSymbol.PerMachine) + if (!facade.PackageSymbol.PerMachine.HasValue) { - facade.PackageSymbol.PerMachine = bundleSymbol.PerMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No; + facade.PackageSymbol.PerMachine = bundleSymbol.PerMachine; } // We will only register packages in the same scope as the bundle. Warn if any packages with providers // are in a different scope and not permanent (permanents typically don't need a ref-count). if (!bundleSymbol.PerMachine && - YesNoDefaultType.Yes == facade.PackageSymbol.PerMachine && + facade.PackageSymbol.PerMachine.Value && !facade.PackageSymbol.Permanent && dependencySymbolsById.ContainsKey(facade.PackageId)) { diff --git a/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs b/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs index 24d6f542..c6b6e7ee 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs @@ -3,6 +3,7 @@ namespace WixToolset.Core.Burn { using System; + using System.Diagnostics; using System.Xml; using WixToolset.Data; using WixToolset.Data.Symbols; @@ -37,6 +38,8 @@ namespace WixToolset.Core.Burn case WixRegistrySearchSymbol symbol: this.WriteRegistrySearchXml(writer, symbol); break; + default: + throw new NotImplementedException(); } } @@ -53,17 +56,19 @@ namespace WixToolset.Core.Burn writer.WriteAttributeString("ProductCode", searchSymbol.ProductCode); } - if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.KeyPath)) + switch (searchSymbol.Type) { - writer.WriteAttributeString("Type", "keyPath"); - } - else if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.State)) - { - writer.WriteAttributeString("Type", "state"); - } - else if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.WantDirectory)) - { - writer.WriteAttributeString("Type", "directory"); + case WixComponentSearchType.KeyPath: + writer.WriteAttributeString("Type", "keyPath"); + break; + case WixComponentSearchType.State: + writer.WriteAttributeString("Type", "state"); + break; + case WixComponentSearchType.WantDirectory: + writer.WriteAttributeString("Type", "directory"); + break; + default: + throw new NotImplementedException(); } writer.WriteEndElement(); @@ -71,24 +76,28 @@ namespace WixToolset.Core.Burn private void WriteFileSearchXml(XmlTextWriter writer, WixFileSearchSymbol searchSymbol) { - writer.WriteStartElement((0 == (searchSymbol.Attributes & WixFileSearchAttributes.IsDirectory)) ? "FileSearch" : "DirectorySearch"); + writer.WriteStartElement(!searchSymbol.IsDirectory ? "FileSearch" : "DirectorySearch"); base.WriteXml(writer); writer.WriteAttributeString("Path", searchSymbol.Path); - if (WixFileSearchAttributes.WantExists == (searchSymbol.Attributes & WixFileSearchAttributes.WantExists)) - { - writer.WriteAttributeString("Type", "exists"); - } - else if (WixFileSearchAttributes.WantVersion == (searchSymbol.Attributes & WixFileSearchAttributes.WantVersion)) - { - // Can never get here for DirectorySearch. - writer.WriteAttributeString("Type", "version"); - } - else + + switch (searchSymbol.Type) { - writer.WriteAttributeString("Type", "path"); + case WixFileSearchType.Exists: + writer.WriteAttributeString("Type", "exists"); + break; + case WixFileSearchType.Version: + Debug.Assert(!searchSymbol.IsDirectory, "Version search type is invalid for DirectorySearch"); + writer.WriteAttributeString("Type", "version"); + break; + case WixFileSearchType.Path: + writer.WriteAttributeString("Type", "path"); + break; + default: + throw new NotImplementedException(); } + writer.WriteEndElement(); } @@ -98,7 +107,7 @@ namespace WixToolset.Core.Burn base.WriteXml(writer); - if (0 != (symbol.Attributes & WixProductSearchAttributes.UpgradeCode)) + if (symbol.IsUpgradeCode) { writer.WriteAttributeString("UpgradeCode", symbol.Guid); } @@ -107,21 +116,22 @@ namespace WixToolset.Core.Burn writer.WriteAttributeString("ProductCode", symbol.Guid); } - if (0 != (symbol.Attributes & WixProductSearchAttributes.Version)) - { - writer.WriteAttributeString("Type", "version"); - } - else if (0 != (symbol.Attributes & WixProductSearchAttributes.Language)) - { - writer.WriteAttributeString("Type", "language"); - } - else if (0 != (symbol.Attributes & WixProductSearchAttributes.State)) - { - writer.WriteAttributeString("Type", "state"); - } - else if (0 != (symbol.Attributes & WixProductSearchAttributes.Assignment)) + switch (symbol.Type) { - writer.WriteAttributeString("Type", "assignment"); + case WixProductSearchType.Version: + writer.WriteAttributeString("Type", "version"); + break; + case WixProductSearchType.Language: + writer.WriteAttributeString("Type", "language"); + break; + case WixProductSearchType.State: + writer.WriteAttributeString("Type", "state"); + break; + case WixProductSearchType.Assignment: + writer.WriteAttributeString("Type", "assignment"); + break; + default: + throw new NotImplementedException(); } writer.WriteEndElement(); @@ -147,6 +157,8 @@ namespace WixToolset.Core.Burn case RegistryRootType.Users: writer.WriteAttributeString("Root", "HKU"); break; + default: + throw new NotImplementedException(); } writer.WriteAttributeString("Key", symbol.Key); @@ -156,27 +168,32 @@ namespace WixToolset.Core.Burn writer.WriteAttributeString("Value", symbol.Value); } - var existenceOnly = 0 != (symbol.Attributes & WixRegistrySearchAttributes.WantExists); - - writer.WriteAttributeString("Type", existenceOnly ? "exists" : "value"); - - if (0 != (symbol.Attributes & WixRegistrySearchAttributes.Win64)) + if (symbol.Win64) { writer.WriteAttributeString("Win64", "yes"); } - if (!existenceOnly) + switch (symbol.Type) { - if (0 != (symbol.Attributes & WixRegistrySearchAttributes.ExpandEnvironmentVariables)) - { - writer.WriteAttributeString("ExpandEnvironment", "yes"); - } + case WixRegistrySearchType.Exists: + writer.WriteAttributeString("Type", "exists"); + break; + case WixRegistrySearchType.Value: + writer.WriteAttributeString("Type", "value"); - // We *always* say this is VariableType="string". If we end up - // needing to be more specific, we will have to expand the "Format" - // attribute to allow "number" and "version". + if (symbol.ExpandEnvironmentVariables) + { + writer.WriteAttributeString("ExpandEnvironment", "yes"); + } - writer.WriteAttributeString("VariableType", "string"); + // We *always* say this is VariableType="string". + // If we end up needing to be more specific, + // we will have to actually implement the "Format" attribute. + writer.WriteAttributeString("VariableType", "string"); + + break; + default: + throw new NotImplementedException(); } writer.WriteEndElement(); diff --git a/src/wix/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs index 75c60e56..064bc62a 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs @@ -4,7 +4,6 @@ namespace WixToolset.Core.Burn.Bundles { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Linq; using WixToolset.Data; using WixToolset.Data.Symbols; @@ -43,7 +42,7 @@ namespace WixToolset.Core.Burn.Bundles // Index target ProductCodes and UpgradeCodes for slipstreamed MSPs. foreach (var symbol in patchTargetCodeSymbols) { - if (symbol.TargetsProductCode) + if (symbol.Type == WixBundlePatchTargetCodeType.ProductCode) { if (!targetsProductCode.TryGetValue(symbol.TargetCode, out var symbols)) { @@ -53,13 +52,15 @@ namespace WixToolset.Core.Burn.Bundles symbols.Add(symbol); } - else if (symbol.TargetsUpgradeCode) + else if (symbol.Type == WixBundlePatchTargetCodeType.UpgradeCode) { if (!targetsUpgradeCode.TryGetValue(symbol.TargetCode, out var symbols)) { symbols = new List(); targetsUpgradeCode.Add(symbol.TargetCode, symbols); } + + symbols.Add(symbol); } } } @@ -74,9 +75,6 @@ namespace WixToolset.Core.Burn.Bundles { foreach (var symbol in symbols) { - Debug.Assert(symbol.TargetsProductCode); - Debug.Assert(!symbol.TargetsUpgradeCode); - this.TryAddSlipstreamSymbol(slipstreamMspIds, msi, symbol); } } @@ -85,13 +83,8 @@ namespace WixToolset.Core.Burn.Bundles { foreach (var symbol in symbols) { - Debug.Assert(!symbol.TargetsProductCode); - Debug.Assert(symbol.TargetsUpgradeCode); - this.TryAddSlipstreamSymbol(slipstreamMspIds, msi, symbol); } - - symbols = null; } } } diff --git a/src/wix/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs index 42e3381a..b993da87 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs @@ -127,8 +127,8 @@ namespace WixToolset.Core.Burn.Bundles { writer.WriteStartElement("WixRollbackBoundary"); writer.WriteAttributeString("Id", rollbackBoundary.Id.Id); - writer.WriteAttributeString("Vital", rollbackBoundary.Vital == false ? "no" : "yes"); - writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction == true ? "yes" : "no"); + writer.WriteAttributeString("Vital", rollbackBoundary.Vital ? "yes" : "no"); + writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction ? "yes" : "no"); if (!String.IsNullOrEmpty(rollbackBoundary.LogPathVariable)) { @@ -155,7 +155,7 @@ namespace WixToolset.Core.Burn.Bundles writer.WriteStartElement("WixPackageProperties"); writer.WriteAttributeString("Package", package.PackageId); - writer.WriteAttributeString("Vital", package.PackageSymbol.Vital == true ? "yes" : "no"); + writer.WriteAttributeString("Vital", package.PackageSymbol.Vital ? "yes" : "no"); if (!String.IsNullOrEmpty(package.PackageSymbol.DisplayName)) { diff --git a/src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs index 14d903db..be5fdf0d 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs @@ -186,8 +186,8 @@ namespace WixToolset.Core.Burn.Bundles { writer.WriteStartElement("RollbackBoundary"); writer.WriteAttributeString("Id", rollbackBoundary.Id.Id); - writer.WriteAttributeString("Vital", rollbackBoundary.Vital == false ? "no" : "yes"); - writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction == true ? "yes" : "no"); + writer.WriteAttributeString("Vital", rollbackBoundary.Vital ? "yes" : "no"); + writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction ? "yes" : "no"); if (!String.IsNullOrEmpty(rollbackBoundary.LogPathVariable)) { @@ -246,13 +246,14 @@ namespace WixToolset.Core.Burn.Bundles writer.WriteAttributeString("ParentDisplayName", this.BundleSymbol.ParentName); } - if (this.BundleSymbol.DisableModify) + switch (this.BundleSymbol.DisableModify) { - writer.WriteAttributeString("DisableModify", "yes"); - } - else if (this.BundleSymbol.SingleChangeUninstallButton) - { - writer.WriteAttributeString("DisableModify", "button"); + case WixBundleModifyType.Disabled: + writer.WriteAttributeString("DisableModify", "yes"); + break; + case WixBundleModifyType.SingleChangeUninstallButton: + writer.WriteAttributeString("DisableModify", "button"); + break; } if (this.BundleSymbol.DisableRemove) @@ -352,9 +353,9 @@ namespace WixToolset.Core.Burn.Bundles writer.WriteAttributeString("CacheId", package.PackageSymbol.CacheId); writer.WriteAttributeString("InstallSize", Convert.ToString(package.PackageSymbol.InstallSize)); writer.WriteAttributeString("Size", Convert.ToString(package.PackageSymbol.Size)); - writer.WriteAttributeString("PerMachine", YesNoDefaultType.Yes == package.PackageSymbol.PerMachine ? "yes" : "no"); + writer.WriteAttributeString("PerMachine", package.PackageSymbol.PerMachine.HasValue && package.PackageSymbol.PerMachine.Value ? "yes" : "no"); writer.WriteAttributeString("Permanent", package.PackageSymbol.Permanent ? "yes" : "no"); - writer.WriteAttributeString("Vital", package.PackageSymbol.Vital == false ? "no" : "yes"); + writer.WriteAttributeString("Vital", package.PackageSymbol.Vital ? "yes" : "no"); if (null != package.PackageSymbol.RollbackBoundaryRef) { @@ -389,9 +390,9 @@ namespace WixToolset.Core.Burn.Bundles writer.WriteAttributeString("UninstallArguments", bundlePackage.UninstallCommand); writer.WriteAttributeString("RepairArguments", bundlePackage.RepairCommand); writer.WriteAttributeString("SupportsBurnProtocol", bundlePackage.SupportsBurnProtocol ? "yes" : "no"); - writer.WriteAttributeString("Win64", bundlePackage.Win64 ? "yes" : "no"); + writer.WriteAttributeString("Win64", package.PackageSymbol.Win64 ? "yes" : "no"); - if (!package.PackageSymbol.Attributes.HasFlag(WixBundlePackageAttributes.Visible)) + if (!package.PackageSymbol.Visible) { writer.WriteAttributeString("HideARP", "yes"); } @@ -434,15 +435,15 @@ namespace WixToolset.Core.Burn.Bundles // product codes, add the patch list to the overall list. if (null != targetCodes) { - if (!mspPackage.TargetUnspecified) + foreach (var patchTargetCode in targetCodesByPatch[mspPackage.Id.Id]) { - var patchTargetCodes = targetCodesByPatch[mspPackage.Id.Id]; + if (patchTargetCode.Type == WixBundlePatchTargetCodeType.Unspecified) + { + targetCodes = null; + break; + } - targetCodes.AddRange(patchTargetCodes); - } - else // we have a patch that targets the world, so throw the whole list away. - { - targetCodes = null; + targetCodes.Add(patchTargetCode); } } } @@ -611,9 +612,11 @@ namespace WixToolset.Core.Burn.Bundles { foreach (var targetCode in targetCodes) { + Debug.Assert(targetCode.Type == WixBundlePatchTargetCodeType.ProductCode || targetCode.Type == WixBundlePatchTargetCodeType.UpgradeCode); + writer.WriteStartElement("PatchTargetCode"); writer.WriteAttributeString("TargetCode", targetCode.TargetCode); - writer.WriteAttributeString("Product", targetCode.TargetsProductCode ? "yes" : "no"); + writer.WriteAttributeString("Product", targetCode.Type == WixBundlePatchTargetCodeType.ProductCode ? "yes" : "no"); writer.WriteEndElement(); } } diff --git a/src/wix/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs index 87c10190..99e1e196 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs @@ -57,7 +57,7 @@ namespace WixToolset.Core.Burn.Bundles { if (this.PackageFacades.TryGetValue(groupSymbol.ChildId, out var facade)) { - var insideMsiTransaction = lastRollbackBoundary.Transaction ?? false; + var insideMsiTransaction = lastRollbackBoundary.Transaction; if (null != pendingRollbackBoundary) { diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs index 986b7605..aed005ba 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs @@ -82,7 +82,7 @@ namespace WixToolset.Core.Burn.Bundles case BurnCommon.IMAGE_FILE_MACHINE_ARM64: case BurnCommon.IMAGE_FILE_MACHINE_IA64: case BurnCommon.IMAGE_FILE_MACHINE_LOONGARCH64: - bundlePackage.Win64 = true; + this.Facade.PackageSymbol.Win64 = true; break; case BurnCommon.IMAGE_FILE_MACHINE_EBC: case BurnCommon.IMAGE_FILE_MACHINE_MIPS16: @@ -123,11 +123,11 @@ namespace WixToolset.Core.Burn.Bundles return; } - if (BurnCommon.BurnV3Namespace == document.DocumentElement.NamespaceURI && !this.Facade.PackageSymbol.Attributes.HasFlag(WixBundlePackageAttributes.Visible)) + if (BurnCommon.BurnV3Namespace == document.DocumentElement.NamespaceURI && !this.Facade.PackageSymbol.Visible) { this.Messaging.Write(BurnBackendWarnings.HiddenBundleNotSupported(packagePayload.SourceLineNumbers, sourcePath)); - this.Facade.PackageSymbol.Attributes |= WixBundlePackageAttributes.Visible; + this.Facade.PackageSymbol.Visible = true; } namespaceManager.AddNamespace("burn", document.DocumentElement.NamespaceURI); @@ -135,7 +135,7 @@ namespace WixToolset.Core.Burn.Bundles var arpElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration/burn:Arp", namespaceManager) as XmlElement; var perMachine = registrationElement.GetAttribute("PerMachine") == "yes"; - this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No; + this.Facade.PackageSymbol.PerMachine = perMachine; var version = registrationElement.GetAttribute("Version"); packagePayload.Version = version; diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs index c2bceb32..4ca3a730 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs @@ -4,6 +4,7 @@ namespace WixToolset.Core.Burn.Bundles { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -88,7 +89,7 @@ namespace WixToolset.Core.Burn.Bundles // in MSI 4.5 and below, if this bit is 0, elevation is required. var perMachine = (0 == (fileAndElevateFlags & 8)); - this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No; + this.Facade.PackageSymbol.PerMachine = perMachine; this.Facade.PackageSymbol.Win64 = this.IsWin64(packagePayload.SourceLineNumbers, sourcePath, platformsAndLanguages); } @@ -177,7 +178,7 @@ namespace WixToolset.Core.Burn.Bundles this.CreateRelatedPackages(db); // If feature selection is enabled, represent the Feature table in the manifest. - if ((msiPackage.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection) == WixBundleMsiPackageAttributes.EnableFeatureSelection) + if (msiPackage.EnableFeatureSelection) { this.CreateMsiFeatures(db); } @@ -240,13 +241,16 @@ namespace WixToolset.Core.Burn.Bundles private void SetPerMachineAppropriately(string allusers, WixBundleMsiPackageSymbol msiPackage, string sourcePath) { + Debug.Assert(this.Facade.PackageSymbol.PerMachine.HasValue); + var perMachine = this.Facade.PackageSymbol.PerMachine.Value; + // Can ignore ALLUSERS from MsiProperties because it is not allowed there. if (msiPackage.ForcePerMachine) { - if (YesNoDefaultType.No == this.Facade.PackageSymbol.PerMachine) + if (!perMachine) { this.Messaging.Write(WarningMessages.PerUserButForcingPerMachine(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath)); - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.Yes; // ensure that we think the package is per-machine. + this.Facade.PackageSymbol.PerMachine = true; // ensure that we think the package is per-machine. } // Force ALLUSERS=1 via the MSI command-line. @@ -257,22 +261,22 @@ namespace WixToolset.Core.Burn.Bundles if (String.IsNullOrEmpty(allusers)) { // Not forced per-machine and no ALLUSERS property, flip back to per-user. - if (YesNoDefaultType.Yes == this.Facade.PackageSymbol.PerMachine) + if (perMachine) { this.Messaging.Write(WarningMessages.ImplicitlyPerUser(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath)); - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.No; + this.Facade.PackageSymbol.PerMachine = false; } } else if (allusers.Equals("1", StringComparison.Ordinal)) { - if (YesNoDefaultType.No == this.Facade.PackageSymbol.PerMachine) + if (!perMachine) { this.Messaging.Write(ErrorMessages.PerUserButAllUsersEquals1(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath)); } } else if (allusers.Equals("2", StringComparison.Ordinal)) { - this.Messaging.Write(WarningMessages.DiscouragedAllUsersValue(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath, (YesNoDefaultType.Yes == this.Facade.PackageSymbol.PerMachine) ? "machine" : "user")); + this.Messaging.Write(WarningMessages.DiscouragedAllUsersValue(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath, perMachine ? "machine" : "user")); } else { @@ -287,7 +291,7 @@ namespace WixToolset.Core.Burn.Bundles if (!msiPropertyNames.Contains("ARPSYSTEMCOMPONENT")) { var alreadyVisible = String.IsNullOrEmpty(systemComponent); - var visible = (this.Facade.PackageSymbol.Attributes & WixBundlePackageAttributes.Visible) == WixBundlePackageAttributes.Visible; + var visible = this.Facade.PackageSymbol.Visible; // If not already set to the correct visibility. if (alreadyVisible != visible) diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs index 5f431b38..d306957e 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs @@ -97,7 +97,7 @@ namespace WixToolset.Core.Burn.Bundles private void ProcessPatchXml(WixBundlePayloadSymbol packagePayload, WixBundleMspPackageSymbol mspPackage, string sourcePath) { - var uniqueTargetCodes = new HashSet(); + var uniqueTargetCodes = new Dictionary(); var patchXml = Installer.ExtractPatchXml(sourcePath); @@ -112,35 +112,42 @@ namespace WixToolset.Core.Burn.Bundles { // If this patch targets a product code, this is the best case. var targetCodeElement = node.SelectSingleNode("p:TargetProductCode", nsmgr); - var attributes = WixBundlePatchTargetCodeAttributes.None; + WixBundlePatchTargetCodeType type; if (ProcessMspPackageCommand.TargetsCode(targetCodeElement)) { - attributes = WixBundlePatchTargetCodeAttributes.TargetsProductCode; + type = WixBundlePatchTargetCodeType.ProductCode; } else // maybe targets an upgrade code? { targetCodeElement = node.SelectSingleNode("p:UpgradeCode", nsmgr); if (ProcessMspPackageCommand.TargetsCode(targetCodeElement)) { - attributes = WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode; + type = WixBundlePatchTargetCodeType.UpgradeCode; } else // this patch targets an unknown number of products { - mspPackage.Attributes |= WixBundleMspPackageAttributes.TargetUnspecified; + type = WixBundlePatchTargetCodeType.Unspecified; } } var targetCode = targetCodeElement.InnerText; - if (uniqueTargetCodes.Add(targetCode)) + if (!uniqueTargetCodes.TryGetValue(targetCode, out var existing)) { - this.Section.AddSymbol(new WixBundlePatchTargetCodeSymbol(packagePayload.SourceLineNumbers) + var symbol = this.Section.AddSymbol(new WixBundlePatchTargetCodeSymbol(packagePayload.SourceLineNumbers) { PackageRef = packagePayload.Id.Id, TargetCode = targetCode, - Attributes = attributes + Attributes = 0, + Type = type, }); + + uniqueTargetCodes.Add(targetCode, symbol); + } + else if (type == WixBundlePatchTargetCodeType.Unspecified) + { + existing.Type = type; } } @@ -178,6 +185,9 @@ namespace WixToolset.Core.Burn.Bundles } } - private static bool TargetsCode(XmlNode node) => "true" == node?.Attributes["Validate"]?.Value; + private static bool TargetsCode(XmlNode node) + { + return "true" == node?.Attributes["Validate"]?.Value; + } } } diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs index af4ab3a8..4c61f6d7 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs @@ -31,7 +31,7 @@ namespace WixToolset.Core.Burn.Bundles this.Facade.PackageSymbol.CacheId = packagePayload.Hash; } - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.Yes; // MSUs are always per-machine. + this.Facade.PackageSymbol.PerMachine = true; // MSUs are always per-machine. } } } diff --git a/src/wix/WixToolset.Core/Compiler_Bundle.cs b/src/wix/WixToolset.Core/Compiler_Bundle.cs index 2632a346..ab405684 100644 --- a/src/wix/WixToolset.Core/Compiler_Bundle.cs +++ b/src/wix/WixToolset.Core/Compiler_Bundle.cs @@ -117,6 +117,7 @@ namespace WixToolset.Core var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); string copyright = null; string aboutUrl = null; + var modifyType = WixBundleModifyType.Allowed; var compressed = YesNoDefaultType.Default; WixBundleAttributes attributes = 0; WixBundleCommandLineVariables commandLineVariables = WixBundleCommandLineVariables.UpperCase; @@ -176,12 +177,13 @@ namespace WixToolset.Core switch (value) { case "button": - attributes |= WixBundleAttributes.SingleChangeUninstallButton; + modifyType = WixBundleModifyType.SingleChangeUninstallButton; break; case "yes": - attributes |= WixBundleAttributes.DisableModify; + modifyType = WixBundleModifyType.Disabled; break; case "no": + modifyType = WixBundleModifyType.Allowed; break; default: this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); @@ -415,6 +417,7 @@ namespace WixToolset.Core UpgradeCode = upgradeCode, Version = version, Copyright = copyright, + DisableModify = modifyType, InProgressName = inProgressName, Name = name, Manufacturer = manufacturer, @@ -2432,16 +2435,16 @@ namespace WixToolset.Core DisplayName = displayName, LogPathVariable = logPathVariable, RollbackLogPathVariable = rollbackPathVariable, + Vital = vital == YesNoType.Yes, }); - if (YesNoType.NotSet != vital) + if (perMachine == YesNoDefaultType.Yes) { - chainPackageSymbol.Vital = (vital == YesNoType.Yes); + chainPackageSymbol.PerMachine = true; } - - if (YesNoDefaultType.NotSet != perMachine) + else if (perMachine == YesNoDefaultType.No) { - chainPackageSymbol.PerMachine = perMachine; + chainPackageSymbol.PerMachine = false; } if (installSize.HasValue) @@ -2918,21 +2921,15 @@ namespace WixToolset.Core { this.Core.AddSymbol(new WixChainItemSymbol(sourceLineNumbers, id)); - var rollbackBoundary = this.Core.AddSymbol(new WixBundleRollbackBoundarySymbol(sourceLineNumbers, id)); - - if (YesNoType.NotSet != vital) + var rollbackBoundary = this.Core.AddSymbol(new WixBundleRollbackBoundarySymbol(sourceLineNumbers, id) { - rollbackBoundary.Vital = (vital == YesNoType.Yes); - } + Transaction = transaction == YesNoType.Yes, + Vital = vital == YesNoType.Yes, + }); - if (YesNoType.NotSet != transaction) + if (logPathVariable != null) { - rollbackBoundary.Transaction = (transaction == YesNoType.Yes); - - if (logPathVariable != null) - { - rollbackBoundary.LogPathVariable = logPathVariable; - } + rollbackBoundary.LogPathVariable = logPathVariable; } this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null); -- cgit v1.2.3-55-g6feb