From 5a3469a43049056773a624032fba170498489e93 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 11 Feb 2025 22:17:14 -0800 Subject: Keep Group symbol fields and attributes unnested --- src/ext/Util/wixext/Symbols/GroupGroupSymbol.cs | 26 +++---- src/ext/Util/wixext/Symbols/GroupSymbol.cs | 92 ++++++++++++------------- src/ext/Util/wixext/UtilCompiler.cs | 16 ++--- src/ext/Util/wixext/UtilDecompiler.cs | 14 ++-- 4 files changed, 74 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/ext/Util/wixext/Symbols/GroupGroupSymbol.cs b/src/ext/Util/wixext/Symbols/GroupGroupSymbol.cs index fdd1ee76..a4ec6ddd 100644 --- a/src/ext/Util/wixext/Symbols/GroupGroupSymbol.cs +++ b/src/ext/Util/wixext/Symbols/GroupGroupSymbol.cs @@ -11,8 +11,8 @@ namespace WixToolset.Util UtilSymbolDefinitionType.GroupGroup.ToString(), new[] { - new IntermediateFieldDefinition(nameof(GroupGroupSymbol.SymbolFields.ParentGroupRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(GroupGroupSymbol.SymbolFields.ChildGroupRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(GroupGroupSymbolFields.ParentGroupRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(GroupGroupSymbolFields.ChildGroupRef), IntermediateFieldType.String), }, typeof(UserGroupSymbol)); } @@ -22,14 +22,14 @@ namespace WixToolset.Util.Symbols { using WixToolset.Data; - public class GroupGroupSymbol : IntermediateSymbol + public enum GroupGroupSymbolFields { - public enum SymbolFields - { - ParentGroupRef, - ChildGroupRef, - } + ParentGroupRef, + ChildGroupRef, + } + public class GroupGroupSymbol : IntermediateSymbol + { public GroupGroupSymbol() : base(UtilSymbolDefinitions.GroupGroup, null, null) { } @@ -38,18 +38,18 @@ namespace WixToolset.Util.Symbols { } - public IntermediateField this[GroupGroupSymbol.SymbolFields index] => this.Fields[(int)index]; + public IntermediateField this[GroupGroupSymbolFields index] => this.Fields[(int)index]; public string ParentGroupRef { - get => this.Fields[(int)GroupGroupSymbol.SymbolFields.ParentGroupRef].AsString(); - set => this.Set((int)GroupGroupSymbol.SymbolFields.ParentGroupRef, value); + get => this.Fields[(int)GroupGroupSymbolFields.ParentGroupRef].AsString(); + set => this.Set((int)GroupGroupSymbolFields.ParentGroupRef, value); } public string ChildGroupRef { - get => this.Fields[(int)GroupGroupSymbol.SymbolFields.ChildGroupRef].AsString(); - set => this.Set((int)GroupGroupSymbol.SymbolFields.ChildGroupRef, value); + get => this.Fields[(int)GroupGroupSymbolFields.ChildGroupRef].AsString(); + set => this.Set((int)GroupGroupSymbolFields.ChildGroupRef, value); } } diff --git a/src/ext/Util/wixext/Symbols/GroupSymbol.cs b/src/ext/Util/wixext/Symbols/GroupSymbol.cs index ac6f6608..551b22e7 100644 --- a/src/ext/Util/wixext/Symbols/GroupSymbol.cs +++ b/src/ext/Util/wixext/Symbols/GroupSymbol.cs @@ -11,9 +11,9 @@ namespace WixToolset.Util UtilSymbolDefinitionType.Group.ToString(), new[] { - new IntermediateFieldDefinition(nameof(GroupSymbol.SymbolFields.ComponentRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(GroupSymbol.SymbolFields.Name), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(GroupSymbol.SymbolFields.Domain), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(GroupSymbolFields.ComponentRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(GroupSymbolFields.Name), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(GroupSymbolFields.Domain), IntermediateFieldType.String), }, typeof(GroupSymbol)); @@ -21,9 +21,9 @@ namespace WixToolset.Util UtilSymbolDefinitionType.Group6.ToString(), new[] { - new IntermediateFieldDefinition(nameof(Group6Symbol.SymbolFields.GroupRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(Group6Symbol.SymbolFields.Comment), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(Group6Symbol.SymbolFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(Group6SymbolFields.GroupRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(Group6SymbolFields.Comment), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(Group6SymbolFields.Attributes), IntermediateFieldType.Number), }, typeof(Group6Symbol)); } @@ -34,15 +34,15 @@ namespace WixToolset.Util.Symbols using System; using WixToolset.Data; - public class GroupSymbol : IntermediateSymbol + public enum GroupSymbolFields { - public enum SymbolFields - { - ComponentRef, - Name, - Domain, - } + ComponentRef, + Name, + Domain, + } + public class GroupSymbol : IntermediateSymbol + { public GroupSymbol() : base(UtilSymbolDefinitions.Group, null, null) { } @@ -51,48 +51,48 @@ namespace WixToolset.Util.Symbols { } - public IntermediateField this[GroupSymbol.SymbolFields index] => this.Fields[(int)index]; + public IntermediateField this[GroupSymbolFields index] => this.Fields[(int)index]; public string ComponentRef { - get => this.Fields[(int)GroupSymbol.SymbolFields.ComponentRef].AsString(); - set => this.Set((int)GroupSymbol.SymbolFields.ComponentRef, value); + get => this.Fields[(int)GroupSymbolFields.ComponentRef].AsString(); + set => this.Set((int)GroupSymbolFields.ComponentRef, value); } public string Name { - get => this.Fields[(int)GroupSymbol.SymbolFields.Name].AsString(); - set => this.Set((int)GroupSymbol.SymbolFields.Name, value); + get => this.Fields[(int)GroupSymbolFields.Name].AsString(); + set => this.Set((int)GroupSymbolFields.Name, value); } public string Domain { - get => this.Fields[(int)GroupSymbol.SymbolFields.Domain].AsString(); - set => this.Set((int)GroupSymbol.SymbolFields.Domain, value); + get => this.Fields[(int)GroupSymbolFields.Domain].AsString(); + set => this.Set((int)GroupSymbolFields.Domain, value); } } - public class Group6Symbol : IntermediateSymbol + [Flags] + public enum Group6SymbolAttributes { - [Flags] - public enum SymbolAttributes - { - None = 0x00000000, - FailIfExists = 0x00000010, - UpdateIfExists = 0x00000020, - DontRemoveOnUninstall = 0x00000100, - DontCreateGroup = 0x00000200, - NonVital = 0x00000400, - RemoveComment = 0x00000800, - } + None = 0x00000000, + FailIfExists = 0x00000010, + UpdateIfExists = 0x00000020, + DontRemoveOnUninstall = 0x00000100, + DontCreateGroup = 0x00000200, + NonVital = 0x00000400, + RemoveComment = 0x00000800, + } - public enum SymbolFields - { - GroupRef, - Comment, - Attributes, - } + public enum Group6SymbolFields + { + GroupRef, + Comment, + Attributes, + } + public class Group6Symbol : IntermediateSymbol + { public Group6Symbol() : base(UtilSymbolDefinitions.Group6, null, null) { } @@ -101,24 +101,24 @@ namespace WixToolset.Util.Symbols { } - public IntermediateField this[Group6Symbol.SymbolFields index] => this.Fields[(int)index]; + public IntermediateField this[Group6SymbolFields index] => this.Fields[(int)index]; public string GroupRef { - get => this.Fields[(int)Group6Symbol.SymbolFields.GroupRef].AsString(); - set => this.Set((int)Group6Symbol.SymbolFields.GroupRef, value); + get => this.Fields[(int)Group6SymbolFields.GroupRef].AsString(); + set => this.Set((int)Group6SymbolFields.GroupRef, value); } public string Comment { - get => this.Fields[(int)Group6Symbol.SymbolFields.Comment].AsString(); - set => this.Set((int)Group6Symbol.SymbolFields.Comment, value); + get => this.Fields[(int)Group6SymbolFields.Comment].AsString(); + set => this.Set((int)Group6SymbolFields.Comment, value); } - public SymbolAttributes Attributes + public Group6SymbolAttributes Attributes { - get => (SymbolAttributes)this.Fields[(int)Group6Symbol.SymbolFields.Attributes].AsNumber(); - set => this.Set((int)Group6Symbol.SymbolFields.Attributes, (int)value); + get => (Group6SymbolAttributes)this.Fields[(int)Group6SymbolFields.Attributes].AsNumber(); + set => this.Set((int)Group6SymbolFields.Attributes, (int)value); } } } diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index f59ffcd6..1ad27322 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs @@ -1361,7 +1361,7 @@ namespace WixToolset.Util string domain = null; string name = null; string comment = null; - Group6Symbol.SymbolAttributes attributes = Group6Symbol.SymbolAttributes.None; + Group6SymbolAttributes attributes = Group6SymbolAttributes.None; foreach (var attrib in element.Attributes()) { @@ -1394,7 +1394,7 @@ namespace WixToolset.Util if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.DontCreateGroup; + attributes |= Group6SymbolAttributes.DontCreateGroup; } break; case "FailIfExists": @@ -1405,7 +1405,7 @@ namespace WixToolset.Util if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.FailIfExists; + attributes |= Group6SymbolAttributes.FailIfExists; } break; case "UpdateIfExists": @@ -1416,13 +1416,13 @@ namespace WixToolset.Util if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.UpdateIfExists; + attributes |= Group6SymbolAttributes.UpdateIfExists; } break; case "RemoveComment": if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.RemoveComment; + attributes |= Group6SymbolAttributes.RemoveComment; } break; case "RemoveOnUninstall": @@ -1433,7 +1433,7 @@ namespace WixToolset.Util if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.DontRemoveOnUninstall; + attributes |= Group6SymbolAttributes.DontRemoveOnUninstall; } break; case "Vital": @@ -1444,7 +1444,7 @@ namespace WixToolset.Util if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { - attributes |= Group6Symbol.SymbolAttributes.NonVital; + attributes |= Group6SymbolAttributes.NonVital; } break; default: @@ -1468,7 +1468,7 @@ namespace WixToolset.Util this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); } - if (null != comment && (Group6Symbol.SymbolAttributes.RemoveComment & attributes) != 0) + if (null != comment && (Group6SymbolAttributes.RemoveComment & attributes) != 0) { this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "Comment", "RemoveComment")); } diff --git a/src/ext/Util/wixext/UtilDecompiler.cs b/src/ext/Util/wixext/UtilDecompiler.cs index a236ece9..1f3079d8 100644 --- a/src/ext/Util/wixext/UtilDecompiler.cs +++ b/src/ext/Util/wixext/UtilDecompiler.cs @@ -453,14 +453,14 @@ namespace WixToolset.Util var groupId = row.FieldAsString(0); if (this.DecompilerHelper.TryGetIndexedElement("Group", groupId, out var group)) { - var attributes = (Group6Symbol.SymbolAttributes)(row.FieldAsNullableInteger(2) ?? 0); + var attributes = (Group6SymbolAttributes)(row.FieldAsNullableInteger(2) ?? 0); group.Add(AttributeIfNotNull("Comment", row, 1)); - group.Add(AttributeIfTrue("FailIfExists", ((attributes & Group6Symbol.SymbolAttributes.FailIfExists) != 0))); - group.Add(AttributeIfTrue("UpdateIfExists", ((attributes & Group6Symbol.SymbolAttributes.UpdateIfExists) != 0))); - group.Add(AttributeIfTrue("DontRemoveOnUninstall", ((attributes & Group6Symbol.SymbolAttributes.DontRemoveOnUninstall) != 0))); - group.Add(AttributeIfTrue("DontCreateGroup", ((attributes & Group6Symbol.SymbolAttributes.DontCreateGroup) != 0))); - group.Add(AttributeIfTrue("NonVital", ((attributes & Group6Symbol.SymbolAttributes.NonVital) != 0))); - group.Add(AttributeIfTrue("RemoveComment", ((attributes & Group6Symbol.SymbolAttributes.RemoveComment) != 0))); + group.Add(AttributeIfTrue("FailIfExists", ((attributes & Group6SymbolAttributes.FailIfExists) != 0))); + group.Add(AttributeIfTrue("UpdateIfExists", ((attributes & Group6SymbolAttributes.UpdateIfExists) != 0))); + group.Add(AttributeIfTrue("DontRemoveOnUninstall", ((attributes & Group6SymbolAttributes.DontRemoveOnUninstall) != 0))); + group.Add(AttributeIfTrue("DontCreateGroup", ((attributes & Group6SymbolAttributes.DontCreateGroup) != 0))); + group.Add(AttributeIfTrue("NonVital", ((attributes & Group6SymbolAttributes.NonVital) != 0))); + group.Add(AttributeIfTrue("RemoveComment", ((attributes & Group6SymbolAttributes.RemoveComment) != 0))); } else { -- cgit v1.2.3-55-g6feb