Cleanups and refactorings, and some small UI fixes

This commit is contained in:
sinaioutlander
2020-09-29 05:40:06 +10:00
parent f1406d016f
commit dab7ecd441
21 changed files with 553 additions and 635 deletions

View File

@ -8,19 +8,12 @@ namespace Explorer
public static class ReflectionExtensions
{
#if CPP
/// <summary>
/// Extension to allow for easy, non-generic Il2Cpp casting.
/// The extension is on System.Object, but only Il2Cpp objects would be a valid target.
/// </summary>
public static object Il2CppCast(this object obj, Type castTo)
{
return ReflectionHelpers.Il2CppCast(obj, castTo);
}
#endif
/// <summary>
/// Extension to safely try to get all Types from an Assembly, with a fallback for ReflectionTypeLoadException.
/// </summary>
public static IEnumerable<Type> TryGetTypes(this Assembly asm)
{
try
@ -29,7 +22,14 @@ namespace Explorer
}
catch (ReflectionTypeLoadException e)
{
return e.Types.Where(t => t != null);
try
{
return asm.GetExportedTypes();
}
catch
{
return e.Types.Where(t => t != null);
}
}
catch
{