diff options
Diffstat (limited to 'src/WixToolset.Data/Symbols/RegistrySymbol.cs')
-rw-r--r-- | src/WixToolset.Data/Symbols/RegistrySymbol.cs | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/WixToolset.Data/Symbols/RegistrySymbol.cs b/src/WixToolset.Data/Symbols/RegistrySymbol.cs new file mode 100644 index 00000000..371bfe98 --- /dev/null +++ b/src/WixToolset.Data/Symbols/RegistrySymbol.cs | |||
@@ -0,0 +1,108 @@ | |||
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 Registry = new IntermediateSymbolDefinition( | ||
10 | SymbolDefinitionType.Registry, | ||
11 | new[] | ||
12 | { | ||
13 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.Root), IntermediateFieldType.Number), | ||
14 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.Key), IntermediateFieldType.String), | ||
15 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.Name), IntermediateFieldType.String), | ||
16 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.Value), IntermediateFieldType.String), | ||
17 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.ValueType), IntermediateFieldType.Number), | ||
18 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.ValueAction), IntermediateFieldType.Number), | ||
19 | new IntermediateFieldDefinition(nameof(RegistrySymbolFields.ComponentRef), IntermediateFieldType.String), | ||
20 | }, | ||
21 | typeof(RegistrySymbol)); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | namespace WixToolset.Data.Symbols | ||
26 | { | ||
27 | public enum RegistrySymbolFields | ||
28 | { | ||
29 | Root, | ||
30 | Key, | ||
31 | Name, | ||
32 | Value, | ||
33 | ValueType, | ||
34 | ValueAction, | ||
35 | ComponentRef, | ||
36 | } | ||
37 | |||
38 | public enum RegistryValueType | ||
39 | { | ||
40 | String, | ||
41 | Binary, | ||
42 | Expandable, | ||
43 | Integer, | ||
44 | MultiString, | ||
45 | } | ||
46 | |||
47 | public enum RegistryValueActionType | ||
48 | { | ||
49 | Write, | ||
50 | Append, | ||
51 | Prepend, | ||
52 | } | ||
53 | |||
54 | public class RegistrySymbol : IntermediateSymbol | ||
55 | { | ||
56 | public RegistrySymbol() : base(SymbolDefinitions.Registry, null, null) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | public RegistrySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.Registry, sourceLineNumber, id) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | public IntermediateField this[RegistrySymbolFields index] => this.Fields[(int)index]; | ||
65 | |||
66 | public RegistryRootType Root | ||
67 | { | ||
68 | get => (RegistryRootType)this.Fields[(int)RegistrySymbolFields.Root].AsNumber(); | ||
69 | set => this.Set((int)RegistrySymbolFields.Root, (int)value); | ||
70 | } | ||
71 | |||
72 | public string Key | ||
73 | { | ||
74 | get => (string)this.Fields[(int)RegistrySymbolFields.Key]; | ||
75 | set => this.Set((int)RegistrySymbolFields.Key, value); | ||
76 | } | ||
77 | |||
78 | public string Name | ||
79 | { | ||
80 | get => (string)this.Fields[(int)RegistrySymbolFields.Name]; | ||
81 | set => this.Set((int)RegistrySymbolFields.Name, value); | ||
82 | } | ||
83 | |||
84 | public string Value | ||
85 | { | ||
86 | get => this.Fields[(int)RegistrySymbolFields.Value].AsString(); | ||
87 | set => this.Set((int)RegistrySymbolFields.Value, value); | ||
88 | } | ||
89 | |||
90 | public RegistryValueType ValueType | ||
91 | { | ||
92 | get => (RegistryValueType)this.Fields[(int)RegistrySymbolFields.ValueType].AsNumber(); | ||
93 | set => this.Set((int)RegistrySymbolFields.ValueType, (int)value); | ||
94 | } | ||
95 | |||
96 | public RegistryValueActionType ValueAction | ||
97 | { | ||
98 | get => (RegistryValueActionType)this.Fields[(int)RegistrySymbolFields.ValueAction].AsNumber(); | ||
99 | set => this.Set((int)RegistrySymbolFields.ValueAction, (int)value); | ||
100 | } | ||
101 | |||
102 | public string ComponentRef | ||
103 | { | ||
104 | get => (string)this.Fields[(int)RegistrySymbolFields.ComponentRef]; | ||
105 | set => this.Set((int)RegistrySymbolFields.ComponentRef, value); | ||
106 | } | ||
107 | } | ||
108 | } \ No newline at end of file | ||