mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Integrates the plugin system into the host and the media library scan pipeline
This commit is contained in:
1 parent
f71e72a948
commit
6f501a51f3
45 files changed
+1268
-370
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Infrastructure.Plugins;
|
||||
using Lumina.Plugins.Contracts.Core.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Core.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Manager of the plugins loaded by the host application.
|
||||
/// </summary>
|
||||
internal sealed class PluginManager : IPluginManager
|
||||
{
|
||||
private readonly IReadOnlyDictionary<Guid, IPlugin> _pluginsById;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
||||
/// </summary>
|
||||
/// <param name="plugins">The plugins that were loaded successfully.</param>
|
||||
public PluginManager(IEnumerable<IPlugin> plugins)
|
||||
{
|
||||
_pluginsById = plugins.ToDictionary(plugin => plugin.Id);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyList<IPlugin> GetPlugins()
|
||||
{
|
||||
return [.. _pluginsById.Values];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IPlugin? GetPlugin(Guid pluginId)
|
||||
{
|
||||
return _pluginsById.GetValueOrDefault(pluginId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user