mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Improves the plugin system documentation, tests and conventions
- Documents the book metadata DTOs and the Book aggregate constructor parameters - References ADR-0006 in the scan snapshot repository remarks, explaining the Dapper choice - Extracts shared plugin entity fixtures and uses them in the plugin and metadata provider tests - Moves PluginLoadResult to the Common DTO models, renaming it PluginLoadResultDto - Replaces the duplicate Contracts plugin setting type with the shared kernel enum - Removes the generated plugin view Designer file and its project wiring - Drops redundant braces in the plugin repositories
This commit is contained in:
1 parent
42566dcf06
commit
3653ff5bd7
25 files changed
+168
-321
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Plugins;
|
||||
using Lumina.Plugins.Contracts.Core.Plugins;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
@@ -9,13 +10,6 @@ using System.Reflection;
|
||||
|
||||
namespace Lumina.Infrastructure.Core.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Result of loading the plugins from the plugins directory.
|
||||
/// </summary>
|
||||
/// <param name="Plugins">The plugins that were loaded successfully.</param>
|
||||
/// <param name="Errors">The errors that occurred while loading the plugins.</param>
|
||||
internal sealed record PluginLoadResult(IReadOnlyList<IPlugin> Plugins, IReadOnlyList<string> Errors);
|
||||
|
||||
/// <summary>
|
||||
/// Loads the plugins from the plugins directory, discovers their descriptors and registers their services.
|
||||
/// </summary>
|
||||
@@ -27,13 +21,13 @@ internal static class PluginLoader
|
||||
/// <param name="pluginsDirectory">The directory where the plugin assemblies are located.</param>
|
||||
/// <param name="services">The service collection to which the plugin services are added.</param>
|
||||
/// <returns>The result of loading the plugins.</returns>
|
||||
public static PluginLoadResult LoadPlugins(string pluginsDirectory, IServiceCollection services)
|
||||
public static PluginLoadResultDto LoadPlugins(string pluginsDirectory, IServiceCollection services)
|
||||
{
|
||||
List<IPlugin> plugins = [];
|
||||
List<string> errors = [];
|
||||
|
||||
if (!Directory.Exists(pluginsDirectory))
|
||||
return new PluginLoadResult(plugins, errors);
|
||||
return new PluginLoadResultDto(plugins, errors);
|
||||
|
||||
foreach (string assemblyPath in Directory.EnumerateFiles(pluginsDirectory, "*.dll"))
|
||||
{
|
||||
@@ -60,6 +54,6 @@ internal static class PluginLoader
|
||||
}
|
||||
}
|
||||
|
||||
return new PluginLoadResult(plugins, errors);
|
||||
return new PluginLoadResultDto(plugins, errors);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user