| 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 Component = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.Component, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.ComponentId), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.DirectoryRef), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Location), IntermediateFieldType.Number), |
| 16 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.DisableRegistryReflection), IntermediateFieldType.Bool), |
| 17 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.NeverOverwrite), IntermediateFieldType.Bool), |
| 18 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Permanent), IntermediateFieldType.Bool), |
| 19 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.SharedDllRefCount), IntermediateFieldType.Bool), |
| 20 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Shared), IntermediateFieldType.Bool), |
| 21 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Transitive), IntermediateFieldType.Bool), |
| 22 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.UninstallWhenSuperseded), IntermediateFieldType.Bool), |
| 23 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Win64), IntermediateFieldType.Bool), |
| 24 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.Condition), IntermediateFieldType.String), |
| 25 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.KeyPath), IntermediateFieldType.String), |
| 26 | new IntermediateFieldDefinition(nameof(ComponentSymbolFields.KeyPathType), IntermediateFieldType.Number), |
| 27 | }, |
| 28 | typeof(ComponentSymbol)); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | namespace WixToolset.Data.Symbols |
| 33 | { |
| 34 | public enum ComponentSymbolFields |
| 35 | { |
| 36 | ComponentId, |
| 37 | DirectoryRef, |
| 38 | Location, |
| 39 | DisableRegistryReflection, |
| 40 | NeverOverwrite, |
| 41 | Permanent, |
| 42 | SharedDllRefCount, |
| 43 | Shared, |
| 44 | Transitive, |
| 45 | UninstallWhenSuperseded, |
| 46 | Win64, |
| 47 | Condition, |
| 48 | KeyPath, |
| 49 | KeyPathType, |
| 50 | } |
| 51 | |
| 52 | public enum ComponentLocation |
| 53 | { |
| 54 | LocalOnly, |
| 55 | SourceOnly, |
| 56 | Either |
| 57 | } |
| 58 | |
| 59 | public class ComponentSymbol : IntermediateSymbol |
| 60 | { |
| 61 | public ComponentSymbol() : base(SymbolDefinitions.Component, null, null) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | public ComponentSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.Component, sourceLineNumber, id) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | public IntermediateField this[ComponentSymbolFields index] => this.Fields[(int)index]; |
| 70 | |
| 71 | public string ComponentId |
| 72 | { |
| 73 | get => (string)this.Fields[(int)ComponentSymbolFields.ComponentId]; |
| 74 | set => this.Set((int)ComponentSymbolFields.ComponentId, value); |
| 75 | } |
| 76 | |
| 77 | public string DirectoryRef |
| 78 | { |
| 79 | get => (string)this.Fields[(int)ComponentSymbolFields.DirectoryRef]; |
| 80 | set => this.Set((int)ComponentSymbolFields.DirectoryRef, value); |
| 81 | } |
| 82 | |
| 83 | public ComponentLocation Location |
| 84 | { |
| 85 | get => (ComponentLocation)this.Fields[(int)ComponentSymbolFields.Location].AsNumber(); |
| 86 | set => this.Set((int)ComponentSymbolFields.Location, (int)value); |
| 87 | } |
| 88 | |
| 89 | public bool DisableRegistryReflection |
| 90 | { |
| 91 | get => this.Fields[(int)ComponentSymbolFields.DisableRegistryReflection].AsBool(); |
| 92 | set => this.Set((int)ComponentSymbolFields.DisableRegistryReflection, value); |
| 93 | } |
| 94 | |
| 95 | public bool NeverOverwrite |
| 96 | { |
| 97 | get => this.Fields[(int)ComponentSymbolFields.NeverOverwrite].AsBool(); |
| 98 | set => this.Set((int)ComponentSymbolFields.NeverOverwrite, value); |
| 99 | } |
| 100 | |
| 101 | public bool Permanent |
| 102 | { |
| 103 | get => this.Fields[(int)ComponentSymbolFields.Permanent].AsBool(); |
| 104 | set => this.Set((int)ComponentSymbolFields.Permanent, value); |
| 105 | } |
| 106 | |
| 107 | public bool SharedDllRefCount |
| 108 | { |
| 109 | get => this.Fields[(int)ComponentSymbolFields.SharedDllRefCount].AsBool(); |
| 110 | set => this.Set((int)ComponentSymbolFields.SharedDllRefCount, value); |
| 111 | } |
| 112 | |
| 113 | public bool Shared |
| 114 | { |
| 115 | get => this.Fields[(int)ComponentSymbolFields.Shared].AsBool(); |
| 116 | set => this.Set((int)ComponentSymbolFields.Shared, value); |
| 117 | } |
| 118 | |
| 119 | public bool Transitive |
| 120 | { |
| 121 | get => this.Fields[(int)ComponentSymbolFields.Transitive].AsBool(); |
| 122 | set => this.Set((int)ComponentSymbolFields.Transitive, value); |
| 123 | } |
| 124 | |
| 125 | public bool UninstallWhenSuperseded |
| 126 | { |
| 127 | get => this.Fields[(int)ComponentSymbolFields.UninstallWhenSuperseded].AsBool(); |
| 128 | set => this.Set((int)ComponentSymbolFields.UninstallWhenSuperseded, value); |
| 129 | } |
| 130 | |
| 131 | public bool Win64 |
| 132 | { |
| 133 | get => this.Fields[(int)ComponentSymbolFields.Win64].AsBool(); |
| 134 | set => this.Set((int)ComponentSymbolFields.Win64, value); |
| 135 | } |
| 136 | |
| 137 | public string Condition |
| 138 | { |
| 139 | get => (string)this.Fields[(int)ComponentSymbolFields.Condition]; |
| 140 | set => this.Set((int)ComponentSymbolFields.Condition, value); |
| 141 | } |
| 142 | |
| 143 | public string KeyPath |
| 144 | { |
| 145 | get => (string)this.Fields[(int)ComponentSymbolFields.KeyPath]; |
| 146 | set => this.Set((int)ComponentSymbolFields.KeyPath, value); |
| 147 | } |
| 148 | |
| 149 | public ComponentKeyPathType KeyPathType |
| 150 | { |
| 151 | get => (ComponentKeyPathType)this.Fields[(int)ComponentSymbolFields.KeyPathType].AsNumber(); |
| 152 | set => this.Set((int)ComponentSymbolFields.KeyPathType, (int)value); |
| 153 | } |
| 154 | } |
| 155 | } |