| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Data |
| 4 | { |
| 5 | using WixToolset.Data.Symbols; |
| 6 | |
| 7 | public static partial class SymbolDefinitions |
| 8 | { |
| 9 | public static readonly IntermediateSymbolDefinition RegLocator = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.RegLocator, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(RegLocatorSymbolFields.Root), IntermediateFieldType.Number), |
| 14 | new IntermediateFieldDefinition(nameof(RegLocatorSymbolFields.Key), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(RegLocatorSymbolFields.Name), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(RegLocatorSymbolFields.Type), IntermediateFieldType.Number), |
| 17 | new IntermediateFieldDefinition(nameof(RegLocatorSymbolFields.Win64), IntermediateFieldType.Bool), |
| 18 | }, |
| 19 | typeof(RegLocatorSymbol)); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | namespace WixToolset.Data.Symbols |
| 24 | { |
| 25 | public enum RegLocatorSymbolFields |
| 26 | { |
| 27 | Root, |
| 28 | Key, |
| 29 | Name, |
| 30 | Type, |
| 31 | Win64, |
| 32 | } |
| 33 | |
| 34 | public enum RegLocatorType |
| 35 | { |
| 36 | Directory, |
| 37 | FileName, |
| 38 | Raw |
| 39 | }; |
| 40 | |
| 41 | public class RegLocatorSymbol : IntermediateSymbol |
| 42 | { |
| 43 | public RegLocatorSymbol() : base(SymbolDefinitions.RegLocator, null, null) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | public RegLocatorSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.RegLocator, sourceLineNumber, id) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | public IntermediateField this[RegLocatorSymbolFields index] => this.Fields[(int)index]; |
| 52 | |
| 53 | public RegistryRootType Root |
| 54 | { |
| 55 | get => (RegistryRootType)this.Fields[(int)RegLocatorSymbolFields.Root].AsNumber(); |
| 56 | set => this.Set((int)RegLocatorSymbolFields.Root, (int)value); |
| 57 | } |
| 58 | |
| 59 | public string Key |
| 60 | { |
| 61 | get => (string)this.Fields[(int)RegLocatorSymbolFields.Key]; |
| 62 | set => this.Set((int)RegLocatorSymbolFields.Key, value); |
| 63 | } |
| 64 | |
| 65 | public string Name |
| 66 | { |
| 67 | get => (string)this.Fields[(int)RegLocatorSymbolFields.Name]; |
| 68 | set => this.Set((int)RegLocatorSymbolFields.Name, value); |
| 69 | } |
| 70 | |
| 71 | public RegLocatorType Type |
| 72 | { |
| 73 | get => (RegLocatorType)this.Fields[(int)RegLocatorSymbolFields.Type].AsNumber(); |
| 74 | set => this.Set((int)RegLocatorSymbolFields.Type, (int)value); |
| 75 | } |
| 76 | |
| 77 | public bool Win64 |
| 78 | { |
| 79 | get => this.Fields[(int)RegLocatorSymbolFields.Win64].AsBool(); |
| 80 | set => this.Set((int)RegLocatorSymbolFields.Win64, value); |
| 81 | } |
| 82 | } |
| 83 | } |