Initial .net 6 upgrades

This commit is contained in:
RaidMax
2022-01-26 10:32:16 -06:00
parent e4cb3abb20
commit a602e8caed
170 changed files with 2805 additions and 2577 deletions

View File

@ -1,19 +1,19 @@
using SharedLibraryCore.Dtos;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using SharedLibraryCore.Dtos;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// describes the capabilities of the audit info repository
/// describes the capabilities of the audit info repository
/// </summary>
public interface IAuditInformationRepository
{
/// <summary>
/// retrieves a list of audit information for given pagination params
/// retrieves a list of audit information for given pagination params
/// </summary>
/// <param name="paginationInfo">pagination info</param>
/// <returns></returns>
Task<IList<AuditInfo>> ListAuditInformation(PaginationRequest paginationInfo);
}
}
}

View File

@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IBaseConfiguration
{
string Name();
IBaseConfiguration Generate();
}
}
}

View File

@ -1,14 +1,14 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities for providing a base path
/// unused as of now, will be used later during refactorying
/// 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
/// working directory of IW4MAdmin
/// </summary>
string BasePath { get; }
}
}
}

View File

@ -3,7 +3,7 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// describes all the base attributes of a client meta object
/// describes all the base attributes of a client meta object
/// </summary>
public interface IClientMeta
{
@ -29,4 +29,4 @@ namespace SharedLibraryCore.Interfaces
QuickMessage,
ConnectionHistory
}
}
}

View File

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IClientMetaResponse
{
int ClientId { get;}
int ClientId { get; }
long MetaId { get; }
}
}
}

View File

@ -5,12 +5,13 @@ namespace SharedLibraryCore.Interfaces
public interface IClientNoticeMessageFormatter
{
/// <summary>
/// builds a game formatted notice message
/// builds a game formatted notice message
/// </summary>
/// <param name="currentPenalty">current penalty the message is for</param>
/// <param name="originalPenalty">previous penalty the current penalty relates to</param>
/// <param name="config">RCon parser config</param>
/// <returns></returns>
string BuildFormattedMessage(IRConParserConfiguration config, EFPenalty currentPenalty, EFPenalty originalPenalty = null);
string BuildFormattedMessage(IRConParserConfiguration config, EFPenalty currentPenalty,
EFPenalty originalPenalty = null);
}
}

View File

@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
{
public interface IConfigurationHandler<T> where T : IBaseConfiguration
{
string FileName { get; }
Task Save();
void Build();
T Configuration();
void Set(T config);
string FileName { get; }
}
}
}

View File

@ -1,17 +1,17 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of the configuration handler factory
/// used to generate new instance of configuration handlers
/// 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
/// 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;
}
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
@ -16,4 +13,4 @@ namespace SharedLibraryCore.Interfaces
Task<T> GetUnique(long entityProperty);
Task<IList<T>> Find(Func<T, bool> expression);
}
}
}

View File

@ -1,15 +1,15 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// handles games events (from log, manual events, etc)
/// handles games events (from log, manual events, etc)
/// </summary>
public interface IEventHandler
{
/// <summary>
/// Add a game event event to the queue to be processed
/// Add a game event event to the queue to be processed
/// </summary>
/// <param name="manager">application manager instance</param>
/// <param name="gameEvent">game event</param>
void HandleEvent(IManager manager, GameEvent gameEvent);
}
}
}

View File

@ -6,44 +6,46 @@ namespace SharedLibraryCore.Interfaces
public interface IEventParser
{
/// <summary>
/// Generates a game event based on log line input
/// </summary>
/// <param name="logLine">single log line string</param>
/// <returns></returns>
/// todo: make this integrate without needing the server
GameEvent GenerateGameEvent(string logLine);
/// <summary>
/// Get game specific folder prefix for log files
/// Get game specific folder prefix for log files
/// </summary>
/// <returns>Game directory prefix</returns>
IEventParserConfiguration Configuration { get; set; }
/// <summary>
/// stores the game/client specific version (usually the value of the "version" DVAR)
/// stores the game/client specific version (usually the value of the "version" DVAR)
/// </summary>
string Version { get; set; }
/// <summary>
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
/// </summary>
Game GameName { get; set; }
/// <summary>
/// specifies the connect URI used to join game servers via web browser
/// specifies the connect URI used to join game servers via web browser
/// </summary>
string URLProtocolFormat { get; set; }
/// <summary>
/// specifies the text name of the game the parser is for
/// specifies the text name of the game the parser is for
/// </summary>
string Name { get; set; }
/// <summary>
/// registers a custom event subtype to be triggered when a value is detected
/// Generates a game event based on log line input
/// </summary>
/// <param name="logLine">single log line string</param>
/// <returns></returns>
/// todo: make this integrate without needing the server
GameEvent GenerateGameEvent(string logLine);
/// <summary>
/// registers a custom event subtype to be triggered when a value is detected
/// </summary>
/// <param name="eventSubtype">subtype assigned to the event when generated</param>
/// <param name="eventTriggerValue">event keyword to trigger an event generation</param>
/// <param name="eventModifier">function pointer that modifies the generated game event</param>
void RegisterCustomEvent(string eventSubtype, string eventTriggerValue, Func<string, IEventParserConfiguration, GameEvent, GameEvent> eventModifier);
void RegisterCustomEvent(string eventSubtype, string eventTriggerValue,
Func<string, IEventParserConfiguration, GameEvent, GameEvent> eventModifier);
}
}
}

