Browse Source

Added BaseUnityPlugin.Metadata and some xmldocs

ManlyMarco 5 years ago
parent
commit
ab3509ed7b
2 changed files with 19 additions and 4 deletions
  1. 1 1
      BepInEx/Contract/Attributes.cs
  2. 18 3
      BepInEx/Contract/BaseUnityPlugin.cs

+ 1 - 1
BepInEx/Contract/Attributes.cs

@@ -116,7 +116,7 @@ namespace BepInEx
 		/// <summary>
 		/// Retrieves the BepInPlugin metadata from a plugin type.
 		/// </summary>
-		/// <param name="plugin">The plugin type.</param>
+		/// <param name="pluginType">The plugin type.</param>
 		/// <returns>The BepInPlugin metadata of the plugin type.</returns>
 		public static BepInPlugin GetMetadata(Type pluginType)
 		{

+ 18 - 3
BepInEx/Contract/BaseUnityPlugin.cs

@@ -9,17 +9,32 @@ namespace BepInEx
 	/// </summary>
 	public abstract class BaseUnityPlugin : MonoBehaviour
 	{
+		/// <summary>
+		/// Information about this plugin as it was loaded.
+		/// </summary>
+		public BepInPlugin Metadata { get; }
+
+		/// <summary>
+		/// Logger instance tied to this plugin.
+		/// </summary>
 		protected ManualLogSource Logger { get; }
 
+		/// <summary>
+		/// Default config file tied to this plugin. The config file will not be created until 
+		/// any settings are added and changed, or <see cref="ConfigFile.Save"/> is called.
+		/// </summary>
 		protected ConfigFile Config { get; }
 
+		/// <summary>
+		/// Create a new instance of a plugin and all of its tied in objects.
+		/// </summary>
 		protected BaseUnityPlugin()
 		{
-			var metadata = MetadataHelper.GetMetadata(this);
+			Metadata = MetadataHelper.GetMetadata(this);
 
-			Logger = Logging.Logger.CreateLogSource(metadata.Name);
+			Logger = Logging.Logger.CreateLogSource(Metadata.Name);
 
-			Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false);
+			Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, Metadata.GUID + ".cfg"), false, this);
 		}
 	}
 }