You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.7 KiB

  1. namespace IPA.Loader.Features
  2. {
  3. /// <summary>
  4. /// The root interface for a mod Feature.
  5. /// </summary>
  6. public abstract class Feature
  7. {
  8. /// <summary>
  9. /// Initializes the feature with the parameters provided in the definition.
  10. ///
  11. /// Note: When no parenthesis are provided, <paramref name="parameters"/> is null.
  12. /// </summary>
  13. /// <param name="meta">the metadata of the plugin that is being prepared</param>
  14. /// <param name="parameters">the parameters passed to the feature definition, or null</param>
  15. /// <returns><see langword="true"/> if the feature is valid for the plugin, <see langword="false"/> otherwise</returns>
  16. public abstract bool Initialize(PluginLoader.PluginMetadata meta, string[] parameters);
  17. /// <summary>
  18. /// Called before a plugin is loaded.
  19. /// </summary>
  20. /// <param name="plugin">the plugin about to be loaded</param>
  21. /// <returns>whether or not the plugin should be loaded</returns>
  22. public virtual bool BeforeLoad(PluginLoader.PluginMetadata plugin) => true;
  23. /// <summary>
  24. /// Called before a plugin's Init method is called.
  25. /// </summary>
  26. /// <param name="plugin">the plugin to be initialized</param>
  27. /// <returns>whether or not to call the Init method</returns>
  28. public virtual bool BeforeInit(PluginLoader.PluginInfo plugin) => true;
  29. /// <summary>
  30. /// Called after a plugin has been fully initialized, whether or not there is an Init method.
  31. /// </summary>
  32. /// <param name="plugin">the plugin that was just initialized</param>
  33. public virtual void AfterInit(PluginLoader.PluginInfo plugin) { }
  34. }
  35. }