View File

@ -1,63 +1,62 @@
using System.Collections.Generic;
using System.Globalization;
using System.Globalization;
namespace SharedLibraryCore.Interfaces
{
public interface IEventParserConfiguration
{
/// <summary>
/// stores the fs_game directory (this folder may vary between different clients)
/// stores the fs_game directory (this folder may vary between different clients)
/// </summary>
string GameDirectory { get; set; }
/// <summary>
/// stores the regex information for a say event printed in the game log
/// stores the regex information for a say event printed in the game log
/// </summary>
ParserRegex Say { get; set; }
/// <summary>
/// stores the regex information for a join event printed in the game log
/// stores the regex information for a join event printed in the game log
/// </summary>
ParserRegex Join { get; set; }
/// <summary>
/// stores the regex information for a quit event printed in the game log
/// stores the regex information for a quit event printed in the game log
/// </summary>
ParserRegex Quit { get; set; }
/// <summary>
/// stores the regex information for a kill event printed in the game log
/// stores the regex information for a kill event printed in the game log
/// </summary>
ParserRegex Kill { get; set; }
/// <summary>
/// stores the regex information for a damage event printed in the game log
/// stores the regex information for a damage event printed in the game log
/// </summary>
ParserRegex Damage { get; set; }
/// <summary>
/// stores the regex information for an action event printed in the game log
/// stores the regex information for an action event printed in the game log
/// </summary>
ParserRegex Action { get; set; }
/// <summary>
/// stores the regex information for the time prefix in game log
/// stores the regex information for the time prefix in game log
/// </summary>
ParserRegex Time { get; set; }
/// <summary>
/// stores the regex information for the map change game log
/// stores the regex information for the map change game log
/// </summary>
ParserRegex MapChange { get; }
/// <summary>
/// stores the regex information for the map end game log
/// stores the regex information for the map end game log
/// </summary>
ParserRegex MapEnd { get; }
/// <summary>
/// indicates the format expected for parsed guids
/// indicates the format expected for parsed guids
/// </summary>
NumberStyles GuidNumberStyle { get; set; }
}
}
}

View File

@ -4,26 +4,26 @@ using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// represents the abstraction of game log reading
/// represents the abstraction of game log reading
/// </summary>
public interface IGameLogReader
{
/// <summary>
/// get new events that have occured since the last poll
/// how long the log file is
/// </summary>
long Length { get; }
/// <summary>
/// how often to poll the log file
/// </summary>
int UpdateInterval { get; }
/// <summary>
/// get new events that have occured since the last poll
/// </summary>
/// <param name="fileSizeDiff"></param>
/// <param name="startPosition"></param>
/// <returns></returns>
Task<IEnumerable<GameEvent>> ReadEventsFromLog(long fileSizeDiff, long startPosition);
/// <summary>
/// how long the log file is
/// </summary>
long Length { get; }
/// <summary>
/// how often to poll the log file
/// </summary>
int UpdateInterval { get; }
}
}
}

View File

@ -3,16 +3,16 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// factory interface to create game log readers based on the log file uri
/// factory interface to create game log readers based on the log file uri
/// </summary>
public interface IGameLogReaderFactory
{
/// <summary>
/// generates a new game log reader based on the provided Uri
/// generates a new game log reader based on the provided Uri
/// </summary>
/// <param name="logUris">collection of log uri used to generate the log reader</param>
/// <param name="eventParser">event parser for the log reader</param>
/// <returns></returns>
IGameLogReader CreateGameLogReader(Uri[] logUris, IEventParser eventParser);
}
}
}

View File

@ -7,7 +7,7 @@ namespace SharedLibraryCore.Interfaces
public interface IGameServer
{
/// <summary>
/// kicks target on behalf of origin for given reason
/// kicks target on behalf of origin for given reason
/// </summary>
/// <param name="reason">reason client is being kicked</param>
/// <param name="target">client to kick</param>

View File

@ -3,16 +3,16 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of game server instance factory
/// defines the capabilities of game server instance factory
/// </summary>
public interface IGameServerInstanceFactory
{
/// <summary>
/// creates the instance of a game server
/// 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);
}
}
}

View File

@ -12,4 +12,4 @@ namespace SharedLibraryCore.Interfaces
void WriteError(string msg);
void WriteAssert(bool condition, string msg);
}
}
}

