From 2446150121e86202ebcfbb1fb48366e1fb2f99f2 Mon Sep 17 00:00:00 2001 From: ZaneYork Date: Sat, 11 Apr 2020 20:23:00 +0800 Subject: [PATCH] Change patch mode to make it available for other platform --- ...zation.csproj => CustomLocalization.csproj | 17 +--- ModEntry.cs | 95 ++++++++++++++++--- Rewrites/LanguageSelectionMobileRewrites.cs | 68 ++++++------- Rewrites/LocalizedContentManagerRewrites.cs | 6 -- Rewrites/SpriteTextRewrites.cs | 6 -- Rewrites/StartupPreferencesRewrites.cs | 9 -- Rewrites/TitleContainerRewrites.cs | 16 ++-- SMAPI.Mods.CustomLocalization.sln | 8 +- manifest.json | 2 +- 9 files changed, 130 insertions(+), 97 deletions(-) rename SMAPI.Mods.CustomLocalization.csproj => CustomLocalization.csproj (57%) diff --git a/SMAPI.Mods.CustomLocalization.csproj b/CustomLocalization.csproj similarity index 57% rename from SMAPI.Mods.CustomLocalization.csproj rename to CustomLocalization.csproj index b421036..4a88e39 100644 --- a/SMAPI.Mods.CustomLocalization.csproj +++ b/CustomLocalization.csproj @@ -12,19 +12,7 @@ - ..\libs\0Harmony.dll - - - ..\libs\Mono.Android.dll - - - ..\libs\\MonoGame.Framework.dll - - - ..\libs\StardewModdingAPI.dll - - - ..\libs\\StardewValley.dll + ..\..\libs\0Harmony.dll @@ -33,4 +21,7 @@ PreserveNewest + + + diff --git a/ModEntry.cs b/ModEntry.cs index 8e93c71..2756a7b 100644 --- a/ModEntry.cs +++ b/ModEntry.cs @@ -1,13 +1,13 @@ +using System; using System.Collections.Generic; -using System.Reflection; -using Android.OS; using Harmony; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; +using StardewModdingAPI.Mods.CustomLocalization.Rewrites; using StardewValley; using StardewValley.BellsAndWhistles; using StardewValley.Menus; -using StardewValley.Mobile; using StardewValley.Objects; using StardewValley.Projectiles; @@ -21,6 +21,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization public static string ModPath; + public static IReflectionHelper Reflection; + private static ModEntry Instance; public static void SaveConfig() @@ -30,14 +32,12 @@ namespace StardewModdingAPI.Mods.CustomLocalization public override void Entry(IModHelper helper) { - if (Build.VERSION.SdkInt < BuildVersionCodes.M) - return; Instance = this; ModConfig = helper.ReadConfig(); ModPath = helper.DirectoryPath; monitor = this.Monitor; - HarmonyInstance harmony = HarmonyInstance.Create("zaneyork.CustomLocalization"); - harmony.PatchAll(Assembly.GetExecutingAssembly()); + Reflection = helper.Reflection; + DoPatch(); Dictionary dictionary = this.Helper.Reflection.GetField>(Game1.content, "_localizedAsset").GetValue(); Dictionary dictionaryAssets = this.Helper.Reflection.GetField>(Game1.content, "loadedAssets").GetValue(); @@ -58,6 +58,66 @@ namespace StardewModdingAPI.Mods.CustomLocalization } } + private static void DoPatch() + { + HarmonyInstance harmony = HarmonyInstance.Create("zaneyork.CustomLocalization"); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(TitleContainer), "OpenStream"), + prefix: new HarmonyMethod(typeof(TitleContainerRewrites.OpenStreamRewrite), nameof(TitleContainerRewrites.OpenStreamRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(StartupPreferences), "readSettings"), + postfix: new HarmonyMethod(typeof(StartupPreferencesRewrites.ReadSettingsRewrite), nameof(StartupPreferencesRewrites.ReadSettingsRewrite.Postfix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(StartupPreferences), "writeSettings"), + prefix: new HarmonyMethod(typeof(StartupPreferencesRewrites.WriteSettingsRewrite), nameof(StartupPreferencesRewrites.WriteSettingsRewrite.Prefix)), + postfix: new HarmonyMethod(typeof(StartupPreferencesRewrites.WriteSettingsRewrite), nameof(StartupPreferencesRewrites.WriteSettingsRewrite.Postfix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(StartupPreferences), "writeSettings"), + prefix: new HarmonyMethod(typeof(StartupPreferencesRewrites.WriteSettingsRewrite), nameof(StartupPreferencesRewrites.WriteSettingsRewrite.Prefix)), + postfix: new HarmonyMethod(typeof(StartupPreferencesRewrites.WriteSettingsRewrite), nameof(StartupPreferencesRewrites.WriteSettingsRewrite.Postfix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(SpriteText), "OnLanguageChange"), + prefix: new HarmonyMethod(typeof(SpriteTextRewrites.OnLanguageChangeRewrite), nameof(SpriteTextRewrites.OnLanguageChangeRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(SpriteText), "setUpCharacterMap"), + prefix: new HarmonyMethod(typeof(SpriteTextRewrites.SetUpCharacterMapRewrite), nameof(SpriteTextRewrites.SetUpCharacterMapRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(typeof(LocalizedContentManager), "LanguageCodeString"), + prefix: new HarmonyMethod(typeof(LocalizedContentManagerRewrites.LanguageCodeStringRewrite), nameof(LocalizedContentManagerRewrites.LanguageCodeStringRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredProperty(typeof(LocalizedContentManager), "CurrentLanguageLatin").GetMethod, + prefix: new HarmonyMethod(typeof(LocalizedContentManagerRewrites.GetCurrentLanguageLatinRewrite), nameof(LocalizedContentManagerRewrites.GetCurrentLanguageLatinRewrite.Prefix)) + ); + + Type mobileMenuType = AccessTools.TypeByName("StardewValley.Menus.LanguageSelectionMobile"); + if (mobileMenuType != null) + { + harmony.Patch( + original: AccessTools.DeclaredMethod(mobileMenuType, "draw", new Type[] { typeof(SpriteBatch) }), + prefix: new HarmonyMethod(typeof(LanguageSelectionMobileRewrites.DrawRewrite), nameof(LanguageSelectionMobileRewrites.DrawRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(mobileMenuType, "releaseLeftClick"), + prefix: new HarmonyMethod(typeof(LanguageSelectionMobileRewrites.ReleaseLeftClickRewrite), nameof(LanguageSelectionMobileRewrites.ReleaseLeftClickRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(mobileMenuType, "setCurrentItemIndex"), + prefix: new HarmonyMethod(typeof(LanguageSelectionMobileRewrites.SetCurrentItemIndexRewrite), nameof(LanguageSelectionMobileRewrites.SetCurrentItemIndexRewrite.Prefix)) + ); + harmony.Patch( + original: AccessTools.DeclaredMethod(mobileMenuType, "SetupButtons"), + transpiler: new HarmonyMethod(typeof(LanguageSelectionMobileRewrites.SetupButtonsRewrite), nameof(LanguageSelectionMobileRewrites.SetupButtonsRewrite.Transpiler)) + ); + } + } + private void LoadContent() { Game1.concessionsSpriteSheet = ((ContentManager)Game1.content).Load("LooseSprites\\Concessions"); @@ -77,17 +137,26 @@ namespace StardewModdingAPI.Mods.CustomLocalization Game1.giftboxTexture = ((ContentManager)Game1.content).Load("LooseSprites\\Giftbox"); Game1.controllerMaps = ((ContentManager)Game1.content).Load("LooseSprites\\ControllerMaps"); Game1.animations = ((ContentManager)Game1.content).Load("TileSheets\\animations"); - Game1.mobileSpriteSheet = ((ContentManager)Game1.content).Load("LooseSprites\\MobileAtlas_manually_made"); + Reflection.GetField(typeof(Game1), "mobileSpriteSheet", false)?.SetValue(((ContentManager)Game1.content).Load("LooseSprites\\MobileAtlas_manually_made")); Game1.achievements = (Dictionary)((ContentManager)Game1.content).Load>("Data\\Achievements"); Game1.NPCGiftTastes = (IDictionary)((ContentManager)Game1.content).Load>("Data\\NPCGiftTastes"); Game1.onScreenMenus.Clear(); - this.Helper.Reflection.GetMethod(Game1.game1, "TranslateFields").Invoke(); + Reflection.GetMethod(Game1.game1, "TranslateFields").Invoke(); Game1.dayTimeMoneyBox = new DayTimeMoneyBox(); - Game1.dayTimeMoneyBox.game1 = Game1.game1; + Reflection.GetField(Game1.dayTimeMoneyBox, "game1", false)?.SetValue(Game1.game1); Game1.onScreenMenus.Add((IClickableMenu)Game1.dayTimeMoneyBox); - Game1.toolbar = new Toolbar(); - Game1.virtualJoypad = new VirtualJoypad(); - Game1.onScreenMenus.Add((IClickableMenu)Game1.toolbar); + IReflectedField fieldToolBar = Helper.Reflection.GetField(typeof(Game1), "toolbar", false); + fieldToolBar?.SetValue(new Toolbar()); + Type typeVirtualJoypad = AccessTools.TypeByName("StardewValley.Mobile.VirtualJoypad"); + if(typeVirtualJoypad != null) + { + object virtualJoypad = AccessTools.CreateInstance(typeVirtualJoypad); + Reflection.GetField(typeof(Game1), "virtualJoypad", false)?.SetValue(virtualJoypad); + } + if (fieldToolBar != null) + { + Game1.onScreenMenus.Add(fieldToolBar.GetValue()); + } Game1.buffsDisplay = new BuffsDisplay(); Game1.onScreenMenus.Add((IClickableMenu)Game1.buffsDisplay); Game1.dialogueFont = (SpriteFont)((ContentManager)Game1.content).Load("Fonts\\SpriteFont1"); diff --git a/Rewrites/LanguageSelectionMobileRewrites.cs b/Rewrites/LanguageSelectionMobileRewrites.cs index aaab117..5a4a4a2 100644 --- a/Rewrites/LanguageSelectionMobileRewrites.cs +++ b/Rewrites/LanguageSelectionMobileRewrites.cs @@ -14,11 +14,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites { public class LanguageSelectionMobileRewrites { - [HarmonyPatch(typeof(LanguageSelectionMobile))] - [HarmonyPatch("SetupButtons")] public class SetupButtonsRewrite { - [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { var codes = new List(instructions); @@ -39,43 +36,40 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites return codes.AsEnumerable(); } } - [HarmonyPatch(typeof(LanguageSelectionMobile))] - [HarmonyPatch("setCurrentItemIndex")] public class SetCurrentItemIndexRewrite { - [HarmonyPrefix] - public static void Prefix(LanguageSelectionMobile __instance) + public static void Prefix(object __instance) { - Rectangle mainBox = (Rectangle)__instance.GetType().GetField("mainBox", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); - int buttonHeight = (int)__instance.GetType().GetField("buttonHeight", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); - for(short i = 0; i < ModEntry.ModConfig.locales.Length; i++) + Rectangle mainBox = ModEntry.Reflection.GetField(__instance, "mainBox").GetValue(); + int buttonHeight = ModEntry.Reflection.GetField(__instance, "buttonHeight").GetValue(); + int buttonWidth = ModEntry.Reflection.GetField(__instance, "buttonWidth").GetValue(); + for (short i = 0; i < ModEntry.ModConfig.locales.Length; i++) { ModConfig.Locale locale = ModEntry.ModConfig.locales[i]; - __instance.languages.Add(new ClickableComponent( - new Rectangle(mainBox.X + 0x10, (mainBox.Y + 0x10) + (buttonHeight * ModEntry.ModConfig.OriginLocaleCount + i), __instance.buttonWidth, buttonHeight), + List languages = ModEntry.Reflection.GetField>(__instance, "languages").GetValue(); + languages.Add(new ClickableComponent( + new Rectangle(mainBox.X + 0x10, (mainBox.Y + 0x10) + (buttonHeight * ModEntry.ModConfig.OriginLocaleCount + i), buttonWidth, buttonHeight), locale.Name, null)); if ((int)(CurrentLanguageCode) == locale.CodeEnum) { - __instance.GetType().GetField("languageCodeName", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(__instance, locale.Name); + ModEntry.Reflection.GetField(__instance, "languageCodeName").SetValue(locale.Name); } } } } - [HarmonyPatch(typeof(LanguageSelectionMobile))] - [HarmonyPatch("releaseLeftClick")] public class ReleaseLeftClickRewrite { - [HarmonyPrefix] - public static bool Prefix(LanguageSelectionMobile __instance, int x, int y) + public static bool Prefix(object __instance, int x, int y) { - MobileScrollbox scrollArea = (MobileScrollbox)__instance.GetType().GetField("scrollArea", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); - if (scrollArea == null || !scrollArea.havePanelScrolled) + object scrollArea = ModEntry.Reflection.GetField(__instance, "scrollArea").GetValue(); + if (scrollArea == null || !ModEntry.Reflection.GetField(scrollArea, "havePanelScrolled").GetValue()) { - foreach (ClickableComponent language in __instance.languages) + List languages = ModEntry.Reflection.GetField>(__instance, "languages").GetValue(); + foreach (ClickableComponent language in languages) { if (language.containsPoint(x, y)) { - __instance.GetType().GetField("languageChosen", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(__instance, true); + ModEntry.Reflection.GetField(__instance, "languageChosen").SetValue(true); Game1.playSound("select"); switch (language.name) { @@ -125,25 +119,23 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites } break; } - __instance.exitThisMenu(true); + ModEntry.Reflection.GetMethod(__instance, "exitThisMenu").Invoke(true); } } } if (scrollArea == null) return false; - scrollArea.releaseLeftClick(x, y); + ModEntry.Reflection.GetMethod(scrollArea, "releaseLeftClick").Invoke(x, y); return false; } } - [HarmonyPatch(typeof(LanguageSelectionMobile))] - [HarmonyPatch("draw")] - [HarmonyPatch(new Type[] { typeof(SpriteBatch) })] public class DrawRewrite { - [HarmonyPrefix] - public static bool Prefix(LanguageSelectionMobile __instance, SpriteBatch b) + public static bool Prefix(object __instance, SpriteBatch b) { - Utility.getTopLeftPositionForCenteringOnScreen(__instance.width, __instance.height - 100, 0, 0); + int width = ModEntry.Reflection.GetField(__instance, "width").GetValue(); + int height = ModEntry.Reflection.GetField(__instance, "height").GetValue(); + Utility.getTopLeftPositionForCenteringOnScreen(width, height - 100, 0, 0); SpriteBatch spriteBatch = b; Texture2D fadeToBlackRect = Game1.fadeToBlackRect; Viewport viewport = Game1.graphics.GraphicsDevice.Viewport; @@ -152,14 +144,15 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites spriteBatch.Draw(fadeToBlackRect, bounds, color); Rectangle mainBox = (Rectangle)__instance.GetType().GetField("mainBox", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); IClickableMenu.drawTextureBox(b, (int)mainBox.X, (int)mainBox.Y, (int)mainBox.Width, (int)mainBox.Height, Color.White); - MobileScrollbox scrollArea = (MobileScrollbox)__instance.GetType().GetField("scrollArea", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); + object scrollArea = ModEntry.Reflection.GetField(__instance, "scrollArea").GetValue(); if (scrollArea != null) { - MobileScrollbar newScrollbar = (MobileScrollbar)__instance.GetType().GetField("newScrollbar", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); - newScrollbar.draw(b); - scrollArea.setUpForScrollBoxDrawing(b, 1f); + object newScrollbar = ModEntry.Reflection.GetField(__instance, "newScrollbar").GetValue(); + ModEntry.Reflection.GetMethod(newScrollbar, "draw").Invoke(b); + ModEntry.Reflection.GetMethod(scrollArea, "setUpForScrollBoxDrawing").Invoke(b, 1f); } - foreach (ClickableComponent language in __instance.languages) + List languages = ModEntry.Reflection.GetField>(__instance, "languages").GetValue(); + foreach (ClickableComponent language in languages) { int num1 = -1; switch (language.name) @@ -221,10 +214,11 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites } } if (scrollArea != null) - scrollArea.finishScrollBoxDrawing(b, 1f); - if ((__instance.upperRightCloseButton != null) && __instance.shouldDrawCloseButton()) + ModEntry.Reflection.GetMethod(scrollArea, "finishScrollBoxDrawing").Invoke(b, 1f); + ClickableTextureComponent upperRightCloseButton = ModEntry.Reflection.GetField(__instance, "upperRightCloseButton").GetValue(); + if (upperRightCloseButton != null && ModEntry.Reflection.GetMethod(__instance, "shouldDrawCloseButton").Invoke()) { - __instance.upperRightCloseButton.draw(b); + upperRightCloseButton.draw(b); } return false; } diff --git a/Rewrites/LocalizedContentManagerRewrites.cs b/Rewrites/LocalizedContentManagerRewrites.cs index 367b863..5a3e66c 100644 --- a/Rewrites/LocalizedContentManagerRewrites.cs +++ b/Rewrites/LocalizedContentManagerRewrites.cs @@ -10,11 +10,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites { public class LocalizedContentManagerRewrites { - [HarmonyPatch(typeof(LocalizedContentManager))] - [HarmonyPatch("LanguageCodeString")] public class LanguageCodeStringRewrite { - [HarmonyPrefix] public static bool Prefix(LanguageCode code, ref string __result) { switch (code) @@ -44,11 +41,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites } } } - [HarmonyPatch(typeof(LocalizedContentManager))] - [HarmonyPatch("get_CurrentLanguageLatin")] public class GetCurrentLanguageLatinRewrite { - [HarmonyPrefix] public static bool Prefix(ref bool __result) { ModConfig.Locale locale = ModEntry.ModConfig.GetByCode((int)LocalizedContentManager.CurrentLanguageCode); diff --git a/Rewrites/SpriteTextRewrites.cs b/Rewrites/SpriteTextRewrites.cs index b4dee94..4c7cf7f 100644 --- a/Rewrites/SpriteTextRewrites.cs +++ b/Rewrites/SpriteTextRewrites.cs @@ -32,11 +32,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites SpriteText.fontPixelZoom = locale.FontPixelZoom; } } - [HarmonyPatch(typeof(SpriteText))] - [HarmonyPatch("setUpCharacterMap")] public class SetUpCharacterMapRewrite { - [HarmonyPrefix] public static void Prefix() { if (!LocalizedContentManager.CurrentLanguageLatin) @@ -50,11 +47,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites } - [HarmonyPatch(typeof(SpriteText))] - [HarmonyPatch("OnLanguageChange")] public class OnLanguageChangeRewrite { - [HarmonyPrefix] public static void Prefix() { LoadFont(); diff --git a/Rewrites/StartupPreferencesRewrites.cs b/Rewrites/StartupPreferencesRewrites.cs index b3d66c9..47698e1 100644 --- a/Rewrites/StartupPreferencesRewrites.cs +++ b/Rewrites/StartupPreferencesRewrites.cs @@ -1,17 +1,12 @@ -using System.IO; using System.Reflection; -using Harmony; using StardewValley; namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites { public class StartupPreferencesRewrites { - [HarmonyPatch(typeof(StartupPreferences))] - [HarmonyPatch("writeSettings")] public class WriteSettingsRewrite { - [HarmonyPrefix] public static void Prefix(StartupPreferences __instance) { ModEntry.ModConfig.CurrentLanguageCode = (int)LocalizedContentManager.CurrentLanguageCode; @@ -21,7 +16,6 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites typeof(StartupPreferences).GetField("languageCode", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(__instance, LocalizedContentManager.LanguageCode.en); } } - [HarmonyPostfix] public static void Postfix(StartupPreferences __instance) { if (ModEntry.ModConfig.CurrentLanguageCode > ModEntry.ModConfig.OriginLocaleCount) @@ -30,11 +24,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites } } } - [HarmonyPatch(typeof(StartupPreferences))] - [HarmonyPatch("readSettings")] public class ReadSettingsRewrite { - [HarmonyPostfix] public static void Postfix(StartupPreferences __instance) { if (ModEntry.ModConfig.CurrentLanguageCode > ModEntry.ModConfig.OriginLocaleCount) diff --git a/Rewrites/TitleContainerRewrites.cs b/Rewrites/TitleContainerRewrites.cs index eb5b7dd..9581cf4 100644 --- a/Rewrites/TitleContainerRewrites.cs +++ b/Rewrites/TitleContainerRewrites.cs @@ -8,11 +8,8 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites { public class TitleContainerRewrites { - [HarmonyPatch(typeof(TitleContainer))] - [HarmonyPatch("OpenStream")] public class OpenStreamRewrite { - [HarmonyPrefix] public static bool Prefix(string name, ref Stream __result) { Stream stream = null; @@ -21,7 +18,6 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites return true; } string newPath = Path.Combine(ModEntry.ModPath, name); - string safeName = (string)typeof(TitleContainer).GetMethod("NormalizeRelativePath", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { name }); try { stream = new FileStream(newPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); @@ -35,9 +31,15 @@ namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites { try { - MethodInfo PlatformOpenStream = typeof(TitleContainer).GetMethod("PlatformOpenStream", BindingFlags.Static | BindingFlags.NonPublic); - stream = (Stream)PlatformOpenStream.Invoke(null, new object[] { safeName }); - __result = stream; + string safeName = ModEntry.Reflection.GetMethod(typeof(TitleContainer), "NormalizeRelativePath", false)?.Invoke(name); + if(safeName != null) + __result = ModEntry.Reflection.GetMethod(typeof(TitleContainer), "PlatformOpenStream", false)?.Invoke(safeName); + else + __result = ModEntry.Reflection.GetMethod(typeof(TitleContainer), "PlatformOpenStream", false)?.Invoke(name); + if(__result == null) + { + return true; + } } catch { diff --git a/SMAPI.Mods.CustomLocalization.sln b/SMAPI.Mods.CustomLocalization.sln index d7740d5..9e58796 100644 --- a/SMAPI.Mods.CustomLocalization.sln +++ b/SMAPI.Mods.CustomLocalization.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29728.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Mods.CustomLocalization", "SMAPI.Mods.CustomLocalization.csproj", "{4E035E78-8288-415F-81D2-B4B3C489A005}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomLocalization", "CustomLocalization.csproj", "{4E035E78-8288-415F-81D2-B4B3C489A005}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,8 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4E035E78-8288-415F-81D2-B4B3C489A005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4E035E78-8288-415F-81D2-B4B3C489A005}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4E035E78-8288-415F-81D2-B4B3C489A005}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4E035E78-8288-415F-81D2-B4B3C489A005}.Release|Any CPU.Build.0 = Release|Any CPU + {4E035E78-8288-415F-81D2-B4B3C489A005}.Debug|Any CPU.ActiveCfg = Debug|x86 + {4E035E78-8288-415F-81D2-B4B3C489A005}.Release|Any CPU.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/manifest.json b/manifest.json index b8ba392..797aa98 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "Name": "Custom Localization", "Author": "ZaneYork", - "Version": "1.0.3", + "Version": "1.1.0", "Description": "Localization for not exist locale.", "UniqueID": "ZaneYork.CustomLocalization", "EntryDll": "CustomLocalization.dll",