diff options
author | Rob Mensching <rob@firegiant.com> | 2017-12-30 01:31:32 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2017-12-30 01:31:32 -0800 |
commit | 7b013ac66a36e0f73d480ef28771a65f64b57e19 (patch) | |
tree | 4a2996a1a539337ae27f3b9dfc692cf6052b897c /src/WixToolset.Data/Bind | |
parent | bcfae2a06a3a6c7e778b615e765b5a9efe847c0c (diff) | |
download | wix-7b013ac66a36e0f73d480ef28771a65f64b57e19.tar.gz wix-7b013ac66a36e0f73d480ef28771a65f64b57e19.tar.bz2 wix-7b013ac66a36e0f73d480ef28771a65f64b57e19.zip |
Support serializing localization information in Intermediates
Diffstat (limited to 'src/WixToolset.Data/Bind')
-rw-r--r-- | src/WixToolset.Data/Bind/BindVariable.cs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/WixToolset.Data/Bind/BindVariable.cs b/src/WixToolset.Data/Bind/BindVariable.cs index 06c004e1..276dae38 100644 --- a/src/WixToolset.Data/Bind/BindVariable.cs +++ b/src/WixToolset.Data/Bind/BindVariable.cs | |||
@@ -1,9 +1,11 @@ | |||
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. | 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 | 2 | ||
3 | namespace WixToolset.Data.Rows | 3 | namespace WixToolset.Data.Bind |
4 | { | 4 | { |
5 | using SimpleJson; | ||
6 | |||
5 | /// <summary> | 7 | /// <summary> |
6 | /// Specialization of a row for the WixVariable table. | 8 | /// Bind variable. |
7 | /// </summary> | 9 | /// </summary> |
8 | public sealed class BindVariable | 10 | public sealed class BindVariable |
9 | { | 11 | { |
@@ -29,5 +31,32 @@ namespace WixToolset.Data.Rows | |||
29 | /// </summary> | 31 | /// </summary> |
30 | /// <value>Whether this variable is overridable.</value> | 32 | /// <value>Whether this variable is overridable.</value> |
31 | public bool Overridable { get; set; } | 33 | public bool Overridable { get; set; } |
34 | |||
35 | internal JsonObject Serialize() | ||
36 | { | ||
37 | var jsonObject = new JsonObject | ||
38 | { | ||
39 | { "name", this.Id }, | ||
40 | }; | ||
41 | |||
42 | jsonObject.AddIsNotNullOrEmpty("value", this.Value); | ||
43 | jsonObject.AddNonDefaultValue("overridable", this.Overridable, false); | ||
44 | jsonObject.AddNonDefaultValue("ln", this.SourceLineNumbers?.Serialize()); | ||
45 | |||
46 | return jsonObject; | ||
47 | } | ||
48 | |||
49 | internal static BindVariable Deserialize(JsonObject jsonObject) | ||
50 | { | ||
51 | var variable = new BindVariable() | ||
52 | { | ||
53 | Id = jsonObject.GetValueOrDefault<string>("name"), | ||
54 | Value = jsonObject.GetValueOrDefault<string>("value"), | ||
55 | Overridable = jsonObject.GetValueOrDefault("overridable", false), | ||
56 | SourceLineNumbers = jsonObject.GetValueOrDefault<SourceLineNumber>("ln") | ||
57 | }; | ||
58 | |||
59 | return variable; | ||
60 | } | ||
32 | } | 61 | } |
33 | } | 62 | } |