View File

@ -1,93 +1,106 @@
using System.Collections.Generic;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using SharedLibraryCore.Services;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database.Models;
using System.Threading;
using System.Collections;
using System;
using System.Collections.Concurrent;
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Services;
namespace SharedLibraryCore.Interfaces
{
public interface IManager
{
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; }
Task Init();
Task Start();
void Stop();
void Restart();
[Obsolete]
ILogger GetLogger(long serverId);
IList<Server> GetServers();
IList<IManagerCommand> GetCommands();
IReadOnlyList<IManagerCommand> Commands { get; }
IList<Helpers.MessageToken> GetMessageTokens();
IList<MessageToken> GetMessageTokens();
IList<EFClient> GetActiveClients();
EFClient FindActiveClient(EFClient client);
IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings();
ClientService GetClientService();
PenaltyService GetPenaltyService();
/// <summary>
/// enumerates the registered plugin instances
/// </summary>
IEnumerable<IPlugin> Plugins { get; }
/// <summary>
/// provides a page list to add and remove from
/// provides a page list to add and remove from
/// </summary>
/// <returns></returns>
IPageList GetPageList();
IList<IRConParser> AdditionalRConParsers { get; }
IList<IEventParser> AdditionalEventParsers { get; }
/// <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
/// 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);
IMiddlewareActionHandler MiddlewareActionHandler { get; }
/// <summary>
/// generates an rcon parser that can be configured by script plugins
/// 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
/// 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);
string Version { get;}
ITokenAuthentication TokenAuthenticator { get; }
string ExternalIPAddress { get; }
CancellationToken CancellationToken { get; }
bool IsRestartRequested { get; }
bool IsRunning { get; }
Task ExecuteEvent(GameEvent gameEvent);
/// <summary>
/// queues an event for processing
/// queues an event for processing
/// </summary>
/// <param name="gameEvent">event to be processed</param>
void AddEvent(GameEvent gameEvent);
/// <summary>
/// adds an additional (script) command to the command list
/// 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
/// removes a command by its name
/// </summary>
/// <param name="name">name of command</param>
void RemoveCommandByName(string name);
/// <summary>
/// event executed when event has finished executing
/// event executed when event has finished executing
/// </summary>
event EventHandler<GameEvent> OnGameEventExecuted;
ConcurrentDictionary<long, GameEvent> ProcessingEvents { get; }
}
}
}

View File

@ -5,60 +5,60 @@ using static SharedLibraryCore.Server;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// Defines the basic properties of a command
/// Defines the basic properties of a command
/// </summary>
public interface IManagerCommand
{
/// <summary>
/// Executes the command
/// </summary>
/// <param name="gameEvent">event corresponding to the command</param>
/// <returns></returns>
Task ExecuteAsync(GameEvent gameEvent);
/// <summary>
/// Name of the command
/// Name of the command
/// </summary>
string Name { get; }
/// <summary>
/// Description of the command
/// Description of the command
/// </summary>
string Description { get; }
/// <summary>
/// Alternative name of the command
/// Alternative name of the command
/// </summary>
string Alias { get; }
/// <summary>
/// Minimum permission required to execute the command
/// Minimum permission required to execute the command
/// </summary>
Permission Permission { get; }
/// <summary>
/// Games the command is supported on
/// Games the command is supported on
/// </summary>
Game[] SupportedGames { get; }
/// <summary>
/// Syntax for using the command
/// Syntax for using the command
/// </summary>
string Syntax { get; }
/// <summary>
/// Indicates if target is required
/// Indicates if target is required
/// </summary>
bool RequiresTarget { get; }
/// <summary>
/// Indicates if the commands can be run as another client
/// Indicates if the commands can be run as another client
/// </summary>
bool AllowImpersonation { get; }
/// <summary>
/// Indicates if the command result should be broadcasted to all clients
/// Indicates if the command result should be broadcasted to all clients
/// </summary>
bool IsBroadcast { get; set; }
/// <summary>
/// Executes the command
/// </summary>
/// <param name="gameEvent">event corresponding to the command</param>
/// <returns></returns>
Task ExecuteAsync(GameEvent gameEvent);
}
}
}

View File

@ -4,21 +4,21 @@ using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of the communication to the master server
/// defines the capabilities of the communication to the master server
/// </summary>
public interface IMasterCommunication
{
/// <summary>
/// checks the current version of IW4MAdmin against the master version
/// checks the current version of IW4MAdmin against the master version
/// </summary>
/// <returns></returns>
Task CheckVersion();
/// <summary>
/// Sends heart beats to the master
/// Sends heart beats to the master
/// </summary>
/// <param name="token">Cancellation token</param>
/// <returns></returns>
Task RunUploadStatus(CancellationToken token);
}
}
}

View File

@ -1,18 +1,18 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// represents a pattern match result
/// represents a pattern match result
/// </summary>
public interface IMatchResult
{
/// <summary>
/// array of matched pattern groups
/// array of matched pattern groups
/// </summary>
string[] Values { get; set; }
/// <summary>
/// indicates if the match succeeded
/// indicates if the match succeeded
/// </summary>
bool Success { get; set; }
}
}
}

View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IMetaRegistration
{
void Register();
}
}
}

View File

@ -1,17 +1,17 @@
using Data.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Data.Models;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.QueryHelper;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
{
public interface IMetaService
{
/// <summary>
/// adds or updates meta key and value to the database
/// adds or updates meta key and value to the database
/// </summary>
/// <param name="metaKey">key of meta data</param>
/// <param name="metaValue">value of the meta data</param>
@ -20,7 +20,7 @@ namespace SharedLibraryCore.Interfaces
Task AddPersistentMeta(string metaKey, string metaValue, EFClient client, EFMeta linkedMeta = null);
/// <summary>
/// adds or updates meta key and value to the database
/// adds or updates meta key and value to the database
/// </summary>
/// <param name="metaKey">key of meta data</param>
/// <param name="metaValue">value of the meta data</param>
@ -28,7 +28,7 @@ namespace SharedLibraryCore.Interfaces
Task AddPersistentMeta(string metaKey, string metaValue);
/// <summary>
/// removes meta key with given value
/// removes meta key with given value
/// </summary>
/// <param name="metaKey">key of meta data</param>
/// <param name="client">client to delete the meta for</param>
@ -36,7 +36,7 @@ namespace SharedLibraryCore.Interfaces
Task RemovePersistentMeta(string metaKey, EFClient client);
/// <summary>
/// removes meta key with given value
/// removes meta key with given value
/// </summary>
/// <param name="metaKey">key of the meta data</param>
/// <param name="metaValue">value of the meta data</param>
@ -44,7 +44,7 @@ namespace SharedLibraryCore.Interfaces
Task RemovePersistentMeta(string metaKey, string metaValue = null);
/// <summary>
/// retrieves meta data for given client and key
/// retrieves meta data for given client and key
/// </summary>
/// <param name="metaKey">key to retrieve value for</param>
/// <param name="client">client to retrieve meta for</param>
@ -52,32 +52,34 @@ namespace SharedLibraryCore.Interfaces
Task<EFMeta> GetPersistentMeta(string metaKey, EFClient client);
/// <summary>
/// retrieves collection of meta for given key
/// retrieves collection of meta for given key
/// </summary>
/// <param name="metaKey">key to retrieve values for</param>
/// <returns></returns>
Task<IEnumerable<EFMeta>> GetPersistentMeta(string metaKey);
/// <summary>
/// adds a meta task to the runtime meta list
/// adds a meta task to the runtime meta list
/// </summary>
/// <param name="metaKey">type of meta</param>
/// <param name="metaAction">action to perform</param>
void AddRuntimeMeta<T,V>(MetaType metaKey, Func<T, Task<IEnumerable<V>>> metaAction) where V : IClientMeta where T: PaginationRequest;
void AddRuntimeMeta<T, V>(MetaType metaKey, Func<T, Task<IEnumerable<V>>> metaAction)
where V : IClientMeta where T : PaginationRequest;
/// <summary>
/// retrieves all the runtime meta information for given client idea
/// retrieves all the runtime meta information for given client idea
/// </summary>
/// <param name="request">request information</param>
/// <returns></returns>
Task<IEnumerable<IClientMeta>> GetRuntimeMeta(ClientPaginationRequest request);
/// <summary>
/// retreives all the runtime of provided type
/// retreives all the runtime of provided type
/// </summary>
/// <param name="request">>request information</param>
/// <param name="metaType">type of meta to retreive</param>
/// <returns></returns>
Task<IEnumerable<T>> GetRuntimeMeta<T>(ClientPaginationRequest request, MetaType metaType) where T : IClientMeta;
Task<IEnumerable<T>> GetRuntimeMeta<T>(ClientPaginationRequest request, MetaType metaType)
where T : IClientMeta;
}
}
}

View File

@ -3,16 +3,16 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// represents an invokable middleware action
/// represents an invokable middleware action
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IMiddlewareAction<T>
{
/// <summary>
/// action to execute when the middleware action is invoked
/// action to execute when the middleware action is invoked
/// </summary>
/// <param name="original"></param>
/// <returns>modified original action type instance</returns>
Task<T> Invoke(T original);
}
}
}

View File

