From d527a86911080d586dbc3f3d768efedf33696bc9 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Tue, 22 Feb 2022 08:38:02 -0600 Subject: [PATCH] improve mag command matching of maps and gametypes --- Application/Commands/MapAndGameTypeCommand.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Application/Commands/MapAndGameTypeCommand.cs b/Application/Commands/MapAndGameTypeCommand.cs index 746862305..b969d3ec1 100644 --- a/Application/Commands/MapAndGameTypeCommand.cs +++ b/Application/Commands/MapAndGameTypeCommand.cs @@ -54,20 +54,8 @@ namespace IW4MAdmin.Application.Commands return; } - string map; - string gametype; - - if (match.Groups.Count > 3) - { - map = match.Groups[2].ToString(); - gametype = match.Groups[4].ToString(); - } - - else - { - map = match.Groups[1].ToString(); - gametype = match.Groups[3].ToString(); - } + var map = match.Groups[1].Length > 0 ? match.Groups[1].ToString() : match.Groups[2].ToString(); + var gametype = match.Groups[3].Length > 0 ? match.Groups[3].ToString() : match.Groups[4].ToString(); var matchingMaps = gameEvent.Owner.FindMap(map); var matchingGametypes = _defaultSettings.FindGametype(gametype, gameEvent.Owner.GameName);