From 0731fa5ca035f0ca9d5cb28f5e3ef07d98f9a7ae Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 29 Dec 2017 21:47:48 -0800 Subject: Implement IParseHelper.GetAttributeMsidbRegistryRootValue() --- src/WixToolset.Core/CompilerCore.cs | 64 +------------------------------------ 1 file changed, 1 insertion(+), 63 deletions(-) (limited to 'src/WixToolset.Core/CompilerCore.cs') diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 7cb7b703..651c80a3 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs @@ -830,42 +830,6 @@ namespace WixToolset.Core return this.parseHelper.GetAttributeVersionValue(sourceLineNumbers, attribute); } - /// - /// Gets a RegistryRoot value and displays an error for an illegal value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// Whether HKMU is considered a valid value. - /// The attribute's RegisitryRootType value. - [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] - public Wix.RegistryRootType GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) - { - Wix.RegistryRootType registryRoot = Wix.RegistryRootType.NotSet; - string value = this.GetAttributeValue(sourceLineNumbers, attribute); - - if (0 < value.Length) - { - registryRoot = Wix.Enums.ParseRegistryRootType(value); - - if (Wix.RegistryRootType.IllegalValue == registryRoot || (!allowHkmu && Wix.RegistryRootType.HKMU == registryRoot)) - { - // TODO: Find a way to expose the valid values programatically! - if (allowHkmu) - { - this.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, - "HKMU", "HKCR", "HKCU", "HKLM", "HKU")); - } - else - { - this.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, - "HKCR", "HKCU", "HKLM", "HKU")); - } - } - } - - return registryRoot; - } - /// /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. /// @@ -876,33 +840,7 @@ namespace WixToolset.Core [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] public int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) { - Wix.RegistryRootType registryRoot = this.GetAttributeRegistryRootValue(sourceLineNumbers, attribute, allowHkmu); - - switch (registryRoot) - { - case Wix.RegistryRootType.NotSet: - return CompilerConstants.IntegerNotSet; - case Wix.RegistryRootType.HKCR: - return Core.Native.MsiInterop.MsidbRegistryRootClassesRoot; - case Wix.RegistryRootType.HKCU: - return Core.Native.MsiInterop.MsidbRegistryRootCurrentUser; - case Wix.RegistryRootType.HKLM: - return Core.Native.MsiInterop.MsidbRegistryRootLocalMachine; - case Wix.RegistryRootType.HKU: - return Core.Native.MsiInterop.MsidbRegistryRootUsers; - case Wix.RegistryRootType.HKMU: - // This is gross, but there was *one* registry root parsing instance - // (in Compiler.ParseRegistrySearchElement()) that did not explicitly - // handle HKMU and it fell through to the default error case. The - // others treated it as -1, which is what we do here. - if (allowHkmu) - { - return -1; - } - break; - } - - return CompilerConstants.IntegerNotSet; + return this.parseHelper.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attribute, allowHkmu); } /// -- cgit v1.2.3-55-g6feb