@joebigelow / wix-1 / commits / be436827

Try to improve fields of bundle symbols.

Sean Hall committed Apr 13, 2022 at 10:13 UTC be43682720cf9c238aa1efba5940b8e2279c5bc4
34 files changed +923 -318
src/api/wix/WixToolset.Data/Symbols/WixApprovedExeForElevationSymbol.cs
+15 -1
@@ -66,6 +66,20 @@ namespace WixToolset.Data.Symbols
66 set => this.Set((int)WixApprovedExeForElevationSymbolFields.Attributes, (int)value);
67 }
68
69 - public bool Win64 => (this.Attributes & WixApprovedExeForElevationAttributes.Win64) == WixApprovedExeForElevationAttributes.Win64;
69 + public bool Win64
70 + {
71 + get { return this.Attributes.HasFlag(WixApprovedExeForElevationAttributes.Win64); }
72 + set
73 + {
74 + if (value)
75 + {
76 + this.Attributes |= WixApprovedExeForElevationAttributes.Win64;
77 + }
78 + else
79 + {
80 + this.Attributes &= ~WixApprovedExeForElevationAttributes.Win64;
81 + }
82 + }
83 + }
84 }
85 }
src/api/wix/WixToolset.Data/Symbols/WixBundleBundlePackageSymbol.cs
-17
@@ -40,7 +40,6 @@ namespace WixToolset.Data.Symbols
40 {
41 None = 0,
42 SupportsBurnProtocol = 1,
43 - Win64 = 2,
43 }
44
45 public class WixBundleBundlePackageSymbol : IntermediateSymbol
@@ -106,21 +105,5 @@ namespace WixToolset.Data.Symbols
105 }
106 }
107 }
109 -
110 - public bool Win64
111 - {
112 - get { return this.Attributes.HasFlag(WixBundleBundlePackageAttributes.Win64); }
113 - set
114 - {
115 - if (value)
116 - {
117 - this.Attributes |= WixBundleBundlePackageAttributes.Win64;
118 - }
119 - else
120 - {
121 - this.Attributes &= ~WixBundleBundlePackageAttributes.Win64;
122 - }
123 - }
124 - }
108 }
109 }
src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs
+15 -1
@@ -90,7 +90,21 @@ namespace WixToolset.Data.Symbols
90 set => this.Set((int)WixBundleExePackageSymbolFields.ExeProtocol, value);
91 }
92
93 - public bool IsBundle => this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle);
93 + public bool IsBundle
94 + {
95 + get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle); }
96 + set
97 + {
98 + if (value)
99 + {
100 + this.Attributes |= WixBundleExePackageAttributes.Bundle;
101 + }
102 + else
103 + {
104 + this.Attributes &= ~WixBundleExePackageAttributes.Bundle;
105 + }
106 + }
107 + }
108
109 public bool Repairable => this.RepairCommand != null;
110
src/api/wix/WixToolset.Data/Symbols/WixBundleMsiFeatureSymbol.cs
+1
@@ -107,6 +107,7 @@ namespace WixToolset.Data.Symbols
107 set => this.Set((int)WixBundleMsiFeatureSymbolFields.Directory, value);
108 }
109
110 + // Passthrough for Attributes column of Feature table.
111 public int Attributes
112 {
113 get => (int)this.Fields[(int)WixBundleMsiFeatureSymbolFields.Attributes];
src/api/wix/WixToolset.Data/Symbols/WixBundleMsiPackageSymbol.cs
+33 -4
@@ -40,7 +40,8 @@ namespace WixToolset.Data.Symbols
40 [Flags]
41 public enum WixBundleMsiPackageAttributes
42 {
43 - EnableFeatureSelection = 0x4,
43 + None = 0x0,
44 + EnableFeatureSelection = 0x1,
45 ForcePerMachine = 0x2,
46 }
47
@@ -98,8 +99,36 @@ namespace WixToolset.Data.Symbols
99 set => this.Set((int)WixBundleMsiPackageSymbolFields.Manufacturer, value);
100 }
101
101 - public bool EnableFeatureSelection => (this.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection) == WixBundleMsiPackageAttributes.EnableFeatureSelection;
102 + public bool EnableFeatureSelection
103 + {
104 + get { return this.Attributes.HasFlag(WixBundleMsiPackageAttributes.EnableFeatureSelection); }
105 + set
106 + {
107 + if (value)
108 + {
109 + this.Attributes |= WixBundleMsiPackageAttributes.EnableFeatureSelection;
110 + }
111 + else
112 + {
113 + this.Attributes &= ~WixBundleMsiPackageAttributes.EnableFeatureSelection;
114 + }
115 + }
116 + }
117
103 - public bool ForcePerMachine => (this.Attributes & WixBundleMsiPackageAttributes.ForcePerMachine) == WixBundleMsiPackageAttributes.ForcePerMachine;
118 + public bool ForcePerMachine
119 + {
120 + get { return this.Attributes.HasFlag(WixBundleMsiPackageAttributes.ForcePerMachine); }
121 + set
122 + {
123 + if (value)
124 + {
125 + this.Attributes |= WixBundleMsiPackageAttributes.ForcePerMachine;
126 + }
127 + else
128 + {
129 + this.Attributes &= ~WixBundleMsiPackageAttributes.ForcePerMachine;
130 + }
131 + }
132 + }
133 }
105 -}
\ No newline at end of file
134 +}
src/api/wix/WixToolset.Data/Symbols/WixBundleMspPackageSymbol.cs
+18 -6
@@ -34,8 +34,8 @@ namespace WixToolset.Data.Symbols
34 [Flags]
35 public enum WixBundleMspPackageAttributes
36 {
37 - Slipstream = 0x2,
38 - TargetUnspecified = 0x4,
37 + None = 0x0,
38 + Slipstream = 0x1,
39 }
40
41 public class WixBundleMspPackageSymbol : IntermediateSymbol
@@ -74,8 +74,20 @@ namespace WixToolset.Data.Symbols
74 set => this.Set((int)WixBundleMspPackageSymbolFields.PatchXml, value);
75 }
76
77 - public bool Slipstream => (this.Attributes & WixBundleMspPackageAttributes.Slipstream) == WixBundleMspPackageAttributes.Slipstream;
78 -
79 - public bool TargetUnspecified => (this.Attributes & WixBundleMspPackageAttributes.TargetUnspecified) == WixBundleMspPackageAttributes.TargetUnspecified;
77 + public bool Slipstream
78 + {
79 + get { return this.Attributes.HasFlag(WixBundleMspPackageAttributes.Slipstream); }
80 + set
81 + {
82 + if (value)
83 + {
84 + this.Attributes |= WixBundleMspPackageAttributes.Slipstream;
85 + }
86 + else
87 + {
88 + this.Attributes &= ~WixBundleMspPackageAttributes.Slipstream;
89 + }
90 + }
91 + }
92 }
81 -}
\ No newline at end of file
93 +}
src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs
+76 -20
@@ -16,8 +16,7 @@ namespace WixToolset.Data
16 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.InstallCondition), IntermediateFieldType.String),
17 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Cache), IntermediateFieldType.String),
18 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.CacheId), IntermediateFieldType.String),
19 - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Vital), IntermediateFieldType.Bool),
20 - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.String),
19 + new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.Bool),
20 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String),
21 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackLogPathVariable), IntermediateFieldType.String),
22 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Size), IntermediateFieldType.LargeNumber),
@@ -28,7 +27,6 @@ namespace WixToolset.Data
27 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Description), IntermediateFieldType.String),
28 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryRef), IntermediateFieldType.String),
29 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef), IntermediateFieldType.String),
31 - new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Win64), IntermediateFieldType.Bool),
30 },
31 typeof(WixBundlePackageSymbol));
32 }
@@ -46,7 +44,6 @@ namespace WixToolset.Data.Symbols
44 InstallCondition,
45 Cache,
46 CacheId,
49 - Vital,
47 PerMachine,
48 LogPathVariable,
49 RollbackLogPathVariable,
@@ -58,7 +55,6 @@ namespace WixToolset.Data.Symbols
55 Description,
56 RollbackBoundaryRef,
57 RollbackBoundaryBackwardRef,
61 - Win64,
58 }
59
60 /// <summary>
@@ -66,6 +62,7 @@ namespace WixToolset.Data.Symbols
62 /// </summary>
63 public enum WixBundlePackageType
64 {
65 + NotSet = -1,
66 Bundle,
67 Exe,
68 Msi,
@@ -76,10 +73,11 @@ namespace WixToolset.Data.Symbols
73 [Flags]
74 public enum WixBundlePackageAttributes
75 {
76 + None = 0x0,
77 Permanent = 0x1,
78 Visible = 0x2,
81 - PerMachine = 0x4,
82 - Win64 = 0x8,
79 + Win64 = 0x4,
80 + Vital = 0x8,
81 }
82
83 public class WixBundlePackageSymbol : IntermediateSymbol
@@ -96,7 +94,15 @@ namespace WixToolset.Data.Symbols
94
95 public WixBundlePackageType Type
96 {
99 - get => (WixBundlePackageType)Enum.Parse(typeof(WixBundlePackageType), (string)this.Fields[(int)WixBundlePackageSymbolFields.Type], true);
97 + get
98 + {
99 + if (Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.Type], true, out WixBundlePackageType value))
100 + {
101 + return value;
102 + }
103 +
104 + return WixBundlePackageType.NotSet;
105 + }
106 set => this.Set((int)WixBundlePackageSymbolFields.Type, value.ToString());
107 }
108
@@ -130,16 +136,10 @@ namespace WixToolset.Data.Symbols
136 set => this.Set((int)WixBundlePackageSymbolFields.CacheId, value);
137 }
138
133 - public bool? Vital
134 - {
135 - get => (bool?)this.Fields[(int)WixBundlePackageSymbolFields.Vital];
136 - set => this.Set((int)WixBundlePackageSymbolFields.Vital, value);
137 - }
138 -
139 - public YesNoDefaultType PerMachine
139 + public bool? PerMachine
140 {
141 - get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.PerMachine], true, out YesNoDefaultType value) ? value : YesNoDefaultType.NotSet;
142 - set => this.Set((int)WixBundlePackageSymbolFields.PerMachine, value.ToString().ToLowerInvariant());
141 + get => (bool?)this.Fields[(int)WixBundlePackageSymbolFields.PerMachine];
142 + set => this.Set((int)WixBundlePackageSymbolFields.PerMachine, value);
143 }
144
145 public string LogPathVariable
@@ -202,12 +202,68 @@ namespace WixToolset.Data.Symbols
202 set => this.Set((int)WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef, value);
203 }
204
205 + public bool Permanent
206 + {
207 + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Permanent); }
208 + set
209 + {
210 + if (value)
211 + {
212 + this.Attributes |= WixBundlePackageAttributes.Permanent;
213 + }
214 + else
215 + {
216 + this.Attributes &= ~WixBundlePackageAttributes.Permanent;
217 + }
218 + }
219 + }
220 +
221 + public bool Visible
222 + {
223 + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Visible); }
224 + set
225 + {
226 + if (value)
227 + {
228 + this.Attributes |= WixBundlePackageAttributes.Visible;
229 + }
230 + else
231 + {
232 + this.Attributes &= ~WixBundlePackageAttributes.Visible;
233 + }
234 + }
235 + }
236 +
237 public bool Win64
238 {
207 - get => (bool)this.Fields[(int)WixBundlePackageSymbolFields.Win64];
208 - set => this.Set((int)WixBundlePackageSymbolFields.Win64, value);
239 + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Win64); }
240 + set
241 + {
242 + if (value)
243 + {
244 + this.Attributes |= WixBundlePackageAttributes.Win64;
245 + }
246 + else
247 + {
248 + this.Attributes &= ~WixBundlePackageAttributes.Win64;
249 + }
250 + }
251 }
252
211 - public bool Permanent => (this.Attributes & WixBundlePackageAttributes.Permanent) == WixBundlePackageAttributes.Permanent;
253 + public bool Vital
254 + {
255 + get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Vital); }
256 + set
257 + {
258 + if (value)
259 + {
260 + this.Attributes |= WixBundlePackageAttributes.Vital;
261 + }
262 + else
263 + {
264 + this.Attributes &= ~WixBundlePackageAttributes.Vital;
265 + }
266 + }
267 + }
268 }
269 }
src/api/wix/WixToolset.Data/Symbols/WixBundlePatchTargetCodeSymbol.cs
+17 -5
@@ -13,6 +13,7 @@ namespace WixToolset.Data
13 new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.PackageRef), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.TargetCode), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.Attributes), IntermediateFieldType.Number),
16 + new IntermediateFieldDefinition(nameof(WixBundlePatchTargetCodeSymbolFields.Type), IntermediateFieldType.Number),
17 },
18 typeof(WixBundlePatchTargetCodeSymbol));
19 }
@@ -27,22 +28,31 @@ namespace WixToolset.Data.Symbols
28 PackageRef,
29 TargetCode,
30 Attributes,
31 + Type,
32 }
33
34 [Flags]
35 public enum WixBundlePatchTargetCodeAttributes : int
36 {
37 None = 0,
38 + }
39 +
40 + public enum WixBundlePatchTargetCodeType
41 + {
42 + /// <summary>
43 + /// The transform has no specific target.
44 + /// </summary>
45 + Unspecified,
46
47 /// <summary>
48 /// The transform targets a specific ProductCode.
49 /// </summary>
40 - TargetsProductCode = 1,
50 + ProductCode,
51
52 /// <summary>
53 /// The transform targets a specific UpgradeCode.
54 /// </summary>
45 - TargetsUpgradeCode = 2,
55 + UpgradeCode,
56 }
57
58 public class WixBundlePatchTargetCodeSymbol : IntermediateSymbol
@@ -75,8 +85,10 @@ namespace WixToolset.Data.Symbols
85 set => this.Set((int)WixBundlePatchTargetCodeSymbolFields.Attributes, (int)value);
86 }
87
78 - public bool TargetsProductCode => (this.Attributes & WixBundlePatchTargetCodeAttributes.TargetsProductCode) == WixBundlePatchTargetCodeAttributes.TargetsProductCode;
79 -
80 - public bool TargetsUpgradeCode => (this.Attributes & WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode) == WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode;
88 + public WixBundlePatchTargetCodeType Type
89 + {
90 + get => (WixBundlePatchTargetCodeType)this.Fields[(int)WixBundlePatchTargetCodeSymbolFields.Type].AsNumber();
91 + set => this.Set((int)WixBundlePatchTargetCodeSymbolFields.Type, (int)value);
92 + }
93 }
94 }
src/api/wix/WixToolset.Data/Symbols/WixBundlePayloadSymbol.cs
+31 -8
@@ -10,6 +10,7 @@ namespace WixToolset.Data
10 SymbolDefinitionType.WixBundlePayload,
11 new[]
12 {
13 + new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Attributes), IntermediateFieldType.Number),
14 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Name), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.SourceFile), IntermediateFieldType.Path),
16 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.DownloadUrl), IntermediateFieldType.String),
@@ -21,7 +22,6 @@ namespace WixToolset.Data
22 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Version), IntermediateFieldType.String),
23 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Hash), IntermediateFieldType.String),
24 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.ContainerRef), IntermediateFieldType.String),
24 - new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.ContentFile), IntermediateFieldType.Bool),
25 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.EmbeddedId), IntermediateFieldType.String),
26 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.LayoutOnly), IntermediateFieldType.Bool),
27 new IntermediateFieldDefinition(nameof(WixBundlePayloadSymbolFields.Packaging), IntermediateFieldType.Number),
@@ -39,6 +39,7 @@ namespace WixToolset.Data.Symbols
39
40 public enum WixBundlePayloadSymbolFields
41 {
42 + Attributes,
43 Name,
44 SourceFile,
45 DownloadUrl,
@@ -50,7 +51,6 @@ namespace WixToolset.Data.Symbols
51 Version,
52 Hash,
53 ContainerRef,
53 - ContentFile,
54 EmbeddedId,
55 LayoutOnly,
56 Packaging,
@@ -59,6 +59,13 @@ namespace WixToolset.Data.Symbols
59 CertificateThumbprint,
60 }
61
62 + [Flags]
63 + public enum WixBundlePayloadAttributes
64 + {
65 + None = 0x0,
66 + ContentFile = 0x1,
67 + }
68 +
69 public class WixBundlePayloadSymbol : IntermediateSymbol
70 {
71 public WixBundlePayloadSymbol() : base(SymbolDefinitions.WixBundlePayload, null, null)
@@ -71,6 +78,12 @@ namespace WixToolset.Data.Symbols
78
79 public IntermediateField this[WixBundlePayloadSymbolFields index] => this.Fields[(int)index];
80
81 + public WixBundlePayloadAttributes Attributes
82 + {
83 + get => (WixBundlePayloadAttributes)this.Fields[(int)WixBundlePayloadSymbolFields.Attributes].AsNumber();
84 + set => this.Set((int)WixBundlePayloadSymbolFields.Attributes, (int)value);
85 + }
86 +
87 public string Name
88 {
89 get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.Name];
@@ -137,12 +150,6 @@ namespace WixToolset.Data.Symbols
150 set => this.Set((int)WixBundlePayloadSymbolFields.ContainerRef, value);
151 }
152
140 - public bool ContentFile
141 - {
142 - get => (bool)this.Fields[(int)WixBundlePayloadSymbolFields.ContentFile];
143 - set => this.Set((int)WixBundlePayloadSymbolFields.ContentFile, value);
144 - }
145 -
153 public string EmbeddedId
154 {
155 get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.EmbeddedId];
@@ -178,5 +185,21 @@ namespace WixToolset.Data.Symbols
185 get => (string)this.Fields[(int)WixBundlePayloadSymbolFields.CertificateThumbprint];
186 set => this.Set((int)WixBundlePayloadSymbolFields.CertificateThumbprint, value);
187 }
188 +
189 + public bool ContentFile
190 + {
191 + get { return this.Attributes.HasFlag(WixBundlePayloadAttributes.ContentFile); }
192 + set
193 + {
194 + if (value)
195 + {
196 + this.Attributes |= WixBundlePayloadAttributes.ContentFile;
197 + }
198 + else
199 + {
200 + this.Attributes &= ~WixBundlePayloadAttributes.ContentFile;
201 + }
202 + }
203 + }
204 }
205 }
src/api/wix/WixToolset.Data/Symbols/WixBundleRelatedPackageSymbol.cs
+60 -4
@@ -93,12 +93,68 @@ namespace WixToolset.Data.Symbols
93 set => this.Set((int)WixBundleRelatedPackageSymbolFields.Attributes, (int)value);
94 }
95
96 - public bool MinInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.MinInclusive) == WixBundleRelatedPackageAttributes.MinInclusive;
96 + public bool MinInclusive
97 + {
98 + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.MinInclusive); }
99 + set
100 + {
101 + if (value)
102 + {
103 + this.Attributes |= WixBundleRelatedPackageAttributes.MinInclusive;
104 + }
105 + else
106 + {
107 + this.Attributes &= ~WixBundleRelatedPackageAttributes.MinInclusive;
108 + }
109 + }
110 + }
111
98 - public bool MaxInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.MaxInclusive) == WixBundleRelatedPackageAttributes.MaxInclusive;
112 + public bool MaxInclusive
113 + {
114 + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.MaxInclusive); }
115 + set
116 + {
117 + if (value)
118 + {
119 + this.Attributes |= WixBundleRelatedPackageAttributes.MaxInclusive;
120 + }
121 + else
122 + {
123 + this.Attributes &= ~WixBundleRelatedPackageAttributes.MaxInclusive;
124 + }
125 + }
126 + }
127
100 - public bool OnlyDetect => (this.Attributes & WixBundleRelatedPackageAttributes.OnlyDetect) == WixBundleRelatedPackageAttributes.OnlyDetect;
128 + public bool OnlyDetect
129 + {
130 + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.OnlyDetect); }
131 + set
132 + {
133 + if (value)
134 + {
135 + this.Attributes |= WixBundleRelatedPackageAttributes.OnlyDetect;
136 + }
137 + else
138 + {
139 + this.Attributes &= ~WixBundleRelatedPackageAttributes.OnlyDetect;
140 + }
141 + }
142 + }
143
102 - public bool LangInclusive => (this.Attributes & WixBundleRelatedPackageAttributes.LangInclusive) == WixBundleRelatedPackageAttributes.LangInclusive;
144 + public bool LangInclusive
145 + {
146 + get { return this.Attributes.HasFlag(WixBundleRelatedPackageAttributes.LangInclusive); }
147 + set
148 + {
149 + if (value)
150 + {
151 + this.Attributes |= WixBundleRelatedPackageAttributes.LangInclusive;
152 + }
153 + else
154 + {
155 + this.Attributes &= ~WixBundleRelatedPackageAttributes.LangInclusive;
156 + }
157 + }
158 + }
159 }
160 }
src/api/wix/WixToolset.Data/Symbols/WixBundleRollbackBoundarySymbol.cs
+48 -14
@@ -10,8 +10,7 @@ namespace WixToolset.Data
10 SymbolDefinitionType.WixBundleRollbackBoundary,
11 new[]
12 {
13 - new IntermediateFieldDefinition(nameof(WixBundleRollbackBoundarySymbolFields.Vital), IntermediateFieldType.Number),
14 - new IntermediateFieldDefinition(nameof(WixBundleRollbackBoundarySymbolFields.Transaction), IntermediateFieldType.Number),
13 + new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.Attributes), IntermediateFieldType.Number),
14 new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String),
15 },
16 typeof(WixBundleRollbackBoundarySymbol));
@@ -20,13 +19,22 @@ namespace WixToolset.Data
19
20 namespace WixToolset.Data.Symbols
21 {
22 + using System;
23 +
24 public enum WixBundleRollbackBoundarySymbolFields
25 {
25 - Vital,
26 - Transaction,
26 + Attributes,
27 LogPathVariable,
28 }
29
30 + [Flags]
31 + public enum WixBundleRollbackBoundaryAttributes
32 + {
33 + None = 0x0,
34 + Vital = 0x1,
35 + Transaction = 0x2,
36 + }
37 +
38 public class WixBundleRollbackBoundarySymbol : IntermediateSymbol
39 {
40 public WixBundleRollbackBoundarySymbol() : base(SymbolDefinitions.WixBundleRollbackBoundary, null, null)
@@ -39,16 +47,10 @@ namespace WixToolset.Data.Symbols
47
48 public IntermediateField this[WixBundleRollbackBoundarySymbolFields index] => this.Fields[(int)index];
49
42 - public bool? Vital
50 + public WixBundleRollbackBoundaryAttributes Attributes
51 {
44 - get => (bool?)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Vital];
45 - set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Vital, value);
46 - }
47 -
48 - public bool? Transaction
49 - {
50 - get => (bool?)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Transaction];
51 - set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Transaction, value);
52 + get => (WixBundleRollbackBoundaryAttributes)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Attributes].AsNumber();
53 + set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Attributes, (int)value);
54 }
55
56 public string LogPathVariable
@@ -56,5 +58,37 @@ namespace WixToolset.Data.Symbols
58 get => (string)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.LogPathVariable];
59 set => this.Set((int)WixBundleRollbackBoundarySymbolFields.LogPathVariable, value);
60 }
61 +
62 + public bool Vital
63 + {
64 + get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Vital); }
65 + set
66 + {
67 + if (value)
68 + {
69 + this.Attributes |= WixBundleRollbackBoundaryAttributes.Vital;
70 + }
71 + else
72 + {
73 + this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Vital;
74 + }
75 + }
76 + }
77 +
78 + public bool Transaction
79 + {
80 + get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Transaction); }
81 + set
82 + {
83 + if (value)
84 + {
85 + this.Attributes |= WixBundleRollbackBoundaryAttributes.Transaction;
86 + }
87 + else
88 + {
89 + this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Transaction;
90 + }
91 + }
92 + }
93 }
60 -}
\ No newline at end of file
94 +}
src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs
+55 -10
@@ -34,6 +34,7 @@ namespace WixToolset.Data
34 new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.ProviderKey), IntermediateFieldType.String),
35 new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.InProgressName), IntermediateFieldType.String),
36 new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.CommandLineVariables), IntermediateFieldType.String),
37 + new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.DisableModify), IntermediateFieldType.String),
38 },
39 typeof(WixBundleSymbol));
40 }
@@ -69,16 +70,15 @@ namespace WixToolset.Data.Symbols
70 ProviderKey,
71 InProgressName,
72 CommandLineVariables,
73 + DisableModify,
74 }
75
76 [Flags]
77 public enum WixBundleAttributes
78 {
79 None = 0x0,
78 - DisableModify = 0x1,
79 - DisableRemove = 0x2,
80 - SingleChangeUninstallButton = 0x4,
81 - PerMachine = 0x8,
80 + DisableRemove = 0x1,
81 + PerMachine = 0x2,
82 }
83
84 public enum WixBundleCommandLineVariables
@@ -87,6 +87,13 @@ namespace WixToolset.Data.Symbols
87 CaseSensitive,
88 }
89
90 + public enum WixBundleModifyType
91 + {
92 + Allowed = 0,
93 + Disabled = 1,
94 + SingleChangeUninstallButton = 2,
95 + }
96 +
97 public class WixBundleSymbol : IntermediateSymbol
98 {
99 public WixBundleSymbol() : base(SymbolDefinitions.WixBundle, null, null)
@@ -243,14 +250,52 @@ namespace WixToolset.Data.Symbols
250 set => this.Set((int)WixBundleSymbolFields.CommandLineVariables, (int)value);
251 }
252
246 - public PackagingType DefaultPackagingType => (this.Compressed.HasValue && !this.Compressed.Value) ? PackagingType.External : PackagingType.Embedded;
247 -
248 - public bool DisableModify => (this.Attributes & WixBundleAttributes.DisableModify) == WixBundleAttributes.DisableModify;
253 + public WixBundleModifyType DisableModify
254 + {
255 + get
256 + {
257 + if (Enum.TryParse((string)this.Fields[(int)WixBundleSymbolFields.DisableModify], true, out WixBundleModifyType value))
258 + {
259 + return value;
260 + }
261 +
262 + return WixBundleModifyType.Allowed;
263 + }
264 + set => this.Set((int)WixBundleSymbolFields.DisableModify, value.ToString().ToLowerInvariant());
265 + }
266
250 - public bool DisableRemove => (this.Attributes & WixBundleAttributes.DisableRemove) == WixBundleAttributes.DisableRemove;
267 + public PackagingType DefaultPackagingType => (this.Compressed.HasValue && !this.Compressed.Value) ? PackagingType.External : PackagingType.Embedded;
268
252 - public bool PerMachine => (this.Attributes & WixBundleAttributes.PerMachine) == WixBundleAttributes.PerMachine;
269 + public bool DisableRemove
270 + {
271 + get { return this.Attributes.HasFlag(WixBundleAttributes.DisableRemove); }
272 + set
273 + {
274 + if (value)
275 + {
276 + this.Attributes |= WixBundleAttributes.DisableRemove;
277 + }
278 + else
279 + {
280 + this.Attributes &= ~WixBundleAttributes.DisableRemove;
281 + }
282 + }
283 + }
284
254 - public bool SingleChangeUninstallButton => (this.Attributes & WixBundleAttributes.SingleChangeUninstallButton) == WixBundleAttributes.SingleChangeUninstallButton;
285 + public bool PerMachine
286 + {
287 + get { return this.Attributes.HasFlag(WixBundleAttributes.PerMachine); }
288 + set
289 + {
290 + if (value)
291 + {
292 + this.Attributes |= WixBundleAttributes.PerMachine;
293 + }
294 + else
295 + {
296 + this.Attributes &= ~WixBundleAttributes.PerMachine;
297 + }
298 + }
299 + }
300 }
301 }
src/api/wix/WixToolset.Data/Symbols/WixBundleTagSymbol.cs
+11 -3
@@ -23,6 +23,8 @@ namespace WixToolset.Data
23
24 namespace WixToolset.Data.Symbols
25 {
26 + using System;
27 +
28 public enum WixBundleTagSymbolFields
29 {
30 Filename,
@@ -33,6 +35,12 @@ namespace WixToolset.Data.Symbols
35 Xml,
36 }
37
38 + [Flags]
39 + public enum WixBundleTagAttributes
40 + {
41 + None = 0x0,
42 + }
43 +
44 public class WixBundleTagSymbol : IntermediateSymbol
45 {
46 public WixBundleTagSymbol() : base(SymbolDefinitions.WixBundleTag, null, null)
@@ -69,10 +77,10 @@ namespace WixToolset.Data.Symbols
77 set => this.Set((int)WixBundleTagSymbolFields.InstallPath, value);
78 }
79
72 - public int Attributes
80 + public WixBundleTagAttributes Attributes
81 {
74 - get => this.Fields[(int)WixBundleTagSymbolFields.Attributes].AsNumber();
75 - set => this.Set((int)WixBundleTagSymbolFields.Attributes, value);
82 + get => (WixBundleTagAttributes)this.Fields[(int)WixBundleTagSymbolFields.Attributes].AsNumber();
83 + set => this.Set((int)WixBundleTagSymbolFields.Attributes, (int)value);
84 }
85
86 public string Xml
src/api/wix/WixToolset.Data/Symbols/WixBundleUpdateSymbol.cs
+12 -4
@@ -19,12 +19,20 @@ namespace WixToolset.Data
19
20 namespace WixToolset.Data.Symbols
21 {
22 + using System;
23 +
24 public enum WixBundleUpdateSymbolFields
25 {
26 Location,
27 Attributes,
28 }
29
30 + [Flags]
31 + public enum WixBundleUpdateAttributes
32 + {
33 + None = 0x0,
34 + }
35 +
36 public class WixBundleUpdateSymbol : IntermediateSymbol
37 {
38 public WixBundleUpdateSymbol() : base(SymbolDefinitions.WixBundleUpdate, null, null)
@@ -43,10 +51,10 @@ namespace WixToolset.Data.Symbols
51 set => this.Set((int)WixBundleUpdateSymbolFields.Location, value);
52 }
53
46 - public int Attributes
54 + public WixBundleUpdateAttributes Attributes
55 {
48 - get => (int)this.Fields[(int)WixBundleUpdateSymbolFields.Attributes];
49 - set => this.Set((int)WixBundleUpdateSymbolFields.Attributes, value);
56 + get => (WixBundleUpdateAttributes)this.Fields[(int)WixBundleUpdateSymbolFields.Attributes].AsNumber();
57 + set => this.Set((int)WixBundleUpdateSymbolFields.Attributes, (int)value);
58 }
59 }
52 -}
\ No newline at end of file
60 +}
src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs
+40 -8
@@ -10,10 +10,9 @@ namespace WixToolset.Data
10 SymbolDefinitionType.WixBundleVariable,
11 new[]
12 {
13 + new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Attributes), IntermediateFieldType.Number),
14 new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Value), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Type), IntermediateFieldType.String),
15 - new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Hidden), IntermediateFieldType.Bool),
16 - new IntermediateFieldDefinition(nameof(WixBundleVariableSymbolFields.Persisted), IntermediateFieldType.Bool),
16 },
17 typeof(WixBundleVariableSymbol));
18 }
@@ -25,10 +24,17 @@ namespace WixToolset.Data.Symbols
24
25 public enum WixBundleVariableSymbolFields
26 {
27 + Attributes,
28 Value,
29 Type,
30 - Hidden,
31 - Persisted,
30 + }
31 +
32 + [Flags]
33 + public enum WixBundleVariableAttributes
34 + {
35 + None = 0x0,
36 + Hidden = 0x1,
37 + Persisted = 0x2,
38 }
39
40 public enum WixBundleVariableType
@@ -52,6 +58,12 @@ namespace WixToolset.Data.Symbols
58
59 public IntermediateField this[WixBundleVariableSymbolFields index] => this.Fields[(int)index];
60
61 + public WixBundleVariableAttributes Attributes
62 + {
63 + get => (WixBundleVariableAttributes)this.Fields[(int)WixBundleVariableSymbolFields.Attributes].AsNumber();
64 + set => this.Set((int)WixBundleVariableSymbolFields.Attributes, (int)value);
65 + }
66 +
67 public string Value
68 {
69 get => (string)this.Fields[(int)WixBundleVariableSymbolFields.Value];
@@ -66,14 +78,34 @@ namespace WixToolset.Data.Symbols
78
79 public bool Hidden
80 {
69 - get => (bool)this.Fields[(int)WixBundleVariableSymbolFields.Hidden];
70 - set => this.Set((int)WixBundleVariableSymbolFields.Hidden, value);
81 + get { return this.Attributes.HasFlag(WixBundleVariableAttributes.Hidden); }
82 + set
83 + {
84 + if (value)
85 + {
86 + this.Attributes |= WixBundleVariableAttributes.Hidden;
87 + }
88 + else
89 + {
90 + this.Attributes &= ~WixBundleVariableAttributes.Hidden;
91 + }
92 + }
93 }
94
95 public bool Persisted
96 {
75 - get => (bool)this.Fields[(int)WixBundleVariableSymbolFields.Persisted];
76 - set => this.Set((int)WixBundleVariableSymbolFields.Persisted, value);
97 + get { return this.Attributes.HasFlag(WixBundleVariableAttributes.Persisted); }
98 + set
99 + {
100 + if (value)
101 + {
102 + this.Attributes |= WixBundleVariableAttributes.Persisted;
103 + }
104 + else
105 + {
106 + this.Attributes &= ~WixBundleVariableAttributes.Persisted;
107 + }
108 + }
109 }
110 }
111 }
src/api/wix/WixToolset.Data/Symbols/WixChainSymbol.cs
+45 -3
@@ -52,10 +52,52 @@ namespace WixToolset.Data.Symbols
52 set => this.Set((int)WixChainSymbolFields.Attributes, (int)value);
53 }
54
55 - public bool DisableRollback => (this.Attributes & WixChainAttributes.DisableRollback) == WixChainAttributes.DisableRollback;
55 + public bool DisableRollback
56 + {
57 + get { return this.Attributes.HasFlag(WixChainAttributes.DisableRollback); }
58 + set
59 + {
60 + if (value)
61 + {
62 + this.Attributes |= WixChainAttributes.DisableRollback;
63 + }
64 + else
65 + {
66 + this.Attributes &= ~WixChainAttributes.DisableRollback;
67 + }
68 + }
69 + }
70
57 - public bool DisableSystemRestore => (this.Attributes & WixChainAttributes.DisableSystemRestore) == WixChainAttributes.DisableSystemRestore;
71 + public bool DisableSystemRestore
72 + {
73 + get { return this.Attributes.HasFlag(WixChainAttributes.DisableSystemRestore); }
74 + set
75 + {
76 + if (value)
77 + {
78 + this.Attributes |= WixChainAttributes.DisableSystemRestore;
79 + }
80 + else
81 + {
82 + this.Attributes &= ~WixChainAttributes.DisableSystemRestore;
83 + }
84 + }
85 + }
86
59 - public bool ParallelCache => (this.Attributes & WixChainAttributes.ParallelCache) == WixChainAttributes.ParallelCache;
87 + public bool ParallelCache
88 + {
89 + get { return this.Attributes.HasFlag(WixChainAttributes.ParallelCache); }
90 + set
91 + {
92 + if (value)
93 + {
94 + this.Attributes |= WixChainAttributes.ParallelCache;
95 + }
96 + else
97 + {
98 + this.Attributes &= ~WixChainAttributes.ParallelCache;
99 + }
100 + }
101 + }
102 }
103 }
src/api/wix/WixToolset.Data/Symbols/WixComponentSearchSymbol.cs
+16 -3
@@ -13,6 +13,7 @@ namespace WixToolset.Data
13 new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Guid), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.ProductCode), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Attributes), IntermediateFieldType.Number),
16 + new IntermediateFieldDefinition(nameof(WixComponentSearchSymbolFields.Type), IntermediateFieldType.Number),
17 },
18 typeof(WixComponentSearchSymbol));
19 }
@@ -27,14 +28,20 @@ namespace WixToolset.Data.Symbols
28 Guid,
29 ProductCode,
30 Attributes,
31 + Type,
32 }
33
34 [Flags]
35 public enum WixComponentSearchAttributes
36 {
35 - KeyPath = 0x1,
36 - State = 0x2,
37 - WantDirectory = 0x4,
37 + None = 0x0,
38 + }
39 +
40 + public enum WixComponentSearchType
41 + {
42 + KeyPath,
43 + State,
44 + WantDirectory,
45 }
46
47 public class WixComponentSearchSymbol : IntermediateSymbol
@@ -66,5 +73,11 @@ namespace WixToolset.Data.Symbols
73 get => (WixComponentSearchAttributes)this.Fields[(int)WixComponentSearchSymbolFields.Attributes].AsNumber();
74 set => this.Set((int)WixComponentSearchSymbolFields.Attributes, (int)value);
75 }
76 +
77 + public WixComponentSearchType Type
78 + {
79 + get => (WixComponentSearchType)this.Fields[(int)WixComponentSearchSymbolFields.Type].AsNumber();
80 + set => this.Set((int)WixComponentSearchSymbolFields.Type, (int)value);
81 + }
82 }
83 }
src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs
+129 -4
@@ -19,6 +19,7 @@ namespace WixToolset.Data
19 new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.MaxDate), IntermediateFieldType.Number),
20 new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Languages), IntermediateFieldType.String),
21 new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Attributes), IntermediateFieldType.Number),
22 + new IntermediateFieldDefinition(nameof(WixFileSearchSymbolFields.Type), IntermediateFieldType.Number),
23 },
24 typeof(WixFileSearchSymbol));
25 }
@@ -39,21 +40,27 @@ namespace WixToolset.Data.Symbols
40 MaxDate,
41 Languages,
42 Attributes,
43 + Type,
44 }
45
46 [Flags]
47 public enum WixFileSearchAttributes
48 {
47 - Default = 0x001,
49 + None = 0x000,
50 + IsDirectory = 0x001,
51 MinVersionInclusive = 0x002,
52 MaxVersionInclusive = 0x004,
53 MinSizeInclusive = 0x008,
54 MaxSizeInclusive = 0x010,
55 MinDateInclusive = 0x020,
56 MaxDateInclusive = 0x040,
54 - WantVersion = 0x080,
55 - WantExists = 0x100,
56 - IsDirectory = 0x200,
57 + }
58 +
59 + public enum WixFileSearchType
60 + {
61 + Path,
62 + Version,
63 + Exists,
64 }
65
66 public class WixFileSearchSymbol : IntermediateSymbol
@@ -121,5 +128,123 @@ namespace WixToolset.Data.Symbols
128 get => (WixFileSearchAttributes)this.Fields[(int)WixFileSearchSymbolFields.Attributes].AsNumber();
129 set => this.Set((int)WixFileSearchSymbolFields.Attributes, (int)value);
130 }
131 +
132 + public WixFileSearchType Type
133 + {
134 + get => (WixFileSearchType)this.Fields[(int)WixFileSearchSymbolFields.Type].AsNumber();
135 + set => this.Set((int)WixFileSearchSymbolFields.Type, (int)value);
136 + }
137 +
138 + public bool IsDirectory
139 + {
140 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.IsDirectory); }
141 + set
142 + {
143 + if (value)
144 + {
145 + this.Attributes |= WixFileSearchAttributes.IsDirectory;
146 + }
147 + else
148 + {
149 + this.Attributes &= ~WixFileSearchAttributes.IsDirectory;
150 + }
151 + }
152 + }
153 +
154 + public bool MinVersionInclusive
155 + {
156 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinVersionInclusive); }
157 + set
158 + {
159 + if (value)
160 + {
161 + this.Attributes |= WixFileSearchAttributes.MinVersionInclusive;
162 + }
163 + else
164 + {
165 + this.Attributes &= ~WixFileSearchAttributes.MinVersionInclusive;
166 + }
167 + }
168 + }
169 +
170 + public bool MaxVersionInclusive
171 + {
172 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxVersionInclusive); }
173 + set
174 + {
175 + if (value)
176 + {
177 + this.Attributes |= WixFileSearchAttributes.MaxVersionInclusive;
178 + }
179 + else
180 + {
181 + this.Attributes &= ~WixFileSearchAttributes.MaxVersionInclusive;
182 + }
183 + }
184 + }
185 +
186 + public bool MinSizeInclusive
187 + {
188 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinSizeInclusive); }
189 + set
190 + {
191 + if (value)
192 + {
193 + this.Attributes |= WixFileSearchAttributes.MinSizeInclusive;
194 + }
195 + else
196 + {
197 + this.Attributes &= ~WixFileSearchAttributes.MinSizeInclusive;
198 + }
199 + }
200 + }
201 +
202 + public bool MaxSizeInclusive
203 + {
204 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxSizeInclusive); }
205 + set
206 + {
207 + if (value)
208 + {
209 + this.Attributes |= WixFileSearchAttributes.MaxSizeInclusive;
210 + }
211 + else
212 + {
213 + this.Attributes &= ~WixFileSearchAttributes.MaxSizeInclusive;
214 + }
215 + }
216 + }
217 +
218 + public bool MinDateInclusive
219 + {
220 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MinDateInclusive); }
221 + set
222 + {
223 + if (value)
224 + {
225 + this.Attributes |= WixFileSearchAttributes.MinDateInclusive;
226 + }
227 + else
228 + {
229 + this.Attributes &= ~WixFileSearchAttributes.MinDateInclusive;
230 + }
231 + }
232 + }
233 +
234 + public bool MaxDateInclusive
235 + {
236 + get { return this.Attributes.HasFlag(WixFileSearchAttributes.MaxDateInclusive); }
237 + set
238 + {
239 + if (value)
240 + {
241 + this.Attributes |= WixFileSearchAttributes.MaxDateInclusive;
242 + }
243 + else
244 + {
245 + this.Attributes &= ~WixFileSearchAttributes.MaxDateInclusive;
246 + }
247 + }
248 + }
249 }
250 }
src/api/wix/WixToolset.Data/Symbols/WixProductSearchSymbol.cs
+38 -5
@@ -12,6 +12,7 @@ namespace WixToolset.Data
12 {
13 new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Guid), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Attributes), IntermediateFieldType.Number),
15 + new IntermediateFieldDefinition(nameof(WixProductSearchSymbolFields.Type), IntermediateFieldType.Number),
16 },
17 typeof(WixProductSearchSymbol));
18 }
@@ -25,16 +26,26 @@ namespace WixToolset.Data.Symbols
26 {
27 Guid,
28 Attributes,
29 + Type,
30 }
31
32 [Flags]
33 public enum WixProductSearchAttributes
34 {
33 - Version = 0x1,
34 - Language = 0x2,
35 - State = 0x4,
36 - Assignment = 0x8,
37 - UpgradeCode = 0x10,
35 + None = 0x0,
36 +
37 + /// <summary>
38 + /// Guid contains the UpgradeCode. If not set, it contains the ProductCode.
39 + /// </summary>
40 + UpgradeCode = 0x1,
41 + }
42 +
43 + public enum WixProductSearchType
44 + {
45 + Version,
46 + Language,
47 + State,
48 + Assignment,
49 }
50
51 public class WixProductSearchSymbol : IntermediateSymbol
@@ -60,5 +71,27 @@ namespace WixToolset.Data.Symbols
71 get => (WixProductSearchAttributes)this.Fields[(int)WixProductSearchSymbolFields.Attributes].AsNumber();
72 set => this.Set((int)WixProductSearchSymbolFields.Attributes, (int)value);
73 }
74 +
75 + public WixProductSearchType Type
76 + {
77 + get => (WixProductSearchType)this.Fields[(int)WixProductSearchSymbolFields.Type].AsNumber();
78 + set => this.Set((int)WixProductSearchSymbolFields.Type, (int)value);
79 + }
80 +
81 + public bool IsUpgradeCode
82 + {
83 + get { return this.Attributes.HasFlag(WixProductSearchAttributes.UpgradeCode); }
84 + set
85 + {
86 + if (value)
87 + {
88 + this.Attributes |= WixProductSearchAttributes.UpgradeCode;
89 + }
90 + else
91 + {
92 + this.Attributes &= ~WixProductSearchAttributes.UpgradeCode;
93 + }
94 + }
95 + }
96 }
97 }
src/api/wix/WixToolset.Data/Symbols/WixRegistrySearchSymbol.cs
+49 -6
@@ -14,6 +14,7 @@ namespace WixToolset.Data
14 new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Key), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Value), IntermediateFieldType.String),
16 new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Attributes), IntermediateFieldType.Number),
17 + new IntermediateFieldDefinition(nameof(WixRegistrySearchSymbolFields.Type), IntermediateFieldType.Number),
18 },
19 typeof(WixRegistrySearchSymbol));
20 }
@@ -29,17 +30,21 @@ namespace WixToolset.Data.Symbols
30 Key,
31 Value,
32 Attributes,
33 + Type,
34 }
35
36 [Flags]
37 public enum WixRegistrySearchAttributes
38 {
37 - Raw = 0x01,
38 - Compatible = 0x02,
39 - ExpandEnvironmentVariables = 0x04,
40 - WantValue = 0x08,
41 - WantExists = 0x10,
42 - Win64 = 0x20,
39 + None = 0x0,
40 + ExpandEnvironmentVariables = 0x01,
41 + Win64 = 0x2,
42 + }
43 +
44 + public enum WixRegistrySearchType
45 + {
46 + Value,
47 + Exists,
48 }
49
50 public class WixRegistrySearchSymbol : IntermediateSymbol
@@ -77,5 +82,43 @@ namespace WixToolset.Data.Symbols
82 get => (WixRegistrySearchAttributes)this.Fields[(int)WixRegistrySearchSymbolFields.Attributes].AsNumber();
83 set => this.Set((int)WixRegistrySearchSymbolFields.Attributes, (int)value);
84 }
85 +
86 + public WixRegistrySearchType Type
87 + {
88 + get => (WixRegistrySearchType)this.Fields[(int)WixRegistrySearchSymbolFields.Type].AsNumber();
89 + set => this.Set((int)WixRegistrySearchSymbolFields.Type, (int)value);
90 + }
91 +
92 + public bool ExpandEnvironmentVariables
93 + {
94 + get { return this.Attributes.HasFlag(WixRegistrySearchAttributes.ExpandEnvironmentVariables); }
95 + set
96 + {
97 + if (value)
98 + {
99 + this.Attributes |= WixRegistrySearchAttributes.ExpandEnvironmentVariables;
100 + }
101 + else
102 + {
103 + this.Attributes &= ~WixRegistrySearchAttributes.ExpandEnvironmentVariables;
104 + }
105 + }
106 + }
107 +
108 + public bool Win64
109 + {
110 + get { return this.Attributes.HasFlag(WixRegistrySearchAttributes.Win64); }
111 + set
112 + {
113 + if (value)
114 + {
115 + this.Attributes |= WixRegistrySearchAttributes.Win64;
116 + }
117 + else
118 + {
119 + this.Attributes &= ~WixRegistrySearchAttributes.Win64;
120 + }
121 + }
122 + }
123 }
124 }
src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+1 -4
@@ -242,7 +242,6 @@ namespace WixToolsetTest.Util
242 [Fact]
243 public void CanBuildBundleWithSearches()
244 {
245 - var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe");
245 var folder = TestData.Get(@"TestData\BundleWithSearches");
246 var rootFolder = TestData.Get();
247 var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll");
@@ -269,9 +268,7 @@ namespace WixToolsetTest.Util
268 result.AssertSuccess();
269
270 Assert.True(File.Exists(bundlePath));
272 -#if TODO
271 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
274 -#endif
272
273 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
274 extractResult.AssertSuccess();
@@ -293,7 +290,7 @@ namespace WixToolsetTest.Util
290 Assert.Equal("<RegistrySearch Id='RegistrySearchId' Variable='RegistrySearchVariable' " +
291 @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' VariableType='string' />", utilSearches[3].GetTestXml());
292 Assert.Equal("<RegistrySearch Id='RegistrySearchId64' Variable='RegistrySearchVariable64' " +
296 - @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' Win64='yes' VariableType='string' />", utilSearches[4].GetTestXml());
293 + @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Win64='yes' Type='value' VariableType='string' />", utilSearches[4].GetTestXml());
294 }
295 }
296
src/ext/Util/wixext/UtilCompiler.cs
+52 -51
@@ -443,7 +443,8 @@ namespace WixToolset.Util
443 string after = null;
444 string guid = null;
445 string productCode = null;
446 - var attributes = WixComponentSearchAttributes.KeyPath;
446 + var attributes = WixComponentSearchAttributes.None;
447 + var type = WixComponentSearchType.KeyPath;
448
449 foreach (var attrib in element.Attributes())
450 {
@@ -468,13 +469,13 @@ namespace WixToolset.Util
469 switch (result)
470 {
471 case "directory":
471 - attributes = WixComponentSearchAttributes.WantDirectory;
472 + type = WixComponentSearchType.WantDirectory;
473 break;
474 case "keyPath":
474 - attributes = WixComponentSearchAttributes.KeyPath;
475 + type = WixComponentSearchType.KeyPath;
476 break;
477 case "state":
477 - attributes = WixComponentSearchAttributes.State;
478 + type = WixComponentSearchType.State;
479 break;
480 default:
481 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "directory", "keyPath", "state"));
@@ -499,7 +500,7 @@ namespace WixToolset.Util
500
501 if (null == id)
502 {
502 - id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString());
503 + id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString(), type.ToString());
504 }
505
506 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -513,6 +514,7 @@ namespace WixToolset.Util
514 Guid = guid,
515 ProductCode = productCode,
516 Attributes = attributes,
517 + Type = type,
518 });
519 }
520 }
@@ -983,6 +985,7 @@ namespace WixToolset.Util
985 string after = null;
986 string path = null;
987 var attributes = WixFileSearchAttributes.IsDirectory;
988 + var type = WixFileSearchType.Path;
989
990 foreach (var attrib in element.Attributes())
991 {
@@ -1004,7 +1007,7 @@ namespace WixToolset.Util
1007 switch (result)
1008 {
1009 case "exists":
1007 - attributes |= WixFileSearchAttributes.WantExists;
1010 + type = WixFileSearchType.Exists;
1011 break;
1012 default:
1013 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists"));
@@ -1029,7 +1032,7 @@ namespace WixToolset.Util
1032
1033 if (null == id)
1034 {
1032 - id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString());
1035 + id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString(), type.ToString());
1036 }
1037
1038 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -1038,7 +1041,7 @@ namespace WixToolset.Util
1041
1042 if (!this.Messaging.EncounteredError)
1043 {
1041 - this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes);
1044 + this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type);
1045 }
1046 }
1047
@@ -1086,7 +1089,8 @@ namespace WixToolset.Util
1089 string condition = null;
1090 string after = null;
1091 string path = null;
1089 - var attributes = WixFileSearchAttributes.Default;
1092 + var attributes = WixFileSearchAttributes.None;
1093 + var type = WixFileSearchType.Path;
1094
1095 foreach (var attrib in node.Attributes())
1096 {
@@ -1108,10 +1112,10 @@ namespace WixToolset.Util
1112 switch (result)
1113 {
1114 case "exists":
1111 - attributes |= WixFileSearchAttributes.WantExists;
1115 + type = WixFileSearchType.Exists;
1116 break;
1117 case "version":
1114 - attributes |= WixFileSearchAttributes.WantVersion;
1118 + type = WixFileSearchType.Version;
1119 break;
1120 default:
1121 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "version"));
@@ -1136,7 +1140,7 @@ namespace WixToolset.Util
1140
1141 if (null == id)
1142 {
1139 - id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString());
1143 + id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString(), type.ToString());
1144 }
1145
1146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);
@@ -1145,7 +1149,7 @@ namespace WixToolset.Util
1149
1150 if (!this.Messaging.EncounteredError)
1151 {
1148 - this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes);
1152 + this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type);
1153 }
1154 }
1155
@@ -1156,12 +1160,14 @@ namespace WixToolset.Util
1160 /// <param name="id">Identifier of the search (key into the WixSearch table)</param>
1161 /// <param name="path">File/directory path to search for.</param>
1162 /// <param name="attributes"></param>
1159 - private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes)
1163 + /// <param name="type"></param>
1164 + private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes, WixFileSearchType type)
1165 {
1166 section.AddSymbol(new WixFileSearchSymbol(sourceLineNumbers, id)
1167 {
1168 Path = path,
1169 Attributes = attributes,
1170 + Type = type,
1171 });
1172 }
1173
@@ -2545,7 +2551,8 @@ namespace WixToolset.Util
2551 string after = null;
2552 string productCode = null;
2553 string upgradeCode = null;
2548 - var attributes = WixProductSearchAttributes.Version;
2554 + var attributes = WixProductSearchAttributes.None;
2555 + var type = WixProductSearchType.Version;
2556
2557 foreach (var attrib in element.Attributes())
2558 {
@@ -2570,16 +2577,16 @@ namespace WixToolset.Util
2577 switch (result)
2578 {
2579 case "version":
2573 - attributes = WixProductSearchAttributes.Version;
2580 + type = WixProductSearchType.Version;
2581 break;
2582 case "language":
2576 - attributes = WixProductSearchAttributes.Language;
2583 + type = WixProductSearchType.Language;
2584 break;
2585 case "state":
2579 - attributes = WixProductSearchAttributes.State;
2586 + type = WixProductSearchType.State;
2587 break;
2588 case "assignment":
2582 - attributes = WixProductSearchAttributes.Assignment;
2589 + type = WixProductSearchType.Assignment;
2590 break;
2591 default:
2592 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
2614 this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "UpgradeCode", "ProductCode"));
2615 }
2616
2617 + string guid;
2618 + if (upgradeCode != null)
2619 + {
2620 + // set an additional flag if this is an upgrade code
2621 + attributes |= WixProductSearchAttributes.UpgradeCode;
2622 + guid = upgradeCode;
2623 + }
2624 + else
2625 + {
2626 + guid = productCode;
2627 + }
2628 +
2629 if (null == id)
2630 {
2612 - id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, productCode ?? upgradeCode, attributes.ToString());
2631 + id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, guid, attributes.ToString(), type.ToString());
2632 }
2633
2634 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -2618,16 +2637,11 @@ namespace WixToolset.Util
2637
2638 if (!this.Messaging.EncounteredError)
2639 {
2621 - // set an additional flag if this is an upgrade code
2622 - if (null != upgradeCode)
2623 - {
2624 - attributes |= WixProductSearchAttributes.UpgradeCode;
2625 - }
2626 -
2640 section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id)
2641 {
2629 - Guid = productCode ?? upgradeCode,
2642 + Guid = guid,
2643 Attributes = attributes,
2644 + Type = type,
2645 });
2646 }
2647 }
@@ -2648,7 +2662,8 @@ namespace WixToolset.Util
2662 string value = null;
2663 var expand = YesNoType.NotSet;
2664 var win64 = this.Context.IsCurrentPlatform64Bit;
2651 - var attributes = WixRegistrySearchAttributes.Raw | WixRegistrySearchAttributes.WantValue;
2665 + var attributes = WixRegistrySearchAttributes.None;
2666 + var type = WixRegistrySearchType.Value;
2667
2668 foreach (var attrib in element.Attributes())
2669 {
@@ -2692,30 +2707,15 @@ namespace WixToolset.Util
2707 case "ExpandEnvironmentVariables":
2708 expand = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2709 break;
2695 - case "Format":
2696 - string format = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2697 - switch (format)
2698 - {
2699 - case "raw":
2700 - attributes |= WixRegistrySearchAttributes.Raw;
2701 - break;
2702 - case "compatible":
2703 - attributes |= WixRegistrySearchAttributes.Compatible;
2704 - break;
2705 - default:
2706 - this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, format, "raw", "compatible"));
2707 - break;
2708 - }
2709 - break;
2710 case "Result":
2711 var result = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2712 switch (result)
2713 {
2714 case "exists":
2715 - attributes |= WixRegistrySearchAttributes.WantExists;
2715 + type = WixRegistrySearchType.Exists;
2716 break;
2717 case "value":
2718 - attributes |= WixRegistrySearchAttributes.WantValue;
2718 + type = WixRegistrySearchType.Value;
2719 break;
2720 default:
2721 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "value"));
@@ -2743,14 +2743,9 @@ namespace WixToolset.Util
2743 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Key"));
2744 }
2745
2746 - if (null == id)
2747 - {
2748 - id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString());
2749 - }
2750 -
2746 if (expand == YesNoType.Yes)
2747 {
2753 - if (0 != (attributes & WixRegistrySearchAttributes.WantExists))
2748 + if (type == WixRegistrySearchType.Exists)
2749 {
2750 this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "ExpandEnvironmentVariables", expand.ToString(), "Result", "exists"));
2751 }
@@ -2763,6 +2758,11 @@ namespace WixToolset.Util
2758 attributes |= WixRegistrySearchAttributes.Win64;
2759 }
2760
2761 + if (null == id)
2762 + {
2763 + id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString(), type.ToString());
2764 + }
2765 +
2766 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
2767
2768 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
@@ -2775,6 +2775,7 @@ namespace WixToolset.Util
2775 Key = key,
2776 Value = value,
2777 Attributes = attributes,
2778 + Type = type,
2779 });
2780 }
2781 }
src/test/burn/WixTestTools/BundleVerifier.cs
+3 -3
@@ -120,7 +120,7 @@ namespace WixTestTools
120 var intermediate = Intermediate.Load(wixOutput);
121 var section = intermediate.Sections.Single();
122 var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId);
123 - var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes);
123 + var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == true);
124 if (Directory.Exists(cachePath))
125 {
126 Directory.Delete(cachePath, true);
@@ -133,7 +133,7 @@ namespace WixTestTools
133 var intermediate = Intermediate.Load(wixOutput);
134 var section = intermediate.Sections.Single();
135 var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId);
136 - var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes);
136 + var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == true);
137 Assert.Equal(cached, Directory.Exists(cachePath));
138 }
139
@@ -144,7 +144,7 @@ namespace WixTestTools
144 var section = intermediate.Sections.Single();
145 var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId);
146 var providerSymbol = section.Symbols.OfType<WixDependencyProviderSymbol>().Single(p => p.ParentRef == packageId);
147 - var registryRoot = packageSymbol.PerMachine == YesNoDefaultType.Yes ? Registry.LocalMachine : Registry.CurrentUser;
147 + var registryRoot = packageSymbol.PerMachine == true ? Registry.LocalMachine : Registry.CurrentUser;
148 var subkeyPath = Path.Combine(DependencyRegistryRoot, providerSymbol.ProviderKey);
149 using var registryKey = registryRoot.OpenSubKey(subkeyPath);
150 if (registryKey != null)
src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+6 -6
@@ -102,7 +102,7 @@ namespace WixToolset.Core.Burn
102
103 bundleSymbol.ProviderKey = bundleSymbol.BundleId = Guid.NewGuid().ToString("B").ToUpperInvariant();
104
105 - bundleSymbol.Attributes |= WixBundleAttributes.PerMachine; // default to per-machine but the first-per user package wil flip the bundle per-user.
105 + bundleSymbol.PerMachine = true; // default to per-machine but the first-per user package wil flip the bundle per-user.
106
107 this.NormalizeRelatedBundles(bundleSymbol, section);
108
@@ -608,11 +608,11 @@ namespace WixToolset.Core.Burn
608
609 foreach (var facade in facades)
610 {
611 - if (bundleSymbol.PerMachine && YesNoDefaultType.No == facade.PackageSymbol.PerMachine)
611 + if (bundleSymbol.PerMachine && facade.PackageSymbol.PerMachine.HasValue && !facade.PackageSymbol.PerMachine.Value)
612 {
613 this.Messaging.Write(VerboseMessages.SwitchingToPerUserPackage(facade.PackageSymbol.SourceLineNumbers, facade.PackageId));
614
615 - bundleSymbol.Attributes &= ~WixBundleAttributes.PerMachine;
615 + bundleSymbol.PerMachine = false;
616 break;
617 }
618 }
@@ -620,15 +620,15 @@ namespace WixToolset.Core.Burn
620 foreach (var facade in facades)
621 {
622 // Update package scope from bundle scope if default.
623 - if (YesNoDefaultType.Default == facade.PackageSymbol.PerMachine)
623 + if (!facade.PackageSymbol.PerMachine.HasValue)
624 {
625 - facade.PackageSymbol.PerMachine = bundleSymbol.PerMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
625 + facade.PackageSymbol.PerMachine = bundleSymbol.PerMachine;
626 }
627
628 // We will only register packages in the same scope as the bundle. Warn if any packages with providers
629 // are in a different scope and not permanent (permanents typically don't need a ref-count).
630 if (!bundleSymbol.PerMachine &&
631 - YesNoDefaultType.Yes == facade.PackageSymbol.PerMachine &&
631 + facade.PackageSymbol.PerMachine.Value &&
632 !facade.PackageSymbol.Permanent &&
633 dependencySymbolsById.ContainsKey(facade.PackageId))
634 {
src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs
+68 -51
@@ -3,6 +3,7 @@
3 namespace WixToolset.Core.Burn
4 {
5 using System;
6 + using System.Diagnostics;
7 using System.Xml;
8 using WixToolset.Data;
9 using WixToolset.Data.Symbols;
@@ -37,6 +38,8 @@ namespace WixToolset.Core.Burn
38 case WixRegistrySearchSymbol symbol:
39 this.WriteRegistrySearchXml(writer, symbol);
40 break;
41 + default:
42 + throw new NotImplementedException();
43 }
44 }
45
@@ -53,17 +56,19 @@ namespace WixToolset.Core.Burn
56 writer.WriteAttributeString("ProductCode", searchSymbol.ProductCode);
57 }
58
56 - if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.KeyPath))
59 + switch (searchSymbol.Type)
60 {
58 - writer.WriteAttributeString("Type", "keyPath");
59 - }
60 - else if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.State))
61 - {
62 - writer.WriteAttributeString("Type", "state");
63 - }
64 - else if (0 != (searchSymbol.Attributes & WixComponentSearchAttributes.WantDirectory))
65 - {
66 - writer.WriteAttributeString("Type", "directory");
61 + case WixComponentSearchType.KeyPath:
62 + writer.WriteAttributeString("Type", "keyPath");
63 + break;
64 + case WixComponentSearchType.State:
65 + writer.WriteAttributeString("Type", "state");
66 + break;
67 + case WixComponentSearchType.WantDirectory:
68 + writer.WriteAttributeString("Type", "directory");
69 + break;
70 + default:
71 + throw new NotImplementedException();
72 }
73
74 writer.WriteEndElement();
@@ -71,24 +76,28 @@ namespace WixToolset.Core.Burn
76
77 private void WriteFileSearchXml(XmlTextWriter writer, WixFileSearchSymbol searchSymbol)
78 {
74 - writer.WriteStartElement((0 == (searchSymbol.Attributes & WixFileSearchAttributes.IsDirectory)) ? "FileSearch" : "DirectorySearch");
79 + writer.WriteStartElement(!searchSymbol.IsDirectory ? "FileSearch" : "DirectorySearch");
80
81 base.WriteXml(writer);
82
83 writer.WriteAttributeString("Path", searchSymbol.Path);
79 - if (WixFileSearchAttributes.WantExists == (searchSymbol.Attributes & WixFileSearchAttributes.WantExists))
80 - {
81 - writer.WriteAttributeString("Type", "exists");
82 - }
83 - else if (WixFileSearchAttributes.WantVersion == (searchSymbol.Attributes & WixFileSearchAttributes.WantVersion))
84 - {
85 - // Can never get here for DirectorySearch.
86 - writer.WriteAttributeString("Type", "version");
87 - }
88 - else
84 +
85 + switch (searchSymbol.Type)
86 {
90 - writer.WriteAttributeString("Type", "path");
87 + case WixFileSearchType.Exists:
88 + writer.WriteAttributeString("Type", "exists");
89 + break;
90 + case WixFileSearchType.Version:
91 + Debug.Assert(!searchSymbol.IsDirectory, "Version search type is invalid for DirectorySearch");
92 + writer.WriteAttributeString("Type", "version");
93 + break;
94 + case WixFileSearchType.Path:
95 + writer.WriteAttributeString("Type", "path");
96 + break;
97 + default:
98 + throw new NotImplementedException();
99 }
100 +
101 writer.WriteEndElement();
102 }
103
@@ -98,7 +107,7 @@ namespace WixToolset.Core.Burn
107
108 base.WriteXml(writer);
109
101 - if (0 != (symbol.Attributes & WixProductSearchAttributes.UpgradeCode))
110 + if (symbol.IsUpgradeCode)
111 {
112 writer.WriteAttributeString("UpgradeCode", symbol.Guid);
113 }
@@ -107,21 +116,22 @@ namespace WixToolset.Core.Burn
116 writer.WriteAttributeString("ProductCode", symbol.Guid);
117 }
118
110 - if (0 != (symbol.Attributes & WixProductSearchAttributes.Version))
111 - {
112 - writer.WriteAttributeString("Type", "version");
113 - }
114 - else if (0 != (symbol.Attributes & WixProductSearchAttributes.Language))
115 - {
116 - writer.WriteAttributeString("Type", "language");
117 - }
118 - else if (0 != (symbol.Attributes & WixProductSearchAttributes.State))
119 - {
120 - writer.WriteAttributeString("Type", "state");
121 - }
122 - else if (0 != (symbol.Attributes & WixProductSearchAttributes.Assignment))
119 + switch (symbol.Type)
120 {
124 - writer.WriteAttributeString("Type", "assignment");
121 + case WixProductSearchType.Version:
122 + writer.WriteAttributeString("Type", "version");
123 + break;
124 + case WixProductSearchType.Language:
125 + writer.WriteAttributeString("Type", "language");
126 + break;
127 + case WixProductSearchType.State:
128 + writer.WriteAttributeString("Type", "state");
129 + break;
130 + case WixProductSearchType.Assignment:
131 + writer.WriteAttributeString("Type", "assignment");
132 + break;
133 + default:
134 + throw new NotImplementedException();
135 }
136
137 writer.WriteEndElement();
@@ -147,6 +157,8 @@ namespace WixToolset.Core.Burn
157 case RegistryRootType.Users:
158 writer.WriteAttributeString("Root", "HKU");
159 break;
160 + default:
161 + throw new NotImplementedException();
162 }
163
164 writer.WriteAttributeString("Key", symbol.Key);
@@ -156,27 +168,32 @@ namespace WixToolset.Core.Burn
168 writer.WriteAttributeString("Value", symbol.Value);
169 }
170
159 - var existenceOnly = 0 != (symbol.Attributes & WixRegistrySearchAttributes.WantExists);
160 -
161 - writer.WriteAttributeString("Type", existenceOnly ? "exists" : "value");
162 -
163 - if (0 != (symbol.Attributes & WixRegistrySearchAttributes.Win64))
171 + if (symbol.Win64)
172 {
173 writer.WriteAttributeString("Win64", "yes");
174 }
175
168 - if (!existenceOnly)
176 + switch (symbol.Type)
177 {
170 - if (0 != (symbol.Attributes & WixRegistrySearchAttributes.ExpandEnvironmentVariables))
171 - {
172 - writer.WriteAttributeString("ExpandEnvironment", "yes");
173 - }
178 + case WixRegistrySearchType.Exists:
179 + writer.WriteAttributeString("Type", "exists");
180 + break;
181 + case WixRegistrySearchType.Value:
182 + writer.WriteAttributeString("Type", "value");
183
175 - // We *always* say this is VariableType="string". If we end up
176 - // needing to be more specific, we will have to expand the "Format"
177 - // attribute to allow "number" and "version".
184 + if (symbol.ExpandEnvironmentVariables)
185 + {
186 + writer.WriteAttributeString("ExpandEnvironment", "yes");
187 + }
188
179 - writer.WriteAttributeString("VariableType", "string");
189 + // We *always* say this is VariableType="string".
190 + // If we end up needing to be more specific,
191 + // we will have to actually implement the "Format" attribute.
192 + writer.WriteAttributeString("VariableType", "string");
193 +
194 + break;
195 + default:
196 + throw new NotImplementedException();
197 }
198
199 writer.WriteEndElement();
src/wix/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs
+4 -11
@@ -4,7 +4,6 @@ namespace WixToolset.Core.Burn.Bundles
4 {
5 using System;
6 using System.Collections.Generic;
7 - using System.Diagnostics;
7 using System.Linq;
8 using WixToolset.Data;
9 using WixToolset.Data.Symbols;
@@ -43,7 +42,7 @@ namespace WixToolset.Core.Burn.Bundles
42 // Index target ProductCodes and UpgradeCodes for slipstreamed MSPs.
43 foreach (var symbol in patchTargetCodeSymbols)
44 {
46 - if (symbol.TargetsProductCode)
45 + if (symbol.Type == WixBundlePatchTargetCodeType.ProductCode)
46 {
47 if (!targetsProductCode.TryGetValue(symbol.TargetCode, out var symbols))
48 {
@@ -53,13 +52,15 @@ namespace WixToolset.Core.Burn.Bundles
52
53 symbols.Add(symbol);
54 }
56 - else if (symbol.TargetsUpgradeCode)
55 + else if (symbol.Type == WixBundlePatchTargetCodeType.UpgradeCode)
56 {
57 if (!targetsUpgradeCode.TryGetValue(symbol.TargetCode, out var symbols))
58 {
59 symbols = new List<WixBundlePatchTargetCodeSymbol>();
60 targetsUpgradeCode.Add(symbol.TargetCode, symbols);
61 }
62 +
63 + symbols.Add(symbol);
64 }
65 }
66 }
@@ -74,9 +75,6 @@ namespace WixToolset.Core.Burn.Bundles
75 {
76 foreach (var symbol in symbols)
77 {
77 - Debug.Assert(symbol.TargetsProductCode);
78 - Debug.Assert(!symbol.TargetsUpgradeCode);
79 -
78 this.TryAddSlipstreamSymbol(slipstreamMspIds, msi, symbol);
79 }
80 }
@@ -85,13 +83,8 @@ namespace WixToolset.Core.Burn.Bundles
83 {
84 foreach (var symbol in symbols)
85 {
88 - Debug.Assert(!symbol.TargetsProductCode);
89 - Debug.Assert(symbol.TargetsUpgradeCode);
90 -
86 this.TryAddSlipstreamSymbol(slipstreamMspIds, msi, symbol);
87 }
93 -
94 - symbols = null;
88 }
89 }
90 }
src/wix/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
+3 -3
@@ -127,8 +127,8 @@ namespace WixToolset.Core.Burn.Bundles
127 {
128 writer.WriteStartElement("WixRollbackBoundary");
129 writer.WriteAttributeString("Id", rollbackBoundary.Id.Id);
130 - writer.WriteAttributeString("Vital", rollbackBoundary.Vital == false ? "no" : "yes");
131 - writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction == true ? "yes" : "no");
130 + writer.WriteAttributeString("Vital", rollbackBoundary.Vital ? "yes" : "no");
131 + writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction ? "yes" : "no");
132
133 if (!String.IsNullOrEmpty(rollbackBoundary.LogPathVariable))
134 {
@@ -155,7 +155,7 @@ namespace WixToolset.Core.Burn.Bundles
155 writer.WriteStartElement("WixPackageProperties");
156
157 writer.WriteAttributeString("Package", package.PackageId);
158 - writer.WriteAttributeString("Vital", package.PackageSymbol.Vital == true ? "yes" : "no");
158 + writer.WriteAttributeString("Vital", package.PackageSymbol.Vital ? "yes" : "no");
159
160 if (!String.IsNullOrEmpty(package.PackageSymbol.DisplayName))
161 {
src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs
+23 -20
@@ -186,8 +186,8 @@ namespace WixToolset.Core.Burn.Bundles
186 {
187 writer.WriteStartElement("RollbackBoundary");
188 writer.WriteAttributeString("Id", rollbackBoundary.Id.Id);
189 - writer.WriteAttributeString("Vital", rollbackBoundary.Vital == false ? "no" : "yes");
190 - writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction == true ? "yes" : "no");
189 + writer.WriteAttributeString("Vital", rollbackBoundary.Vital ? "yes" : "no");
190 + writer.WriteAttributeString("Transaction", rollbackBoundary.Transaction ? "yes" : "no");
191
192 if (!String.IsNullOrEmpty(rollbackBoundary.LogPathVariable))
193 {
@@ -246,13 +246,14 @@ namespace WixToolset.Core.Burn.Bundles
246 writer.WriteAttributeString("ParentDisplayName", this.BundleSymbol.ParentName);
247 }
248
249 - if (this.BundleSymbol.DisableModify)
249 + switch (this.BundleSymbol.DisableModify)
250 {
251 - writer.WriteAttributeString("DisableModify", "yes");
252 - }
253 - else if (this.BundleSymbol.SingleChangeUninstallButton)
254 - {
255 - writer.WriteAttributeString("DisableModify", "button");
251 + case WixBundleModifyType.Disabled:
252 + writer.WriteAttributeString("DisableModify", "yes");
253 + break;
254 + case WixBundleModifyType.SingleChangeUninstallButton:
255 + writer.WriteAttributeString("DisableModify", "button");
256 + break;
257 }
258
259 if (this.BundleSymbol.DisableRemove)
@@ -352,9 +353,9 @@ namespace WixToolset.Core.Burn.Bundles
353 writer.WriteAttributeString("CacheId", package.PackageSymbol.CacheId);
354 writer.WriteAttributeString("InstallSize", Convert.ToString(package.PackageSymbol.InstallSize));
355 writer.WriteAttributeString("Size", Convert.ToString(package.PackageSymbol.Size));
355 - writer.WriteAttributeString("PerMachine", YesNoDefaultType.Yes == package.PackageSymbol.PerMachine ? "yes" : "no");
356 + writer.WriteAttributeString("PerMachine", package.PackageSymbol.PerMachine.HasValue && package.PackageSymbol.PerMachine.Value ? "yes" : "no");
357 writer.WriteAttributeString("Permanent", package.PackageSymbol.Permanent ? "yes" : "no");
357 - writer.WriteAttributeString("Vital", package.PackageSymbol.Vital == false ? "no" : "yes");
358 + writer.WriteAttributeString("Vital", package.PackageSymbol.Vital ? "yes" : "no");
359
360 if (null != package.PackageSymbol.RollbackBoundaryRef)
361 {
@@ -389,9 +390,9 @@ namespace WixToolset.Core.Burn.Bundles
390 writer.WriteAttributeString("UninstallArguments", bundlePackage.UninstallCommand);
391 writer.WriteAttributeString("RepairArguments", bundlePackage.RepairCommand);
392 writer.WriteAttributeString("SupportsBurnProtocol", bundlePackage.SupportsBurnProtocol ? "yes" : "no");
392 - writer.WriteAttributeString("Win64", bundlePackage.Win64 ? "yes" : "no");
393 + writer.WriteAttributeString("Win64", package.PackageSymbol.Win64 ? "yes" : "no");
394
394 - if (!package.PackageSymbol.Attributes.HasFlag(WixBundlePackageAttributes.Visible))
395 + if (!package.PackageSymbol.Visible)
396 {
397 writer.WriteAttributeString("HideARP", "yes");
398 }
@@ -434,15 +435,15 @@ namespace WixToolset.Core.Burn.Bundles
435 // product codes, add the patch list to the overall list.
436 if (null != targetCodes)
437 {
437 - if (!mspPackage.TargetUnspecified)
438 + foreach (var patchTargetCode in targetCodesByPatch[mspPackage.Id.Id])
439 {
439 - var patchTargetCodes = targetCodesByPatch[mspPackage.Id.Id];
440 + if (patchTargetCode.Type == WixBundlePatchTargetCodeType.Unspecified)
441 + {
442 + targetCodes = null;
443 + break;
444 + }
445
441 - targetCodes.AddRange(patchTargetCodes);
442 - }
443 - else // we have a patch that targets the world, so throw the whole list away.
444 - {
445 - targetCodes = null;
446 + targetCodes.Add(patchTargetCode);
447 }
448 }
449 }
@@ -611,9 +612,11 @@ namespace WixToolset.Core.Burn.Bundles
612 {
613 foreach (var targetCode in targetCodes)
614 {
615 + Debug.Assert(targetCode.Type == WixBundlePatchTargetCodeType.ProductCode || targetCode.Type == WixBundlePatchTargetCodeType.UpgradeCode);
616 +
617 writer.WriteStartElement("PatchTargetCode");
618 writer.WriteAttributeString("TargetCode", targetCode.TargetCode);
616 - writer.WriteAttributeString("Product", targetCode.TargetsProductCode ? "yes" : "no");
619 + writer.WriteAttributeString("Product", targetCode.Type == WixBundlePatchTargetCodeType.ProductCode ? "yes" : "no");
620 writer.WriteEndElement();
621 }
622 }
src/wix/WixToolset.Core.Burn/Bundles/OrderPackagesAndRollbackBoundariesCommand.cs
+1 -1
@@ -57,7 +57,7 @@ namespace WixToolset.Core.Burn.Bundles
57 {
58 if (this.PackageFacades.TryGetValue(groupSymbol.ChildId, out var facade))
59 {
60 - var insideMsiTransaction = lastRollbackBoundary.Transaction ?? false;
60 + var insideMsiTransaction = lastRollbackBoundary.Transaction;
61
62 if (null != pendingRollbackBoundary)
63 {
src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs
+4 -4
@@ -82,7 +82,7 @@ namespace WixToolset.Core.Burn.Bundles
82 case BurnCommon.IMAGE_FILE_MACHINE_ARM64:
83 case BurnCommon.IMAGE_FILE_MACHINE_IA64:
84 case BurnCommon.IMAGE_FILE_MACHINE_LOONGARCH64:
85 - bundlePackage.Win64 = true;
85 + this.Facade.PackageSymbol.Win64 = true;
86 break;
87 case BurnCommon.IMAGE_FILE_MACHINE_EBC:
88 case BurnCommon.IMAGE_FILE_MACHINE_MIPS16:
@@ -123,11 +123,11 @@ namespace WixToolset.Core.Burn.Bundles
123 return;
124 }
125
126 - if (BurnCommon.BurnV3Namespace == document.DocumentElement.NamespaceURI && !this.Facade.PackageSymbol.Attributes.HasFlag(WixBundlePackageAttributes.Visible))
126 + if (BurnCommon.BurnV3Namespace == document.DocumentElement.NamespaceURI && !this.Facade.PackageSymbol.Visible)
127 {
128 this.Messaging.Write(BurnBackendWarnings.HiddenBundleNotSupported(packagePayload.SourceLineNumbers, sourcePath));
129
130 - this.Facade.PackageSymbol.Attributes |= WixBundlePackageAttributes.Visible;
130 + this.Facade.PackageSymbol.Visible = true;
131 }
132
133 namespaceManager.AddNamespace("burn", document.DocumentElement.NamespaceURI);
@@ -135,7 +135,7 @@ namespace WixToolset.Core.Burn.Bundles
135 var arpElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration/burn:Arp", namespaceManager) as XmlElement;
136
137 var perMachine = registrationElement.GetAttribute("PerMachine") == "yes";
138 - this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
138 + this.Facade.PackageSymbol.PerMachine = perMachine;
139
140 var version = registrationElement.GetAttribute("Version");
141 packagePayload.Version = version;
src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs
+13 -9
@@ -4,6 +4,7 @@ namespace WixToolset.Core.Burn.Bundles
4 {
5 using System;
6 using System.Collections.Generic;
7 + using System.Diagnostics;
8 using System.Globalization;
9 using System.IO;
10 using System.Linq;
@@ -88,7 +89,7 @@ namespace WixToolset.Core.Burn.Bundles
89 // in MSI 4.5 and below, if this bit is 0, elevation is required.
90 var perMachine = (0 == (fileAndElevateFlags & 8));
91
91 - this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
92 + this.Facade.PackageSymbol.PerMachine = perMachine;
93 this.Facade.PackageSymbol.Win64 = this.IsWin64(packagePayload.SourceLineNumbers, sourcePath, platformsAndLanguages);
94 }
95
@@ -177,7 +178,7 @@ namespace WixToolset.Core.Burn.Bundles
178 this.CreateRelatedPackages(db);
179
180 // If feature selection is enabled, represent the Feature table in the manifest.
180 - if ((msiPackage.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection) == WixBundleMsiPackageAttributes.EnableFeatureSelection)
181 + if (msiPackage.EnableFeatureSelection)
182 {
183 this.CreateMsiFeatures(db);
184 }
@@ -240,13 +241,16 @@ namespace WixToolset.Core.Burn.Bundles
241
242 private void SetPerMachineAppropriately(string allusers, WixBundleMsiPackageSymbol msiPackage, string sourcePath)
243 {
244 + Debug.Assert(this.Facade.PackageSymbol.PerMachine.HasValue);
245 + var perMachine = this.Facade.PackageSymbol.PerMachine.Value;
246 +
247 // Can ignore ALLUSERS from MsiProperties because it is not allowed there.
248 if (msiPackage.ForcePerMachine)
249 {
246 - if (YesNoDefaultType.No == this.Facade.PackageSymbol.PerMachine)
250 + if (!perMachine)
251 {
252 this.Messaging.Write(WarningMessages.PerUserButForcingPerMachine(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath));
249 - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.Yes; // ensure that we think the package is per-machine.
253 + this.Facade.PackageSymbol.PerMachine = true; // ensure that we think the package is per-machine.
254 }
255
256 // Force ALLUSERS=1 via the MSI command-line.
@@ -257,22 +261,22 @@ namespace WixToolset.Core.Burn.Bundles
261 if (String.IsNullOrEmpty(allusers))
262 {
263 // Not forced per-machine and no ALLUSERS property, flip back to per-user.
260 - if (YesNoDefaultType.Yes == this.Facade.PackageSymbol.PerMachine)
264 + if (perMachine)
265 {
266 this.Messaging.Write(WarningMessages.ImplicitlyPerUser(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath));
263 - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.No;
267 + this.Facade.PackageSymbol.PerMachine = false;
268 }
269 }
270 else if (allusers.Equals("1", StringComparison.Ordinal))
271 {
268 - if (YesNoDefaultType.No == this.Facade.PackageSymbol.PerMachine)
272 + if (!perMachine)
273 {
274 this.Messaging.Write(ErrorMessages.PerUserButAllUsersEquals1(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath));
275 }
276 }
277 else if (allusers.Equals("2", StringComparison.Ordinal))
278 {
275 - this.Messaging.Write(WarningMessages.DiscouragedAllUsersValue(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath, (YesNoDefaultType.Yes == this.Facade.PackageSymbol.PerMachine) ? "machine" : "user"));
279 + this.Messaging.Write(WarningMessages.DiscouragedAllUsersValue(this.Facade.PackageSymbol.SourceLineNumbers, sourcePath, perMachine ? "machine" : "user"));
280 }
281 else
282 {
@@ -287,7 +291,7 @@ namespace WixToolset.Core.Burn.Bundles
291 if (!msiPropertyNames.Contains("ARPSYSTEMCOMPONENT"))
292 {
293 var alreadyVisible = String.IsNullOrEmpty(systemComponent);
290 - var visible = (this.Facade.PackageSymbol.Attributes & WixBundlePackageAttributes.Visible) == WixBundlePackageAttributes.Visible;
294 + var visible = this.Facade.PackageSymbol.Visible;
295
296 // If not already set to the correct visibility.
297 if (alreadyVisible != visible)
src/wix/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs
+19 -9
@@ -97,7 +97,7 @@ namespace WixToolset.Core.Burn.Bundles
97
98 private void ProcessPatchXml(WixBundlePayloadSymbol packagePayload, WixBundleMspPackageSymbol mspPackage, string sourcePath)
99 {
100 - var uniqueTargetCodes = new HashSet<string>();
100 + var uniqueTargetCodes = new Dictionary<string, WixBundlePatchTargetCodeSymbol>();
101
102 var patchXml = Installer.ExtractPatchXml(sourcePath);
103
@@ -112,35 +112,42 @@ namespace WixToolset.Core.Burn.Bundles
112 {
113 // If this patch targets a product code, this is the best case.
114 var targetCodeElement = node.SelectSingleNode("p:TargetProductCode", nsmgr);
115 - var attributes = WixBundlePatchTargetCodeAttributes.None;
115 + WixBundlePatchTargetCodeType type;
116
117 if (ProcessMspPackageCommand.TargetsCode(targetCodeElement))
118 {
119 - attributes = WixBundlePatchTargetCodeAttributes.TargetsProductCode;
119 + type = WixBundlePatchTargetCodeType.ProductCode;
120 }
121 else // maybe targets an upgrade code?
122 {
123 targetCodeElement = node.SelectSingleNode("p:UpgradeCode", nsmgr);
124 if (ProcessMspPackageCommand.TargetsCode(targetCodeElement))
125 {
126 - attributes = WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode;
126 + type = WixBundlePatchTargetCodeType.UpgradeCode;
127 }
128 else // this patch targets an unknown number of products
129 {
130 - mspPackage.Attributes |= WixBundleMspPackageAttributes.TargetUnspecified;
130 + type = WixBundlePatchTargetCodeType.Unspecified;
131 }
132 }
133
134 var targetCode = targetCodeElement.InnerText;
135
136 - if (uniqueTargetCodes.Add(targetCode))
136 + if (!uniqueTargetCodes.TryGetValue(targetCode, out var existing))
137 {
138 - this.Section.AddSymbol(new WixBundlePatchTargetCodeSymbol(packagePayload.SourceLineNumbers)
138 + var symbol = this.Section.AddSymbol(new WixBundlePatchTargetCodeSymbol(packagePayload.SourceLineNumbers)
139 {
140 PackageRef = packagePayload.Id.Id,
141 TargetCode = targetCode,
142 - Attributes = attributes
142 + Attributes = 0,
143 + Type = type,
144 });
145 +
146 + uniqueTargetCodes.Add(targetCode, symbol);
147 + }
148 + else if (type == WixBundlePatchTargetCodeType.Unspecified)
149 + {
150 + existing.Type = type;
151 }
152 }
153
@@ -178,6 +185,9 @@ namespace WixToolset.Core.Burn.Bundles
185 }
186 }
187
181 - private static bool TargetsCode(XmlNode node) => "true" == node?.Attributes["Validate"]?.Value;
188 + private static bool TargetsCode(XmlNode node)
189 + {
190 + return "true" == node?.Attributes["Validate"]?.Value;
191 + }
192 }
193 }
src/wix/WixToolset.Core.Burn/Bundles/ProcessMsuPackageCommand.cs
+1 -1
@@ -31,7 +31,7 @@ namespace WixToolset.Core.Burn.Bundles
31 this.Facade.PackageSymbol.CacheId = packagePayload.Hash;
32 }
33
34 - this.Facade.PackageSymbol.PerMachine = YesNoDefaultType.Yes; // MSUs are always per-machine.
34 + this.Facade.PackageSymbol.PerMachine = true; // MSUs are always per-machine.
35 }
36 }
37 }
src/wix/WixToolset.Core/Compiler_Bundle.cs
+16 -19
@@ -117,6 +117,7 @@ namespace WixToolset.Core
117 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
118 string copyright = null;
119 string aboutUrl = null;
120 + var modifyType = WixBundleModifyType.Allowed;
121 var compressed = YesNoDefaultType.Default;
122 WixBundleAttributes attributes = 0;
123 WixBundleCommandLineVariables commandLineVariables = WixBundleCommandLineVariables.UpperCase;
@@ -176,12 +177,13 @@ namespace WixToolset.Core
177 switch (value)
178 {
179 case "button":
179 - attributes |= WixBundleAttributes.SingleChangeUninstallButton;
180 + modifyType = WixBundleModifyType.SingleChangeUninstallButton;
181 break;
182 case "yes":
182 - attributes |= WixBundleAttributes.DisableModify;
183 + modifyType = WixBundleModifyType.Disabled;
184 break;
185 case "no":
186 + modifyType = WixBundleModifyType.Allowed;
187 break;
188 default:
189 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no"));
@@ -415,6 +417,7 @@ namespace WixToolset.Core
417 UpgradeCode = upgradeCode,
418 Version = version,
419 Copyright = copyright,
420 + DisableModify = modifyType,
421 InProgressName = inProgressName,
422 Name = name,
423 Manufacturer = manufacturer,
@@ -2432,16 +2435,16 @@ namespace WixToolset.Core
2435 DisplayName = displayName,
2436 LogPathVariable = logPathVariable,
2437 RollbackLogPathVariable = rollbackPathVariable,
2438 + Vital = vital == YesNoType.Yes,
2439 });
2440
2437 - if (YesNoType.NotSet != vital)
2441 + if (perMachine == YesNoDefaultType.Yes)
2442 {
2439 - chainPackageSymbol.Vital = (vital == YesNoType.Yes);
2443 + chainPackageSymbol.PerMachine = true;
2444 }
2441 -
2442 - if (YesNoDefaultType.NotSet != perMachine)
2445 + else if (perMachine == YesNoDefaultType.No)
2446 {
2444 - chainPackageSymbol.PerMachine = perMachine;
2447 + chainPackageSymbol.PerMachine = false;
2448 }
2449
2450 if (installSize.HasValue)
@@ -2918,21 +2921,15 @@ namespace WixToolset.Core
2921 {
2922 this.Core.AddSymbol(new WixChainItemSymbol(sourceLineNumbers, id));
2923
2921 - var rollbackBoundary = this.Core.AddSymbol(new WixBundleRollbackBoundarySymbol(sourceLineNumbers, id));
2922 -
2923 - if (YesNoType.NotSet != vital)
2924 + var rollbackBoundary = this.Core.AddSymbol(new WixBundleRollbackBoundarySymbol(sourceLineNumbers, id)
2925 {
2925 - rollbackBoundary.Vital = (vital == YesNoType.Yes);
2926 - }
2926 + Transaction = transaction == YesNoType.Yes,
2927 + Vital = vital == YesNoType.Yes,
2928 + });
2929
2928 - if (YesNoType.NotSet != transaction)
2930 + if (logPathVariable != null)
2931 {
2930 - rollbackBoundary.Transaction = (transaction == YesNoType.Yes);
2931 -
2932 - if (logPathVariable != null)
2933 - {
2934 - rollbackBoundary.LogPathVariable = logPathVariable;
2935 - }
2932 + rollbackBoundary.LogPathVariable = logPathVariable;
2933 }
2934
2935 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null);