Accomodate breaking changes in preparation for api refactors

This commit is contained in:
aldelaro5 committed 2024-09-01 17:14:59 -04:00
1 parent 24cf635e65
commit 0a4f1d6d73
5 files changed
+11 -11

No files matched your search

+2 -2
View File
@@ -290,7 +290,7 @@ public static class MetadataHelper
/// </summary>
/// <param name="pluginType">The plugin type.</param>
/// <returns>The BepInPlugin metadata of the plugin type.</returns>
public static BepInPlugin GetPluginMetadata(Type pluginType)
public static BepInPlugin GetMetadata(Type pluginType)
{
var attributes = pluginType.GetCustomAttributes(typeof(BepInPlugin), false);
@@ -305,7 +305,7 @@ public static class MetadataHelper
/// </summary>
/// <param name="plugin">The plugin instance.</param>
/// <returns>The BepInPlugin metadata of the plugin instance.</returns>
public static BepInPlugin GetPluginMetadata(object plugin) => GetPluginMetadata(plugin.GetType());
public static BepInPlugin GetMetadata(object plugin) => GetMetadata(plugin.GetType());
/// <summary>
/// Retrieves the BepInPluginProvider metadata from a plugin type.
+1 -1
View File
@@ -13,7 +13,7 @@ internal interface IPlugin
/// <summary>
/// Logger instance tied to this plugin.
/// </summary>
ManualLogSource Logger { get; }
ManualLogSource Log { get; }
/// <summary>
/// Default config file tied to this plugin. The config file will not be created until
@@ -11,7 +11,7 @@ namespace BepInEx.NET.Common
{
protected BasePlugin()
{
var metadata = MetadataHelper.GetPluginMetadata(this);
var metadata = MetadataHelper.GetMetadata(this);
HarmonyInstance = new Harmony("BepInEx.Plugin." + metadata.GUID);
@@ -25,7 +25,7 @@ namespace BepInEx.NET.Common
throw new InvalidOperationException($"The plugin information for {metadata.GUID} couldn't be found on the chainloader");
}
Logger = BepInEx.Logging.Logger.CreateLogSource(metadata.Name);
Log = BepInEx.Logging.Logger.CreateLogSource(metadata.Name);
Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false, metadata);
}
@@ -34,7 +34,7 @@ namespace BepInEx.NET.Common
public PluginInfo Info { get; }
/// <inheritdoc />
public ManualLogSource Logger { get; }
public ManualLogSource Log { get; }
/// <inheritdoc />
public ConfigFile Config { get; }
@@ -11,7 +11,7 @@ public abstract class BasePlugin : IPlugin
{
protected BasePlugin()
{
var metadata = MetadataHelper.GetPluginMetadata(this);
var metadata = MetadataHelper.GetMetadata(this);
if (BaseChainloader<BasePlugin>.Instance.Plugins.TryGetValue(metadata.GUID, out var pluginInfo))
{
@@ -23,14 +23,14 @@ public abstract class BasePlugin : IPlugin
throw new InvalidOperationException($"The plugin information for {metadata.GUID} couldn't be found on the chainloader");
}
Logger = BepInEx.Logging.Logger.CreateLogSource(metadata.Name);
Log = BepInEx.Logging.Logger.CreateLogSource(metadata.Name);
Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false, metadata);
}
public PluginInfo Info { get; }
public ManualLogSource Logger { get; }
public ManualLogSource Log { get; }
public ConfigFile Config { get; }
@@ -10,7 +10,7 @@ namespace BepInEx.Unity.Mono;
/// <summary>
/// The base plugin type that is used by the BepInEx plugin loader.
/// </summary>
public abstract class BaseUnityPlugin : MonoBehaviour, IPlugin
public abstract class BaseUnityPlugin : MonoBehaviour
{
/// <summary>
/// Create a new instance of a plugin and all of its tied in objects.
@@ -18,7 +18,7 @@ public abstract class BaseUnityPlugin : MonoBehaviour, IPlugin
/// <exception cref="InvalidOperationException">BepInPlugin attribute is missing.</exception>
protected BaseUnityPlugin()
{
var metadata = MetadataHelper.GetPluginMetadata(this);
var metadata = MetadataHelper.GetMetadata(this);
if (metadata == null)
throw new InvalidOperationException("Can't create an instance of " + GetType().FullName +
" because it inherits from BaseUnityPlugin and the BepInPlugin attribute is missing.");