From f55ec69f2125d5cee3e1f861ee60172615954e43 Mon Sep 17 00:00:00 2001 From: CactusPie Date: Sat, 18 Nov 2023 11:17:00 +0100 Subject: [PATCH] Naming and var usage adjustments after merging a pull request --- src/CactusPie.FastSearch/SearchInitialDelayPatch.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CactusPie.FastSearch/SearchInitialDelayPatch.cs b/src/CactusPie.FastSearch/SearchInitialDelayPatch.cs index cffe54c..c4779c2 100644 --- a/src/CactusPie.FastSearch/SearchInitialDelayPatch.cs +++ b/src/CactusPie.FastSearch/SearchInitialDelayPatch.cs @@ -19,21 +19,22 @@ public class SearchInitialDelayPatch : ModulePatch protected override MethodBase GetTargetMethod() { _searchOperationClass = PatchConstants.EftTypes.Single(x => x.GetMethod("GetNextDiscoveryTime", BindingFlags.Static | BindingFlags.Public) != null); + _terminatedField = _searchOperationClass.GetField("Terminated", BindingFlags.Instance | BindingFlags.Public); - var searchOperationFields = _searchOperationClass.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); + FieldInfo[] searchOperationFields = _searchOperationClass.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); _inventoryControllerField = searchOperationFields.Single(x => x.FieldType == typeof(InventoryControllerClass)); _searchableItemField = searchOperationFields.Single(x => x.FieldType == typeof(SearchableItemClass)); return AccessTools.GetDeclaredMethods(_searchOperationClass).FirstOrDefault(IsTargetMethod); } - private static bool IsTargetMethod(MethodInfo mi) + private static bool IsTargetMethod(MethodInfo methodInfo) { - var parameters = mi.GetParameters(); + ParameterInfo[] parameters = methodInfo.GetParameters(); return parameters.Length >= 2 && parameters[0].Name == "callback" && parameters[1].Name == "isInstant" - && mi.ReturnType == typeof(System.Collections.IEnumerator); + && methodInfo.ReturnType == typeof(System.Collections.IEnumerator); } [PatchPrefix]