1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-07-02 01:50:14 -05:00

fix for runaway regular expression on linux

explicitly set string dvars in quotes to allow setting empty dvars
allow piping in input from command line (#114)
update the distribution for top stats elo
prevent game log file rotation from stopping event parsing
This commit is contained in:
RaidMax
2020-04-01 14:11:56 -05:00
parent 87987f885d
commit d45d99454b
35 changed files with 504 additions and 124 deletions

View File

@ -12,15 +12,11 @@ using static SharedLibraryCore.Server;
namespace IW4MAdmin.Application.RconParsers
{
#if DEBUG
public class BaseRConParser : IRConParser
#else
class BaseRConParser : IRConParser
#endif
{
public BaseRConParser()
public BaseRConParser(IParserRegexFactory parserRegexFactory)
{
Configuration = new DynamicRConParserConfiguration()
Configuration = new DynamicRConParserConfiguration(parserRegexFactory)
{
CommandPrefixes = new CommandPrefix()
{
@ -90,7 +86,6 @@ namespace IW4MAdmin.Application.RconParsers
string removeTrailingColorCode(string input) => Regex.Replace(input, @"\^7$", "");
value = removeTrailingColorCode(value);
defaultValue = removeTrailingColorCode(defaultValue);
latchedValue = removeTrailingColorCode(latchedValue);
@ -134,7 +129,11 @@ namespace IW4MAdmin.Application.RconParsers
public async Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue)
{
return (await connection.SendQueryAsync(StaticHelpers.QueryType.SET_DVAR, $"{dvarName} {dvarValue}")).Length > 0;
string dvarString = (dvarValue is string str)
? $"{dvarName} \"{str}\""
: $"{dvarName} {dvarValue.ToString()}";
return (await connection.SendQueryAsync(StaticHelpers.QueryType.SET_DVAR, dvarString)).Length > 0;
}
private List<EFClient> ClientsFromStatus(string[] Status)

View File

@ -1,4 +1,6 @@
namespace IW4MAdmin.Application.RconParsers
using SharedLibraryCore.Interfaces;
namespace IW4MAdmin.Application.RconParsers
{
/// <summary>
/// empty implementation of the IW4RConParser
@ -6,5 +8,8 @@
/// </summary>
sealed internal class DynamicRConParser : BaseRConParser
{
public DynamicRConParser(IParserRegexFactory parserRegexFactory) : base(parserRegexFactory)
{
}
}
}

View File

@ -1,4 +1,5 @@
using SharedLibraryCore.Interfaces;
using IW4MAdmin.Application.Factories;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.RCon;
using System.Globalization;
@ -11,11 +12,18 @@ namespace IW4MAdmin.Application.RconParsers
sealed internal class DynamicRConParserConfiguration : IRConParserConfiguration
{
public CommandPrefix CommandPrefixes { get; set; }
public ParserRegex Status { get; set; } = new ParserRegex();
public ParserRegex MapStatus { get; set; } = new ParserRegex();
public ParserRegex Dvar { get; set; } = new ParserRegex();
public ParserRegex Status { get; set; }
public ParserRegex MapStatus { get; set; }
public ParserRegex Dvar { get; set; }
public string ServerNotRunningResponse { get; set; }
public bool WaitForResponse { get; set; } = true;
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
public DynamicRConParserConfiguration(IParserRegexFactory parserRegexFactory)
{
Status = parserRegexFactory.CreateParserRegex();
MapStatus = parserRegexFactory.CreateParserRegex();
Dvar = parserRegexFactory.CreateParserRegex();
}
}
}