From a8d581eab7f48fe449db20b38b3e909494d05051 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 20 Jan 2022 11:41:26 -0600 Subject: [PATCH] Update shared library to reference data library instead of separate nuget package --- SharedLibraryCore/SharedLibraryCore.csproj | 114 ++++++++++++--------- SharedLibraryCore/TagHelpers/ColorCode.cs | 15 ++- 2 files changed, 74 insertions(+), 55 deletions(-) diff --git a/SharedLibraryCore/SharedLibraryCore.csproj b/SharedLibraryCore/SharedLibraryCore.csproj index fc04de381..b60217241 100644 --- a/SharedLibraryCore/SharedLibraryCore.csproj +++ b/SharedLibraryCore/SharedLibraryCore.csproj @@ -1,56 +1,68 @@  - - Library - netcoreapp3.1 - RaidMax.IW4MAdmin.SharedLibraryCore - 2022.01.08.1 - RaidMax - Forever None - Debug;Release;Prerelease - false - 8.0 - IW4MAdmin - https://github.com/RaidMax/IW4M-Admin/ - https://www.raidmax.org/IW4MAdmin/ - 2022 - true - true - true - MIT - Shared Library for IW4MAdmin - 2022.01.08.1 - + + Library + netcoreapp3.1 + RaidMax.IW4MAdmin.SharedLibraryCore + 2022.01.20.1 + RaidMax + Forever None + Debug;Release;Prerelease + false + 8.0 + IW4MAdmin + https://github.com/RaidMax/IW4M-Admin/ + https://www.raidmax.org/IW4MAdmin/ + 2022 + true + true + true + MIT + Shared Library for IW4MAdmin + 2022.01.08.2 + - - full - true - - - - - - - - - - - - - - - - - - - - - - - - - - - + + full + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage + + + + + + diff --git a/SharedLibraryCore/TagHelpers/ColorCode.cs b/SharedLibraryCore/TagHelpers/ColorCode.cs index e0283fea5..1f765294d 100644 --- a/SharedLibraryCore/TagHelpers/ColorCode.cs +++ b/SharedLibraryCore/TagHelpers/ColorCode.cs @@ -1,28 +1,35 @@ using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Razor.TagHelpers; +using SharedLibraryCore.Configuration; namespace SharedLibraryCore { [HtmlTargetElement("color-code")] public class ColorCode : TagHelper { + public ColorCode(ApplicationConfiguration appConfig) + { + _allow = appConfig?.EnableColorCodes ?? false; + } + public string Value { get; set; } - public bool Allow { get; set; } = false; + private readonly bool _allow; public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "ColorCode"; output.TagMode = TagMode.StartTagAndEndTag; - if (Allow) + if (_allow) { var matches = Regex.Matches(Value, @"\^([0-9]|\:)([^\^]*)"); foreach (Match match in matches) { - char colorCode = match.Groups[1].ToString().Last(); - output.PreContent.AppendHtml($""); + var colorCode = match.Groups[1].ToString().Last(); + output.PreContent.AppendHtml( + $""); output.PreContent.Append(match.Groups[2].ToString()); output.PreContent.AppendHtml(""); }