From 28fa6e31b091b7255f28fc4cdc5a32b4f7eef1a7 Mon Sep 17 00:00:00 2001 From: Aragas Date: Wed, 29 Jun 2022 00:17:21 +0300 Subject: [PATCH] fix --- .../Utils/LocalizedTextManagerUtils.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs b/src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs index dee3054..30b12ba 100644 --- a/src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs +++ b/src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs @@ -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); } } }