SearchWithSpacesFix: initial release

This commit is contained in:
NotAKidoS 2024-10-29 23:56:10 -05:00
parent 379be57b84
commit d0c8298074
5 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,26 @@
using System.Reflection;
using ABI_RC.Core.InteractionSystem;
using HarmonyLib;
using MelonLoader;
namespace NAK.SearchWithSpacesFix;
public class SearchWithSpacesFixMod : MelonMod
{
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(ViewManager).GetMethod(nameof(ViewManager.GetSearchResults),
BindingFlags.Public | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(SearchWithSpacesFixMod).GetMethod(nameof(OnPreGetSearchResults),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
// this is so crazy
private static void OnPreGetSearchResults(ref string searchTerm)
=> searchTerm = searchTerm.Replace(" ", "_");
// this is so crazy
}