Change the concurrent dictionary to a dictionary

It'd be nice to be thread-safe, but I don't really expect multithreaded applications to be calling this method a lot, and I'd imagine the concurrent version has more overhead
This commit is contained in:
Evan Dixon 2017-11-01 21:42:12 -05:00
parent 29ce9a347b
commit 81e87c1a15

View file

@ -13,7 +13,7 @@ namespace PKHeX.Core
private const string TranslationSplitter = " = "; private const string TranslationSplitter = " = ";
private static Assembly thisAssembly = typeof(Util).GetTypeInfo().Assembly; private static Assembly thisAssembly = typeof(Util).GetTypeInfo().Assembly;
private static string[] manifestResourceNames = thisAssembly.GetManifestResourceNames(); private static string[] manifestResourceNames = thisAssembly.GetManifestResourceNames();
private static ConcurrentDictionary<string, string[]> stringListCache = new ConcurrentDictionary<string, string[]>(); private static Dictionary<string, string[]> stringListCache = new Dictionary<string, string[]>();
#region String Lists #region String Lists
@ -86,7 +86,7 @@ namespace PKHeX.Core
string[] rawlist = txt.Split('\n'); string[] rawlist = txt.Split('\n');
for (int i = 0; i < rawlist.Length; i++) for (int i = 0; i < rawlist.Length; i++)
rawlist[i] = rawlist[i].Trim(); rawlist[i] = rawlist[i].Trim();
stringListCache[f] = rawlist; stringListCache.Add(f, rawlist);
return rawlist; return rawlist;
} }
public static string[] GetStringList(string f, string l, string type = "text") => GetStringList($"{type}_{f}_{l}"); public static string[] GetStringList(string f, string l, string type = "text") => GetStringList($"{type}_{f}_{l}");