Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Oid.cs
Go to the documentation of this file.
2
4
5public sealed class Oid
6{
7 private string _value;
8
9 private string _friendlyName;
10
12
13 private readonly OidGroup _group;
14
15 public string? Value
16 {
17 get
18 {
19 return _value;
20 }
21 set
22 {
23 if (_value != null && !_value.Equals(value, StringComparison.Ordinal))
24 {
26 }
27 _value = value;
28 }
29 }
30
31 public string? FriendlyName
32 {
33 get
34 {
35 if (!_hasInitializedFriendlyName && _value != null)
36 {
37 _friendlyName = OidLookup.ToFriendlyName(_value, _group, fallBackToAllGroups: true);
39 }
40 return _friendlyName;
41 }
42 set
43 {
45 {
46 if ((_friendlyName != null && !_friendlyName.Equals(value, StringComparison.Ordinal)) || (_friendlyName == null && value != null))
47 {
49 }
50 return;
51 }
52 if (value != null)
53 {
54 string text = OidLookup.ToOid(value, _group, fallBackToAllGroups: true);
55 if (text != null)
56 {
57 if (_value == null)
58 {
59 _value = text;
60 }
61 else if (!_value.Equals(text, StringComparison.Ordinal))
62 {
64 }
65 }
66 }
69 }
70 }
71
72 public Oid()
73 {
74 }
75
76 public Oid(string oid)
77 {
78 string text = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false);
79 if (text == null)
80 {
81 text = oid;
82 }
83 Value = text;
84 _group = OidGroup.All;
85 }
86
87 public Oid(string? value, string? friendlyName)
88 {
89 _value = value;
90 _friendlyName = friendlyName;
91 _hasInitializedFriendlyName = friendlyName != null;
92 }
93
94 public Oid(Oid oid)
95 {
96 if (oid == null)
97 {
98 throw new ArgumentNullException("oid");
99 }
100 _value = oid._value;
102 _group = oid._group;
104 }
105
106 public static Oid FromFriendlyName(string friendlyName, OidGroup group)
107 {
108 if (friendlyName == null)
109 {
110 throw new ArgumentNullException("friendlyName");
111 }
112 string text = OidLookup.ToOid(friendlyName, group, fallBackToAllGroups: false);
113 if (text == null)
114 {
116 }
117 return new Oid(text, friendlyName, group);
118 }
119
120 public static Oid FromOidValue(string oidValue, OidGroup group)
121 {
122 if (oidValue == null)
123 {
124 throw new ArgumentNullException("oidValue");
125 }
126 string text = OidLookup.ToFriendlyName(oidValue, group, fallBackToAllGroups: false);
127 if (text == null)
128 {
130 }
131 return new Oid(oidValue, text, group);
132 }
133
134 private Oid(string value, string friendlyName, OidGroup group)
135 {
136 _value = value;
137 _friendlyName = friendlyName;
138 _group = group;
140 }
141}
static string ToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups)
Definition OidLookup.cs:39
static string ToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups)
Definition OidLookup.cs:20
static string Cryptography_Oid_SetOnceFriendlyName
Definition SR.cs:20
static string Cryptography_Oid_InvalidName
Definition SR.cs:16
static string Cryptography_Oid_InvalidValue
Definition SR.cs:14
static string Cryptography_Oid_SetOnceValue
Definition SR.cs:18
Definition SR.cs:7
readonly OidGroup _group
Definition Oid.cs:13
Oid(string? value, string? friendlyName)
Definition Oid.cs:87
static Oid FromOidValue(string oidValue, OidGroup group)
Definition Oid.cs:120
Oid(string value, string friendlyName, OidGroup group)
Definition Oid.cs:134
static Oid FromFriendlyName(string friendlyName, OidGroup group)
Definition Oid.cs:106