@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// used to handle middleware actions registered from arbitrary assemblies
/// used to handle middleware actions registered from arbitrary assemblies
/// </summary>
public interface IMiddlewareActionHandler
{
/// <summary>
/// registers an action with the middleware handler
/// registers an action with the middleware handler
/// </summary>
/// <typeparam name="T">action return type</typeparam>
/// <param name="actionType">class type of action</param>
@ -20,7 +17,7 @@ namespace SharedLibraryCore.Interfaces
void Register<T>(T actionType, IMiddlewareAction<T> action, string name = null);
/// <summary>
/// executes the given action type or name
/// executes the given action type or name
/// </summary>
/// <typeparam name="T">action return type</typeparam>
/// <param name="value">instance member to perform the action on</param>
@ -28,4 +25,4 @@ namespace SharedLibraryCore.Interfaces
/// <returns></returns>
Task<T> Execute<T>(T value, string name = null);
}
}
}

View File

@ -1,7 +1,4 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
{
@ -9,4 +6,4 @@ namespace SharedLibraryCore.Interfaces
{
void Configure(ModelBuilder builder);
}
}
}

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
{
@ -8,4 +6,4 @@ namespace SharedLibraryCore.Interfaces
{
IDictionary<string, string> Pages { get; set; }
}
}
}

View File

@ -1,21 +1,21 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of a parser pattern
/// defines the capabilities of a parser pattern
/// </summary>
public interface IParserPatternMatcher
{
/// <summary>
/// converts input string into pattern groups
/// converts input string into pattern groups
/// </summary>
/// <param name="input">input string</param>
/// <returns>group matches</returns>
IMatchResult Match(string input);
/// <summary>
/// compiles the pattern to be used for matching
/// compiles the pattern to be used for matching
/// </summary>
/// <param name="pattern"></param>
void Compile(string pattern);
}
}
}

View File

@ -1,14 +1,14 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of the parser regex factory
/// defines the capabilities of the parser regex factory
/// </summary>
public interface IParserRegexFactory
{
/// <summary>
/// creates a new ParserRegex instance
/// creates a new ParserRegex instance
/// </summary>
/// <returns>ParserRegex instance</returns>
ParserRegex CreateParserRegex();
}
}
}

View File

@ -4,14 +4,13 @@ namespace SharedLibraryCore.Interfaces
{
public interface IPlugin
{
string Name { get; }
float Version { get; }
string Author { get; }
bool IsParser => false;
Task OnLoadAsync(IManager manager);
Task OnUnloadAsync();
Task OnEventAsync(GameEvent E, Server S);
Task OnTickAsync(Server S);
string Name { get; }
float Version { get; }
string Author { get; }
bool IsParser => false;
}
}
}

View File

@ -4,20 +4,20 @@ using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of the plugin importer
/// defines the capabilities of the plugin importer
/// </summary>
public interface IPluginImporter
{
{
/// <summary>
/// discovers C# assembly plugin and command types
/// discovers C# assembly plugin and command types
/// </summary>
/// <returns>tuple of IPlugin implementation type definitions, and IManagerCommand type definitions</returns>
(IEnumerable<Type>, IEnumerable<Type>, IEnumerable<Type>) DiscoverAssemblyPluginImplementations();
/// <summary>
/// discovers the script plugins
/// discovers the script plugins
/// </summary>
/// <returns>initialized script plugin collection</returns>
IEnumerable<IPlugin> DiscoverScriptPlugins();
}
}
}

View File

@ -1,15 +1,15 @@
using SharedLibraryCore.RCon;
using System.Threading.Tasks;
using System.Threading.Tasks;
using SharedLibraryCore.RCon;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of an RCon connection
/// defines the capabilities of an RCon connection
/// </summary>
public interface IRConConnection
{
/// <summary>
/// sends a query with the instance of the rcon connection
/// 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>
@ -17,9 +17,9 @@ namespace SharedLibraryCore.Interfaces
Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "");
/// <summary>
/// sets the rcon parser
/// sets the rcon parser
/// </summary>
/// <param name="config">parser</param>
void SetConfiguration(IRConParser config);
}
}
}

View File

@ -3,12 +3,12 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of an RCon connection factory
/// defines the capabilities of an RCon connection factory
/// </summary>
public interface IRConConnectionFactory
{
/// <summary>
/// creates an rcon connection instance
/// creates an rcon connection instance
/// </summary>
/// <param name="ipEndpoint">ip address and port of the server</param>
/// <param name="password"> password of the server</param>
@ -16,4 +16,4 @@ namespace SharedLibraryCore.Interfaces
/// <returns>instance of rcon connection</returns>
IRConConnection CreateConnection(IPEndPoint ipEndpoint, string password, string rconEngine);
}
}
}

View File

