private static void Load(string directoryPath)
{
if (!Directory.Exists(directoryPath)) return;
_dic.Clear();
foreach (string path in Directory.GetFiles(directoryPath, "*", SearchOption.AllDirectories))
{
var dic = new Dictionary<string, string>();
using (XmlTextReader xml = new XmlTextReader(path))
{
try
{
while (xml.Read())
{
if (xml.NodeType == XmlNodeType.Element)
{
if (xml.LocalName == "Translate")
{
dic.Add(xml.GetAttribute("Key"), xml.GetAttribute("Value"));
}
}
}
}
catch (XmlException)
{
}
}
_dic[Path.GetFileNameWithoutExtension(path)] = dic;
}
if (CultureInfo.CurrentUICulture.Name == "ja-JP" && _dic.Keys.Any(n => n == "Japanese"))
{
_currentLanguage = "Japanese";
}
else if (_dic.Keys.Any(n => n == "English"))
{
_currentLanguage = "English";
}
}