Bläddra i källkod

Seperate logger helper class

Bepis 7 år sedan
förälder
incheckning
15d9b066ae

+ 1 - 0
BepInEx/BepInEx.csproj

@@ -70,6 +70,7 @@
     <Compile Include="ConsoleUtil\SafeConsole.cs" />
     <Compile Include="Chainloader.cs" />
     <Compile Include="BaseUnityPlugin.cs" />
+    <Compile Include="Logger.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <Import Project="..\BepInEx.Common\BepInEx.Common.projitems" Label="Shared" />

+ 0 - 12
BepInEx/Chainloader.cs

@@ -18,18 +18,6 @@ namespace BepInEx
         public static GameObject ManagerObject { get; protected set; } = new GameObject("BepInEx_Manager");
 
 
-
-        public delegate void EntryLoggedEventHandler(string entry, bool show = false);
-
-        public static event EntryLoggedEventHandler EntryLogged;
-
-
-        public static void Log(string entry, bool show = false)
-        {
-            EntryLogged?.Invoke(entry, show);
-        }
-
-
         public static void Initialize()
         {
             if (loaded)

+ 20 - 0
BepInEx/Logger.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BepInEx
+{
+    public static class BepInLogger
+    {
+        public delegate void EntryLoggedEventHandler(string entry, bool show = false);
+
+        public static event EntryLoggedEventHandler EntryLogged;
+
+
+        public static void Log(string entry, bool show = false)
+        {
+            EntryLogged?.Invoke(entry, show);
+        }
+    }
+}

+ 1 - 1
Plugins/DeveloperConsole/DeveloperConsole.cs

@@ -19,7 +19,7 @@ namespace DeveloperConsole
 
         public DeveloperConsole()
         {
-            Chainloader.EntryLogged += (log, show) =>
+            BepInLogger.EntryLogged += (log, show) =>
             {
                 string current = $"{TotalLog}\r\n{log}";
                 if (current.Length > 2000)

+ 1 - 1
Plugins/DynamicTranslationLoader/DynamicTranslator.cs

@@ -103,7 +103,7 @@ namespace DynamicTranslationLoader
             if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.F10))
             {
                 Dump();
-                Chainloader.Log($"Text dumped to \"{Path.GetFullPath("dumped-tl.txt")}\"", true);
+                BepInLogger.Log($"Text dumped to \"{Path.GetFullPath("dumped-tl.txt")}\"", true);
             }
         }
         #endregion

+ 1 - 1
Plugins/ResourceRedirector/Loaders/BGMLoader.cs

@@ -31,7 +31,7 @@ namespace ResourceRedirector
                 if (File.Exists(path))
                 {
 
-                    Chainloader.Log($"Loading {path}");
+                    BepInLogger.Log($"Loading {path}");
 
                     result = new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadAudioClip(path, AudioType.WAV));
 

+ 3 - 3
Plugins/ResourceRedirector/ResourceRedirector.cs

@@ -55,7 +55,7 @@ namespace ResourceRedirector
                     if (!File.Exists(path))
                         return __result;
 
-                    Chainloader.Log($"Loading emulated asset {path}");
+                    BepInLogger.Log($"Loading emulated asset {path}");
 
                     return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadTexture(path));
                 }
@@ -66,7 +66,7 @@ namespace ResourceRedirector
                     if (!File.Exists(path))
                         return __result;
 
-                    Chainloader.Log($"Loading emulated asset {path}");
+                    BepInLogger.Log($"Loading emulated asset {path}");
 
                     return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadAudioClip(path, AudioType.WAV));
                 }
@@ -77,7 +77,7 @@ namespace ResourceRedirector
                     if (!File.Exists(path))
                         return __result;
 
-                    Chainloader.Log($"Loading emulated asset {path}");
+                    BepInLogger.Log($"Loading emulated asset {path}");
 
                     return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadTextAsset(path));
                 }

+ 2 - 2
Plugins/Screencap/ScreenshotManager.cs

@@ -49,7 +49,7 @@ namespace Screencap
             while (!File.Exists(filename))
                 yield return new WaitForSeconds(0.01f);
 
-            Chainloader.Log($"Screenshot saved to {filename}", true);
+            BepInLogger.Log($"Screenshot saved to {filename}", true);
         }
 
         void TakeCharScreenshot(string filename)
@@ -59,7 +59,7 @@ namespace Screencap
             File.WriteAllBytes(filename, tex.EncodeToPNG());
             Destroy(tex);
             Illusion.Game.Utils.Sound.Play(SystemSE.photo);
-            Chainloader.Log($"Character screenshot saved to {filename}", true);
+            BepInLogger.Log($"Character screenshot saved to {filename}", true);
         }
 
         Texture2D RenderCamera(Camera cam)