@ -7,7 +7,45 @@ namespace SharedLibraryCore.Interfaces
public interface IRConParser
{
/// <summary>
/// retrieves the value of a given DVAR
/// stores the RCon configuration
/// </summary>
IRConParserConfiguration Configuration { get; set; }
/// <summary>
/// stores the game/client specific version (usually the value of the "version" DVAR)
/// </summary>
string Version { get; }
/// <summary>
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
/// </summary>
Game GameName { get; }
/// <summary>
/// indicates if the game supports generating a log path from DVAR retrieval
/// of fs_game, fs_basepath, g_log
/// </summary>
bool CanGenerateLogPath { get; }
/// <summary>
/// specifies the name of the parser
/// </summary>
string Name { get; }
/// <summary>
/// specifies the type of rcon engine
/// eg: COD, Source
/// </summary>
string RConEngine { get; }
/// <summary>
/// indicates that the game does not log to the mods folder (when mod is loaded),
/// but rather always to the fs_basegame directory
/// </summary>
bool IsOneLog { get; }
/// <summary>
/// retrieves the value of a given DVAR
/// </summary>
/// <typeparam name="T">type of DVAR expected (string, int, float etc...)</typeparam>
/// <param name="connection">RCon connection to retrieve with</param>
@ -17,7 +55,7 @@ namespace SharedLibraryCore.Interfaces
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default);
/// <summary>
/// set value of DVAR by name
/// set value of DVAR by name
/// </summary>
/// <param name="connection">RCon connection to use</param>
/// <param name="dvarName">name of DVAR to set</param>
@ -26,7 +64,7 @@ namespace SharedLibraryCore.Interfaces
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue);
/// <summary>
/// executes a console command on the server
/// executes a console command on the server
/// </summary>
/// <param name="connection">RCon connection to use</param>
/// <param name="command">console command to execute</param>
@ -34,71 +72,35 @@ namespace SharedLibraryCore.Interfaces
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command);
/// <summary>
/// get the list of connected clients from status response
/// get the list of connected clients from status response
/// </summary>
/// <param name="connection">RCon connection to use</param>
/// <returns><see cref="IStatusResponse"/></returns>
/// <returns>
/// <see cref="IStatusResponse" />
/// </returns>
Task<IStatusResponse> GetStatusAsync(IRConConnection connection);
/// <summary>
/// stores the RCon configuration
/// </summary>
IRConParserConfiguration Configuration { get; set; }
/// <summary>
/// stores the game/client specific version (usually the value of the "version" DVAR)
/// </summary>
string Version { get; }
/// <summary>
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
/// </summary>
Game GameName { get; }
/// <summary>
/// indicates if the game supports generating a log path from DVAR retrieval
/// of fs_game, fs_basepath, g_log
/// </summary>
bool CanGenerateLogPath { get; }
/// <summary>
/// specifies the name of the parser
/// </summary>
string Name { get; }
/// <summary>
/// specifies the type of rcon engine
/// eg: COD, Source
/// </summary>
string RConEngine { get; }
/// <summary>
/// indicates that the game does not log to the mods folder (when mod is loaded),
/// but rather always to the fs_basegame directory
/// </summary>
bool IsOneLog { get; }
/// <summary>
/// retrieves the value of given dvar key if it exists in the override dict
/// otherwise returns original
/// retrieves the value of given dvar key if it exists in the override dict
/// otherwise returns original
/// </summary>
/// <param name="dvarName">name of dvar key</param>
/// <returns></returns>
string GetOverrideDvarName(string dvarName);
/// <summary>
/// retrieves the configuration value of a dvar key for
/// games that do not support the given dvar
/// retrieves the configuration value of a dvar key for
/// games that do not support the given dvar
/// </summary>
/// <param name="dvarName">dvar key name</param>
/// <returns></returns>
T GetDefaultDvarValue<T>(string dvarName);
/// <summary>
/// determines the amount of time to wait for the command to respond
/// determines the amount of time to wait for the command to respond
/// </summary>
/// <param name="command">name of command being executed</param>
/// <returns></returns>
TimeSpan OverrideTimeoutForCommand(string command);
}
}
}

View File

