diff options
Diffstat (limited to '')
-rw-r--r-- | src/WixToolset.Data/LocalizedControl.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/WixToolset.Data/LocalizedControl.cs b/src/WixToolset.Data/LocalizedControl.cs index 979f9fde..cb60b7ba 100644 --- a/src/WixToolset.Data/LocalizedControl.cs +++ b/src/WixToolset.Data/LocalizedControl.cs | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace WixToolset.Data | 3 | namespace WixToolset.Data |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using SimpleJson; | ||
6 | 7 | ||
7 | public class LocalizedControl | 8 | public class LocalizedControl |
8 | { | 9 | { |
@@ -47,5 +48,37 @@ namespace WixToolset.Data | |||
47 | /// <param name="control">The id of the control.</param> | 48 | /// <param name="control">The id of the control.</param> |
48 | /// <returns>The localized control id.</returns> | 49 | /// <returns>The localized control id.</returns> |
49 | public static string GetKey(string dialog, string control) => String.Concat(dialog, "/", control); | 50 | public static string GetKey(string dialog, string control) => String.Concat(dialog, "/", control); |
51 | |||
52 | internal JsonObject Serialize() | ||
53 | { | ||
54 | var jsonObject = new JsonObject | ||
55 | { | ||
56 | { "dialog", this.Dialog }, | ||
57 | }; | ||
58 | |||
59 | jsonObject.AddIsNotNullOrEmpty("control", this.Control); | ||
60 | jsonObject.AddNonDefaultValue("x", this.X, 0); | ||
61 | jsonObject.AddNonDefaultValue("y", this.Y, 0); | ||
62 | jsonObject.AddNonDefaultValue("width", this.Width, 0); | ||
63 | jsonObject.AddNonDefaultValue("height", this.Height, 0); | ||
64 | jsonObject.AddNonDefaultValue("attribs", this.Attributes, 0); | ||
65 | jsonObject.AddIsNotNullOrEmpty("text", this.Text); | ||
66 | |||
67 | return jsonObject; | ||
68 | } | ||
69 | |||
70 | internal static LocalizedControl Deserialize(JsonObject jsonObject) | ||
71 | { | ||
72 | var dialog = jsonObject.GetValueOrDefault<string>("dialog"); | ||
73 | var control = jsonObject.GetValueOrDefault<string>("control"); | ||
74 | var x = jsonObject.GetValueOrDefault("x", 0); | ||
75 | var y = jsonObject.GetValueOrDefault("y", 0); | ||
76 | var width = jsonObject.GetValueOrDefault("width", 0); | ||
77 | var height = jsonObject.GetValueOrDefault("height", 0); | ||
78 | var attribs = jsonObject.GetValueOrDefault("attribs", 0); | ||
79 | var text = jsonObject.GetValueOrDefault<string>("text"); | ||
80 | |||
81 | return new LocalizedControl(dialog, control, x, y, width, height, attribs, text); | ||
82 | } | ||
50 | } | 83 | } |
51 | } | 84 | } |