mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-09-20 13:36:01 +08:00
Implemented the console log, some cleanups
This commit is contained in:
@ -108,9 +108,6 @@ namespace UnityExplorer.Core.Config
|
||||
"\r\nSeperate signatures with a semicolon ';'.",
|
||||
"DEFAULT");
|
||||
|
||||
Reflection_Signature_Blacklist.OnValueChanged += ReflectionUtility.LoadBlacklistString;
|
||||
ReflectionUtility.LoadBlacklistString(Reflection_Signature_Blacklist.Value);
|
||||
|
||||
// Internal configs (panel save data)
|
||||
|
||||
ObjectExplorerData = new ConfigElement<string>("ObjectExplorer", "", "", true);
|
||||
|
@ -14,13 +14,16 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using UnityExplorer.Core;
|
||||
using CppType = Il2CppSystem.Type;
|
||||
using BF = System.Reflection.BindingFlags;
|
||||
using UnityExplorer.Core.Config;
|
||||
|
||||
namespace UnityExplorer
|
||||
{
|
||||
public class Il2CppReflection : ReflectionUtility
|
||||
{
|
||||
public Il2CppReflection()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
TryLoadGameModules();
|
||||
|
||||
BuildDeobfuscationCache();
|
||||
@ -70,7 +73,7 @@ namespace UnityExplorer
|
||||
}
|
||||
|
||||
if (DeobfuscatedTypes.Count > 0)
|
||||
ExplorerCore.Log($"Built deobfuscation cache, count: {DeobfuscatedTypes.Count}");
|
||||
ExplorerCore.Log($"Built IL2CPP deobfuscation cache, initial count: {DeobfuscatedTypes.Count}");
|
||||
}
|
||||
|
||||
private static void TryCacheDeobfuscatedType(Type type)
|
||||
|
@ -17,16 +17,25 @@ namespace UnityExplorer
|
||||
{
|
||||
public const BF FLAGS = BF.Public | BF.Instance | BF.NonPublic | BF.Static;
|
||||
|
||||
internal static readonly ReflectionUtility Instance =
|
||||
internal static ReflectionUtility Instance;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
Instance =
|
||||
#if CPP
|
||||
new Il2CppReflection();
|
||||
#else
|
||||
new ReflectionUtility();
|
||||
#endif
|
||||
Instance.Initialize();
|
||||
}
|
||||
|
||||
static ReflectionUtility()
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
SetupTypeCache();
|
||||
|
||||
LoadBlacklistString(ConfigManager.Reflection_Signature_Blacklist.Value);
|
||||
ConfigManager.Reflection_Signature_Blacklist.OnValueChanged += LoadBlacklistString;
|
||||
}
|
||||
|
||||
#region Type cache
|
||||
@ -409,7 +418,12 @@ namespace UnityExplorer
|
||||
public static void LoadBlacklistString(string blacklist)
|
||||
{
|
||||
if (string.Equals(blacklist, "DEFAULT", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
blacklist = Instance.DefaultReflectionBlacklist;
|
||||
ConfigManager.Reflection_Signature_Blacklist.Value = blacklist;
|
||||
ConfigManager.Handler.SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(blacklist))
|
||||
return;
|
||||
|
@ -8,21 +8,17 @@ namespace UnityExplorer
|
||||
{
|
||||
public static class IOUtility
|
||||
{
|
||||
public static string EnsureValid(string path)
|
||||
private static readonly char[] invalidDirectoryCharacters = Path.GetInvalidPathChars();
|
||||
private static readonly char[] invalidFilenameCharacters = Path.GetInvalidFileNameChars();
|
||||
|
||||
public static string EnsureValidDirectory(string path)
|
||||
{
|
||||
path = RemoveInvalidChars(path);
|
||||
|
||||
var dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
return path;
|
||||
return string.Concat(path.Split(invalidDirectoryCharacters));
|
||||
}
|
||||
|
||||
public static string RemoveInvalidChars(string path)
|
||||
public static string EnsureValidFilename(string filename)
|
||||
{
|
||||
return string.Concat(path.Split(Path.GetInvalidPathChars()));
|
||||
return string.Concat(filename.Split(invalidFilenameCharacters));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user