@joebigelow / wix / commits / 3761d820

Add enum for bundle variable Type.

Sean Hall committed Aug 2, 2020 at 08:26 UTC 3761d820d9407c0417e7ef26386d9d906e1e5329
2 files changed +19 -6
src/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs
+14 -3
@@ -21,6 +21,8 @@ namespace WixToolset.Data
21
22 namespace WixToolset.Data.Symbols
23 {
24 + using System;
25 +
26 public enum WixBundleVariableSymbolFields
27 {
28 Value,
@@ -29,6 +31,15 @@ namespace WixToolset.Data.Symbols
31 Persisted,
32 }
33
34 + public enum WixBundleVariableType
35 + {
36 + Unknown,
37 + Formatted,
38 + Numeric,
39 + String,
40 + Version,
41 + }
42 +
43 public class WixBundleVariableSymbol : IntermediateSymbol
44 {
45 public WixBundleVariableSymbol() : base(SymbolDefinitions.WixBundleVariable, null, null)
@@ -47,10 +58,10 @@ namespace WixToolset.Data.Symbols
58 set => this.Set((int)WixBundleVariableSymbolFields.Value, value);
59 }
60
50 - public string Type
61 + public WixBundleVariableType Type
62 {
52 - get => (string)this.Fields[(int)WixBundleVariableSymbolFields.Type];
53 - set => this.Set((int)WixBundleVariableSymbolFields.Type, value);
63 + get => Enum.TryParse((string)this.Fields[(int)WixBundleVariableSymbolFields.Type], true, out WixBundleVariableType value) ? value : WixBundleVariableType.Unknown;
64 + set => this.Set((int)WixBundleVariableSymbolFields.Type, value.ToString().ToLowerInvariant());
65 }
66
67 public bool Hidden
src/WixToolset.Data/Symbols/WixSetVariableSymbol.cs
+5 -3
@@ -19,6 +19,8 @@ namespace WixToolset.Data
19
20 namespace WixToolset.Data.Symbols
21 {
22 + using System;
23 +
24 public enum WixSetVariableSymbolFields
25 {
26 Value,
@@ -43,10 +45,10 @@ namespace WixToolset.Data.Symbols
45 set => this.Set((int)WixSetVariableSymbolFields.Value, value);
46 }
47
46 - public string Type
48 + public WixBundleVariableType Type
49 {
48 - get => (string)this.Fields[(int)WixSetVariableSymbolFields.Type];
49 - set => this.Set((int)WixSetVariableSymbolFields.Type, value);
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 }