Auto-cleanup

This commit is contained in:
Sinai 2021-06-05 19:36:09 +10:00
parent 8fab9e6268
commit 16335c1bc4
57 changed files with 194 additions and 199 deletions

View File

@ -1,12 +1,12 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityExplorer.Core.Input;
using BF = System.Reflection.BindingFlags;
using UnityExplorer.Core.Config;
using UnityExplorer.Core;
using UnityExplorer.Core.Config;
using UnityExplorer.Core.Input;
using UnityExplorer.UI;
using System.Collections;
using BF = System.Reflection.BindingFlags;
namespace UnityExplorer.Core.Input

View File

@ -1,6 +1,6 @@
using System;
using UnityEngine;
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
namespace UnityExplorer.Core.Input

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityExplorer.UI;
using System.Collections.Generic;
using System.Linq;
namespace UnityExplorer.Core.Input
{

View File

@ -37,7 +37,7 @@ namespace UnityExplorer
$"deobfuscated types count: {DeobfuscatedTypes.Count}");
}
#region IL2CPP Extern and pointers
#region IL2CPP Extern and pointers
// Extern C++ methods
[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
@ -63,10 +63,10 @@ namespace UnityExplorer
return il2cppPtr != IntPtr.Zero;
}
#endregion
#endregion
#region Deobfuscation cache
#region Deobfuscation cache
private static readonly Dictionary<string, Type> DeobfuscatedTypes = new Dictionary<string, Type>();
private static readonly Dictionary<string, string> reverseDeobCache = new Dictionary<string, string>();
@ -111,7 +111,7 @@ namespace UnityExplorer
return theString;
}
#endregion
#endregion
// Get type by name
@ -124,7 +124,7 @@ namespace UnityExplorer
return base.Internal_GetTypeByName(fullName);
}
#region Get actual type
#region Get actual type
internal override Type Internal_GetActualType(object obj)
{
@ -183,10 +183,10 @@ namespace UnityExplorer
return monoType;
}
#endregion
#endregion
#region Casting
#region Casting
private static readonly Dictionary<string, IntPtr> cppClassPointers = new Dictionary<string, IntPtr>();
@ -278,10 +278,10 @@ namespace UnityExplorer
// return il2cpp_class_is_assignable_from(thisTypePtr, fromTypePtr);
//}
#endregion
#endregion
#region Boxing and unboxing ValueTypes
#region Boxing and unboxing ValueTypes
// cached il2cpp unbox methods
internal static readonly Dictionary<string, MethodInfo> unboxMethods = new Dictionary<string, MethodInfo>();
@ -384,10 +384,10 @@ namespace UnityExplorer
return cppStruct;
}
#endregion
#endregion
#region String boxing/unboxing
#region String boxing/unboxing
private const string IL2CPP_STRING_FULLNAME = "Il2CppSystem.String";
private const string STRING_FULLNAME = "System.String";
@ -428,10 +428,10 @@ namespace UnityExplorer
return s;
}
#endregion
#endregion
#region Singleton finder
#region Singleton finder
internal override void Internal_FindSingleton(string[] possibleNames, Type type, BF flags, List<object> instances)
{
@ -453,10 +453,10 @@ namespace UnityExplorer
base.Internal_FindSingleton(possibleNames, type, flags, instances);
}
#endregion
#endregion
#region Force-loading game modules
#region Force-loading game modules
internal static string UnhollowedFolderPath => Path.GetFullPath(
#if ML
@ -513,10 +513,10 @@ namespace UnityExplorer
return false;
}
#endregion
#endregion
#region Il2cpp reflection blacklist
#region Il2cpp reflection blacklist
public override string[] DefaultReflectionBlacklist => defaultIl2CppBlacklist.ToArray();
@ -665,10 +665,10 @@ namespace UnityExplorer
"UnityEngine.XR.InputDevice.SendHapticImpulse",
};
#endregion
#endregion
#region IL2CPP IEnumerable and IDictionary
#region IL2CPP IEnumerable and IDictionary
protected override bool Internal_TryGetEntryType(Type enumerableType, out Type type)
{

View File

@ -4,11 +4,11 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using BF = System.Reflection.BindingFlags;
using UnityExplorer.Core.Runtime;
using System.Text;
using UnityEngine;
using UnityExplorer.Core.Config;
using UnityExplorer.Core.Runtime;
using BF = System.Reflection.BindingFlags;
namespace UnityExplorer
{
@ -225,7 +225,7 @@ namespace UnityExplorer
return ret;
}
#endregion
#endregion
#region Type and Generic Parameter implementation cache
@ -360,7 +360,7 @@ namespace UnityExplorer
return genericParameterInheritance[key];
}
#endregion
#endregion
#region Internal MemberInfo Cache

View File

@ -2,11 +2,11 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityExplorer.UI.CacheObject.IValues;
using System.Reflection;
using UnityExplorer.UI;
using UnityExplorer.UI.CacheObject.IValues;
#if CPP
using UnhollowerRuntimeLib;
using UnhollowerBaseLib;
@ -16,7 +16,7 @@ namespace UnityExplorer.Tests
{
public class TestIndexer : IList<int>
{
private readonly List<int> list = new List<int>() { 1,2,3,4,5 };
private readonly List<int> list = new List<int>() { 1, 2, 3, 4, 5 };
public int Count => list.Count;
public bool IsReadOnly => false;

View File

@ -103,7 +103,7 @@ namespace UnityExplorer
RuntimeProvider.Instance.ProcessOnPostRender();
}
#region LOGGING
#region LOGGING
public static void Log(object message)
=> Log(message, LogType.Log);
@ -146,6 +146,6 @@ namespace UnityExplorer
}
}
#endregion
#endregion
}
}

View File

@ -7,12 +7,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityExplorer.Core.Config;
using UnityExplorer.Loader.BIE;
using UnityEngine;
using UnityExplorer.Core;
using UnityEngine.EventSystems;
using UnityExplorer.Core;
using UnityExplorer.Core.Config;
using UnityExplorer.Core.Input;
using UnityExplorer.Loader.BIE;
#if CPP
using BepInEx.IL2CPP;
using UnhollowerRuntimeLib;

View File

@ -22,7 +22,6 @@ namespace UnityExplorer.UI.CSConsole
AutoCompleteModal.Instance.ReleaseOwnership(this);
}
// Delimiters for completions, notably does not include '.'
private readonly HashSet<char> delimiters = new HashSet<char>
{
'{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?'
@ -67,7 +66,6 @@ namespace UnityExplorer.UI.CSConsole
}
string input = InputField.Text.Substring(startIdx, caret - startIdx + 1);
// Get MCS completions
string[] evaluatorCompletions = ConsoleController.Evaluator.GetCompletions(input, out string prefix);

View File

@ -1,18 +1,18 @@
using System;
using Mono.CSharp;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityExplorer.UI.CSConsole;
using UnityExplorer.Core.Input;
using UnityExplorer.UI.CSConsole;
using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets.AutoComplete;
using System.Reflection;
using Mono.CSharp;
namespace UnityExplorer.UI.CSConsole
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexers
{

View File

@ -1,9 +1,9 @@
using System;
using Mono.CSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using Mono.CSharp;
// Thanks to ManlyMarco for this

View File

@ -1,11 +1,11 @@
using System;
using Mono.CSharp;
using Mono.CSharp;
using System;
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using UnityExplorer.Core.Runtime;
using System.Text;
using UnityEngine;
using UnityExplorer.Core.Runtime;
/*
Welcome to the UnityExplorer C# Console!

View File

@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityExplorer.UI.CacheObject.Views;
using UnityExplorer.UI.CacheObject.IValues;
using UnityExplorer.UI.CacheObject.Views;
namespace UnityExplorer.UI.CacheObject
{

View File

@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityExplorer.UI.CacheObject.Views;
using UnityExplorer.UI.CacheObject.IValues;
using UnityExplorer.UI.CacheObject.Views;
namespace UnityExplorer.UI.CacheObject
{

View File

@ -7,8 +7,8 @@ using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Core.Runtime;
using UnityExplorer.UI.CacheObject.Views;
using UnityExplorer.UI.CacheObject.IValues;
using UnityExplorer.UI.CacheObject.Views;
using UnityExplorer.UI.Models;
namespace UnityExplorer.UI.CacheObject

View File

@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI.Inspectors;
using UnityExplorer.UI.CacheObject.IValues;
using UnityExplorer.UI.Inspectors;
using UnityExplorer.UI.Widgets;
namespace UnityExplorer.UI.CacheObject.Views

View File

@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI.Inspectors;
using UnityExplorer.UI.CacheObject.IValues;
using UnityExplorer.UI.Inspectors;
using UnityExplorer.UI.Widgets;
namespace UnityExplorer.UI.CacheObject.Views

View File

@ -54,6 +54,7 @@ namespace UnityExplorer.UI.Inspectors
private readonly Color disabledButtonColor = new Color(0.24f, 0.24f, 0.24f);
private readonly Color enabledButtonColor = new Color(0.2f, 0.27f, 0.2f);
private readonly Dictionary<BindingFlags, ButtonRef> scopeFilterButtons = new Dictionary<BindingFlags, ButtonRef>();
private readonly List<Toggle> memberTypeToggles = new List<Toggle>();
private InputFieldRef filterInputField;
@ -73,7 +74,6 @@ namespace UnityExplorer.UI.Inspectors
private IEnumerator InitCoroutine()
{
yield return null;
LayoutRebuilder.ForceRebuildLayoutImmediate(InspectorPanel.Instance.ContentRect);
}
@ -307,11 +307,8 @@ namespace UnityExplorer.UI.Inspectors
private void CalculateLayouts()
{
// Calculate sizes
LeftGroupWidth = (int)Math.Max(200, (0.4f * InspectorManager.PanelWidth) - 5);// Math.Min(450f, 0.4f * InspectorManager.PanelWidth - 5));
LeftGroupWidth = (int)Math.Max(200, (0.4f * InspectorManager.PanelWidth) - 5);
RightGroupWidth = (int)Math.Max(200, InspectorManager.PanelWidth - LeftGroupWidth - 65);
//memberTitleLayout.minWidth = LeftGroupWidth;
}
private void SetCellLayout(CacheObjectCell cell)
@ -342,7 +339,7 @@ namespace UnityExplorer.UI.Inspectors
ConstructUnityObjectRow();
mainContentHolder = UIFactory.CreateVerticalGroup(UIRoot, "MemberHolder", false, false, true, true, 5, new Vector4(2,2,2,2),
mainContentHolder = UIFactory.CreateVerticalGroup(UIRoot, "MemberHolder", false, false, true, true, 5, new Vector4(2, 2, 2, 2),
new Color(0.12f, 0.12f, 0.12f));
UIFactory.SetLayoutElement(mainContentHolder, flexibleWidth: 9999, flexibleHeight: 9999);
@ -352,7 +349,7 @@ namespace UnityExplorer.UI.Inspectors
// Member scroll pool
var memberBorder = UIFactory.CreateVerticalGroup(mainContentHolder, "ScrollPoolHolder", false, false, true, true, padding: new Vector4(2,2,2,2),
var memberBorder = UIFactory.CreateVerticalGroup(mainContentHolder, "ScrollPoolHolder", false, false, true, true, padding: new Vector4(2, 2, 2, 2),
bgColor: new Color(0.05f, 0.05f, 0.05f));
UIFactory.SetLayoutElement(memberBorder, flexibleWidth: 9999, flexibleHeight: 9999);

View File

@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Core.Input;
using System.IO;
using System.Diagnostics;
using UnityExplorer.UI.Models;
using System.Linq;
using UnityExplorer.UI.Widgets.AutoComplete;
namespace UnityExplorer.UI.Panels

View File

@ -729,7 +729,7 @@ namespace UnityExplorer.UI
var sliderContainer = CreateVerticalGroup(mainObj, "SliderContainer",
false, false, true, true, 0, default, new Color(0.05f, 0.05f, 0.05f));
SetLayoutElement(sliderContainer, minWidth: 25, flexibleWidth:0, flexibleHeight: 9999);
SetLayoutElement(sliderContainer, minWidth: 25, flexibleWidth: 0, flexibleHeight: 9999);
sliderContainer.AddComponent<Mask>();
CreateSliderScrollbar(sliderContainer, out Slider slider);

View File

@ -169,7 +169,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
// Setting autocomplete cell buttons
private readonly Color selectedSuggestionColor = new Color(45/255f, 75/255f, 80/255f);
private readonly Color selectedSuggestionColor = new Color(45 / 255f, 75 / 255f, 80 / 255f);
private readonly Color inactiveSuggestionColor = new Color(0.11f, 0.11f, 0.11f);
private List<Suggestion> GetEntries() => Suggestions;

View File

@ -4,9 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityExplorer.UI.Models;
namespace UnityExplorer.UI.Widgets