diff --git a/FModel/FModel_Main.xaml.cs b/FModel/FModel_Main.xaml.cs index 8f15354c..dd3963ff 100644 --- a/FModel/FModel_Main.xaml.cs +++ b/FModel/FModel_Main.xaml.cs @@ -36,7 +36,7 @@ namespace FModel DebugHelper.WriteLine("AutoUpdater: Checking for updates"); AutoUpdater.CheckForUpdateEvent += UIHelper.AutoUpdaterOnCheckForUpdateEvent; - AutoUpdater.Start("https://dl.dropbox.com/s/3kv2pukqu6tj1r0/FModel.xml?dl=0"); + AutoUpdater.Start("https://cdn.asval.tk/d/FModel/FModel.xml"); DebugHelper.WriteUserSettings(); diff --git a/FModel/Methods/Assets/AssetTranslations.cs b/FModel/Methods/Assets/AssetTranslations.cs index ac60a0e2..5b3e8469 100644 --- a/FModel/Methods/Assets/AssetTranslations.cs +++ b/FModel/Methods/Assets/AssetTranslations.cs @@ -159,42 +159,31 @@ namespace FModel.Methods.Assets foreach (string line in lines) { - if (line.StartsWith("+TextReplacements=(Category=Game,")) - { - string txtNamespace = GetValueFromParam(line, "Namespace=\"", "\","); - string txtKey = GetValueFromParam(line, "Key=\"", "\","); - string txtNativeString = GetValueFromParam(line, "NativeString=\"", "\","); - - string translations = GetValueFromParam(line, "LocalizedStrings=(", "))"); - if (!translations.EndsWith(")")) { translations = translations + ")"; } - - if (!HotfixLocResDict.ContainsKey(txtNamespace)) - HotfixLocResDict[txtNamespace] = new Dictionary>>(); - - if (!HotfixLocResDict[txtNamespace].ContainsKey(txtKey)) - HotfixLocResDict[txtNamespace][txtKey] = new Dictionary>(); - - if (!HotfixLocResDict[txtNamespace][txtKey].ContainsKey(txtNativeString)) - HotfixLocResDict[txtNamespace][txtKey][txtNativeString] = new Dictionary(); - - Regex regex = new Regex(@"(?<=\().+?(?=\))"); - foreach (Match match in regex.Matches(translations)) - { - try - { - string[] langParts = match.Value.Substring(1, match.Value.Length - 2).Split(new string[] { "\",\"" }, StringSplitOptions.None); - HotfixLocResDict[txtNamespace][txtKey][txtNativeString][langParts[0]] = langParts[1]; - } - catch (IndexOutOfRangeException) - { - string[] langParts = match.Value.Substring(1, match.Value.Length - 2).Split(new string[] { "\", \"" }, StringSplitOptions.None); - HotfixLocResDict[txtNamespace][txtKey][txtNativeString][langParts[0]] = langParts[1]; - } - } - } + HFedStringsProcess(line); } DebugHelper.WriteLine(".PAKs: Populated hotfixed string dictionary"); } + else + { + DebugHelper.WriteLine(".PAKs: Hotfixed strings endpoint returned nothing!!! this isn't normal"); + string pdd = Path.GetFullPath(Path.Combine(FProp.Default.FPak_Path, @"..\..\PersistentDownloadDir\EMS\")); + if (File.Exists(pdd + "a22d837b6a2b46349421259c0a5411bf")) + { + DebugHelper.WriteLine(".PAKs: Populating hotfixed string dictionary at " + pdd + "a22d837b6a2b46349421259c0a5411bf"); + HotfixLocResDict = new Dictionary>>>(); + using (StreamReader sr = new StreamReader(File.Open(pdd + "a22d837b6a2b46349421259c0a5411bf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) + { + while (!sr.EndOfStream) + { + string line = sr.ReadLine(); + HFedStringsProcess(line); + } + } + DebugHelper.WriteLine(".PAKs: Populated hotfixed string dictionary"); + } + else + DebugHelper.WriteLine(".PAKs: No such file or directory " + pdd + "a22d837b6a2b46349421259c0a5411bf"); + } } } @@ -205,6 +194,43 @@ namespace FModel.Methods.Assets return fullLine.Substring(startIndex, endIndex); } + private static void HFedStringsProcess(string line) + { + if (line.StartsWith("+TextReplacements=(Category=Game,")) + { + string txtNamespace = GetValueFromParam(line, "Namespace=\"", "\","); + string txtKey = GetValueFromParam(line, "Key=\"", "\","); + string txtNativeString = GetValueFromParam(line, "NativeString=\"", "\","); + + string translations = GetValueFromParam(line, "LocalizedStrings=(", "))"); + if (!translations.EndsWith(")")) { translations = translations + ")"; } + + if (!HotfixLocResDict.ContainsKey(txtNamespace)) + HotfixLocResDict[txtNamespace] = new Dictionary>>(); + + if (!HotfixLocResDict[txtNamespace].ContainsKey(txtKey)) + HotfixLocResDict[txtNamespace][txtKey] = new Dictionary>(); + + if (!HotfixLocResDict[txtNamespace][txtKey].ContainsKey(txtNativeString)) + HotfixLocResDict[txtNamespace][txtKey][txtNativeString] = new Dictionary(); + + Regex regex = new Regex(@"(?<=\().+?(?=\))"); + foreach (Match match in regex.Matches(translations)) + { + try + { + string[] langParts = match.Value.Substring(1, match.Value.Length - 2).Split(new string[] { "\",\"" }, StringSplitOptions.None); + HotfixLocResDict[txtNamespace][txtKey][txtNativeString][langParts[0]] = langParts[1]; + } + catch (IndexOutOfRangeException) + { + string[] langParts = match.Value.Substring(1, match.Value.Length - 2).Split(new string[] { "\", \"" }, StringSplitOptions.None); + HotfixLocResDict[txtNamespace][txtKey][txtNativeString][langParts[0]] = langParts[1]; + } + } + } + } + private static string GetLanguageCode() { switch (FProp.Default.FLanguage) diff --git a/FModel/Methods/Utilities/EndpointsUtility.cs b/FModel/Methods/Utilities/EndpointsUtility.cs index f7c02779..3e160da7 100644 --- a/FModel/Methods/Utilities/EndpointsUtility.cs +++ b/FModel/Methods/Utilities/EndpointsUtility.cs @@ -9,7 +9,7 @@ namespace FModel.Methods.Utilities { static class EndpointsUtility { - private const string DROPBOX_JSON = "https://dl.dropbox.com/s/0ykcue03qweb98r/FModel.json?dl=0"; + private const string DROPBOX_JSON = "https://cdn.asval.tk/d/FModel/FModel.json"; private const string BENBOT_AES = "http://benbotfn.tk:8080/api/aes"; public static string GetEndpoint(string url)