mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
SearchWithSpacesFix: initial release
This commit is contained in:
parent
379be57b84
commit
d0c8298074
5 changed files with 97 additions and 0 deletions
26
SearchWithSpacesFix/Main.cs
Normal file
26
SearchWithSpacesFix/Main.cs
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue