tweak for T6 parser
This commit is contained in:
parent
b381af5fba
commit
841bcf6156
@ -176,16 +176,16 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
return new StatusResponse
|
return new StatusResponse
|
||||||
{
|
{
|
||||||
Clients = ClientsFromStatus(response).ToArray(),
|
Clients = ClientsFromStatus(response).ToArray(),
|
||||||
Map = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusMap, Configuration.MapStatus.Pattern),
|
Map = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusMap, Configuration.MapStatus),
|
||||||
GameType = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusGametype, Configuration.GametypeStatus.Pattern),
|
GameType = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusGametype, Configuration.GametypeStatus),
|
||||||
Hostname = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusHostname, Configuration.HostnameStatus.Pattern),
|
Hostname = GetValueFromStatus<string>(response, ParserRegex.GroupType.RConStatusHostname, Configuration.HostnameStatus),
|
||||||
MaxClients = GetValueFromStatus<int?>(response, ParserRegex.GroupType.RConStatusMaxPlayers, Configuration.MaxPlayersStatus.Pattern)
|
MaxClients = GetValueFromStatus<int?>(response, ParserRegex.GroupType.RConStatusMaxPlayers, Configuration.MaxPlayersStatus)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private T GetValueFromStatus<T>(IEnumerable<string> response, ParserRegex.GroupType groupType, string groupPattern)
|
private T GetValueFromStatus<T>(IEnumerable<string> response, ParserRegex.GroupType groupType, ParserRegex parserRegex)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(groupPattern))
|
if (string.IsNullOrEmpty(parserRegex.Pattern))
|
||||||
{
|
{
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
@ -193,10 +193,10 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
string value = null;
|
string value = null;
|
||||||
foreach (var line in response)
|
foreach (var line in response)
|
||||||
{
|
{
|
||||||
var regex = Regex.Match(line, groupPattern);
|
var regex = Regex.Match(line, parserRegex.Pattern);
|
||||||
if (regex.Success)
|
if (regex.Success && parserRegex.GroupMapping.ContainsKey(groupType))
|
||||||
{
|
{
|
||||||
value = regex.Groups[Configuration.MapStatus.GroupMapping[groupType]].ToString();
|
value = regex.Groups[parserRegex.GroupMapping[groupType]].ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ var plugin = {
|
|||||||
eventParser = manager.GenerateDynamicEventParser(this.name);
|
eventParser = manager.GenerateDynamicEventParser(this.name);
|
||||||
|
|
||||||
rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +(\\d+\\.\\d+\\.\\d+.\\d+\\:-*\\d{1,5}|0+.0+:-*\\d{1,5}|loopback|unknown)(?:\\([0-9]+\\)) +(-*[0-9]+) *$';
|
rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +(\\d+\\.\\d+\\.\\d+.\\d+\\:-*\\d{1,5}|0+.0+:-*\\d{1,5}|loopback|unknown)(?:\\([0-9]+\\)) +(-*[0-9]+) *$';
|
||||||
rconParser.Configuration.StatusHeader.Pattern = 'num +score +ping +xuid +name +address +qport';
|
rconParser.Configuration.StatusHeader.Pattern = 'num +score +ping +xuid +name +address +qport|---------- Live ----------';
|
||||||
rconParser.Configuration.CommandPrefixes.Kick = 'clientkick {0}';
|
rconParser.Configuration.CommandPrefixes.Kick = 'clientkick {0}';
|
||||||
rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0}';
|
rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0}';
|
||||||
rconParser.Configuration.CommandPrefixes.TempBan = 'tempbanclient {0}';
|
rconParser.Configuration.CommandPrefixes.TempBan = 'tempbanclient {0}';
|
||||||
|
Loading…
Reference in New Issue
Block a user