From 6ae15261c9337fbab418610ca7c8aeb6781ed8dc Mon Sep 17 00:00:00 2001 From: Edo Date: Tue, 2 May 2023 03:40:12 +0100 Subject: [PATCH] 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 --- Application/EventParsers/BaseEventParser.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Application/EventParsers/BaseEventParser.cs b/Application/EventParsers/BaseEventParser.cs index 6eade2c12..90e84e519 100644 --- a/Application/EventParsers/BaseEventParser.cs +++ b/Application/EventParsers/BaseEventParser.cs @@ -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; }