diff --git a/src/CacheObject/CacheMember.cs b/src/CacheObject/CacheMember.cs index fdaa67d..7be8da7 100644 --- a/src/CacheObject/CacheMember.cs +++ b/src/CacheObject/CacheMember.cs @@ -32,7 +32,9 @@ namespace UnityExplorer.CacheObject public virtual void SetInspectorOwner(ReflectionInspector inspector, MemberInfo member) { this.Owner = inspector; - this.NameLabelText = SignatureHighlighter.Parse(member.DeclaringType, false, member); + this.NameLabelText = this is CacheMethod + ? SignatureHighlighter.HighlightMethod(member as MethodInfo) + : SignatureHighlighter.Parse(member.DeclaringType, false, member); this.NameForFiltering = $"{member.DeclaringType.Name}.{member.Name}"; this.NameLabelTextRaw = NameForFiltering; } diff --git a/src/Hooks/HookManager.cs b/src/Hooks/HookManager.cs index 28fcb0a..4c1c123 100644 --- a/src/Hooks/HookManager.cs +++ b/src/Hooks/HookManager.cs @@ -84,7 +84,7 @@ namespace UnityExplorer.Hooks cell.CurrentDisplayedIndex = index; var hook = (HookInstance)this.currentHooks[index]; - cell.MethodNameLabel.text = HighlightMethod(hook.TargetMethod); + cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(hook.TargetMethod); cell.ToggleActiveButton.ButtonText.text = hook.Enabled ? "Enabled" : "Disabled"; RuntimeProvider.Instance.SetColorBlockAuto(cell.ToggleActiveButton.Component, @@ -183,7 +183,7 @@ namespace UnityExplorer.Hooks cell.CurrentDisplayedIndex = index; var method = this.filteredEligableMethods[index]; - cell.MethodNameLabel.text = HighlightMethod(method); + cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(method); var sig = method.FullDescription(); if (hookedSignatures.Contains(sig)) @@ -225,50 +225,5 @@ namespace UnityExplorer.Hooks Panel.SetPage(HookManagerPanel.Pages.CurrentHooks); } } - - // ~~~~~~~~~~ Method syntax highlighting - - private static readonly Dictionary highlightedMethods = new Dictionary(); - - private string HighlightMethod(MethodInfo method) - { - var sig = method.FullDescription(); - if (highlightedMethods.ContainsKey(sig)) - return highlightedMethods[sig]; - - var sb = new StringBuilder(); - - // declaring type - sb.Append(SignatureHighlighter.Parse(method.DeclaringType, false)); - sb.Append('.'); - - // method name - var color = !method.IsStatic - ? SignatureHighlighter.METHOD_INSTANCE - : SignatureHighlighter.METHOD_STATIC; - sb.Append($"{method.Name}"); - - // arguments - sb.Append('('); - var args = method.GetParameters(); - if (args != null && args.Any()) - { - int i = 0; - foreach (var param in args) - { - sb.Append(SignatureHighlighter.Parse(param.ParameterType, false)); - sb.Append(' '); - sb.Append($"{param.Name}"); - i++; - if (i < args.Length) - sb.Append(", "); - } - } - sb.Append(')'); - - var ret = sb.ToString(); - highlightedMethods.Add(sig, ret); - return ret; - } } } diff --git a/src/UI/Clipboard/Clipboard.cs b/src/UI/Clipboard/Clipboard.cs new file mode 100644 index 0000000..58c8432 --- /dev/null +++ b/src/UI/Clipboard/Clipboard.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UnityExplorer.UI +{ + public static class Clipboard + { + public static object Current { get; private set; } + + public static void Init() + { + + } + + public static void Copy(object obj) + { + Current = obj; + } + } +} diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index 8dd2992..db9fd29 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -102,6 +102,7 @@ namespace UnityExplorer.UI // Call some initialize methods ConsoleController.Init(); + Clipboard.Init(); // Add this listener to prevent ScrollPool doing anything while we are resizing panels ScrollPool.writingLockedListeners.Add(() => !PanelDragger.Resizing); diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index ab5612f..caf7632 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -172,13 +172,13 @@ False - packages\UniverseLib.1.0.3\lib\net35\UniverseLib.Mono.dll + packages\UniverseLib.1.0.4\lib\net35\UniverseLib.Mono.dll - packages\UniverseLib.1.0.3\lib\net472\UniverseLib.IL2CPP.dll + packages\UniverseLib.1.0.4\lib\net472\UniverseLib.IL2CPP.dll ..\lib\Il2CppAssemblyUnhollower\UnhollowerBaseLib\bin\Release\net4.7.2\UnhollowerBaseLib.dll @@ -222,6 +222,7 @@ + diff --git a/src/packages.config b/src/packages.config index 6666e07..5cf0826 100644 --- a/src/packages.config +++ b/src/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file