main
cs 54 lines 1.91 KB
Raw
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 WixSetVariable = new IntermediateSymbolDefinition(
10 SymbolDefinitionType.WixSetVariable,
11 new[]
12 {
13 new IntermediateFieldDefinition(nameof(WixSetVariableSymbolFields.Value), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixSetVariableSymbolFields.Type), IntermediateFieldType.String),
15 },
16 typeof(WixSetVariableSymbol));
17 }
18 }
19
20 namespace WixToolset.Data.Symbols
21 {
22 using System;
23
24 public enum WixSetVariableSymbolFields
25 {
26 Value,
27 Type,
28 }
29
30 public class WixSetVariableSymbol : IntermediateSymbol
31 {
32 public WixSetVariableSymbol() : base(SymbolDefinitions.WixSetVariable, null, null)
33 {
34 }
35
36 public WixSetVariableSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixSetVariable, sourceLineNumber, id)
37 {
38 }
39
40 public IntermediateField this[WixSetVariableSymbolFields index] => this.Fields[(int)index];
41
42 public string Value
43 {
44 get => (string)this.Fields[(int)WixSetVariableSymbolFields.Value];
45 set => this.Set((int)WixSetVariableSymbolFields.Value, value);
46 }
47
48 public WixBundleVariableType Type
49 {
50 get => Enum.TryParse((string)this.Fields[(int)WixSetVariableSymbolFields.Type], true, out WixBundleVariableType value) ? value : WixBundleVariableType.Unknown;
51 set => this.Set((int)WixSetVariableSymbolFields.Type, value.ToString().ToLowerInvariant());
52 }
53 }
54 }