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

◆ GetNameFromCodePage()

static string System.Text.EncodingTable.GetNameFromCodePage ( int codePage,
string names,
int[] indices,
Dictionary< int, string > cache )
inlinestaticprivate

Definition at line 251 of file EncodingTable.cs.

252 {
253 for (int i = 0; i < s_mappedCodePages.Length; i++)
254 {
255 if (s_mappedCodePages[i] != codePage)
256 {
257 continue;
258 }
259 s_cacheLock.EnterUpgradeableReadLock();
260 try
261 {
263 {
264 return value;
265 }
266 value = names.Substring(indices[i], indices[i + 1] - indices[i]);
267 s_cacheLock.EnterWriteLock();
268 try
269 {
271 {
272 return value2;
273 }
275 return value;
276 }
277 finally
278 {
279 s_cacheLock.ExitWriteLock();
280 }
281 }
282 finally
283 {
284 s_cacheLock.ExitUpgradeableReadLock();
285 }
286 }
287 return null;
288 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static readonly ushort[] s_mappedCodePages
static readonly ReaderWriterLockSlim s_cacheLock

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.indices, System.Text.EncodingTable.s_cacheLock, System.Text.EncodingTable.s_mappedCodePages, System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.

Referenced by System.Text.EncodingTable.GetEnglishNameFromCodePage(), and System.Text.EncodingTable.GetWebNameFromCodePage().