IW4M-Admin/SharedLibraryCore/Interfaces/IManager.cs

107 lines
3.8 KiB
C#
Raw Normal View History

2022-01-26 11:32:16 -05:00
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
2018-04-08 02:44:42 -04:00
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database.Models;
2022-01-26 11:32:16 -05:00
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Services;
2018-04-08 02:44:42 -04:00
namespace SharedLibraryCore.Interfaces
{
public interface IManager
{
2022-01-26 11:32:16 -05:00
IReadOnlyList<IManagerCommand> Commands { get; }
/// <summary>
/// enumerates the registered plugin instances
/// </summary>
IEnumerable<IPlugin> Plugins { get; }
IList<IRConParser> AdditionalRConParsers { get; }
IList<IEventParser> AdditionalEventParsers { get; }
IMiddlewareActionHandler MiddlewareActionHandler { get; }
string Version { get; }
ITokenAuthentication TokenAuthenticator { get; }
string ExternalIPAddress { get; }
CancellationToken CancellationToken { get; }
bool IsRestartRequested { get; }
bool IsRunning { get; }
ConcurrentDictionary<long, GameEvent> ProcessingEvents { get; }
2018-03-06 02:22:19 -05:00
Task Init();
Task Start();
Task Stop();
void Restart();
2022-01-26 11:32:16 -05:00
[Obsolete]
ILogger GetLogger(long serverId);
2022-01-26 11:32:16 -05:00
IList<Server> GetServers();
IList<IManagerCommand> GetCommands();
2022-01-26 11:32:16 -05:00
IList<MessageToken> GetMessageTokens();
IList<EFClient> GetActiveClients();
2021-10-31 12:57:32 -04:00
EFClient FindActiveClient(EFClient client);
IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings();
2018-03-06 02:22:19 -05:00
ClientService GetClientService();
PenaltyService GetPenaltyService();
2022-01-26 11:32:16 -05:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// provides a page list to add and remove from
/// </summary>
/// <returns></returns>
IPageList GetPageList();
2022-01-26 11:32:16 -05:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// provides a method to execute database operations by name without exposing the
/// service level methods
/// todo: this could be made obsolete by creating a seperate service library with more concrete definitions
/// </summary>
/// <param name="operationName"></param>
/// <returns></returns>
Task<IList<T>> ExecuteSharedDatabaseOperation<T>(string operationName);
2022-01-26 11:32:16 -05:00
void RegisterSharedDatabaseOperation(Task<IList> operation, string operationName);
/// <summary>
2022-01-26 11:32:16 -05:00
/// generates an rcon parser that can be configured by script plugins
/// </summary>
/// <param name="name">name of the RCon parser</param>
/// <returns>new rcon parser instance</returns>
IRConParser GenerateDynamicRConParser(string name);
/// <summary>
2022-01-26 11:32:16 -05:00
/// Generates an event parser that can be configured by script plugins
/// </summary>
/// <param name="name">name of the event parser</param>
/// <returns>new event parser instance</returns>
IEventParser GenerateDynamicEventParser(string name);
2022-01-26 11:32:16 -05:00
Task ExecuteEvent(GameEvent gameEvent);
2022-01-26 11:32:16 -05:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// queues an event for processing
/// </summary>
/// <param name="gameEvent">event to be processed</param>
void AddEvent(GameEvent gameEvent);
2022-01-26 11:32:16 -05:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// adds an additional (script) command to the command list
/// </summary>
/// <param name="command"></param>
void AddAdditionalCommand(IManagerCommand command);
2022-01-26 11:32:16 -05:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// removes a command by its name
/// </summary>
/// <param name="name">name of command</param>
void RemoveCommandByName(string name);
2022-01-26 11:32:16 -05:00
2020-05-22 22:38:38 -04:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// event executed when event has finished executing
2020-05-22 22:38:38 -04:00
/// </summary>
event EventHandler<GameEvent> OnGameEventExecuted;
}
}