Allow either parser version or parser name to be used in server config block

This commit is contained in:
RaidMax 2022-02-01 18:27:03 -06:00
parent 2ed5e00bcb
commit 261da918c7
2 changed files with 10 additions and 6 deletions

View File

@ -1088,10 +1088,14 @@ namespace IW4MAdmin
}
RconParser = Manager.AdditionalRConParsers
.FirstOrDefault(_parser => _parser.Version == ServerConfig.RConParserVersion);
.FirstOrDefault(parser =>
parser.Version == ServerConfig.RConParserVersion ||
parser.Name == ServerConfig.RConParserVersion);
EventParser = Manager.AdditionalEventParsers
.FirstOrDefault(_parser => _parser.Version == ServerConfig.EventParserVersion);
.FirstOrDefault(parser =>
parser.Version == ServerConfig.EventParserVersion ||
parser.Name == ServerConfig.RConParserVersion);
RconParser ??= Manager.AdditionalRConParsers[0];
EventParser ??= Manager.AdditionalEventParsers[0];
@ -1108,7 +1112,7 @@ namespace IW4MAdmin
GameName = RconParser.GameName;
}
if (version?.Value?.Length != 0)
if (version.Value?.Length != 0)
{
var matchedRconParser = Manager.AdditionalRConParsers.FirstOrDefault(_parser => _parser.Version == version.Value);
RconParser.Configuration = matchedRconParser != null ? matchedRconParser.Configuration : RconParser.Configuration;

View File

@ -147,8 +147,8 @@ namespace SharedLibraryCore.Configuration
}
_selectedParser = _rconParsers.FirstOrDefault(p => p.Name == parser);
RConParserVersion = _selectedParser?.Version;
EventParserVersion = _selectedParser?.Version;
RConParserVersion = _selectedParser?.Name;
EventParserVersion = _selectedParser?.Name;
if (index <= 0 || _rconParsers[index].CanGenerateLogPath)
{