mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Added BaseUnityPlugin.Metadata and some xmldocs
This commit is contained in:
1 parent
970438883c
commit
ab3509ed7b
2 files changed
+19
-4
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user