Browse Source

Moved IGenericEnhancedPlugin code into IEnhancedPlugin to aid backwards compatablility

pull/1/head
Anairkoen Schno 6 years ago
parent
commit
112906e906
2 changed files with 16 additions and 7 deletions
  1. +5
    -6
      IPA.Loader/Loader/PluginManager.cs
  2. +11
    -1
      IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs

+ 5
- 6
IPA.Loader/Loader/PluginManager.cs View File

@ -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;


+ 11
- 1
IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs View File

@ -8,7 +8,17 @@ namespace IPA.Old
/// An enhanced version of the standard IPA plugin.
/// </summary>
[Obsolete("When building plugins for Beat Saber, use IEnhancedBeatSaberPlugin")]
public interface IEnhancedPlugin : IPlugin, IGenericEnhancedPlugin
public interface IEnhancedPlugin : IPlugin
{
/// <summary>
/// Gets a list of executables this plugin should be executed on (without the file ending)
/// </summary>
/// <example>{ "PlayClub", "PlayClubStudio" }</example>
string[] Filter { get; }
/// <summary>
/// Called after Update.
/// </summary>
void OnLateUpdate();
}
}

Loading…
Cancel
Save