Browse Source

Add debug info attribute

Bepis 6 years ago
parent
commit
2cf9d34fdb
2 changed files with 32 additions and 0 deletions
  1. 14 0
      BepInEx/Bootstrap/Preloader.cs
  2. 18 0
      BepInEx/Contract/Attributes.cs

+ 14 - 0
BepInEx/Bootstrap/Preloader.cs

@@ -58,6 +58,20 @@ namespace BepInEx.Bootstrap
 				Logger.SetLogger(PreloaderLog);
 
 				PreloaderLog.WriteLine(consoleTile);
+
+				#if DEBUG
+
+				object[] attributes = typeof(DebugInfoAttribute).Assembly.GetCustomAttributes(typeof(DebugInfoAttribute), false);
+				
+				if (attributes.Length > 0)
+				{
+					var attribute = (DebugInfoAttribute)attributes[0];
+
+					PreloaderLog.WriteLine(attribute.Info);
+				}
+
+				#endif
+
 				Logger.Log(LogLevel.Message, "Preloader started");
 
 				string entrypointAssembly = Config.GetEntry("entrypoint-assembly", "UnityEngine.dll", "Preloader");

+ 18 - 0
BepInEx/Contract/Attributes.cs

@@ -196,4 +196,22 @@ namespace BepInEx
     }
 
     #endregion
+
+	#region Debug
+
+	#if DEBUG
+
+	public class DebugInfoAttribute : Attribute
+	{
+		public string Info { get; }
+
+		public DebugInfoAttribute(string info)
+		{
+			Info = info;
+		}
+	}
+
+	#endif
+
+	#endregion
 }