Add ContainsIgnoreCase helper to reduce string alloc, cleanup

This commit is contained in:
Sinai committed 2021-04-30 23:43:27 +10:00
1 parent 74ff1d8f01
commit d76bc1f812
8 files changed
+34 -21

No files matched your search

@@ -22,7 +22,7 @@ namespace UnityExplorer.UI.Widgets
get => currentFilter;
set
{
currentFilter = value?.ToLower() ?? "";
currentFilter = value ?? "";
if (!wasFiltering && Filtering)
wasFiltering = true;
else if (wasFiltering && !Filtering)
@@ -133,7 +133,7 @@ namespace UnityExplorer.UI.Widgets
private bool FilterHierarchy(Transform obj)
{
if (obj.name.ToLower().Contains(currentFilter))
if (obj.name.ContainsIgnoreCase(currentFilter))
return true;
if (obj.childCount <= 0)
@@ -146,10 +146,8 @@ namespace UnityExplorer.UI.Widgets
return false;
}
public void SetCell(TransformCell iCell, int index)
public void SetCell(TransformCell cell, int index)
{
var cell = iCell as TransformCell;
if (index < displayedObjects.Count)
cell.ConfigureCell(displayedObjects[index], index);
else