mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-08 18:43:37 +08:00
Small optimizations/cleanup
This commit is contained in:
parent
5c9dcb1d43
commit
df0abbc847
@ -134,6 +134,9 @@ namespace UnityExplorer
|
|||||||
var type = obj.GetType();
|
var type = obj.GetType();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (type.IsGenericType)
|
||||||
|
return type;
|
||||||
|
|
||||||
if (IsString(obj))
|
if (IsString(obj))
|
||||||
return typeof(string);
|
return typeof(string);
|
||||||
|
|
||||||
@ -178,7 +181,8 @@ namespace UnityExplorer
|
|||||||
if (fullname.StartsWith("System."))
|
if (fullname.StartsWith("System."))
|
||||||
fullname = $"Il2Cpp{fullname}";
|
fullname = $"Il2Cpp{fullname}";
|
||||||
|
|
||||||
AllTypes.TryGetValue(fullname, out Type monoType);
|
if (!AllTypes.TryGetValue(fullname, out Type monoType))
|
||||||
|
ExplorerCore.LogWarning($"Failed to get type by name '{fullname}'!");
|
||||||
return monoType;
|
return monoType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,16 +501,7 @@ namespace UnityExplorer
|
|||||||
{
|
{
|
||||||
var files = Directory.GetFiles(UnhollowedFolderPath);
|
var files = Directory.GetFiles(UnhollowedFolderPath);
|
||||||
foreach (var filePath in files)
|
foreach (var filePath in files)
|
||||||
{
|
DoLoadModule(filePath, false);
|
||||||
try
|
|
||||||
{
|
|
||||||
DoLoadModule(filePath, true);
|
|
||||||
}
|
|
||||||
catch //(Exception ex)
|
|
||||||
{
|
|
||||||
//ExplorerCore.LogWarning($"Failed to force-load module '{name}': {ex.ReflectionExToString()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ExplorerCore.LogWarning($"Expected Unhollowed folder path does not exist: '{UnhollowedFolderPath}'");
|
ExplorerCore.LogWarning($"Expected Unhollowed folder path does not exist: '{UnhollowedFolderPath}'");
|
||||||
@ -514,7 +509,7 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
internal bool DoLoadModule(string fullPath, bool suppressWarning = false)
|
internal bool DoLoadModule(string fullPath, bool suppressWarning = false)
|
||||||
{
|
{
|
||||||
if (!File.Exists(fullPath))
|
if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -525,11 +520,9 @@ namespace UnityExplorer
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (!suppressWarning)
|
//ExplorerCore.LogWarning($"Failed loading module '{Path.GetFileName(fullPath)}'! {e.ReflectionExToString()}");
|
||||||
Console.WriteLine($"Failed loading module '{Path.GetFileName(fullPath)}'! {e.ReflectionExToString()}");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user