/*using System; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using HarmonyLib; namespace CLre.Fixes { [Bugfix(name = "AntiStupidFloats", description = "Force language-agnostic float->string behaviour internally, like all programs should (DISABLED BY DEFAULT)", component = BugfixType.Initialiser, id = 10)] public static class FloatLanguageFix { public static bool Enabled { private set; get; } = false; public static void Init() { string[] args = Environment.GetCommandLineArgs(); if (args.Contains("-ff", StringComparer.InvariantCultureIgnoreCase) || args.Contains("--float-fix", StringComparer.InvariantCultureIgnoreCase) || File.Exists("floatFix.txt") || File.Exists("whateverFloatsYourBoat")) { Enabled = true; API.Utility.Logging.LogWarning("AntiStupidFloats fix enabled, this may cause issues"); API.Utility.Logging.MetaLog(args.ToString()); } else { CultureInfo ci = CultureInfo.CurrentUICulture; if (ci.TwoLetterISOLanguageName.ToLower() != "en") { API.Utility.Logging.LogWarning( $"CLre detected non-English language {ci.DisplayName} ({ci.Name}/{ci.TwoLetterISOLanguageName}). " + "CardLife works best with the Windows language set to English. " + "If you run into bugs, try launching CardLife with the launch options set to \"%command% --float-fix\", without quotes. " + "Please also report the issue to NGnius (ngniusness@gmail.com or NGnius#0864 on the CL Discord server) or on Trello (https://trello.com/b/EGKEpfBF/cardlife-bugs), so the problem can be fixed properly."); } } } } [Bugfix(name = "AntiStupidFloats", description = "Force language-agnostic float->string behaviour internally, like all programs should (DISABLED BY DEFAULT)", component = BugfixType.HarmonyPatch, id = 10)] [HarmonyPatch] class Float_ToString0_Patch { [HarmonyPostfix] // prefix causes a crash for some reason... public static void AfterMethodCall(ref float __instance, ref string __result) { #if DEBUG API.Utility.Logging.MetaLog("Float_ToString0_Patch"); #endif if (!FloatLanguageFix.Enabled) return; API.Utility.Logging.LogWarning($"Intercepting float.ToString() to InvariantCulture equivalent\nStackTrace: {Environment.StackTrace}"); __result = __instance.ToString(CultureInfo.InvariantCulture); } [HarmonyTargetMethod] public static MethodBase Target() { return AccessTools.Method(typeof(float), "ToString"); } } [Bugfix(name = "AntiStupidFloats", description = "Force language-agnostic float->string behaviour internally, like all programs should (DISABLED BY DEFAULT)", component = BugfixType.HarmonyPatch, id = 10)] [HarmonyPatch] class Float_ToString1_Patch { [HarmonyPostfix] public static void AfterMethodCall(ref string format, ref float __instance, ref string __result) { #if DEBUG API.Utility.Logging.MetaLog("Float_ToString1_Patch"); #endif if (!FloatLanguageFix.Enabled) return; API.Utility.Logging.LogWarning($"Intercepting float.ToString(\"{format}\") to InvariantCulture equivalent\nStackTrace: {Environment.StackTrace}"); __result = __instance.ToString(format, CultureInfo.InvariantCulture); } [HarmonyTargetMethod] public static MethodBase Target() { return AccessTools.Method(typeof(float), "ToString", new[] {typeof(string)}); } } }*/