Fix a typo

This commit is contained in:
Sinai 2022-04-22 22:19:43 +10:00
parent 6a28a93e3a
commit 9b9cb54a79

View File

@ -20,11 +20,11 @@ namespace UnityExplorer.Hooks
{ {
public class HookCreator : ICellPoolDataSource<AddHookCell> public class HookCreator : ICellPoolDataSource<AddHookCell>
{ {
public int ItemCount => filteredEligableMethods.Count; public int ItemCount => filteredEligibleMethods.Count;
static readonly List<MethodInfo> currentAddEligableMethods = new(); static readonly List<MethodInfo> currentAddEligibleMethods = new();
static readonly List<MethodInfo> filteredEligableMethods = new(); static readonly List<MethodInfo> filteredEligibleMethods = new();
static readonly List<string> currentEligableNamesForFiltering = new(); static readonly List<string> currentEligibleNamesForFiltering = new();
// hook editor // hook editor
static readonly LexerBuilder Lexer = new(); static readonly LexerBuilder Lexer = new();
@ -74,16 +74,16 @@ namespace UnityExplorer.Hooks
AddHooksMethodFilterInput.Text = string.Empty; AddHooksMethodFilterInput.Text = string.Empty;
filteredEligableMethods.Clear(); filteredEligibleMethods.Clear();
currentAddEligableMethods.Clear(); currentAddEligibleMethods.Clear();
currentEligableNamesForFiltering.Clear(); currentEligibleNamesForFiltering.Clear();
foreach (MethodInfo method in type.GetMethods(ReflectionUtility.FLAGS)) foreach (MethodInfo method in type.GetMethods(ReflectionUtility.FLAGS))
{ {
if (UERuntimeHelper.IsBlacklisted(method)) if (UERuntimeHelper.IsBlacklisted(method))
continue; continue;
currentAddEligableMethods.Add(method); currentAddEligibleMethods.Add(method);
currentEligableNamesForFiltering.Add(SignatureHighlighter.RemoveHighlighting(SignatureHighlighter.ParseMethod(method))); currentEligibleNamesForFiltering.Add(SignatureHighlighter.RemoveHighlighting(SignatureHighlighter.ParseMethod(method)));
filteredEligableMethods.Add(method); filteredEligibleMethods.Add(method);
} }
AddHooksScrollPool.Refresh(true, true); AddHooksScrollPool.Refresh(true, true);
@ -112,10 +112,10 @@ namespace UnityExplorer.Hooks
public static void AddHookClicked(int index) public static void AddHookClicked(int index)
{ {
if (index >= filteredEligableMethods.Count) if (index >= filteredEligibleMethods.Count)
return; return;
MethodInfo method = filteredEligableMethods[index]; MethodInfo method = filteredEligibleMethods[index];
if (!method.IsGenericMethod && HookList.hookedSignatures.Contains(method.FullDescription())) if (!method.IsGenericMethod && HookList.hookedSignatures.Contains(method.FullDescription()))
{ {
ExplorerCore.Log($"Non-generic methods can only be hooked once."); ExplorerCore.Log($"Non-generic methods can only be hooked once.");
@ -129,7 +129,7 @@ namespace UnityExplorer.Hooks
return; return;
} }
AddHook(filteredEligableMethods[index]); AddHook(filteredEligibleMethods[index]);
} }
static void OnGenericMethodChosen(Type[] arguments) static void OnGenericMethodChosen(Type[] arguments)
@ -168,38 +168,38 @@ namespace UnityExplorer.Hooks
public void OnAddHookFilterInputChanged(string input) public void OnAddHookFilterInputChanged(string input)
{ {
filteredEligableMethods.Clear(); filteredEligibleMethods.Clear();
if (string.IsNullOrEmpty(input)) if (string.IsNullOrEmpty(input))
filteredEligableMethods.AddRange(currentAddEligableMethods); filteredEligibleMethods.AddRange(currentAddEligibleMethods);
else else
{ {
for (int i = 0; i < currentAddEligableMethods.Count; i++) for (int i = 0; i < currentAddEligibleMethods.Count; i++)
{ {
MethodInfo eligable = currentAddEligableMethods[i]; MethodInfo eligible = currentAddEligibleMethods[i];
string sig = currentEligableNamesForFiltering[i]; string sig = currentEligibleNamesForFiltering[i];
if (sig.ContainsIgnoreCase(input)) if (sig.ContainsIgnoreCase(input))
filteredEligableMethods.Add(eligable); filteredEligibleMethods.Add(eligible);
} }
} }
AddHooksScrollPool.Refresh(true, true); AddHooksScrollPool.Refresh(true, true);
} }
// Set eligable method cell // Set eligible method cell
public void OnCellBorrowed(AddHookCell cell) { } public void OnCellBorrowed(AddHookCell cell) { }
public void SetCell(AddHookCell cell, int index) public void SetCell(AddHookCell cell, int index)
{ {
if (index >= filteredEligableMethods.Count) if (index >= filteredEligibleMethods.Count)
{ {
cell.Disable(); cell.Disable();
return; return;
} }
cell.CurrentDisplayedIndex = index; cell.CurrentDisplayedIndex = index;
MethodInfo method = filteredEligableMethods[index]; MethodInfo method = filteredEligibleMethods[index];
cell.MethodNameLabel.text = SignatureHighlighter.ParseMethod(method); cell.MethodNameLabel.text = SignatureHighlighter.ParseMethod(method);
} }