From 5dfaa4ebd64b73eb2f973aeb9a591329a4325516 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 23 Apr 2018 16:03:50 -0500 Subject: [PATCH] update projects to .NET Core 2.0.7 added instance and client count to api page removed vestigial ConfigGenerator --- Application/Application.csproj | 4 ++ Application/ConfigurationGenerator.cs | 62 ------------------- Application/Localization/Configure.cs | 2 +- Application/Manager.cs | 8 ++- Application/Server.cs | 4 +- Master/master/resources/history_graph.py | 15 ++--- Master/master/templates/index.html | 12 +++- Master/master/views.py | 5 +- Plugins/Login/Login.csproj | 4 ++ .../ProfanityDeterment.csproj | 4 ++ Plugins/Stats/Stats.csproj | 4 ++ Plugins/Tests/Tests.csproj | 4 ++ Plugins/Welcome/Welcome.csproj | 4 ++ README.md | 8 +-- .../Configuration/ServerConfiguration.cs | 32 ++++++++-- SharedLibraryCore/SharedLibraryCore.csproj | 4 ++ WebfrontCore/WebfrontCore.csproj | 6 +- version.txt | 1 + 18 files changed, 98 insertions(+), 85 deletions(-) delete mode 100644 Application/ConfigurationGenerator.cs diff --git a/Application/Application.csproj b/Application/Application.csproj index 1b867d24c..5ee1fef5e 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -63,6 +63,10 @@ + + + + diff --git a/Application/ConfigurationGenerator.cs b/Application/ConfigurationGenerator.cs deleted file mode 100644 index b86614c33..000000000 --- a/Application/ConfigurationGenerator.cs +++ /dev/null @@ -1,62 +0,0 @@ -using SharedLibraryCore; -using SharedLibraryCore.Configuration; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; - -namespace IW4MAdmin.Application -{ - class ConfigurationGenerator - { - public static List GenerateServerConfig(List configList) - { - - var loc = Utilities.CurrentLocalization.LocalizationSet; - var newConfig = new ServerConfiguration(); - - while (string.IsNullOrEmpty(newConfig.IPAddress)) - { - try - { - string input = Utilities.PromptString(loc["SETUP_SERVER_IP"]); - IPAddress.Parse(input); - newConfig.IPAddress = input; - } - - catch (Exception) - { - continue; - } - } - - while (newConfig.Port == 0) - { - try - { - newConfig.Port = Int16.Parse(Utilities.PromptString(loc["SETUP_SERVER_PORT"])); - } - - catch (Exception) - { - continue; - } - } - - newConfig.Password = Utilities.PromptString(loc["SETUP_SERVER_RCON"]); - newConfig.AutoMessages = new List(); - newConfig.Rules = new List(); - - newConfig.UseT6MParser = Utilities.PromptBool(loc["SETUP_SERVER_USET6M"]); - - configList.Add(newConfig); - - if (Utilities.PromptBool(loc["SETUP_SERVER_SAVE"])) - GenerateServerConfig(configList); - - return configList; - } - } -} diff --git a/Application/Localization/Configure.cs b/Application/Localization/Configure.cs index 2badf5bc2..77c7a40cb 100644 --- a/Application/Localization/Configure.cs +++ b/Application/Localization/Configure.cs @@ -13,7 +13,7 @@ namespace IW4MAdmin.Application.Localization { string currentLocal = CultureInfo.CurrentCulture.Name; #if DEBUG - currentLocal = "ru-RU"; + // currentLocal = "ru-RU"; #endif string localizationFile = $"Localization{Path.DirectorySeparatorChar}IW4MAdmin.{currentLocal}.json"; string localizationContents; diff --git a/Application/Manager.cs b/Application/Manager.cs index f2b2bd1db..c42f6ff31 100644 --- a/Application/Manager.cs +++ b/Application/Manager.cs @@ -138,7 +138,13 @@ namespace IW4MAdmin.Application if (newConfig.Servers == null) { ConfigHandler.Set(newConfig); - newConfig.Servers = ConfigurationGenerator.GenerateServerConfig(new List()); + newConfig.Servers = new List(); + + do + { + newConfig.Servers.Add((ServerConfiguration)new ServerConfiguration().Generate()); + } while (Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationSet["SETUP_SERVER_SAVE"])); + config = newConfig; await ConfigHandler.Save(); } diff --git a/Application/Server.cs b/Application/Server.cs index 7eca0373b..3c0d778f3 100644 --- a/Application/Server.cs +++ b/Application/Server.cs @@ -361,7 +361,7 @@ namespace IW4MAdmin public override async Task ExecuteEvent(GameEvent E) { //if (Throttled) - // return; + // return; await ProcessEvent(E); Manager.GetEventApi().OnServerEvent(this, E); @@ -658,7 +658,7 @@ namespace IW4MAdmin CustomCallback = await ScriptLoaded(); string mainPath = EventParser.GetGameDir(); #if DEBUG - // basepath.Value = @"\\192.168.88.253\Call of Duty Black Ops II"; + basepath.Value = @"\\192.168.88.253\Call of Duty Black Ops II"; #endif string logPath; if (GameName == Game.IW5) diff --git a/Master/master/resources/history_graph.py b/Master/master/resources/history_graph.py index a5691aad3..8bf4e280b 100644 --- a/Master/master/resources/history_graph.py +++ b/Master/master/resources/history_graph.py @@ -21,10 +21,6 @@ class HistoryGraph(Resource): ) graph = pygal.StackedLine( - interpolate='cubic', - interpolation_precision=3, - #x_labels_major_every=100, - #x_labels_major_count=500, stroke_style={'width': 0.4}, show_dots=False, show_legend=False, @@ -37,10 +33,15 @@ class HistoryGraph(Resource): if len(instance_count) > 0: graph.x_labels = [ timeago.format(instance_count[0])] - graph.add('Instance Count', [history['count'] for history in ctx.history.instance_history][-history_count:]) - graph.add('Client Count', [history['count'] for history in ctx.history.client_history][-history_count:]) + instance_counts = [history['count'] for history in ctx.history.instance_history][-history_count:] + client_counts = [history['count'] for history in ctx.history.client_history][-history_count:] + + graph.add('Instance Count', instance_counts) + graph.add('Client Count', client_counts) return { 'message' : graph.render(), - 'data_points' : len(instance_count) + 'data_points' : len(instance_count), + 'instance_count' : 0 if len(instance_counts) is 0 else instance_counts[-1], + 'client_count' : 0 if len(client_counts) is 0 else client_counts[-1] }, 200 except Exception as e: return { 'message' : str(e) }, 500 diff --git a/Master/master/templates/index.html b/Master/master/templates/index.html index 4f9083d52..db8d27356 100644 --- a/Master/master/templates/index.html +++ b/Master/master/templates/index.html @@ -5,12 +5,19 @@
{{history_graph|safe}}
-
+
+
+ {{instance_count}} instances + — {{client_count}} clients +
+
+
+
{% endblock %} @@ -20,6 +27,7 @@