aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-29 00:44:42 -0800
committerRob Mensching <rob@firegiant.com>2017-12-29 00:44:42 -0800
commit77ec8bfc6df897000619abaa6c9068942a3775c2 (patch)
treefda226c139686b9be47d381c4bfb7bf78939ad1f
parentd62e43fcb9bbfe2f1dc7de654b606eea9e659547 (diff)
downloadwix-77ec8bfc6df897000619abaa6c9068942a3775c2.tar.gz
wix-77ec8bfc6df897000619abaa6c9068942a3775c2.tar.bz2
wix-77ec8bfc6df897000619abaa6c9068942a3775c2.zip
Improve Identifier constructor
-rw-r--r--src/WixToolset.Data/Identifier.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/WixToolset.Data/Identifier.cs b/src/WixToolset.Data/Identifier.cs
index 84c80081..ffb04cd7 100644
--- a/src/WixToolset.Data/Identifier.cs
+++ b/src/WixToolset.Data/Identifier.cs
@@ -12,20 +12,40 @@ namespace WixToolset.Data
12 [DebuggerDisplay("{Access} {Id,nq}")] 12 [DebuggerDisplay("{Access} {Id,nq}")]
13 public class Identifier 13 public class Identifier
14 { 14 {
15 public static Identifier Invalid = new Identifier(null, AccessModifier.Private); 15 public static Identifier Invalid = new Identifier(AccessModifier.Private, (string)null);
16 16
17 // TODO: [Obsolete] this constructor.
17 public Identifier(string id, AccessModifier access) 18 public Identifier(string id, AccessModifier access)
18 { 19 {
19 this.Id = id; 20 this.Id = id;
20 this.Access = access; 21 this.Access = access;
21 } 22 }
22 23
24 // TODO: [Obsolete] this constructor.
23 public Identifier(int id, AccessModifier access) 25 public Identifier(int id, AccessModifier access)
24 { 26 {
25 this.Id = id.ToString(); 27 this.Id = id.ToString();
26 this.Access = access; 28 this.Access = access;
27 } 29 }
28 30
31 public Identifier(AccessModifier access, string id)
32 {
33 this.Access = access;
34 this.Id = id;
35 }
36
37 public Identifier(AccessModifier access, params string[] ids)
38 {
39 this.Access = access;
40 this.Id = String.Join("/", ids);
41 }
42
43 public Identifier(AccessModifier access, int id)
44 {
45 this.Access = access;
46 this.Id = id.ToString();
47 }
48
29 /// <summary> 49 /// <summary>
30 /// Access modifier for a tuple. 50 /// Access modifier for a tuple.
31 /// </summary> 51 /// </summary>
@@ -42,7 +62,7 @@ namespace WixToolset.Data
42 var accessValue = jsonObject.GetValueOrDefault<string>("access"); 62 var accessValue = jsonObject.GetValueOrDefault<string>("access");
43 Enum.TryParse(accessValue, true, out AccessModifier access); 63 Enum.TryParse(accessValue, true, out AccessModifier access);
44 64
45 return new Identifier(id, access); 65 return new Identifier(access, id);
46 } 66 }
47 67
48 internal JsonObject Serialize() 68 internal JsonObject Serialize()