[Refactor-Minor]
- Refactored interface definition. - Plugin Loading System Refactor (incomplete).
This commit is contained in:
+6
-10
@@ -18,28 +18,24 @@ public interface IPluginManagementService : IReusableService
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="package"></param>
|
||||
/// <param name="namespacePrefix"></param>
|
||||
/// <param name="includeInterfaces"></param>
|
||||
/// <param name="includeAbstractTypes"></param>
|
||||
/// <param name="includeDefaultContext"></param>
|
||||
/// <param name="includeExplicitAssembliesOnly"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
FluentResults.Result<ImmutableArray<T>> GetTypes<T>(
|
||||
ContentPackage package = null,
|
||||
FluentResults.Result<ImmutableArray<Type>> GetImplementingTypes<T>(
|
||||
string namespacePrefix = null,
|
||||
bool includeInterfaces = false,
|
||||
bool includeAbstractTypes = false,
|
||||
bool includeDefaultContext = true,
|
||||
bool includeExplicitAssembliesOnly = false);
|
||||
|
||||
bool includeDefaultContext = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Tries to get the
|
||||
/// </summary>
|
||||
/// <param name="package"></param>
|
||||
/// <param name="typeName"></param>
|
||||
/// <returns></returns>
|
||||
FluentResults.Result<ImmutableArray<IAssemblyResourceInfo>> GetCachedAssembliesForPackage(ContentPackage package);
|
||||
Type GetType(string typeName);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
+6
-8
@@ -19,7 +19,7 @@ public interface IServicesProvider
|
||||
/// <param name="lifetimeInstance"></param>
|
||||
/// <typeparam name="TSvcInterface"></typeparam>
|
||||
/// <typeparam name="TService"></typeparam>
|
||||
void RegisterServiceType<TSvcInterface, TService>(ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IReusableService where TService : class, IReusableService, TSvcInterface;
|
||||
void RegisterServiceType<TSvcInterface, TService>(ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface;
|
||||
|
||||
/// <summary>
|
||||
/// Registers a type as a service for a given interface that can be requested by name.
|
||||
@@ -29,7 +29,7 @@ public interface IServicesProvider
|
||||
/// <param name="lifetimeInstance"></param>
|
||||
/// <typeparam name="TSvcInterface"></typeparam>
|
||||
/// <typeparam name="TService"></typeparam>
|
||||
void RegisterServiceType<TSvcInterface, TService>(string name, ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IReusableService where TService : class, IReusableService, TSvcInterface;
|
||||
void RegisterServiceType<TSvcInterface, TService>(string name, ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface;
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever a new service type for a given interface is implemented.
|
||||
@@ -58,27 +58,25 @@ public interface IServicesProvider
|
||||
/// Tries to get a service for the given interface, returns success/failure.
|
||||
/// </summary>
|
||||
/// <param name="service"></param>
|
||||
/// <param name="lifetime"></param>
|
||||
/// <typeparam name="TSvcInterface"></typeparam>
|
||||
/// <returns></returns>
|
||||
bool TryGetService<TSvcInterface>(out TSvcInterface service) where TSvcInterface : class, IReusableService;
|
||||
bool TryGetService<TSvcInterface>(out TSvcInterface service) where TSvcInterface : class, IService;
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get a service for the given name and interface, returns success/failure.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="service"></param>
|
||||
/// <param name="lifetime"></param>
|
||||
/// <typeparam name="TSvcInterface"></typeparam>
|
||||
/// <returns></returns>
|
||||
bool TryGetService<TSvcInterface>(string name, out TSvcInterface service) where TSvcInterface : class, IReusableService;
|
||||
bool TryGetService<TSvcInterface>(string name, out TSvcInterface service) where TSvcInterface : class, IService;
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever a new service is created/instanced.
|
||||
/// Args[0]: The interface type of the service.
|
||||
/// Args[1]: The instance of the service.
|
||||
/// </summary>
|
||||
event System.Action<Type, IReusableService> OnServiceInstanced;
|
||||
event System.Action<Type, IService> OnServiceInstanced;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -89,7 +87,7 @@ public interface IServicesProvider
|
||||
/// </summary>
|
||||
/// <typeparam name="TSvc"></typeparam>
|
||||
/// <returns></returns>
|
||||
ImmutableArray<TSvc> GetAllServices<TSvc>() where TSvc : class, IReusableService;
|
||||
ImmutableArray<TSvc> GetAllServices<TSvc>() where TSvc : class, IService;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
+3
-9
@@ -7,8 +7,7 @@ namespace Barotrauma.LuaCs.Services;
|
||||
|
||||
public interface IStorageService : IService
|
||||
{
|
||||
#region LocalGameData
|
||||
|
||||
// -- local game folder storage
|
||||
FluentResults.Result<XDocument> LoadLocalXml(ContentPackage package, string localFilePath);
|
||||
FluentResults.Result<byte[]> LoadLocalBinary(ContentPackage package, string localFilePath);
|
||||
FluentResults.Result<string> LoadLocalText(ContentPackage package, string localFilePath);
|
||||
@@ -22,10 +21,8 @@ public interface IStorageService : IService
|
||||
Task<FluentResults.Result> SaveLocalXmlAsync(ContentPackage package, string localFilePath, XDocument document);
|
||||
Task<FluentResults.Result> SaveLocalBinaryAsync(ContentPackage package, string localFilePath, byte[] bytes);
|
||||
Task<FluentResults.Result> SaveLocalTextAsync(ContentPackage package, string localFilePath, string text);
|
||||
|
||||
#endregion
|
||||
|
||||
#region ContentPackageData
|
||||
// -- package directory
|
||||
// singles
|
||||
FluentResults.Result<XDocument> LoadPackageXml(ContentPackage package, string localFilePath);
|
||||
FluentResults.Result<byte[]> LoadPackageBinary(ContentPackage package, string localFilePath);
|
||||
@@ -45,9 +42,7 @@ public interface IStorageService : IService
|
||||
Task<ImmutableArray<(string, FluentResults.Result<byte[]>)>> LoadPackageBinaryFilesAsync(ContentPackage package, ImmutableArray<string> localFilePaths);
|
||||
Task<ImmutableArray<(string, FluentResults.Result<string>)>> LoadPackageTextFilesAsync(ContentPackage package, ImmutableArray<string> localFilePaths);
|
||||
|
||||
#endregion
|
||||
|
||||
#region AbsolutePaths
|
||||
// -- absolute paths
|
||||
FluentResults.Result<XDocument> TryLoadXml(string filePath, Encoding encoding = null);
|
||||
FluentResults.Result<string> TryLoadText(string filePath, Encoding encoding = null);
|
||||
FluentResults.Result<byte[]> TryLoadBinary(string filePath);
|
||||
@@ -62,5 +57,4 @@ public interface IStorageService : IService
|
||||
Task<FluentResults.Result> TrySaveXmlAsync(string filePath, XDocument document, Encoding encoding = null);
|
||||
Task<FluentResults.Result> TrySaveTextAsync(string filePath, string text, Encoding encoding = null);
|
||||
Task<FluentResults.Result> TrySaveBinaryAsync(string filePath, byte[] bytes);
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user