Add commenting for parsers
rename IW4*Parser to Base*Parser
This commit is contained in:
parent
97ba6aae2e
commit
0a1dc46760
@ -7,9 +7,9 @@ using System.Text.RegularExpressions;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class IW4EventParser : IEventParser
|
class BaseEventParser : IEventParser
|
||||||
{
|
{
|
||||||
public IW4EventParser()
|
public BaseEventParser()
|
||||||
{
|
{
|
||||||
Configuration = new DynamicEventParserConfiguration()
|
Configuration = new DynamicEventParserConfiguration()
|
||||||
{
|
{
|
||||||
@ -17,53 +17,53 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
};
|
};
|
||||||
|
|
||||||
Configuration.Say.Pattern = @"^(say|sayteam);(.{1,32});([0-9]+)(.*);(.*)$";
|
Configuration.Say.Pattern = @"^(say|sayteam);(.{1,32});([0-9]+)(.*);(.*)$";
|
||||||
Configuration.Say.GroupMapping.Add(ParserRegex.GroupType.EventType, 1);
|
Configuration.Say.AddMapping(ParserRegex.GroupType.EventType, 1);
|
||||||
Configuration.Say.GroupMapping.Add(ParserRegex.GroupType.OriginNetworkId, 2);
|
Configuration.Say.AddMapping(ParserRegex.GroupType.OriginNetworkId, 2);
|
||||||
Configuration.Say.GroupMapping.Add(ParserRegex.GroupType.OriginClientNumber, 3);
|
Configuration.Say.AddMapping(ParserRegex.GroupType.OriginClientNumber, 3);
|
||||||
Configuration.Say.GroupMapping.Add(ParserRegex.GroupType.OriginName, 4);
|
Configuration.Say.AddMapping(ParserRegex.GroupType.OriginName, 4);
|
||||||
Configuration.Say.GroupMapping.Add(ParserRegex.GroupType.Message, 5);
|
Configuration.Say.AddMapping(ParserRegex.GroupType.Message, 5);
|
||||||
|
|
||||||
Configuration.Quit.Pattern = @"^(Q);(.{16,32}|bot[0-9]+);([0-9]+);(.*)$";
|
Configuration.Quit.Pattern = @"^(Q);(.{16,32}|bot[0-9]+);([0-9]+);(.*)$";
|
||||||
Configuration.Quit.GroupMapping.Add(ParserRegex.GroupType.EventType, 1);
|
Configuration.Quit.AddMapping(ParserRegex.GroupType.EventType, 1);
|
||||||
Configuration.Quit.GroupMapping.Add(ParserRegex.GroupType.OriginNetworkId, 2);
|
Configuration.Quit.AddMapping(ParserRegex.GroupType.OriginNetworkId, 2);
|
||||||
Configuration.Quit.GroupMapping.Add(ParserRegex.GroupType.OriginClientNumber, 3);
|
Configuration.Quit.AddMapping(ParserRegex.GroupType.OriginClientNumber, 3);
|
||||||
Configuration.Quit.GroupMapping.Add(ParserRegex.GroupType.OriginName, 4);
|
Configuration.Quit.AddMapping(ParserRegex.GroupType.OriginName, 4);
|
||||||
|
|
||||||
Configuration.Join.Pattern = @"^(J);(.{16,32}|bot[0-9]+);([0-9]+);(.*)$";
|
Configuration.Join.Pattern = @"^(J);(.{16,32}|bot[0-9]+);([0-9]+);(.*)$";
|
||||||
Configuration.Join.GroupMapping.Add(ParserRegex.GroupType.EventType, 1);
|
Configuration.Join.AddMapping(ParserRegex.GroupType.EventType, 1);
|
||||||
Configuration.Join.GroupMapping.Add(ParserRegex.GroupType.OriginNetworkId, 2);
|
Configuration.Join.AddMapping(ParserRegex.GroupType.OriginNetworkId, 2);
|
||||||
Configuration.Join.GroupMapping.Add(ParserRegex.GroupType.OriginClientNumber, 3);
|
Configuration.Join.AddMapping(ParserRegex.GroupType.OriginClientNumber, 3);
|
||||||
Configuration.Join.GroupMapping.Add(ParserRegex.GroupType.OriginName, 4);
|
Configuration.Join.AddMapping(ParserRegex.GroupType.OriginName, 4);
|
||||||
|
|
||||||
Configuration.Damage.Pattern = @"^(D);([A-Fa-f0-9_]{16,32}|bot[0-9]+);(-?[0-9]+);(axis|allies|world);(.{1,24});([A-Fa-f0-9_]{16,32}|bot[0-9]+)?;-?([0-9]+);(axis|allies|world);(.{1,24})?;((?:[0-9]+|[a-z]+|_)+);([0-9]+);((?:[A-Z]|_)+);((?:[a-z]|_)+)$";
|
Configuration.Damage.Pattern = @"^(D);([A-Fa-f0-9_]{16,32}|bot[0-9]+);(-?[0-9]+);(axis|allies|world);(.{1,24});([A-Fa-f0-9_]{16,32}|bot[0-9]+)?;-?([0-9]+);(axis|allies|world);(.{1,24})?;((?:[0-9]+|[a-z]+|_)+);([0-9]+);((?:[A-Z]|_)+);((?:[a-z]|_)+)$";
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.EventType, 1);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.EventType, 1);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.TargetNetworkId, 2);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.TargetNetworkId, 2);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.TargetClientNumber, 3);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.TargetClientNumber, 3);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.TargetTeam, 4);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.TargetTeam, 4);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.TargetName, 5);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.TargetName, 5);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.OriginNetworkId, 6);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.OriginNetworkId, 6);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.OriginClientNumber, 7);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.OriginClientNumber, 7);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.OriginTeam, 8);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.OriginTeam, 8);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.OriginName, 9);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.OriginName, 9);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.Weapon, 10);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.Weapon, 10);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.Damage, 11);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.Damage, 11);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.MeansOfDeath, 12);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.MeansOfDeath, 12);
|
||||||
Configuration.Damage.GroupMapping.Add(ParserRegex.GroupType.HitLocation, 13);
|
Configuration.Damage.AddMapping(ParserRegex.GroupType.HitLocation, 13);
|
||||||
|
|
||||||
Configuration.Kill.Pattern = @"^(K);([A-Fa-f0-9_]{16,32}|bot[0-9]+);(-?[0-9]+);(axis|allies|world);(.{1,24});([A-Fa-f0-9_]{16,32}|bot[0-9]+)?;-?([0-9]+);(axis|allies|world);(.{1,24})?;((?:[0-9]+|[a-z]+|_)+);([0-9]+);((?:[A-Z]|_)+);((?:[a-z]|_)+)$";
|
Configuration.Kill.Pattern = @"^(K);([A-Fa-f0-9_]{16,32}|bot[0-9]+);(-?[0-9]+);(axis|allies|world);(.{1,24});([A-Fa-f0-9_]{16,32}|bot[0-9]+)?;-?([0-9]+);(axis|allies|world);(.{1,24})?;((?:[0-9]+|[a-z]+|_)+);([0-9]+);((?:[A-Z]|_)+);((?:[a-z]|_)+)$";
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.EventType, 1);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.EventType, 1);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.TargetNetworkId, 2);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.TargetNetworkId, 2);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.TargetClientNumber, 3);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.TargetClientNumber, 3);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.TargetTeam, 4);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.TargetTeam, 4);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.TargetName, 5);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.TargetName, 5);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.OriginNetworkId, 6);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.OriginNetworkId, 6);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.OriginClientNumber, 7);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.OriginClientNumber, 7);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.OriginTeam, 8);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.OriginTeam, 8);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.OriginName, 9);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.OriginName, 9);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.Weapon, 10);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.Weapon, 10);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.Damage, 11);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.Damage, 11);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.MeansOfDeath, 12);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.MeansOfDeath, 12);
|
||||||
Configuration.Kill.GroupMapping.Add(ParserRegex.GroupType.HitLocation, 13);
|
Configuration.Kill.AddMapping(ParserRegex.GroupType.HitLocation, 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEventParserConfiguration Configuration { get; set; }
|
public IEventParserConfiguration Configuration { get; set; }
|
@ -5,7 +5,11 @@ using static SharedLibraryCore.Server;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
sealed internal class DynamicEventParser : IW4EventParser
|
/// <summary>
|
||||||
|
/// empty generic implementation of the IEventParserConfiguration
|
||||||
|
/// allows script plugins to generate dynamic event parsers
|
||||||
|
/// </summary>
|
||||||
|
sealed internal class DynamicEventParser : BaseEventParser
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class DynamicEventParserConfiguration : IEventParserConfiguration
|
/// <summary>
|
||||||
|
/// generic implementation of the IEventParserConfiguration
|
||||||
|
/// allows script plugins to generate dynamic configurations
|
||||||
|
/// </summary>
|
||||||
|
sealed internal class DynamicEventParserConfiguration : IEventParserConfiguration
|
||||||
{
|
{
|
||||||
public string GameDirectory { get; set; }
|
public string GameDirectory { get; set; }
|
||||||
public ParserRegex Say { get; set; } = new ParserRegex();
|
public ParserRegex Say { get; set; } = new ParserRegex();
|
||||||
|
@ -4,7 +4,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class IW3EventParser : IW4EventParser
|
class IW3EventParser : BaseEventParser
|
||||||
{
|
{
|
||||||
public IW3EventParser() : base()
|
public IW3EventParser() : base()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class T5MEventParser : IW4EventParser
|
class T5MEventParser : BaseEventParser
|
||||||
{
|
{
|
||||||
public T5MEventParser() : base()
|
public T5MEventParser() : base()
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class T6MEventParser : IW4EventParser
|
class T6MEventParser : BaseEventParser
|
||||||
{
|
{
|
||||||
public T6MEventParser() : base()
|
public T6MEventParser() : base()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using SharedLibraryCore;
|
using SharedLibraryCore;
|
||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -671,8 +671,8 @@ namespace IW4MAdmin
|
|||||||
var eventParser = Manager.AdditionalEventParsers
|
var eventParser = Manager.AdditionalEventParsers
|
||||||
.FirstOrDefault(_parser => _parser.Version == Manager.GetApplicationSettings().Configuration().CustomParserVersion);
|
.FirstOrDefault(_parser => _parser.Version == Manager.GetApplicationSettings().Configuration().CustomParserVersion);
|
||||||
|
|
||||||
rconParser = rconParser ?? new IW4RConParser();
|
rconParser = rconParser ?? new BaseRConParser();
|
||||||
eventParser = eventParser ?? new IW4EventParser();
|
eventParser = eventParser ?? new BaseEventParser();
|
||||||
|
|
||||||
RemoteConnection.SetConfiguration(rconParser.Configuration);
|
RemoteConnection.SetConfiguration(rconParser.Configuration);
|
||||||
|
|
||||||
@ -685,8 +685,8 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
if (GameName == Game.IW4)
|
if (GameName == Game.IW4)
|
||||||
{
|
{
|
||||||
EventParser = new IW4EventParser();
|
EventParser = new BaseEventParser();
|
||||||
RconParser = new IW4RConParser();
|
RconParser = new BaseRConParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (GameName == Game.T5M)
|
else if (GameName == Game.T5M)
|
||||||
|
@ -11,9 +11,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.RconParsers
|
namespace IW4MAdmin.Application.RconParsers
|
||||||
{
|
{
|
||||||
class IW4RConParser : IRConParser
|
class BaseRConParser : IRConParser
|
||||||
{
|
{
|
||||||
public IW4RConParser()
|
public BaseRConParser()
|
||||||
{
|
{
|
||||||
Configuration = new DynamicRConParserConfiguration()
|
Configuration = new DynamicRConParserConfiguration()
|
||||||
{
|
{
|
||||||
@ -33,19 +33,19 @@ namespace IW4MAdmin.Application.RconParsers
|
|||||||
};
|
};
|
||||||
|
|
||||||
Configuration.Status.Pattern = @"^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){16}|(?:[a-z]|[0-9]){32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
|
Configuration.Status.Pattern = @"^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){16}|(?:[a-z]|[0-9]){32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConClientNumber, 1);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConClientNumber, 1);
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConScore, 2);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConScore, 2);
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConPing, 3);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConPing, 3);
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConNetworkId, 4);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConNetworkId, 4);
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConName, 5);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConName, 5);
|
||||||
Configuration.Status.GroupMapping.Add(ParserRegex.GroupType.RConIpAddress, 7);
|
Configuration.Status.AddMapping(ParserRegex.GroupType.RConIpAddress, 7);
|
||||||
|
|
||||||
Configuration.Dvar.Pattern = "^\"(.+)\" is: \"(.+)\" default: \"(.+)\"\n(?:latched: \"(.+)\"\n)? *(.+)$";
|
Configuration.Dvar.Pattern = "^\"(.+)\" is: \"(.+)\" default: \"(.+)\"\n(?:latched: \"(.+)\"\n)? *(.+)$";
|
||||||
Configuration.Dvar.GroupMapping.Add(ParserRegex.GroupType.RConDvarName, 1);
|
Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarName, 1);
|
||||||
Configuration.Dvar.GroupMapping.Add(ParserRegex.GroupType.RConDvarValue, 2);
|
Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarValue, 2);
|
||||||
Configuration.Dvar.GroupMapping.Add(ParserRegex.GroupType.RConDvarDefaultValue, 3);
|
Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarDefaultValue, 3);
|
||||||
Configuration.Dvar.GroupMapping.Add(ParserRegex.GroupType.RConDvarLatchedValue, 4);
|
Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarLatchedValue, 4);
|
||||||
Configuration.Dvar.GroupMapping.Add(ParserRegex.GroupType.RConDvarDomain, 5);
|
Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarDomain, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRConParserConfiguration Configuration { get; set; }
|
public IRConParserConfiguration Configuration { get; set; }
|
@ -1,11 +1,10 @@
|
|||||||
using SharedLibraryCore;
|
namespace IW4MAdmin.Application.RconParsers
|
||||||
using SharedLibraryCore.RCon;
|
|
||||||
using System;
|
|
||||||
using static SharedLibraryCore.Server;
|
|
||||||
|
|
||||||
namespace IW4MAdmin.Application.RconParsers
|
|
||||||
{
|
{
|
||||||
sealed internal class DynamicRConParser : IW4RConParser
|
/// <summary>
|
||||||
|
/// empty implementation of the IW4RConParser
|
||||||
|
/// allows script plugins to generate dynamic RCon parsers
|
||||||
|
/// </summary>
|
||||||
|
sealed internal class DynamicRConParser : BaseRConParser
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,11 @@ using SharedLibraryCore.RCon;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.RconParsers
|
namespace IW4MAdmin.Application.RconParsers
|
||||||
{
|
{
|
||||||
class DynamicRConParserConfiguration : IRConParserConfiguration
|
/// <summary>
|
||||||
|
/// generic implementation of the IRConParserConfiguration
|
||||||
|
/// allows script plugins to generate dynamic RCon configurations
|
||||||
|
/// </summary>
|
||||||
|
sealed internal class DynamicRConParserConfiguration : IRConParserConfiguration
|
||||||
{
|
{
|
||||||
public CommandPrefix CommandPrefixes { get; set; }
|
public CommandPrefix CommandPrefixes { get; set; }
|
||||||
public Server.Game GameName { get; set; }
|
public Server.Game GameName { get; set; }
|
||||||
|
@ -6,7 +6,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace IW4MAdmin.Application.RconParsers
|
namespace IW4MAdmin.Application.RconParsers
|
||||||
{
|
{
|
||||||
class IW3RConParser : IW4RConParser
|
class IW3RConParser : BaseRConParser
|
||||||
{
|
{
|
||||||
public IW3RConParser() : base()
|
public IW3RConParser() : base()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,10 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
{
|
{
|
||||||
public sealed class ParserRegex
|
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
|
public enum GroupType
|
||||||
{
|
{
|
||||||
EventType,
|
EventType,
|
||||||
@ -35,9 +39,24 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
RConDvarDomain = 110,
|
RConDvarDomain = 110,
|
||||||
AdditionalGroup = 200
|
AdditionalGroup = 200
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regular expression groups that will be mapped to group types
|
||||||
|
/// </summary>
|
||||||
public string Pattern { get; set; }
|
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; }
|
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)
|
public void AddMapping(object mapKey, object mapValue)
|
||||||
{
|
{
|
||||||
if (int.TryParse(mapKey.ToString(), out int key) && int.TryParse(mapValue.ToString(), out int value))
|
if (int.TryParse(mapKey.ToString(), out int key) && int.TryParse(mapValue.ToString(), out int value))
|
||||||
|
@ -2,12 +2,33 @@
|
|||||||
{
|
{
|
||||||
public interface IEventParserConfiguration
|
public interface IEventParserConfiguration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// stores the fs_game directory (this folder may vary between different clients)
|
||||||
|
/// </summary>
|
||||||
string GameDirectory { get; set; }
|
string GameDirectory { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for a say event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Say { get; set; }
|
ParserRegex Say { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for a join event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Join { get; set; }
|
ParserRegex Join { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for a quit event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Quit { get; set; }
|
ParserRegex Quit { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for a kill event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Kill { get; set; }
|
ParserRegex Kill { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for a damage event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Damage { get; set; }
|
ParserRegex Damage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex information for an action event printed in the game log
|
||||||
|
/// </summary>
|
||||||
ParserRegex Action { get; set; }
|
ParserRegex Action { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,47 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IRConParser
|
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);
|
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);
|
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);
|
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);
|
Task<List<EFClient>> GetStatusAsync(Connection connection);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// stores the RCon configuration
|
||||||
|
/// </summary>
|
||||||
IRConParserConfiguration Configuration { get; set; }
|
IRConParserConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// stores the game/client specific version (usually the value of the "version" DVAR)
|
||||||
|
/// </summary>
|
||||||
string Version { get; set; }
|
string Version { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,21 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IRConParserConfiguration
|
public interface IRConParserConfiguration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// stores the command format for console commands
|
||||||
|
/// </summary>
|
||||||
CommandPrefix CommandPrefixes { get; set; }
|
CommandPrefix CommandPrefixes { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// optionally stores the game name type
|
||||||
|
/// </summary>
|
||||||
Server.Game GameName { get; set; }
|
Server.Game GameName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex info for parsing get status response
|
||||||
|
/// </summary>
|
||||||
ParserRegex Status { get; set; }
|
ParserRegex Status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// stores the regex info for parsing get DVAR responses
|
||||||
|
/// </summary>
|
||||||
ParserRegex Dvar { get; set; }
|
ParserRegex Dvar { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user