@ -1,105 +1,104 @@
using SharedLibraryCore.RCon;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Globalization;
using SharedLibraryCore.Formatting;
using SharedLibraryCore.Localization;
using SharedLibraryCore.RCon;
namespace SharedLibraryCore.Interfaces
{
public interface IRConParserConfiguration
{
/// <summary>
/// stores the command format for console commands
/// stores the command format for console commands
/// </summary>
CommandPrefix CommandPrefixes { get; }
/// <summary>
/// stores the regex info for parsing get status response
/// stores the regex info for parsing get status response
/// </summary>
ParserRegex Status { get; }
/// <summary>
/// stores regex info for parsing the map line from rcon status response
/// stores regex info for parsing the map line from rcon status response
/// </summary>
ParserRegex MapStatus { get; }
/// <summary>
/// stores regex info for parsing the gametype line from rcon status response
/// stores regex info for parsing the gametype line from rcon status response
/// </summary>
ParserRegex GametypeStatus { get; }
/// <summary>
/// stores regex info for parsing hostname line from rcon status response
/// stores regex info for parsing hostname line from rcon status response
/// </summary>
ParserRegex HostnameStatus { get; }
/// <summary>
/// stores regex info for parsing max players line from rcon status response
/// stores regex info for parsing max players line from rcon status response
/// </summary>
ParserRegex MaxPlayersStatus { get; }
/// <summary>
/// stores the regex info for parsing get DVAR responses
/// stores the regex info for parsing get DVAR responses
/// </summary>
ParserRegex Dvar { get; }
/// <summary>
/// stores the regex info for parsing the header of a status response
/// stores the regex info for parsing the header of a status response
/// </summary>
ParserRegex StatusHeader { get; }
/// <summary>
/// Specifies the expected response message from rcon when the server is not running
/// Specifies the expected response message from rcon when the server is not running
/// </summary>
string ServerNotRunningResponse { get; }
/// <summary>
/// indicates if the application should wait for response from server
/// when executing a command
/// indicates if the application should wait for response from server
/// when executing a command
/// </summary>
bool WaitForResponse { get; }
/// <summary>
/// indicates the format expected for parsed guids
/// indicates the format expected for parsed guids
/// </summary>
NumberStyles GuidNumberStyle { get; }
/// <summary>
/// specifies simple mappings for dvar names in scenarios where the needed
/// information is not stored in a traditional dvar name
/// specifies simple mappings for dvar names in scenarios where the needed
/// information is not stored in a traditional dvar name
/// </summary>
IDictionary<string, string> OverrideDvarNameMapping { get; }
/// <summary>
/// specifies the default dvar values for games that don't support certain dvars
/// specifies the default dvar values for games that don't support certain dvars
/// </summary>
IDictionary<string, string> DefaultDvarValues { get; }
/// <summary>
/// specifies how many lines can be used for ingame notice
/// specifies how many lines can be used for ingame notice
/// </summary>
int NoticeMaximumLines { get; set; }
/// <summary>
/// specifies how many characters can be displayed per notice line
/// specifies how many characters can be displayed per notice line
/// </summary>
int NoticeMaxCharactersPerLine { get; }
/// <summary>
/// specifies the characters used to split a line
/// specifies the characters used to split a line
/// </summary>
string NoticeLineSeparator { get; }
/// <summary>
/// Default port the game listens to RCon requests on
/// Default port the game listens to RCon requests on
/// </summary>
int? DefaultRConPort { get; }
/// <summary>
/// Default Indicator of where the game is installed (ex file path or registry entry)
/// Default Indicator of where the game is installed (ex file path or registry entry)
/// </summary>
string DefaultInstallationDirectoryHint { get; }
ColorCodeMapping ColorCodeMapping { get; }
}
}
}

View File

@ -4,16 +4,16 @@ using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// interface defining the capabilities of a custom event registration
/// interface defining the capabilities of a custom event registration
/// </summary>
public interface IRegisterEvent
{
/// <summary>
/// collection of custom event registrations
/// <remarks>
/// (Subtype, trigger value, event generator)
/// </remarks>
/// collection of custom event registrations
/// <remarks>
/// (Subtype, trigger value, event generator)
/// </remarks>
/// </summary>
IEnumerable<(string, string, Func<string, IEventParserConfiguration, GameEvent, GameEvent>)> Events { get; }
}
}
}

View File

@ -8,4 +8,4 @@ namespace SharedLibraryCore.Interfaces
IEnumerable<Assembly> DecryptAssemblies(string[] encryptedAssemblies);
IEnumerable<string> DecryptScripts(string[] encryptedScripts);
}
}
}

View File

@ -1,20 +1,20 @@
using SharedLibraryCore.Helpers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using SharedLibraryCore.Helpers;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of a resource queryier
/// defines the capabilities of a resource queryier
/// </summary>
/// <typeparam name="QueryType">Type of query</typeparam>
/// <typeparam name="ResultType">Type of result</typeparam>
public interface IResourceQueryHelper<QueryType, ResultType>
{
/// <summary>
/// queries a resource and returns the result of the query
/// queries a resource and returns the result of the query
/// </summary>
/// <param name="query">query params</param>
/// <returns></returns>
Task<ResourceQueryHelperResult<ResultType>> QueryResource(QueryType query);
}
}
}

View File

@ -4,12 +4,12 @@ using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines capabilities of script command factory
/// defines capabilities of script command factory
/// </summary>
public interface IScriptCommandFactory
{
/// <summary>
/// generate a new script command from parsed source
/// generate a new script command from parsed source
/// </summary>
/// <param name="name">name of command</param>
/// <param name="alias">alias of command</param>
@ -19,6 +19,7 @@ namespace SharedLibraryCore.Interfaces
/// <param name="args">command arguments (name, is required)</param>
/// <param name="executeAction">action to peform when commmand is executed</param>
/// <returns></returns>
IManagerCommand CreateScriptCommand(string name, string alias, string description, string permission, bool isTargetRequired, IEnumerable<(string, bool)> args, Action<GameEvent> executeAction);
IManagerCommand CreateScriptCommand(string name, string alias, string description, string permission,
bool isTargetRequired, IEnumerable<(string, bool)> args, Action<GameEvent> executeAction);
}
}
}

