From 524589717b91e4d49c9db563bb314500b49f7ffc Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 30 Sep 2019 18:35:36 -0500 Subject: [PATCH] Update to .NET Core 3.0 --- Application/Application.csproj | 14 +++++------- Application/IW4MServer.cs | 2 +- .../AutomessageFeed/AutomessageFeed.csproj | 2 +- .../IW4ScriptCommands.csproj | 9 ++------ Plugins/LiveRadar/LiveRadar.csproj | 7 ++---- Plugins/Login/Login.csproj | 7 +----- .../ProfanityDeterment.csproj | 7 +----- Plugins/Stats/Stats.csproj | 7 +----- Plugins/Tests/Tests.csproj | 7 +----- Plugins/Web/StatsWeb/StatsWeb.csproj | 7 ++---- Plugins/Welcome/Welcome.csproj | 7 +----- SharedLibraryCore/Database/DatabaseContext.cs | 8 +++---- SharedLibraryCore/SharedLibraryCore.csproj | 10 ++------- SharedLibraryCore/Utilities.cs | 3 +-- WebfrontCore/Startup.cs | 22 +++++++++---------- WebfrontCore/TagHelpers/ColorCode.cs | 2 -- WebfrontCore/Views/Configuration/Index.cshtml | 3 +-- WebfrontCore/WebfrontCore.csproj | 18 ++++----------- 18 files changed, 40 insertions(+), 102 deletions(-) diff --git a/Application/Application.csproj b/Application/Application.csproj index df8389eb9..7d2490c87 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -2,11 +2,10 @@ Exe - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 false RaidMax.IW4MAdmin.Application - 2.2.8.3 + 2.3.1.0 RaidMax Forever None IW4MAdmin @@ -34,9 +33,10 @@ false true true - 2.2.8.3 - 2.2.8.3 + 2.3.1.0 + 2.3.1.0 7.1 + @@ -55,10 +55,6 @@ - - - - diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index cfa9fe3a3..35415137c 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -24,7 +24,7 @@ namespace IW4MAdmin { public class IW4MServer : Server { - private static readonly Index loc = Utilities.CurrentLocalization.LocalizationIndex; + private static readonly SharedLibraryCore.Localization.Index loc = Utilities.CurrentLocalization.LocalizationIndex; private GameLogEventDetection LogEvent; private const int REPORT_FLAG_COUNT = 4; diff --git a/Plugins/AutomessageFeed/AutomessageFeed.csproj b/Plugins/AutomessageFeed/AutomessageFeed.csproj index c1e8b4905..b4eab9727 100644 --- a/Plugins/AutomessageFeed/AutomessageFeed.csproj +++ b/Plugins/AutomessageFeed/AutomessageFeed.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 true 7.1 Debug;Release;Prerelease diff --git a/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj b/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj index ae9424209..2d5ccc905 100644 --- a/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj +++ b/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 Debug;Release;Prerelease @@ -22,9 +21,5 @@ false - - - - - + diff --git a/Plugins/LiveRadar/LiveRadar.csproj b/Plugins/LiveRadar/LiveRadar.csproj index ba5349765..64d85f54c 100644 --- a/Plugins/LiveRadar/LiveRadar.csproj +++ b/Plugins/LiveRadar/LiveRadar.csproj @@ -1,9 +1,10 @@  - netcoreapp2.2 + netcoreapp3.0 true true + true 0.1.0.0 Debug;Release;Prerelease 7.1 @@ -16,10 +17,6 @@ - - - - Never diff --git a/Plugins/Login/Login.csproj b/Plugins/Login/Login.csproj index 12463fd10..bd1e08fb1 100644 --- a/Plugins/Login/Login.csproj +++ b/Plugins/Login/Login.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 RaidMax.IW4MAdmin.Plugins.Login @@ -24,10 +23,6 @@ - - - - diff --git a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj index 6a36bd557..f0c943f3c 100644 --- a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj +++ b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 RaidMax.IW4MAdmin.Plugins.ProfanityDeterment @@ -22,10 +21,6 @@ - - - - diff --git a/Plugins/Stats/Stats.csproj b/Plugins/Stats/Stats.csproj index 4f371e775..bbe579a49 100644 --- a/Plugins/Stats/Stats.csproj +++ b/Plugins/Stats/Stats.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 RaidMax.IW4MAdmin.Plugins.Stats @@ -25,10 +24,6 @@ - - - - diff --git a/Plugins/Tests/Tests.csproj b/Plugins/Tests/Tests.csproj index 872f54352..e129952a6 100644 --- a/Plugins/Tests/Tests.csproj +++ b/Plugins/Tests/Tests.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 7.1 @@ -26,8 +25,4 @@ - - - - diff --git a/Plugins/Web/StatsWeb/StatsWeb.csproj b/Plugins/Web/StatsWeb/StatsWeb.csproj index e4550db72..6c7ddefbf 100644 --- a/Plugins/Web/StatsWeb/StatsWeb.csproj +++ b/Plugins/Web/StatsWeb/StatsWeb.csproj @@ -1,16 +1,13 @@  - netcoreapp2.2 + netcoreapp3.0 true true + true Debug;Release;Prerelease 7.1 - - - - false diff --git a/Plugins/Welcome/Welcome.csproj b/Plugins/Welcome/Welcome.csproj index caefd0da7..50e72401e 100644 --- a/Plugins/Welcome/Welcome.csproj +++ b/Plugins/Welcome/Welcome.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 RaidMax.IW4MAdmin.Plugins.Welcome @@ -22,10 +21,6 @@ - - - - diff --git a/SharedLibraryCore/Database/DatabaseContext.cs b/SharedLibraryCore/Database/DatabaseContext.cs index 498d6ee3e..f1a3cf72a 100644 --- a/SharedLibraryCore/Database/DatabaseContext.cs +++ b/SharedLibraryCore/Database/DatabaseContext.cs @@ -23,10 +23,10 @@ namespace SharedLibraryCore.Database public DbSet EFChangeHistory { get; set; } - [Obsolete] - private static readonly ILoggerFactory _loggerFactory = new LoggerFactory(new[] { - new ConsoleLoggerProvider((category, level) => level == LogLevel.Information, true) - }); + //[Obsolete] + //private static readonly ILoggerFactory _loggerFactory = new LoggerFactory(new[] { + // new ConsoleLoggerProvider((category, level) => level == LogLevel.Information, true) + //}); static string _ConnectionString; static string _provider; diff --git a/SharedLibraryCore/SharedLibraryCore.csproj b/SharedLibraryCore/SharedLibraryCore.csproj index dd0980538..4d97af716 100644 --- a/SharedLibraryCore/SharedLibraryCore.csproj +++ b/SharedLibraryCore/SharedLibraryCore.csproj @@ -2,8 +2,7 @@ Library - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 RaidMax.IW4MAdmin.SharedLibraryCore @@ -16,7 +15,6 @@ IW4MAdmin https://github.com/RaidMax/IW4M-Admin/ https://www.raidmax.org/IW4MAdmin/ - https://www.raidmax.org/IW4MAdmin/img/iw4adminicon-3.png 2019 true true @@ -53,11 +51,7 @@ - - - - - + diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index ca8003406..c8f4ad571 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -25,8 +25,7 @@ namespace SharedLibraryCore public static class Utilities { #if DEBUG == true - public static string OperatingDirectory => @"X:\IW4MAdmin\Application\bin\Debug\netcoreapp2.2\"; - //public static string OperatingDirectory => $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}{Path.DirectorySeparatorChar}"; + public static string OperatingDirectory => $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}{Path.DirectorySeparatorChar}"; #else public static string OperatingDirectory => $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}"; #endif diff --git a/WebfrontCore/Startup.cs b/WebfrontCore/Startup.cs index 53aad854a..bc4282d18 100644 --- a/WebfrontCore/Startup.cs +++ b/WebfrontCore/Startup.cs @@ -13,10 +13,10 @@ namespace WebfrontCore { public class Startup { - private readonly IHostingEnvironment _appHost; + private readonly IWebHostEnvironment _appHost; public static IConfigurationRoot Configuration { get; private set; } - public Startup(IHostingEnvironment env) + public Startup(IWebHostEnvironment env) { var builder = new ConfigurationBuilder() .AddEnvironmentVariables(); @@ -37,13 +37,12 @@ namespace WebfrontCore { _builder.AllowAnyOrigin() .AllowAnyMethod() - .AllowAnyHeader() - .AllowCredentials(); + .AllowAnyHeader(); }); }); // Add framework services. - var mvcBuilder = services.AddMvc() + var mvcBuilder = services.AddMvc(_options => _options.SuppressAsyncSuffixInActionNames = false) .ConfigureApplicationPartManager(_ => { foreach (var assembly in Program.Manager.GetPluginAssemblies()) @@ -61,7 +60,7 @@ namespace WebfrontCore }); #if DEBUG - mvcBuilder = mvcBuilder.AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true); + mvcBuilder = mvcBuilder.AddRazorRuntimeCompilation(); services.Configure(_options => { _options.ViewLocationFormats.Add(@"/Views/Plugins/{1}/{0}" + RazorViewEngine.ViewExtension); @@ -94,9 +93,9 @@ namespace WebfrontCore } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { - if (env.IsDevelopment()) + if (env.EnvironmentName == "Development") { app.UseDeveloperExceptionPage(); } @@ -115,11 +114,10 @@ namespace WebfrontCore app.UseAuthentication(); app.UseCors("AllowAll"); - app.UseMvc(routes => + app.UseRouting(); + app.UseEndpoints(endpoints => { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); } } diff --git a/WebfrontCore/TagHelpers/ColorCode.cs b/WebfrontCore/TagHelpers/ColorCode.cs index f3f184550..b947e71a4 100644 --- a/WebfrontCore/TagHelpers/ColorCode.cs +++ b/WebfrontCore/TagHelpers/ColorCode.cs @@ -17,8 +17,6 @@ namespace WebfrontCore.TagHelpers output.TagName = "ColorCode"; output.TagMode = TagMode.StartTagAndEndTag; - - if (Allow) { var matches = Regex.Matches(Value, @"\^([0-9]|\:)([^\^]*)"); diff --git a/WebfrontCore/Views/Configuration/Index.cshtml b/WebfrontCore/Views/Configuration/Index.cshtml index f8aafa4d2..4035d736e 100644 --- a/WebfrontCore/Views/Configuration/Index.cshtml +++ b/WebfrontCore/Views/Configuration/Index.cshtml @@ -51,9 +51,8 @@ if (property.PropertyType.Name == typeof(System.Boolean).Name) { - var attributes = linkedPropertyNames.Length > 0 ? new { htmlAttributes = new { @class = "has-related-content mb-0", data_related_content = string.Join(',', linkedPropertyNames.Select(_id => $"#{_id}_content")) } } : null;
- @Html.Editor(property.Name, attributes) + @Html.Editor(property.Name, linkedPropertyNames.Length > 0 ? new { htmlAttributes = new { @class= "has-related-content mb-0", data_related_content = string.Join(',', linkedPropertyNames.Select(_id => $"#{_id}_content")) } } : null) @Html.Label(property.Name, null, new { @class = "form-check-label ml-1" })
} diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index 076be9222..20f5ec30d 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -1,10 +1,10 @@  - netcoreapp2.2 - 2.2.2 + netcoreapp3.0 true true + true true 2.6 RaidMax.IW4MAdmin.WebfrontCore @@ -68,18 +68,8 @@ - - - - - - - - - - - - + +