Browse Source

Fixed patching chainloader breaking console title version; Fixed console title potentially not being set when using hard patcher

ManlyMarco 5 years ago
parent
commit
e0edca64db
1 changed files with 4 additions and 3 deletions
  1. 4 3
      BepInEx/Bootstrap/Chainloader.cs

+ 4 - 3
BepInEx/Bootstrap/Chainloader.cs

@@ -2,6 +2,7 @@
 using BepInEx.Logging;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -99,7 +100,7 @@ namespace BepInEx.Bootstrap
 			// Temporarily disable the console log listener as we replay the preloader logs
 
 			var logListener = Logger.Listeners.FirstOrDefault(logger => logger is ConsoleLogListener);
-			
+
 			if (logListener != null)
 				Logger.Listeners.Remove(logListener);
 
@@ -182,6 +183,7 @@ namespace BepInEx.Bootstrap
 		}
 
 		private static readonly string CurrentAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
+		private static readonly Version CurrentAssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
 
 		private static bool HasBepinPlugins(AssemblyDefinition ass)
 		{
@@ -213,8 +215,7 @@ namespace BepInEx.Bootstrap
 			try
 			{
 				var productNameProp = typeof(Application).GetProperty("productName", BindingFlags.Public | BindingFlags.Static);
-				if (productNameProp != null)
-					ConsoleWindow.Title = $"BepInEx {Assembly.GetExecutingAssembly().GetName().Version} - {productNameProp.GetValue(null, null)}";
+				ConsoleWindow.Title = $"{CurrentAssemblyName} {CurrentAssemblyVersion} - {productNameProp?.GetValue(null, null) ?? Process.GetCurrentProcess().ProcessName}";
 
 				Logger.LogMessage("Chainloader started");