Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jun 28, 2022
1 parent 272d7d5 commit 28fa6e3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ internal static class LocalizedTextManagerUtils
public static void LoadLanguageData()
{
if (LoadXmlFile is null || LoadFromXml is null) return;

foreach (var moduleInfo in ModuleInfoHelper.GetLoadedModules())

var moduleInfo = ModuleInfoHelper.GetModuleByType(typeof(LocalizedTextManagerUtils));
if (moduleInfo is null) return;

var path = Path.Combine(Utilities.GetBasePath(), "Modules", moduleInfo.Id, "ModuleData", "Languages");
if (!Directory.Exists(path)) return;

foreach (var file in Directory.GetFiles(path, "language_data.xml_", SearchOption.AllDirectories))
{
var path = Path.Combine(Utilities.GetBasePath(), "Modules", moduleInfo.Id, "ModuleData", "Languages");

if (!Directory.Exists(path)) continue;

foreach (var file in Directory.GetFiles(path, "language_data.xml_", SearchOption.AllDirectories))
{
if (LoadXmlFile(file) is { } xmlDocument)
LoadFromXml(xmlDocument, path);
}
if (LoadXmlFile(file) is { } xmlDocument)
LoadFromXml(xmlDocument, path);
}
}
}
Expand Down

0 comments on commit 28fa6e3

Please sign in to comment.