- Some work on PluginManagementService, IAssemblyLoaderService and IAssemblyManagementService refactors.

- Fixed mod list sync not checking for zero package diff length.
- Fixed the services provider not being able to inject itself as a dependcency.
- Added UseInternalName data spec to ModConfig.xml
- Changed Basic.Reference.Assemblies to Net80.
This commit is contained in:
MapleWheels
2026-01-29 18:01:45 -05:00
committed by Maplewheels
parent 37e3a195dc
commit 13a9bc443e
13 changed files with 324 additions and 180 deletions
@@ -12,7 +12,7 @@ using OneOf;
namespace Barotrauma.LuaCs.Services;
public interface IAssemblyManagementService : IReusableService
public interface IAssemblyManagementService : IPluginManagementService
{
/// <summary>
@@ -22,17 +22,4 @@ public interface IAssemblyManagementService : IReusableService
/// <param name="excludedContexts">Guids of excluded contexts.</param>
/// <returns><b>On Success:</b> The assembly. <br/><b>On Failure:</b> nothing.</returns>
FluentResults.Result<Assembly> GetLoadedAssembly(OneOf<AssemblyName, string> assemblyName, in Guid[] excludedContexts);
/// <summary>
/// Gets all <see cref="MetadataReference"/> for all service-managed assemblies.
/// </summary>
/// <returns><see cref="MetadataReference"/> collection for all service-managed, and default if selected, assemblies, if any are found. Returns an empty collection otherwise.</returns>
ImmutableArray<MetadataReference> GetDefaultMetadataReferences(bool includeDefaultContext = true);
/// <summary>
/// Returns all active, managed assembly loaders.
/// </summary>
ImmutableArray<IAssemblyLoaderService> AssemblyLoaderServices { get; }
}
@@ -32,13 +32,6 @@ public interface IPluginManagementService : IReusableService
/// <returns></returns>
Type GetType(string typeName, bool isByRefType = false, bool includeInterfaces = false, bool includeDefaultContext = true);
/// <summary>
/// Loads the provided assembly resources in the order of their dependencies and intra-mod priority load order.
/// </summary>
/// <param name="resources"></param>
/// <returns>Success/Failure and list of failed resources, if any.</returns>
FluentResults.Result LoadAssemblyResources(ImmutableArray<IAssemblyResourceInfo> resources);
/// <summary>
/// Creates instances of the given type and provides Property Injection and instance reference caching. Disposes of
/// all references that throw errors on
@@ -50,6 +43,12 @@ public interface IPluginManagementService : IReusableService
ImmutableArray<FluentResults.Result<(Type, T)>> ActivateTypeInstances<T>(ImmutableArray<Type> types, bool serviceInjection = true,
bool hostInstanceReference = false) where T : IDisposable;
/// <summary>
/// Loads the provided assembly resources in the order of their dependencies and intra-mod priority load order.
/// </summary>
/// <param name="resources"></param>
/// <returns>Success/Failure and list of failed resources, if any.</returns>
FluentResults.Result LoadAssemblyResources(ImmutableArray<IAssemblyResourceInfo> resources);
/// <summary>
/// Unloads all managed <see cref="IAssemblyPlugin"/>, <see cref="Assembly"/>, and <see cref="IAssemblyLoaderService"/>s.