From ea42dd8392b6938c86c39d333b83ebdd29d65f4f Mon Sep 17 00:00:00 2001 From: 1A3 Date: Wed, 17 Jan 2024 16:22:08 +0000 Subject: [PATCH 1/3] Config option to disable logging to disk --- src/Config/ConfigManager.cs | 5 +++++ src/UI/Panels/LogPanel.cs | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index f04c5dd5..61d1f553 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -27,6 +27,7 @@ public static class ConfigManager public static ConfigElement UI_MouseInspect_Keybind; public static ConfigElement CSConsole_Assembly_Blacklist; public static ConfigElement Reflection_Signature_Blacklist; + public static ConfigElement Save_Logs; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } @@ -140,6 +141,10 @@ private static void CreateConfigElements() "Seperate signatures with a semicolon ';'.\r\n" + "For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'", ""); + + Save_Logs = new("Save Logs To Disk", + "Should the log files be saved to disk?", + false); } } } diff --git a/src/UI/Panels/LogPanel.cs b/src/UI/Panels/LogPanel.cs index 7a010b8a..9c3625a3 100644 --- a/src/UI/Panels/LogPanel.cs +++ b/src/UI/Panels/LogPanel.cs @@ -73,7 +73,8 @@ private void SetupIO() File.Delete(files[i]); } - File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); + if (ConfigManager.Save_Logs.Value) + File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); } // Logging @@ -82,7 +83,7 @@ public static void Log(string message, LogType type) { Logs.Add(new LogInfo(message, type)); - if (CurrentStreamPath != null) + if (CurrentStreamPath != null && ConfigManager.Save_Logs.Value) File.AppendAllText(CurrentStreamPath, '\n' + message); if (logScrollPool != null) From 61ee3bda6d491f6f25485f26101fa76700ea0365 Mon Sep 17 00:00:00 2001 From: 1A3 Date: Wed, 17 Jan 2024 16:27:11 +0000 Subject: [PATCH 2/3] renamed to make more sense --- src/Config/ConfigManager.cs | 10 +++++----- src/UI/Panels/LogPanel.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index 61d1f553..87b6ceec 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -22,12 +22,12 @@ public static class ConfigManager public static ConfigElement Default_Output_Path; public static ConfigElement DnSpy_Path; public static ConfigElement Log_Unity_Debug; + public static ConfigElement Log_To_Disk; public static ConfigElement Main_Navbar_Anchor; public static ConfigElement World_MouseInspect_Keybind; public static ConfigElement UI_MouseInspect_Keybind; public static ConfigElement CSConsole_Assembly_Blacklist; public static ConfigElement Reflection_Signature_Blacklist; - public static ConfigElement Save_Logs; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } @@ -122,6 +122,10 @@ private static void CreateConfigElements() "Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?", false); + Log_To_Disk = new("Log To Disk", + "Should UnityExplorer save log files to the disk?", + false); + World_MouseInspect_Keybind = new("World Mouse-Inspect Keybind", "Optional keybind to being a World-mode Mouse Inspect.", KeyCode.None); @@ -141,10 +145,6 @@ private static void CreateConfigElements() "Seperate signatures with a semicolon ';'.\r\n" + "For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'", ""); - - Save_Logs = new("Save Logs To Disk", - "Should the log files be saved to disk?", - false); } } } diff --git a/src/UI/Panels/LogPanel.cs b/src/UI/Panels/LogPanel.cs index 9c3625a3..ed70757b 100644 --- a/src/UI/Panels/LogPanel.cs +++ b/src/UI/Panels/LogPanel.cs @@ -73,7 +73,7 @@ private void SetupIO() File.Delete(files[i]); } - if (ConfigManager.Save_Logs.Value) + if (ConfigManager.Log_To_Disk.Value) File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); } @@ -83,7 +83,7 @@ public static void Log(string message, LogType type) { Logs.Add(new LogInfo(message, type)); - if (CurrentStreamPath != null && ConfigManager.Save_Logs.Value) + if (CurrentStreamPath != null && ConfigManager.Log_To_Disk.Value) File.AppendAllText(CurrentStreamPath, '\n' + message); if (logScrollPool != null) From 9ee62ef32005616cba2e49dbd95873fea50b7f0c Mon Sep 17 00:00:00 2001 From: Jenson R Date: Thu, 18 Jan 2024 02:04:13 +0000 Subject: [PATCH 3/3] Changed default state to true --- src/Config/ConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index 87b6ceec..1c5de260 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -124,7 +124,7 @@ private static void CreateConfigElements() Log_To_Disk = new("Log To Disk", "Should UnityExplorer save log files to the disk?", - false); + true); World_MouseInspect_Keybind = new("World Mouse-Inspect Keybind", "Optional keybind to being a World-mode Mouse Inspect.",