Remove arbitrary static restriction on class search

This commit is contained in:
Sinai 2021-07-02 17:53:12 +10:00
parent 7ff508b874
commit 601567f9d2
2 changed files with 7 additions and 9 deletions

View File

@ -53,8 +53,8 @@ namespace UnityExplorer.ObjectExplorer
if (m_context == SearchContext.Singleton)
currentResults = SearchProvider.SingletonSearch(nameInputField.Text);
else if (m_context == SearchContext.StaticClass)
currentResults = SearchProvider.StaticClassSearch(nameInputField.Text);
else if (m_context == SearchContext.Class)
currentResults = SearchProvider.ClassSearch(nameInputField.Text);
else
{
string compType = "";
@ -130,7 +130,7 @@ namespace UnityExplorer.ObjectExplorer
if (!cachedCellTexts.ContainsKey(index))
{
string text;
if (m_context == SearchContext.StaticClass)
if (m_context == SearchContext.Class)
text = SignatureHighlighter.Parse(currentResults[index] as Type, true);
else
text = ToStringUtility.ToStringWithType(currentResults[index], currentResults[index]?.GetActualType());
@ -143,7 +143,7 @@ namespace UnityExplorer.ObjectExplorer
private void OnCellClicked(int dataIndex)
{
if (m_context == SearchContext.StaticClass)
if (m_context == SearchContext.Class)
InspectorManager.Inspect(currentResults[dataIndex] as Type);
else
InspectorManager.Inspect(currentResults[dataIndex]);

View File

@ -13,9 +13,8 @@ namespace UnityExplorer.ObjectExplorer
public enum SearchContext
{
UnityObject,
// GameObject,
Singleton,
StaticClass
Class
}
public enum ChildFilter
@ -134,7 +133,7 @@ namespace UnityExplorer.ObjectExplorer
return results;
}
internal static List<object> StaticClassSearch(string input)
internal static List<object> ClassSearch(string input)
{
var list = new List<object>();
@ -144,11 +143,10 @@ namespace UnityExplorer.ObjectExplorer
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
{
foreach (var type in asm.TryGetTypes().Where(it => it.IsSealed && it.IsAbstract))
foreach (var type in asm.TryGetTypes())
{
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
continue;
list.Add(type);
}
}