From 6d5c368954a34b01b4d29d8e14109e8745b8a5fe Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 8 Apr 2018 13:48:40 -0500 Subject: [PATCH] Seperated the application back into a seperate project webfront is just a library now --- Application/Application.csproj | 25 ++++++++++++++ .../Application/API/EventAPI.cs | 24 +++++++------ .../Application/ConfigurationGenerator.cs | 2 +- .../Application/Logger.cs | 2 +- .../Application/Main.cs | 8 ++--- .../Application/Manager.cs | 10 ++++-- .../Application/Misc/VPNCheck.cs | 2 +- .../Application/Server.cs | 15 ++++---- IW4MAdmin.sln | 34 +++++++++++++++++++ SharedLibraryCore/Interfaces/IEventApi.cs | 11 ++++++ SharedLibraryCore/Interfaces/IManager.cs | 4 ++- .../Controllers/API/EventController.cs | 3 +- WebfrontCore/Controllers/AccountController.cs | 2 +- WebfrontCore/Controllers/BaseController.cs | 21 ++++++------ WebfrontCore/Controllers/ConsoleController.cs | 4 +-- WebfrontCore/Program.cs | 10 ++++-- WebfrontCore/Startup.cs | 3 -- .../PenaltyListViewComponent.cs | 2 +- .../ViewComponents/ServerListViewComponent.cs | 5 +-- WebfrontCore/WebfrontCore.csproj | 3 ++ 20 files changed, 133 insertions(+), 57 deletions(-) create mode 100644 Application/Application.csproj rename {WebfrontCore => Application}/Application/API/EventAPI.cs (83%) rename {WebfrontCore => Application}/Application/ConfigurationGenerator.cs (98%) rename {WebfrontCore => Application}/Application/Logger.cs (98%) rename {WebfrontCore => Application}/Application/Main.cs (95%) rename {WebfrontCore => Application}/Application/Manager.cs (98%) rename {WebfrontCore => Application}/Application/Misc/VPNCheck.cs (96%) rename {WebfrontCore => Application}/Application/Server.cs (99%) create mode 100644 SharedLibraryCore/Interfaces/IEventApi.cs diff --git a/Application/Application.csproj b/Application/Application.csproj new file mode 100644 index 000000000..4977bdce8 --- /dev/null +++ b/Application/Application.csproj @@ -0,0 +1,25 @@ + + + + Exe + netcoreapp2.0 + RaidMax.IW4MAdmin.Application + 2.0.0 + RaidMax + Forever None + IW4MAdmin + IW4MAdmin is a complete server administration tool for IW4x and most Call of Duty® dedicated server + 2018 + https://github.com/RaidMax/IW4M-Admin/blob/master/LICENSE + https://raidmax.org/IW4MAdmin + https://github.com/RaidMax/IW4M-Admin + https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png + + + + + + + + + diff --git a/WebfrontCore/Application/API/EventAPI.cs b/Application/Application/API/EventAPI.cs similarity index 83% rename from WebfrontCore/Application/API/EventAPI.cs rename to Application/Application/API/EventAPI.cs index 20305f9ef..61fbc6747 100644 --- a/WebfrontCore/Application/API/EventAPI.cs +++ b/Application/Application/API/EventAPI.cs @@ -1,15 +1,17 @@ -using SharedLibraryCore; -using SharedLibraryCore.Dtos; -using SharedLibraryCore.Objects; -using System; +using System; using System.Collections.Generic; -namespace WebfrontCore.Application.API +using SharedLibraryCore; +using SharedLibraryCore.Dtos; +using SharedLibraryCore.Interfaces; +using SharedLibraryCore.Objects; + +namespace IW4MAdmin.Application.API { - class EventAPI + class EventApi : IEventApi { - public static Queue Events = new Queue(); - static DateTime LastFlagEvent; + Queue Events = new Queue(); + DateTime LastFlagEvent; static string[] FlaggedMessageContains = { " wh ", @@ -22,9 +24,11 @@ namespace WebfrontCore.Application.API "hak", "bot" }; - static int FlaggedMessageCount; + int FlaggedMessageCount; - public static void OnServerEventOccurred(object sender, Event E) + public Queue GetEvents() => Events; + + public void OnServerEvent(object sender, Event E) { if (E.Type == Event.GType.Say && E.Origin.Level < Player.Permission.Trusted) { diff --git a/WebfrontCore/Application/ConfigurationGenerator.cs b/Application/Application/ConfigurationGenerator.cs similarity index 98% rename from WebfrontCore/Application/ConfigurationGenerator.cs rename to Application/Application/ConfigurationGenerator.cs index 0e528f6c6..04fb5e2ab 100644 --- a/WebfrontCore/Application/ConfigurationGenerator.cs +++ b/Application/Application/ConfigurationGenerator.cs @@ -7,7 +7,7 @@ using System.Net; using System.Text; using System.Threading.Tasks; -namespace IW4MAdmin +namespace IW4MAdmin.Application { class ConfigurationGenerator { diff --git a/WebfrontCore/Application/Logger.cs b/Application/Application/Logger.cs similarity index 98% rename from WebfrontCore/Application/Logger.cs rename to Application/Application/Logger.cs index ac88c1cc7..88de9b5cb 100644 --- a/WebfrontCore/Application/Logger.cs +++ b/Application/Application/Logger.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace IW4MAdmin +namespace IW4MAdmin.Application { class Logger : SharedLibraryCore.Interfaces.ILogger { diff --git a/WebfrontCore/Application/Main.cs b/Application/Application/Main.cs similarity index 95% rename from WebfrontCore/Application/Main.cs rename to Application/Application/Main.cs index 5dd8f0748..8b9d9dcab 100644 --- a/WebfrontCore/Application/Main.cs +++ b/Application/Application/Main.cs @@ -6,7 +6,7 @@ using System.IO; using SharedLibraryCore.Objects; using System.Reflection; -namespace IW4MAdmin +namespace IW4MAdmin.Application { public class Program { @@ -14,7 +14,7 @@ namespace IW4MAdmin static public ApplicationManager ServerManager = ApplicationManager.GetInstance(); public static string OperatingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar; - public static bool Start() + public static void Main(string[] args) { AppDomain.CurrentDomain.SetData("DataDirectory", OperatingDirectory); System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal; @@ -60,8 +60,7 @@ namespace IW4MAdmin Console.WriteLine("Shutdown complete"); }); - return true; - + WebfrontCore.Program.Init(ServerManager); } catch (Exception e) @@ -74,7 +73,6 @@ namespace IW4MAdmin } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); - return false; } } diff --git a/WebfrontCore/Application/Manager.cs b/Application/Application/Manager.cs similarity index 98% rename from WebfrontCore/Application/Manager.cs rename to Application/Application/Manager.cs index eedaa6c3b..d4440425c 100644 --- a/WebfrontCore/Application/Manager.cs +++ b/Application/Application/Manager.cs @@ -12,14 +12,14 @@ using SharedLibraryCore.Helpers; using SharedLibraryCore.Exceptions; using SharedLibraryCore.Objects; using SharedLibraryCore.Services; -using WebfrontCore.Application.API; +using IW4MAdmin.Application.API; using Microsoft.Extensions.Configuration; using WebfrontCore; using SharedLibraryCore.Configuration; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -namespace IW4MAdmin +namespace IW4MAdmin.Application { public class ApplicationManager : IManager { @@ -38,6 +38,7 @@ namespace IW4MAdmin AliasService AliasSvc; PenaltyService PenaltySvc; BaseConfigurationHandler ConfigHandler; + EventApi Api; #if FTP_LOG const int UPDATE_FREQUENCY = 700; #else @@ -55,7 +56,8 @@ namespace IW4MAdmin AliasSvc = new AliasService(); PenaltySvc = new PenaltyService(); PrivilegedClients = new Dictionary(); - ServerEventOccurred += EventAPI.OnServerEventOccurred; + Api = new EventApi(); + ServerEventOccurred += Api.OnServerEvent; ConfigHandler = new BaseConfigurationHandler("IW4MAdminSettings"); Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey); } @@ -314,5 +316,7 @@ namespace IW4MAdmin public IConfigurationHandler GetApplicationSettings() => ConfigHandler; public IDictionary GetPrivilegedClients() => PrivilegedClients; + + public IEventApi GetEventApi() => Api; } } diff --git a/WebfrontCore/Application/Misc/VPNCheck.cs b/Application/Application/Misc/VPNCheck.cs similarity index 96% rename from WebfrontCore/Application/Misc/VPNCheck.cs rename to Application/Application/Misc/VPNCheck.cs index dc9306bc0..6d0056f04 100644 --- a/WebfrontCore/Application/Misc/VPNCheck.cs +++ b/Application/Application/Misc/VPNCheck.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace WebfrontCore.Application.Misc +namespace IW4MAdmin.Application.Misc { public class VPNCheck { diff --git a/WebfrontCore/Application/Server.cs b/Application/Application/Server.cs similarity index 99% rename from WebfrontCore/Application/Server.cs rename to Application/Application/Server.cs index 790762b37..3e274d5b4 100644 --- a/WebfrontCore/Application/Server.cs +++ b/Application/Application/Server.cs @@ -14,7 +14,7 @@ using SharedLibraryCore.Database.Models; using SharedLibraryCore.Dtos; using SharedLibraryCore.Configuration; -using WebfrontCore.Application.Misc; +using IW4MAdmin.Application.Misc; namespace IW4MAdmin { @@ -358,20 +358,20 @@ namespace IW4MAdmin return; await ProcessEvent(E); - ((ApplicationManager)Manager).ServerEventOccurred(this, E); + Manager.GetEventApi().OnServerEvent(this, E); foreach (IPlugin P in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins) { - //#if !DEBUG +#if !DEBUG try - //#endif +#endif { if (cts.IsCancellationRequested) break; await P.OnEventAsync(E, this); } - //#if !DEBUG +#if !DEBUG catch (Exception Except) { Logger.WriteError(String.Format("The plugin \"{0}\" generated an error. ( see log )", P.Name)); @@ -379,7 +379,7 @@ namespace IW4MAdmin Logger.WriteDebug(String.Format("Error Trace: {0}", Except.StackTrace)); continue; } - //#endif +#endif } } @@ -540,7 +540,6 @@ namespace IW4MAdmin } oldLines = lines; l_size = LogFile.Length(); - if (!((ApplicationManager)Manager).Running) { foreach (var plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins) await plugin.OnUnloadAsync(); @@ -964,7 +963,7 @@ namespace IW4MAdmin override public void InitializeTokens() { Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", Manager.GetClientService().GetTotalClientsAsync().Result.ToString)); - Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", Program.Version.ToString)); + Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", IW4MAdmin.Application.Program.Version.ToString)); } } } diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln index cab733f06..671a56ee8 100644 --- a/IW4MAdmin.sln +++ b/IW4MAdmin.sln @@ -24,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedLibraryCore", "Shared EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebfrontCore", "WebfrontCore\WebfrontCore.csproj", "{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{B4626E78-BB22-43F8-A6AD-890B0853D61F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -234,6 +236,38 @@ Global {D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x64.Build.0 = Release|Any CPU {D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.ActiveCfg = Release|Any CPU {D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x64.ActiveCfg = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x64.Build.0 = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x86.ActiveCfg = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x86.Build.0 = Debug|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Any CPU.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x64.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x64.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x86.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x86.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x64.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x64.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x86.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x86.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Any CPU.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Mixed Platforms.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Mixed Platforms.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x64.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x64.Build.0 = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x86.ActiveCfg = Release|Any CPU + {B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SharedLibraryCore/Interfaces/IEventApi.cs b/SharedLibraryCore/Interfaces/IEventApi.cs new file mode 100644 index 000000000..3aaf8d8bf --- /dev/null +++ b/SharedLibraryCore/Interfaces/IEventApi.cs @@ -0,0 +1,11 @@ +using SharedLibraryCore.Dtos; +using System.Collections.Generic; + +namespace SharedLibraryCore.Interfaces +{ + public interface IEventApi + { + void OnServerEvent(object sender, Event E); + Queue GetEvents(); + } +} diff --git a/SharedLibraryCore/Interfaces/IManager.cs b/SharedLibraryCore/Interfaces/IManager.cs index c8eeb0ae2..bffac44a6 100644 --- a/SharedLibraryCore/Interfaces/IManager.cs +++ b/SharedLibraryCore/Interfaces/IManager.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; +using System.Threading.Tasks; + using SharedLibraryCore.Objects; using SharedLibraryCore.Services; -using System.Threading.Tasks; using SharedLibraryCore.Configuration; namespace SharedLibraryCore.Interfaces @@ -21,5 +22,6 @@ namespace SharedLibraryCore.Interfaces AliasService GetAliasService(); PenaltyService GetPenaltyService(); IDictionary GetPrivilegedClients(); + IEventApi GetEventApi(); } } diff --git a/WebfrontCore/Controllers/API/EventController.cs b/WebfrontCore/Controllers/API/EventController.cs index f5730aacc..de7cc3549 100644 --- a/WebfrontCore/Controllers/API/EventController.cs +++ b/WebfrontCore/Controllers/API/EventController.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; -using WebfrontCore.Application.API; namespace WebfrontCore.Controllers.API { @@ -12,7 +11,7 @@ namespace WebfrontCore.Controllers.API [Route("event")] public ActionResult Index() { - var events = EventAPI.Events; + var events = Manager.GetEventApi().GetEvents(); var eventsDto = new List(); while (events.Count > 0) eventsDto.Add(events.Dequeue()); diff --git a/WebfrontCore/Controllers/AccountController.cs b/WebfrontCore/Controllers/AccountController.cs index ccc6a448f..7cc598e0e 100644 --- a/WebfrontCore/Controllers/AccountController.cs +++ b/WebfrontCore/Controllers/AccountController.cs @@ -19,7 +19,7 @@ namespace WebfrontCore.Controllers try { - var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[clientId]; + var client = Manager.GetPrivilegedClients()[clientId]; string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt)); if (hashedPassword[0] == client.Password) diff --git a/WebfrontCore/Controllers/BaseController.cs b/WebfrontCore/Controllers/BaseController.cs index 0529982f2..7e93167ed 100644 --- a/WebfrontCore/Controllers/BaseController.cs +++ b/WebfrontCore/Controllers/BaseController.cs @@ -1,20 +1,19 @@ -using IW4MAdmin; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using SharedLibraryCore; -using SharedLibraryCore.Database; -using SharedLibraryCore.Database.Models; -using SharedLibraryCore.Objects; -using System; -using System.Collections.Generic; +using System; using System.Linq; using System.Security.Claims; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; + +using SharedLibraryCore.Database; +using SharedLibraryCore.Database.Models; +using SharedLibraryCore.Interfaces; +using SharedLibraryCore.Objects; namespace WebfrontCore.Controllers { public class BaseController : Controller { - protected ApplicationManager Manager; + protected IManager Manager; protected readonly DatabaseContext Context; protected bool Authorized { get; private set; } protected EFClient User { get; private set; } @@ -26,7 +25,7 @@ namespace WebfrontCore.Controllers public override void OnActionExecuting(ActionExecutingContext context) { - Manager = IW4MAdmin.Program.ServerManager; + Manager = Program.Manager; User = new EFClient() { diff --git a/WebfrontCore/Controllers/ConsoleController.cs b/WebfrontCore/Controllers/ConsoleController.cs index 970cff025..14f06b0cd 100644 --- a/WebfrontCore/Controllers/ConsoleController.cs +++ b/WebfrontCore/Controllers/ConsoleController.cs @@ -13,7 +13,7 @@ namespace WebfrontCore.Controllers { public IActionResult Index() { - var activeServers = Manager.Servers.Select(s => new ServerInfo() + var activeServers = Manager.GetServers().Select(s => new ServerInfo() { Name = s.Hostname, ID = s.GetHashCode(), @@ -29,7 +29,7 @@ namespace WebfrontCore.Controllers public async Task ExecuteAsync(int serverId, string command) { - var server = Manager.Servers.First(s => s.GetHashCode() == serverId); + var server = Manager.GetServers().First(s => s.GetHashCode() == serverId); var client = new Player() { ClientId = User.ClientId, diff --git a/WebfrontCore/Program.cs b/WebfrontCore/Program.cs index ba50af8df..1002a9641 100644 --- a/WebfrontCore/Program.cs +++ b/WebfrontCore/Program.cs @@ -1,16 +1,20 @@ using System.IO; using Microsoft.AspNetCore.Hosting; +using SharedLibraryCore.Interfaces; namespace WebfrontCore { public class Program { - public static void Main(string[] args) + public static IManager Manager; + + public static void Init(IManager mgr) { - BuildWebHost(args).Run(); + Manager = mgr; + BuildWebHost().Run(); } - public static IWebHost BuildWebHost(string[] args) => + public static IWebHost BuildWebHost() => new WebHostBuilder() .UseContentRoot(Directory.GetCurrentDirectory()) .UseKestrel() diff --git a/WebfrontCore/Startup.cs b/WebfrontCore/Startup.cs index 6466a1a76..68ed2302c 100644 --- a/WebfrontCore/Startup.cs +++ b/WebfrontCore/Startup.cs @@ -49,9 +49,6 @@ namespace WebfrontCore options.AccessDeniedPath = "/"; options.LoginPath = "/"; }); - - if (!IW4MAdmin.Program.Start()) - Environment.Exit(-1); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs index 275fb3d9a..a39e2041c 100644 --- a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs +++ b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs @@ -28,7 +28,7 @@ namespace WebfrontCore.ViewComponents } - var penalties = await IW4MAdmin.ApplicationManager.GetInstance().GetPenaltyService().GetRecentPenalties(15, offset); + var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(15, offset); var penaltiesDto = penalties.Select(p => new PenaltyInfo() { OffenderId = p.OffenderId, diff --git a/WebfrontCore/ViewComponents/ServerListViewComponent.cs b/WebfrontCore/ViewComponents/ServerListViewComponent.cs index 3111a4678..409f8b979 100644 --- a/WebfrontCore/ViewComponents/ServerListViewComponent.cs +++ b/WebfrontCore/ViewComponents/ServerListViewComponent.cs @@ -1,9 +1,6 @@ using Microsoft.AspNetCore.Mvc; using SharedLibraryCore.Dtos; -using System; -using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace WebfrontCore.ViewComponents { @@ -11,7 +8,7 @@ namespace WebfrontCore.ViewComponents { public IViewComponentResult Invoke() { - var servers = IW4MAdmin.Program.ServerManager.GetServers(); + var servers = Program.Manager.GetServers(); var serverInfo = servers.Select(s => new ServerInfo() { Name = s.Hostname, diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index 0c587cb53..6ba6248e1 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -15,6 +15,9 @@ https://raidmax.org/IW4MAdmin https://github.com/RaidMax/IW4M-Admin https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png + + Library +