From a34ac7d2246aec4c32274b57933af8561682ae78 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Fri, 12 Jul 2024 22:19:42 -0500 Subject: [PATCH] prevent auto parsing of base gamescript and anticheat events to mitigate unneeded processing time --- Application/EventParsers/BaseEventParser.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Application/EventParsers/BaseEventParser.cs b/Application/EventParsers/BaseEventParser.cs index 1baa4ab8..365232fb 100644 --- a/Application/EventParsers/BaseEventParser.cs +++ b/Application/EventParsers/BaseEventParser.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using Data.Models; +using IW4MAdmin.Plugins.Stats.Events; using Microsoft.Extensions.Logging; using SharedLibraryCore.Events.Game; using SharedLibraryCore.Interfaces.Events; @@ -202,7 +203,17 @@ public virtual GameEvent GenerateGameEvent(string logLine) var createdEvent = _gameScriptEventFactory.Create(split[0], logLine.Replace(split[0], "")); if (createdEvent is not null) { - createdEvent.ParseArguments(); + var eventTypeName = createdEvent.GetType().Name; + var isParseIgnoredEvent = eventTypeName is nameof(GameScriptEvent) or nameof(AntiCheatDamageEvent); + + // avoid parsing base script event (which has no viable properties) + // and anticheat events as they are manually mapped. + // for performance as dynamic "Invoke" is relatively costly due + if (isParseIgnoredEvent) + { + createdEvent.ParseArguments(); + } + return createdEvent as GameEventV2; } }