using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("UnityLogViewer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("In-game log viewer for BepInEx")] [assembly: AssemblyFileVersion("0.0.3.0")] [assembly: AssemblyInformationalVersion("0.0.3+3a4a0129279e9af3cf8a761294c5f7bdbc7dc3b7")] [assembly: AssemblyProduct("UnityLogViewer")] [assembly: AssemblyTitle("UnityLogViewer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace malafein.UnityLogViewer { public class LogViewerUI : MonoBehaviour, ILogListener, IDisposable { private struct HighlightRule { public Regex Pattern; public string Color; } private readonly object logLock = new object(); private bool isVisible = Plugin.ShowWindow.Value; private bool isPinned; private Rect windowRect; private Vector2 scrollPosition; private string filterText = ""; private bool filterDirty = true; private readonly List logLines = new List(); private readonly List filteredLines = new List(); private bool autoScroll = true; private bool pendingScrollToBottom; private readonly List renderedLines = new List(); private bool renderDirty = true; private readonly List highlightRules = new List(); private bool highlightsDirty = true; private const int WindowID = 99701; private const float WindowHeaderHeight = 98f; private const float PinnedHeaderHeight = 26f; private float lineHeight = 20f; private int scrollFirstVisible; private int scrollLastVisible; private bool isResizing; private const float ResizeHandleSize = 20f; private const float MinWidth = 400f; private const float MinHeight = 300f; private Texture2D bgTexture; private int lastOpacity = -1; private GUIStyle logStyle; private GUIStyle closeButtonStyle; private GUIStyle pinButtonStyle; private GUIStyle pinnedWindowStyle; private bool stylesInitialized; private Rect lastSavedRect; private readonly List validFontNames = new List(); private int fontSelectorIndex; private bool fontDropdownOpen; private Rect fontDropdownRect; private Vector2 fontDropdownScrollPos; private const int FontDropdownWindowID = 99702; public LogLevel LogLevelFilter => (LogLevel)63; private int MaxLines => Plugin.BufferSize.Value; private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) windowRect = new Rect((float)Plugin.WindowX.Value, (float)Plugin.WindowY.Value, (float)Plugin.WindowWidth.Value, (float)Plugin.WindowHeight.Value); lastSavedRect = windowRect; filterText = Plugin.Filter.Value ?? ""; isPinned = Plugin.Pinned.Value; Plugin.Filter.SettingChanged += delegate { filterText = Plugin.Filter.Value ?? ""; filterDirty = true; }; Plugin.ShowWindow.SettingChanged += delegate { isVisible = Plugin.ShowWindow.Value; }; Plugin.Pinned.SettingChanged += delegate { isPinned = Plugin.Pinned.Value; }; Plugin.WindowX.SettingChanged += delegate { ((Rect)(ref windowRect)).x = Plugin.WindowX.Value; }; Plugin.WindowY.SettingChanged += delegate { ((Rect)(ref windowRect)).y = Plugin.WindowY.Value; }; Plugin.WindowWidth.SettingChanged += delegate { ((Rect)(ref windowRect)).width = Plugin.WindowWidth.Value; }; Plugin.WindowHeight.SettingChanged += delegate { ((Rect)(ref windowRect)).height = Plugin.WindowHeight.Value; }; for (int i = 0; i < 8; i++) { Plugin.HighlightPattern[i].SettingChanged += delegate { highlightsDirty = true; renderDirty = true; }; Plugin.HighlightColor[i].SettingChanged += delegate { highlightsDirty = true; renderDirty = true; }; } Plugin.FontName.SettingChanged += delegate { int num = validFontNames.IndexOf(Plugin.FontName.Value); if (num >= 0) { fontSelectorIndex = num; } }; Logger.Listeners.Add((ILogListener)(object)this); } private void BuildValidFontList() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown validFontNames.Clear(); validFontNames.Add(""); string[] oSInstalledFontNames = Font.GetOSInstalledFontNames(); Array.Sort(oSInstalledFontNames, (IComparer?)StringComparer.OrdinalIgnoreCase); Logger.Listeners.Remove((ILogListener)(object)this); string[] array = oSInstalledFontNames; foreach (string text in array) { bool warned = false; LogCallback val = delegate(string msg, string _, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)type == 2 || (int)type == 0) { warned = true; } }; Application.logMessageReceived += val; Font font = Font.CreateDynamicFontFromOSFont(text, 13); new GUIStyle(GUI.skin.label) { font = font, fontSize = 13 }.CalcSize(new GUIContent("Ag")); Application.logMessageReceived -= val; if (!warned) { validFontNames.Add(text); } } Logger.Listeners.Add((ILogListener)(object)this); fontSelectorIndex = Math.Max(0, validFontNames.IndexOf(Plugin.FontName.Value)); StringBuilder stringBuilder = new StringBuilder(); for (int j = 1; j < validFontNames.Count; j++) { if (j > 1) { stringBuilder.Append(", "); } stringBuilder.Append(validFontNames[j]); } Plugin.Log.LogInfo((object)((validFontNames.Count > 1) ? $"[UnityLogViewer] {validFontNames.Count - 1} usable font(s): {stringBuilder}" : "[UnityLogViewer] No usable OS fonts found; using default UI font.")); } public void LogEvent(object sender, LogEventArgs eventArgs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) string text = $"[{eventArgs.Level}] [{eventArgs.Source.SourceName}] "; lock (logLock) { logLines.Add(text + eventArgs.Data); if (logLines.Count > MaxLines) { logLines.RemoveRange(0, logLines.Count - MaxLines); } filterDirty = true; if (autoScroll) { pendingScrollToBottom = true; } } } public void Dispose() { } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = Plugin.ToggleShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Plugin.ShowWindow.Value = !Plugin.ShowWindow.Value; } if (filterDirty) { RebuildFilteredLines(); } if (renderDirty) { RebuildRenderedLines(); } if (pendingScrollToBottom) { scrollPosition.y = 1E+09f; pendingScrollToBottom = false; } } private void RebuildHighlightRules() { highlightRules.Clear(); for (int i = 0; i < 8; i++) { string value = Plugin.HighlightPattern[i].Value; string value2 = Plugin.HighlightColor[i].Value; if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value2)) { try { highlightRules.Add(new HighlightRule { Pattern = new Regex(value, RegexOptions.IgnoreCase), Color = value2 }); } catch (ArgumentException) { } } } highlightsDirty = false; } private void RebuildFilteredLines() { filteredLines.Clear(); lock (logLock) { if (string.IsNullOrEmpty(filterText)) { filteredLines.AddRange(logLines); } else { try { Regex regex = new Regex(filterText, RegexOptions.IgnoreCase); for (int i = 0; i < logLines.Count; i++) { if (regex.IsMatch(logLines[i])) { filteredLines.Add(logLines[i]); } } } catch (ArgumentException) { for (int j = 0; j < logLines.Count; j++) { if (logLines[j].IndexOf(filterText, StringComparison.OrdinalIgnoreCase) >= 0) { filteredLines.Add(logLines[j]); } } } } filterDirty = false; } renderDirty = true; } private static string EscapeRichText(string text) { return text.Replace("<", "\u200b<"); } private string GetColorForLine(string line) { for (int i = 0; i < highlightRules.Count; i++) { if (highlightRules[i].Pattern.IsMatch(line)) { return highlightRules[i].Color; } } return null; } private void RebuildRenderedLines() { if (highlightsDirty) { RebuildHighlightRules(); } renderedLines.Clear(); for (int i = 0; i < filteredLines.Count; i++) { string text = EscapeRichText(filteredLines[i]); string colorForLine = GetColorForLine(filteredLines[i]); string[] array = text.Split(new char[1] { '\n' }); for (int j = 0; j < array.Length; j++) { string text2 = array[j].TrimEnd(new char[1] { '\r' }); renderedLines.Add((colorForLine != null) ? ("" + text2 + "") : text2); } } renderDirty = false; } private Texture2D MakeBgTexture(int opacity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown byte b = (byte)(opacity * 255 / 100); Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, b))); val.Apply(); return val; } private void InitStyles() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_013c: Expected O, but got Unknown BuildValidFontList(); string text = ((fontSelectorIndex > 0 && fontSelectorIndex < validFontNames.Count) ? validFontNames[fontSelectorIndex] : null); GUIStyle val = new GUIStyle(GUI.skin.label) { richText = true, wordWrap = false, fontSize = 13 }; val.normal.textColor = Color.white; val.padding = new RectOffset(4, 4, 2, 2); val.margin = new RectOffset(0, 0, 0, 0); val.font = (string.IsNullOrEmpty(text) ? null : Font.CreateDynamicFontFromOSFont(text, 13)); logStyle = val; lineHeight = logStyle.CalcSize(new GUIContent("Ag")).y; closeButtonStyle = new GUIStyle(GUI.skin.button) { fontSize = 14, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; pinButtonStyle = new GUIStyle(GUI.skin.button) { fontSize = 12, alignment = (TextAnchor)4 }; pinnedWindowStyle = new GUIStyle(GUI.skin.box) { padding = new RectOffset(4, 4, 4, 4) }; stylesInitialized = true; } private void UpdateBgTexture() { int value = Plugin.BackgroundOpacity.Value; if (value != lastOpacity) { if ((Object)(object)bgTexture != (Object)null) { Object.Destroy((Object)(object)bgTexture); } bgTexture = MakeBgTexture(value); lastOpacity = value; if (stylesInitialized) { pinnedWindowStyle.normal.background = bgTexture; } } } private void OnGUI() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!isVisible) { fontDropdownOpen = false; return; } if (!stylesInitialized) { InitStyles(); } UpdateBgTexture(); if (isPinned) { DrawPinnedWindow(); } else { Color backgroundColor = GUI.backgroundColor; float num = (float)Plugin.BackgroundOpacity.Value / 100f; GUI.backgroundColor = new Color(backgroundColor.r, backgroundColor.g, backgroundColor.b, num); GUI.Window(99701, windowRect, new WindowFunction(DrawWindow), "Log Viewer"); GUI.backgroundColor = backgroundColor; HandleResize(); } SaveWindowRectIfChanged(); if (fontDropdownOpen) { DrawFontDropdown(); } } private void SaveWindowRectIfChanged() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (((Rect)(ref windowRect)).x != ((Rect)(ref lastSavedRect)).x || ((Rect)(ref windowRect)).y != ((Rect)(ref lastSavedRect)).y || ((Rect)(ref windowRect)).width != ((Rect)(ref lastSavedRect)).width || ((Rect)(ref windowRect)).height != ((Rect)(ref lastSavedRect)).height) { Plugin.WindowX.Value = (int)((Rect)(ref windowRect)).x; Plugin.WindowY.Value = (int)((Rect)(ref windowRect)).y; Plugin.WindowWidth.Value = (int)((Rect)(ref windowRect)).width; Plugin.WindowHeight.Value = (int)((Rect)(ref windowRect)).height; lastSavedRect = windowRect; } } private void DrawVirtualScrollContent(float viewHeight) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) float num = lineHeight; int count = renderedLines.Count; float num2 = (float)count * num; float num3 = Mathf.Max(0f, num2 - viewHeight + 30f); scrollPosition.y = Mathf.Min(scrollPosition.y, num3); if ((int)Event.current.type == 8) { scrollFirstVisible = Mathf.Max(0, (int)(scrollPosition.y / num) - 1); scrollLastVisible = Mathf.Min(count - 1, scrollFirstVisible + (int)(viewHeight / num) + 3); } scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(viewHeight) }); if (scrollFirstVisible > 0) { GUILayout.Space((float)scrollFirstVisible * num); } for (int i = scrollFirstVisible; i <= scrollLastVisible; i++) { GUILayout.Label(renderedLines[i], logStyle, Array.Empty()); } int num4 = count - scrollLastVisible - 1; if (num4 > 0) { GUILayout.Space((float)num4 * num); } GUILayout.EndScrollView(); } private void DrawPinnedWindow() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) pinnedWindowStyle.normal.background = bgTexture; GUILayout.BeginArea(windowRect, pinnedWindowStyle); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("□", pinButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(18f) })) { isPinned = false; Plugin.Pinned.Value = false; } GUILayout.EndHorizontal(); DrawVirtualScrollContent(Mathf.Max(50f, ((Rect)(ref windowRect)).height - 26f)); GUILayout.EndArea(); } private void ApplyFont(int index) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) fontSelectorIndex = index; string text = ((index > 0 && index < validFontNames.Count) ? validFontNames[index] : null); Plugin.FontName.Value = text ?? ""; logStyle.font = (string.IsNullOrEmpty(text) ? null : Font.CreateDynamicFontFromOSFont(text, 13)); lineHeight = logStyle.CalcSize(new GUIContent("Ag")).y; renderDirty = true; } private void DrawWindow(int windowID) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) if (GUI.Button(new Rect(((Rect)(ref windowRect)).width - 25f, 2f, 22f, 18f), "X", closeButtonStyle)) { Plugin.ShowWindow.Value = false; return; } if (GUI.Button(new Rect(((Rect)(ref windowRect)).width - 53f, 2f, 26f, 18f), "■", pinButtonStyle)) { isPinned = true; Plugin.Pinned.Value = true; return; } if (validFontNames.Count > 1) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Font:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); if (GUILayout.Button(((fontSelectorIndex > 0) ? validFontNames[fontSelectorIndex] : "(default)") + " ▼", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { fontDropdownOpen = !fontDropdownOpen; if (fontDropdownOpen) { Rect lastRect = GUILayoutUtility.GetLastRect(); float num = GUI.skin.window.border.top; float num2 = Mathf.Min((float)validFontNames.Count * 22f + 6f, 200f); fontDropdownRect = new Rect(((Rect)(ref windowRect)).x + ((Rect)(ref lastRect)).x, ((Rect)(ref windowRect)).y + num + ((Rect)(ref lastRect)).yMax, ((Rect)(ref lastRect)).width, num2); } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Filter:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); string text = GUILayout.TextField(filterText, Array.Empty()); if (text != filterText) { filterText = text; filterDirty = true; } if (GUILayout.Button("⌫", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { filterText = ""; filterDirty = true; } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { lock (logLock) { logLines.Clear(); } filteredLines.Clear(); renderedLines.Clear(); scrollPosition = Vector2.zero; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); int count; lock (logLock) { count = logLines.Count; } GUILayout.Label($"{filteredLines.Count} / {count} lines", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); GUILayout.FlexibleSpace(); bool flag = GUILayout.Toggle(autoScroll, "Auto-scroll", Array.Empty()); if (flag != autoScroll) { autoScroll = flag; if (autoScroll) { pendingScrollToBottom = true; } } GUILayout.EndHorizontal(); float num3 = ((validFontNames.Count > 1) ? 98f : 72f); DrawVirtualScrollContent(Mathf.Max(50f, ((Rect)(ref windowRect)).height - num3)); GUI.Label(new Rect(((Rect)(ref windowRect)).width - 20f, ((Rect)(ref windowRect)).height - 20f, 20f, 20f), "◢"); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width - 58f, 25f)); } private void DrawFontDropdown() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 0 && !((Rect)(ref fontDropdownRect)).Contains(Event.current.mousePosition)) { fontDropdownOpen = false; return; } fontDropdownRect = GUI.Window(99702, fontDropdownRect, (WindowFunction)delegate { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) fontDropdownScrollPos = GUILayout.BeginScrollView(fontDropdownScrollPos, Array.Empty()); for (int i = 0; i < validFontNames.Count; i++) { if (GUILayout.Button((i == 0) ? "(default)" : validFontNames[i], (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { ApplyFont(i); fontDropdownOpen = false; } } GUILayout.EndScrollView(); }, ""); } private void HandleResize() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 Event current = Event.current; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x + ((Rect)(ref windowRect)).width - 20f, ((Rect)(ref windowRect)).y + ((Rect)(ref windowRect)).height - 20f, 20f, 20f); if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { isResizing = true; current.Use(); } if (isResizing && ((int)current.type == 3 || (int)current.type == 1)) { ((Rect)(ref windowRect)).width = Mathf.Max(400f, current.mousePosition.x - ((Rect)(ref windowRect)).x); ((Rect)(ref windowRect)).height = Mathf.Max(300f, current.mousePosition.y - ((Rect)(ref windowRect)).y); if ((int)current.type == 1) { isResizing = false; } current.Use(); } } private void OnDestroy() { Logger.Listeners.Remove((ILogListener)(object)this); if ((Object)(object)bgTexture != (Object)null) { Object.Destroy((Object)(object)bgTexture); } } } [BepInPlugin("com.malafein.unitylogviewer", "UnityLogViewer", "0.0.3")] public class Plugin : BaseUnityPlugin { internal class ConfigurationManagerAttributes { public int? Order; } public const string ModGUID = "com.malafein.unitylogviewer"; public const string ModName = "UnityLogViewer"; public const string ModVersion = "0.0.3"; public static ConfigEntry ToggleShortcut; public static ConfigEntry ShowWindow; public static ConfigEntry Filter; public static ConfigEntry BackgroundOpacity; public static ConfigEntry Pinned; public static ConfigEntry BufferSize; public static ConfigEntry FontName; public static ConfigEntry WindowX; public static ConfigEntry WindowY; public static ConfigEntry WindowWidth; public static ConfigEntry WindowHeight; public const int HighlightSlotCount = 8; public static ConfigEntry[] HighlightPattern = new ConfigEntry[8]; public static ConfigEntry[] HighlightColor = new ConfigEntry[8]; internal static ManualLogSource Log; private void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"UnityLogViewer 0.0.3 is loading..."); ShowWindow = ((BaseUnityPlugin)this).Config.Bind("General", "ShowWindow", false, new ConfigDescription("Toggle the log viewer window on/off. Use this if the hotkey doesn't work with your game's input system.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 65 } })); ToggleShortcut = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleShortcut", new KeyboardShortcut((KeyCode)288, Array.Empty()), new ConfigDescription("Keyboard shortcut to toggle log view.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 60 } })); Filter = ((BaseUnityPlugin)this).Config.Bind("General", "Filter", "", new ConfigDescription("Optional filter, supports regular expressions.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 50 } })); FontName = ((BaseUnityPlugin)this).Config.Bind("General", "FontName", "", new ConfigDescription("Font to use for log text. Leave empty for the default UI font. Check the BepInEx log at startup for a list of fonts available on this system.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 45 } })); Pinned = ((BaseUnityPlugin)this).Config.Bind("General", "Pinned", false, new ConfigDescription("Pin the log view in place. Hides window decorations and disables interaction.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 40 } })); BufferSize = ((BaseUnityPlugin)this).Config.Bind("General", "BufferSize", 500, new ConfigDescription("Maximum number of log lines to keep in the buffer.", (AcceptableValueBase)(object)new AcceptableValueRange(100, 5000), new object[1] { new ConfigurationManagerAttributes { Order = 20 } })); BackgroundOpacity = ((BaseUnityPlugin)this).Config.Bind("General", "BackgroundOpacity", 80, new ConfigDescription("Background opacity of the log view window (0-100).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), new object[1] { new ConfigurationManagerAttributes { Order = 10 } })); WindowX = ((BaseUnityPlugin)this).Config.Bind("Window", "WindowX", 833, new ConfigDescription("Horizontal position of the log viewer window.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 40 } })); WindowY = ((BaseUnityPlugin)this).Config.Bind("Window", "WindowY", 1019, new ConfigDescription("Vertical position of the log viewer window.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 30 } })); WindowWidth = ((BaseUnityPlugin)this).Config.Bind("Window", "WindowWidth", 1507, new ConfigDescription("Width of the log viewer window.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 20 } })); WindowHeight = ((BaseUnityPlugin)this).Config.Bind("Window", "WindowHeight", 300, new ConfigDescription("Height of the log viewer window.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 10 } })); string[] array = new string[8] { "\\[ERROR\\]", "\\[WARNING\\]", "\\[DEBUG\\]|\\[DBG\\]", "\\[INFO\\]", "", "", "", "" }; string[] array2 = new string[8] { "red", "yellow", "cyan", "white", "", "", "", "" }; for (int i = 0; i < 8; i++) { int num = i + 1; int num2 = (8 - i) * 2; HighlightPattern[i] = ((BaseUnityPlugin)this).Config.Bind("Highlighting", $"Highlight{num}Pattern", array[i], new ConfigDescription($"Regex pattern for highlight rule {num}. Leave empty to disable.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = num2 } })); HighlightColor[i] = ((BaseUnityPlugin)this).Config.Bind("Highlighting", $"Highlight{num}Color", array2[i], new ConfigDescription($"Color for highlight rule {num} (e.g. red, yellow, cyan, green, blue, magenta, orange, white, or #RRGGBB hex).", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = num2 - 1 } })); } if (!Application.isBatchMode) { ((Component)this).gameObject.AddComponent(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"UnityLogViewer loaded!"); } } }