From 9a50f697796cc5a5e282d61058b4498e1e1ba82b Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 19 Nov 2018 10:12:13 -0600 Subject: [PATCH] Moved IGenericEnhancedPlugin code into IEnhancedPlugin to aid backwards compatablility --- IPA.Loader/Loader/PluginManager.cs | 11 +++++------ IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs | 12 +++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index b8c2e6b9..0322d705 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -137,7 +137,6 @@ namespace IPA.Loader foreach (string s in originalPlugins) { string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s)); - File.Copy(Path.Combine(pluginDirectory, s), pluginCopy); #region Fix assemblies for refactor @@ -182,7 +181,7 @@ namespace IPA.Loader var selfPlugin = new PluginInfo { - Filename = Path.Combine(Environment.CurrentDirectory, "IPA.exe"), + Filename = Path.Combine(BeatSaber.InstallPath, "IPA.exe"), Plugin = SelfPlugin.Instance }; selfPlugin.ModSaberInfo = selfPlugin.Plugin.ModInfo; @@ -237,10 +236,10 @@ namespace IPA.Loader T pluginInstance = Activator.CreateInstance(t) as T; string[] filter = null; - if (pluginInstance is IGenericEnhancedPlugin) - { - filter = ((IGenericEnhancedPlugin)pluginInstance).Filter; - } + if (typeof(T) == typeof(IPlugin) && pluginInstance is IEnhancedPlugin enhancedPlugin) + filter = enhancedPlugin.Filter; + else if (pluginInstance is IGenericEnhancedPlugin plugin) + filter = plugin.Filter; if (filter == null || filter.Contains(exeName, StringComparer.OrdinalIgnoreCase)) return pluginInstance; diff --git a/IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs b/IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs index 054f0933..4db7fa06 100644 --- a/IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs +++ b/IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs @@ -8,7 +8,17 @@ namespace IPA.Old /// An enhanced version of the standard IPA plugin. /// [Obsolete("When building plugins for Beat Saber, use IEnhancedBeatSaberPlugin")] - public interface IEnhancedPlugin : IPlugin, IGenericEnhancedPlugin + public interface IEnhancedPlugin : IPlugin { + /// + /// Gets a list of executables this plugin should be executed on (without the file ending) + /// + /// { "PlayClub", "PlayClubStudio" } + string[] Filter { get; } + + /// + /// Called after Update. + /// + void OnLateUpdate(); } } \ No newline at end of file