mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 07:13:58 -05:00
Add commenting for parsers
rename IW4*Parser to Base*Parser
This commit is contained in:
@ -6,6 +6,10 @@ namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
public sealed class ParserRegex
|
||||
{
|
||||
/// <summary>
|
||||
/// represents the logical mapping of information provided by
|
||||
/// game logs, get status, and get dvar information
|
||||
/// </summary>
|
||||
public enum GroupType
|
||||
{
|
||||
EventType,
|
||||
@ -35,9 +39,24 @@ namespace SharedLibraryCore.Interfaces
|
||||
RConDvarDomain = 110,
|
||||
AdditionalGroup = 200
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// stores the regular expression groups that will be mapped to group types
|
||||
/// </summary>
|
||||
public string Pattern { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// stores the mapping from group type to group index in the regular expression
|
||||
/// </summary>
|
||||
public Dictionary<GroupType, int> GroupMapping { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// helper method to enable script parsers to app regex mapping
|
||||
/// the first parameter specifies the group type contained in the regex pattern
|
||||
/// the second parameter specifies the group index to retrieve in the matched regex pattern
|
||||
/// </summary>
|
||||
/// <param name="mapKey">group type</param>
|
||||
/// <param name="mapValue">group index</param>
|
||||
public void AddMapping(object mapKey, object mapValue)
|
||||
{
|
||||
if (int.TryParse(mapKey.ToString(), out int key) && int.TryParse(mapValue.ToString(), out int value))
|
||||
|
@ -2,12 +2,33 @@
|
||||
{
|
||||
public interface IEventParserConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
ParserRegex Say { get; set; }
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
ParserRegex Quit { get; set; }
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
ParserRegex Damage { get; set; }
|
||||
/// <summary>
|
||||
/// stores the regex information for an action event printed in the game log
|
||||
/// </summary>
|
||||
ParserRegex Action { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,47 @@ namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
public interface IRConParser
|
||||
{
|
||||
/// <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>
|
||||
/// <param name="dvarName">name of DVAR</param>
|
||||
/// <returns></returns>
|
||||
Task<Dvar<T>> GetDvarAsync<T>(Connection connection, string dvarName);
|
||||
|
||||
/// <summary>
|
||||
/// set value of DVAR by name
|
||||
/// </summary>
|
||||
/// <param name="connection">RCon connection to use</param>
|
||||
/// <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);
|
||||
|
||||
/// <summary>
|
||||
/// executes a console command on the server
|
||||
/// </summary>
|
||||
/// <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);
|
||||
|
||||
/// <summary>
|
||||
/// get the list of connected clients from status response
|
||||
/// </summary>
|
||||
/// <param name="connection">RCon connection to use</param>
|
||||
/// <returns></returns>
|
||||
Task<List<EFClient>> GetStatusAsync(Connection 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; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,21 @@ namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
public interface IRConParserConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// stores the command format for console commands
|
||||
/// </summary>
|
||||
CommandPrefix CommandPrefixes { get; set; }
|
||||
/// <summary>
|
||||
/// optionally stores the game name type
|
||||
/// </summary>
|
||||
Server.Game GameName { get; set; }
|
||||
/// <summary>
|
||||
/// stores the regex info for parsing get status response
|
||||
/// </summary>
|
||||
ParserRegex Status { get; set; }
|
||||
/// <summary>
|
||||
/// stores the regex info for parsing get DVAR responses
|
||||
/// </summary>
|
||||
ParserRegex Dvar { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user