aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Identifier.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Data/Identifier.cs')
-rw-r--r--src/WixToolset.Data/Identifier.cs27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/WixToolset.Data/Identifier.cs b/src/WixToolset.Data/Identifier.cs
index 38b12989..84c80081 100644
--- a/src/WixToolset.Data/Identifier.cs
+++ b/src/WixToolset.Data/Identifier.cs
@@ -4,9 +4,10 @@ namespace WixToolset.Data
4{ 4{
5 using System; 5 using System;
6 using System.Diagnostics; 6 using System.Diagnostics;
7 using SimpleJson;
7 8
8 /// <summary> 9 /// <summary>
9 /// Class to define the identifier and access for a row. 10 /// Class to define the identifier and access for a tuple.
10 /// </summary> 11 /// </summary>
11 [DebuggerDisplay("{Access} {Id,nq}")] 12 [DebuggerDisplay("{Access} {Id,nq}")]
12 public class Identifier 13 public class Identifier
@@ -26,13 +27,33 @@ namespace WixToolset.Data
26 } 27 }
27 28
28 /// <summary> 29 /// <summary>
29 /// Access modifier for a row. 30 /// Access modifier for a tuple.
30 /// </summary> 31 /// </summary>
31 public AccessModifier Access { get; } 32 public AccessModifier Access { get; }
32 33
33 /// <summary> 34 /// <summary>
34 /// Identifier for the row. 35 /// Identifier for the tuple.
35 /// </summary> 36 /// </summary>
36 public string Id { get; } 37 public string Id { get; }
38
39 internal static Identifier Deserialize(JsonObject jsonObject)
40 {
41 var id = jsonObject.GetValueOrDefault<string>("id");
42 var accessValue = jsonObject.GetValueOrDefault<string>("access");
43 Enum.TryParse(accessValue, true, out AccessModifier access);
44
45 return new Identifier(id, access);
46 }
47
48 internal JsonObject Serialize()
49 {
50 var jsonObject = new JsonObject
51 {
52 { "id", this.Id },
53 { "access", this.Access.ToString().ToLowerInvariant() }
54 };
55
56 return jsonObject;
57 }
37 } 58 }
38} 59}