From 17c9944eef78912e888cd28eafbc1dd15e586783 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Wed, 24 Nov 2021 09:49:44 -0600 Subject: [PATCH] fix concurrency issue with accent color setup --- Application/ApplicationManager.cs | 12 ++++++++++++ Application/IW4MServer.cs | 9 --------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Application/ApplicationManager.cs b/Application/ApplicationManager.cs index 925f9ddc0..26344f593 100644 --- a/Application/ApplicationManager.cs +++ b/Application/ApplicationManager.cs @@ -27,6 +27,7 @@ using IW4MAdmin.Application.Migration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Serilog.Context; +using SharedLibraryCore.Formatting; using static SharedLibraryCore.GameEvent; using ILogger = Microsoft.Extensions.Logging.ILogger; using ObsoleteLogger = SharedLibraryCore.Interfaces.ILogger; @@ -455,6 +456,17 @@ namespace IW4MAdmin.Application Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Utilities.EncodingType = Encoding.GetEncoding(!string.IsNullOrEmpty(_appConfig.CustomParserEncoding) ? _appConfig.CustomParserEncoding : "windows-1252"); + foreach (var parser in AdditionalRConParsers) + { + if (!parser.Configuration.ColorCodeMapping.ContainsKey(ColorCodes.Accent.ToString())) + { + parser.Configuration.ColorCodeMapping.Add(ColorCodes.Accent.ToString(), + parser.Configuration.ColorCodeMapping.TryGetValue(_appConfig.IngameAccentColorKey, out var colorCode) + ? colorCode + : ""); + } + } + #endregion #region COMMANDS diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index 0ba4a3251..e58cce774 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -1111,15 +1111,6 @@ namespace IW4MAdmin Version = RconParser.Version; } - if (!RconParser.Configuration.ColorCodeMapping.ContainsKey(ColorCodes.Accent.ToString())) - { - var accentKey = Manager.GetApplicationSettings().Configuration().IngameAccentColorKey; - RconParser.Configuration.ColorCodeMapping.Add(ColorCodes.Accent.ToString(), - RconParser.Configuration.ColorCodeMapping.TryGetValue(accentKey, out var colorCode) - ? colorCode - : ""); - } - var svRunning = await this.GetMappedDvarValueOrDefaultAsync("sv_running"); if (!string.IsNullOrEmpty(svRunning.Value) && svRunning.Value != "1")