mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 10:39:47 +00:00
Refactored
This commit is contained in:
parent
b91ffc3ed9
commit
12885a4fff
@ -15,22 +15,12 @@ public static partial class PluginFactory
|
|||||||
|
|
||||||
private static readonly string PLUGINS_ROOT = Path.Join(DATA_DIR, "plugins");
|
private static readonly string PLUGINS_ROOT = Path.Join(DATA_DIR, "plugins");
|
||||||
|
|
||||||
private static readonly Dictionary<IPluginMetadata, string> AVAILABLE_PLUGINS = new();
|
private static readonly List<IPluginMetadata> AVAILABLE_PLUGINS = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of all available plugins.
|
/// A list of all available plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IEnumerable<IPluginMetadata> AvailablePlugins => AVAILABLE_PLUGINS.Keys;
|
public static IReadOnlyCollection<IPluginMetadata> AvailablePlugins => AVAILABLE_PLUGINS;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of all enabled plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static IEnumerable<IPluginMetadata> EnabledPlugins => AVAILABLE_PLUGINS.Keys.Where(x => SETTINGS.ConfigurationData.EnabledPlugins.Contains(x.Id) || MANDATORY_INTERNAL_PLUGINS.Contains(x.Id));
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of all disabled plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static IEnumerable<IPluginMetadata> DisabledPlugins => AVAILABLE_PLUGINS.Keys.Where(x => !(SETTINGS.ConfigurationData.EnabledPlugins.Contains(x.Id) || MANDATORY_INTERNAL_PLUGINS.Contains(x.Id)));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to load all plugins from the plugins directory.
|
/// Try to load all plugins from the plugins directory.
|
||||||
@ -92,7 +82,7 @@ public static partial class PluginFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG.LogInformation($"Successfully loaded plugin: '{pluginMainFile}' (Id='{plugin.Id}', Type='{plugin.Type}', Name='{plugin.Name}', Version='{plugin.Version}', Authors='{string.Join(", ", plugin.Authors)}')");
|
LOG.LogInformation($"Successfully loaded plugin: '{pluginMainFile}' (Id='{plugin.Id}', Type='{plugin.Type}', Name='{plugin.Name}', Version='{plugin.Version}', Authors='{string.Join(", ", plugin.Authors)}')");
|
||||||
AVAILABLE_PLUGINS.Add(new PluginMetadata(plugin), pluginMainFile);
|
AVAILABLE_PLUGINS.Add(new PluginMetadata(plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user