BaseEvent: Deal with all sorts of special characters sent by the engine (#298)

* BaseEvent: Deal with all sorts of special characters sent by the engine
This commit is contained in:
Edo 2023-05-02 03:40:12 +01:00 committed by GitHub
parent ed3f9f750f
commit 6ae15261c9

View File

@ -578,11 +578,15 @@ namespace IW4MAdmin.Application.EventParsers
return null;
}
var message = matchResult.Values[Configuration.Say.GroupMapping[ParserRegex.GroupType.Message]]
.Replace(Configuration.LocalizeText, "")
.Trim();
var message = new string(matchResult.Values[Configuration.Say.GroupMapping[ParserRegex.GroupType.Message]]
.Where(c => !char.IsControl(c)).ToArray());
if (message.Length <= 0)
if (message.StartsWith("/"))
{
message = message[1..];
}
if (String.IsNullOrEmpty(message))
{
return null;
}