View File

@ -1,25 +1,23 @@
using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// interface used to dynamically resolve services by string name
/// interface used to dynamically resolve services by string name
/// </summary>
public interface IScriptPluginServiceResolver
{
/// <summary>
/// resolves a service with the given name
/// resolves a service with the given name
/// </summary>
/// <param name="serviceName">class name of service</param>
/// <returns></returns>
object ResolveService(string serviceName);
/// <summary>
/// resolves a service with the given name and generic params
/// resolves a service with the given name and generic params
/// </summary>
/// <param name="serviceName">class name of service</param>
/// <param name="genericParams">generic class names</param>
/// <returns></returns>
object ResolveService(string serviceName, string[] genericParameters);
}
}
}

View File

@ -7,7 +7,7 @@ namespace SharedLibraryCore.Interfaces
public interface IServerDataCollector
{
/// <summary>
/// Begins to collection on servers for analytical purposes
/// Begins to collection on servers for analytical purposes
/// </summary>
/// <param name="period">interval at which to collect data</param>
/// <param name="cancellationToken">Token</param>

View File

@ -3,26 +3,26 @@ using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Helpers;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// Exposes methods to get analytical data about server(s)
/// Exposes methods to get analytical data about server(s)
/// </summary>
public interface IServerDataViewer
{
/// <summary>
/// Retrieves the max concurrent clients over a give time period for all servers or given server id
/// Retrieves the max concurrent clients over a give time period for all servers or given server id
/// </summary>
/// <param name="serverId">ServerId to query on</param>
/// <param name="overPeriod">how far in the past to search</param>
/// <param name="token">CancellationToken</param>
/// <returns></returns>
Task<(int?, DateTime?)> MaxConcurrentClientsAsync(long? serverId = null, TimeSpan? overPeriod = null, CancellationToken token = default);
Task<(int?, DateTime?)> MaxConcurrentClientsAsync(long? serverId = null, TimeSpan? overPeriod = null,
CancellationToken token = default);
/// <summary>
/// Gets the total number of clients connected and total clients connected in the given time frame
/// Gets the total number of clients connected and total clients connected in the given time frame
/// </summary>
/// <param name="overPeriod">how far in the past to search</param>
/// <param name="token">CancellationToken</param>
@ -30,11 +30,12 @@ namespace SharedLibraryCore.Interfaces
Task<(int, int)> ClientCountsAsync(TimeSpan? overPeriod = null, CancellationToken token = default);
/// <summary>
/// Retrieves the client count and history over the given period
/// Retrieves the client count and history over the given period
/// </summary>
/// <param name="overPeriod">how far in the past to search</param>
/// <param name="token">CancellationToken</param>
/// <returns></returns>
Task<IEnumerable<ClientHistoryInfo>> ClientHistoryAsync(TimeSpan? overPeriod = null, CancellationToken token = default);
Task<IEnumerable<ClientHistoryInfo>> ClientHistoryAsync(TimeSpan? overPeriod = null,
CancellationToken token = default);
}
}

View File

@ -3,32 +3,32 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// describes the collection of data returned from a status query
/// describes the collection of data returned from a status query
/// </summary>
public interface IStatusResponse
{
/// <summary>
/// name of the map
/// name of the map
/// </summary>
string Map { get; }
/// <summary>
/// gametype/mode
/// gametype/mode
/// </summary>
string GameType { get; }
/// <summary>
/// server name
/// server name
/// </summary>
string Hostname { get; }
/// <summary>
/// max number of players
/// max number of players
/// </summary>
int? MaxClients { get; }
/// <summary>
/// active clients
/// active clients
/// </summary>
EFClient[] Clients { get; }
}

View File

@ -1,24 +1,21 @@
using SharedLibraryCore.Helpers;
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
{
public interface ITokenAuthentication
{
/// <summary>
/// generates and returns a token for the given network id
/// generates and returns a token for the given network id
/// </summary>
/// <param name="networkId">network id of the players to generate the token for</param>
/// <returns>4 character string token</returns>
TokenState GenerateNextToken(long networkId);
/// <summary>
/// authorizes given token
/// authorizes given token
/// </summary>
/// <param name="token">token to authorize</param>
/// <returns>true if token authorized successfully, false otherwise</returns>
bool AuthorizeToken(long networkId, string token);
}
}
}

View File

@ -1,15 +1,15 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// Defines the translation lookup capabilities for DI
/// Defines the translation lookup capabilities for DI
/// </summary>
public interface ITranslationLookup
{
/// <summary>
/// Allows indexing
/// Allows indexing
/// </summary>
/// <param name="key">translation lookup key</param>
/// <returns></returns>
string this[string key] { get; }
}
}
}