Browse Source

Add console title changing

Bepis 6 years ago
parent
commit
54054ebf06
2 changed files with 10 additions and 4 deletions
  1. 4 1
      BepInEx/Bootstrap/Chainloader.cs
  2. 6 3
      BepInEx/Bootstrap/Preloader.cs

+ 4 - 1
BepInEx/Bootstrap/Chainloader.cs

@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using BepInEx.Logging;
 using UnityEngine;
 using UnityLogWriter = BepInEx.Logging.UnityLogWriter;
@@ -46,10 +47,12 @@ namespace BepInEx.Bootstrap
                 UnityLogWriter unityLogWriter = new UnityLogWriter();
 
 			    if (Preloader.PreloaderLog != null)
-			        unityLogWriter.WriteToLog(Preloader.PreloaderLog.ToString());
+			        unityLogWriter.WriteToLog($"{Preloader.PreloaderLog}\r\n");
 
                 Logger.SetLogger(unityLogWriter);
 
+			    string consoleTile = $"BepInEx {Assembly.GetExecutingAssembly().GetName().Version} - {Application.productName}";
+			    Console.Title = consoleTile;
                 
 				Logger.Log(LogLevel.Message, "Chainloader started");
 

+ 6 - 3
BepInEx/Bootstrap/Preloader.cs

@@ -101,11 +101,14 @@ namespace BepInEx.Bootstrap
                 PreloaderLog = new PreloaderLogWriter(TryGetConfigBool("preloader-logconsole", "false"));
                 PreloaderLog.Enabled = true;
 
-                Logger.SetLogger(PreloaderLog);
+                string consoleTile = $"BepInEx {Assembly.GetExecutingAssembly().GetName().Version} - {Process.GetCurrentProcess().ProcessName}";
+                Console.Title = consoleTile;
 
-                Logger.CurrentLogger.WriteLine($"BepInEx {Assembly.GetExecutingAssembly().GetName().Version}");
-                Logger.Log(LogLevel.Message, "Preloader started");
 
+                Logger.SetLogger(PreloaderLog);
+                
+                PreloaderLog.WriteLine(consoleTile);
+                Logger.Log(LogLevel.Message, "Preloader started");
 
 
                 AddPatcher("UnityEngine.dll", PatchEntrypoint);