Minor fix

This commit is contained in:
yangzhi 2023-07-11 08:06:06 +08:00
parent fc6dc349da
commit a5a10e60cb
2 changed files with 4 additions and 2 deletions

View File

@ -201,9 +201,9 @@ namespace StardewModdingAPI.Patches
newInsns.Add(insn); newInsns.Add(insn);
Label continueLabel = gen.DefineLabel(); Label continueLabel = gen.DefineLabel();
Label retLabel = gen.DefineLabel(); Label retLabel = gen.DefineLabel();
newInsns.Add(new CodeInstruction(OpCodes.Ldarg_0)); newInsns.Add(new CodeInstruction(OpCodes.Ldarg_1));
newInsns.Add(new CodeInstruction(OpCodes.Brfalse_S, retLabel)); newInsns.Add(new CodeInstruction(OpCodes.Brfalse_S, retLabel));
newInsns.Add(new CodeInstruction(OpCodes.Ldarg_0)); newInsns.Add(new CodeInstruction(OpCodes.Ldarg_1));
newInsns.Add(new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(string), nameof(string.Length)))); newInsns.Add(new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(string), nameof(string.Length))));
newInsns.Add(new CodeInstruction(OpCodes.Ldc_I4_0)); newInsns.Add(new CodeInstruction(OpCodes.Ldc_I4_0));
newInsns.Add(new CodeInstruction(OpCodes.Cgt)); newInsns.Add(new CodeInstruction(OpCodes.Cgt));

View File

@ -56,6 +56,8 @@ namespace StardewModdingAPI.Utilities
// parse buttons // parse buttons
#if SMAPI_FOR_MOBILE #if SMAPI_FOR_MOBILE
string[] rawButtons = input.Split('+', StringSplitOptions.RemoveEmptyEntries); string[] rawButtons = input.Split('+', StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < rawButtons.Length; i++)
rawButtons[i] = rawButtons[i].Trim();
#else #else
string[] rawButtons = input.Split('+', StringSplitOptions.TrimEntries); string[] rawButtons = input.Split('+', StringSplitOptions.TrimEntries);
#endif #endif