|
- using System;
- using System.Globalization;
- using System.Reflection;
- using HarmonyLib;
-
- namespace CLre.Fixes
- {
- public class EnchantmentTableFloatParseFix
- {
-
- }
-
- [HarmonyPatch]
- class Float_TryParse_Patch
- {
- [HarmonyPostfix]
- public static void BeforeMethodCall(string s, ref float result, ref bool __result)
- {
- if (__result) return;
- __result = float.TryParse(s,
- NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign |
- NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowExponent,
- NumberFormatInfo.InvariantInfo, out result);
- }
-
- [HarmonyTargetMethod]
- public static MethodBase Target()
- {
- return AccessTools.Method(typeof(float), "TryParse", new []{typeof(string), typeof(float).MakeByRefType()});
- }
- }
- }
|