Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetObject() [3/3]

object System.Resources.RuntimeResourceSet.GetObject ( string key,
bool ignoreCase,
bool isString )
inlineprivate

Definition at line 84 of file RuntimeResourceSet.cs.

85 {
86 if (key == null)
87 {
88 throw new ArgumentNullException("key");
89 }
90 ResourceReader defaultReader = _defaultReader;
92 if (defaultReader == null || resCache == null)
93 {
94 throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
95 }
96 ResourceLocator value;
97 object obj;
99 {
100 int dataPosition;
102 {
103 obj = value.Value;
104 if (obj != null)
105 {
106 return obj;
107 }
108 dataPosition = value.DataPosition;
109 ResourceTypeCode typeCode;
110 return isString ? defaultReader.LoadString(dataPosition) : defaultReader.LoadObject(dataPosition, out typeCode);
111 }
112 dataPosition = defaultReader.FindPosForResource(key);
113 if (dataPosition >= 0)
114 {
116 resCache[key] = value;
117 return obj;
118 }
119 }
120 if (!ignoreCase)
121 {
122 return null;
123 }
124 bool flag = false;
126 if (dictionary == null)
127 {
128 dictionary = new Dictionary<string, ResourceLocator>(StringComparer.OrdinalIgnoreCase);
129 flag = true;
130 }
132 {
133 if (flag)
134 {
135 ResourceReader.ResourceEnumerator enumeratorInternal = defaultReader.GetEnumeratorInternal();
136 while (enumeratorInternal.MoveNext())
137 {
138 string key2 = (string)enumeratorInternal.Key;
139 ResourceLocator value2 = new ResourceLocator(enumeratorInternal.DataPosition, null);
140 dictionary.Add(key2, value2);
141 }
143 }
144 if (!dictionary.TryGetValue(key, out value))
145 {
146 return null;
147 }
148 if (value.Value != null)
149 {
150 return value.Value;
151 }
152 obj = ReadValue(defaultReader, value.DataPosition, isString, out value);
153 if (value.Value != null)
154 {
156 }
157 }
158 return obj;
159 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static object ReadValue(ResourceReader reader, int dataPos, bool isString, out ResourceLocator locator)
Dictionary< string, ResourceLocator > _resCache
Dictionary< string, ResourceLocator > _caseInsensitiveTable

References System.Resources.RuntimeResourceSet._caseInsensitiveTable, System.Resources.RuntimeResourceSet._defaultReader, System.Resources.RuntimeResourceSet._resCache, System.dictionary, System.key, System.obj, System.SR.ObjectDisposed_ResourceSet, System.StringComparer.OrdinalIgnoreCase, System.Resources.RuntimeResourceSet.ReadValue(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.