refactor a good bit of stuff for better dependency injection
fix regular expression for T6 log parsing
This commit is contained in:
14
SharedLibraryCore/Interfaces/IBasePathProvider.cs
Normal file
14
SharedLibraryCore/Interfaces/IBasePathProvider.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the capabilities for providing a base path
|
||||
/// unused as of now, will be used later during refactorying
|
||||
/// </summary>
|
||||
public interface IBasePathProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// working directory of IW4MAdmin
|
||||
/// </summary>
|
||||
string BasePath { get; }
|
||||
}
|
||||
}
|
17
SharedLibraryCore/Interfaces/IConfigurationHandlerFactory.cs
Normal file
17
SharedLibraryCore/Interfaces/IConfigurationHandlerFactory.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the capabilities of the configuration handler factory
|
||||
/// used to generate new instance of configuration handlers
|
||||
/// </summary>
|
||||
public interface IConfigurationHandlerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// generates a new configuration handler
|
||||
/// </summary>
|
||||
/// <typeparam name="T">base configuration type</typeparam>
|
||||
/// <param name="name">file name of configuration</param>
|
||||
/// <returns>new configuration handler instance</returns>
|
||||
IConfigurationHandler<T> GetConfigurationHandler<T>(string name) where T : IBaseConfiguration;
|
||||
}
|
||||
}
|
18
SharedLibraryCore/Interfaces/IGameServerInstanceFactory.cs
Normal file
18
SharedLibraryCore/Interfaces/IGameServerInstanceFactory.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using SharedLibraryCore.Configuration;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the capabilities of game server instance factory
|
||||
/// </summary>
|
||||
public interface IGameServerInstanceFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// creates the instance of a game server
|
||||
/// </summary>
|
||||
/// <param name="config">server configuration</param>
|
||||
/// <param name="manager">application manager</param>
|
||||
/// <returns></returns>
|
||||
Server CreateServer(ServerConfiguration config, IManager manager);
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Services;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using System.Reflection;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
@ -29,7 +28,10 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// </summary>
|
||||
/// <returns>EventHandler for the manager</returns>
|
||||
IEventHandler GetEventHandler();
|
||||
IList<Assembly> GetPluginAssemblies();
|
||||
/// <summary>
|
||||
/// enumerates the registered plugin instances
|
||||
/// </summary>
|
||||
IEnumerable<IPlugin> Plugins { get; }
|
||||
/// <summary>
|
||||
/// provides a page list to add and remove from
|
||||
/// </summary>
|
||||
|
@ -1,32 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the capabilities of the plugin importer
|
||||
/// defines the capabilities of the plugin importer
|
||||
/// </summary>
|
||||
public interface IPluginImporter
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Command types that are defined in plugin assemblies
|
||||
/// discovers C# assembly plugin and command types
|
||||
/// </summary>
|
||||
IList<Type> CommandTypes { get; }
|
||||
/// <returns>tuple of IPlugin implementation type definitions, and IManagerCommand type definitions</returns>
|
||||
(IEnumerable<Type>, IEnumerable<Type>) DiscoverAssemblyPluginImplementations();
|
||||
|
||||
/// <summary>
|
||||
/// The loaded plugins from plugin assemblies
|
||||
/// discovers the script plugins
|
||||
/// </summary>
|
||||
IList<IPlugin> ActivePlugins { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Assemblies that contain plugins
|
||||
/// </summary>
|
||||
IList<Assembly> PluginAssemblies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// All assemblies in the plugin folder
|
||||
/// </summary>
|
||||
IList<Assembly> Assemblies { get; }
|
||||
/// <returns>initialized script plugin collection</returns>
|
||||
IEnumerable<IPlugin> DiscoverScriptPlugins();
|
||||
}
|
||||
}
|
||||
|
25
SharedLibraryCore/Interfaces/IRConConnection.cs
Normal file
25
SharedLibraryCore/Interfaces/IRConConnection.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using SharedLibraryCore.RCon;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the capabilities of an RCon connection
|
||||
/// </summary>
|
||||
public interface IRConConnection
|
||||
{
|
||||
/// <summary>
|
||||
/// sends a query with the instance of the rcon connection
|
||||
/// </summary>
|
||||
/// <param name="type">type of RCon query to perform</param>
|
||||
/// <param name="parameters">optional parameter list</param>
|
||||
/// <returns></returns>
|
||||
Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "");
|
||||
|
||||
/// <summary>
|
||||
/// sets the rcon parser configuration
|
||||
/// </summary>
|
||||
/// <param name="config">parser config</param>
|
||||
void SetConfiguration(IRConParserConfiguration config);
|
||||
}
|
||||
}
|
17
SharedLibraryCore/Interfaces/IRConConnectionFactory.cs
Normal file
17
SharedLibraryCore/Interfaces/IRConConnectionFactory.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the capabilities of an RCon connection factory
|
||||
/// </summary>
|
||||
public interface IRConConnectionFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// creates an rcon connection instance
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">ip address of the server</param>
|
||||
/// <param name="port">port of the server</param>
|
||||
/// <param name="password"> password of the server</param>
|
||||
/// <returns>instance of rcon connection</returns>
|
||||
IRConConnection CreateConnection(string ipAddress, int port, string password);
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.RCon;
|
||||
using static SharedLibraryCore.Server;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
@ -15,7 +14,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="connection">RCon connection to retrieve with</param>
|
||||
/// <param name="dvarName">name of DVAR</param>
|
||||
/// <returns></returns>
|
||||
Task<Dvar<T>> GetDvarAsync<T>(Connection connection, string dvarName);
|
||||
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName);
|
||||
|
||||
/// <summary>
|
||||
/// set value of DVAR by name
|
||||
@ -24,7 +23,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="dvarName">name of DVAR to set</param>
|
||||
/// <param name="dvarValue">value to set DVAR to</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetDvarAsync(Connection connection, string dvarName, object dvarValue);
|
||||
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue);
|
||||
|
||||
/// <summary>
|
||||
/// executes a console command on the server
|
||||
@ -32,14 +31,14 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="connection">RCon connection to use</param>
|
||||
/// <param name="command">console command to execute</param>
|
||||
/// <returns></returns>
|
||||
Task<string[]> ExecuteCommandAsync(Connection connection, string command);
|
||||
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command);
|
||||
|
||||
/// <summary>
|
||||
/// get the list of connected clients from status response
|
||||
/// </summary>
|
||||
/// <param name="connection">RCon connection to use</param>
|
||||
/// <returns>list of clients, and current map</returns>
|
||||
Task<(List<EFClient>, string)> GetStatusAsync(Connection connection);
|
||||
Task<(List<EFClient>, string)> GetStatusAsync(IRConConnection connection);
|
||||
|
||||
/// <summary>
|
||||
/// stores the RCon configuration
|
||||
|
Reference in New Issue
Block a user