2017-06-01 13:42:28 -04:00
|
|
|
|
using System.Collections.Generic;
|
2018-04-08 14:48:40 -04:00
|
|
|
|
using System.Threading.Tasks;
|
2018-04-08 02:44:42 -04:00
|
|
|
|
using SharedLibraryCore.Services;
|
|
|
|
|
using SharedLibraryCore.Configuration;
|
2018-11-05 22:01:29 -05:00
|
|
|
|
using SharedLibraryCore.Database.Models;
|
2019-05-08 21:34:17 -04:00
|
|
|
|
using System.Threading;
|
2019-07-16 16:27:19 -04:00
|
|
|
|
using System.Collections;
|
2020-05-22 22:38:38 -04:00
|
|
|
|
using System;
|
2021-01-17 22:58:18 -05:00
|
|
|
|
using System.Collections.Concurrent;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Interfaces
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
|
|
|
|
public interface IManager
|
|
|
|
|
{
|
2018-03-06 02:22:19 -05:00
|
|
|
|
Task Init();
|
2019-05-08 21:34:17 -04:00
|
|
|
|
Task Start();
|
2017-05-26 18:49:27 -04:00
|
|
|
|
void Stop();
|
2019-05-08 21:34:17 -04:00
|
|
|
|
void Restart();
|
2020-11-11 18:31:26 -05:00
|
|
|
|
[Obsolete]
|
2018-11-27 19:31:48 -05:00
|
|
|
|
ILogger GetLogger(long serverId);
|
2017-09-29 22:42:24 -04:00
|
|
|
|
IList<Server> GetServers();
|
2020-01-31 21:15:07 -05:00
|
|
|
|
IList<IManagerCommand> GetCommands();
|
2017-06-12 17:47:31 -04:00
|
|
|
|
IList<Helpers.MessageToken> GetMessageTokens();
|
2018-11-05 22:01:29 -05:00
|
|
|
|
IList<EFClient> GetActiveClients();
|
2021-10-31 12:57:32 -04:00
|
|
|
|
EFClient FindActiveClient(EFClient client);
|
2018-03-18 22:25:11 -04:00
|
|
|
|
IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings();
|
2018-03-06 02:22:19 -05:00
|
|
|
|
ClientService GetClientService();
|
2017-11-25 20:29:58 -05:00
|
|
|
|
PenaltyService GetPenaltyService();
|
2018-04-26 02:13:04 -04:00
|
|
|
|
/// <summary>
|
2020-02-11 17:44:06 -05:00
|
|
|
|
/// enumerates the registered plugin instances
|
|
|
|
|
/// </summary>
|
|
|
|
|
IEnumerable<IPlugin> Plugins { get; }
|
2018-08-03 18:10:20 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// provides a page list to add and remove from
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
IPageList GetPageList();
|
2019-01-26 21:33:37 -05:00
|
|
|
|
IList<IRConParser> AdditionalRConParsers { get; }
|
|
|
|
|
IList<IEventParser> AdditionalEventParsers { get; }
|
2019-07-16 16:27:19 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 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);
|
|
|
|
|
void RegisterSharedDatabaseOperation(Task<IList> operation, string operationName);
|
2019-07-27 09:18:49 -04:00
|
|
|
|
IMiddlewareActionHandler MiddlewareActionHandler { get; }
|
2020-01-21 19:08:18 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 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>
|
|
|
|
|
/// 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);
|
2018-09-16 16:34:16 -04:00
|
|
|
|
string Version { get;}
|
2019-02-15 23:19:59 -05:00
|
|
|
|
ITokenAuthentication TokenAuthenticator { get; }
|
2019-04-08 13:29:48 -04:00
|
|
|
|
string ExternalIPAddress { get; }
|
2019-05-08 21:34:17 -04:00
|
|
|
|
CancellationToken CancellationToken { get; }
|
|
|
|
|
bool IsRestartRequested { get; }
|
2020-05-04 17:50:02 -04:00
|
|
|
|
bool IsRunning { get; }
|
2019-11-15 15:50:20 -05:00
|
|
|
|
Task ExecuteEvent(GameEvent gameEvent);
|
2020-05-04 17:50:02 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// queues an event for processing
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="gameEvent">event to be processed</param>
|
|
|
|
|
void AddEvent(GameEvent gameEvent);
|
2020-05-11 17:10:43 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// adds an additional (script) command to the command list
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="command"></param>
|
|
|
|
|
void AddAdditionalCommand(IManagerCommand command);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// removes a command by its name
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">name of command</param>
|
|
|
|
|
void RemoveCommandByName(string name);
|
2020-05-22 22:38:38 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// event executed when event has finished executing
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GameEvent> OnGameEventExecuted;
|
2021-01-17 22:58:18 -05:00
|
|
|
|
ConcurrentDictionary<long, GameEvent> ProcessingEvents { get; }
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
}
|