update projects to .NET Core 2.0.7

added instance and client count to api page
removed vestigial ConfigGenerator
This commit is contained in:
RaidMax 2018-04-23 16:03:50 -05:00
parent 02ef5a0bf8
commit 5dfaa4ebd6
18 changed files with 98 additions and 85 deletions

View File

@ -63,6 +63,10 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="call $(ProjectDir)BuildScripts\PreBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" /> <Exec Command="call $(ProjectDir)BuildScripts\PreBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" />
</Target> </Target>

View File

@ -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<ServerConfiguration> GenerateServerConfig(List<ServerConfiguration> 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<string>();
newConfig.Rules = new List<string>();
newConfig.UseT6MParser = Utilities.PromptBool(loc["SETUP_SERVER_USET6M"]);
configList.Add(newConfig);
if (Utilities.PromptBool(loc["SETUP_SERVER_SAVE"]))
GenerateServerConfig(configList);
return configList;
}
}
}

View File

@ -13,7 +13,7 @@ namespace IW4MAdmin.Application.Localization
{ {
string currentLocal = CultureInfo.CurrentCulture.Name; string currentLocal = CultureInfo.CurrentCulture.Name;
#if DEBUG #if DEBUG
currentLocal = "ru-RU"; // currentLocal = "ru-RU";
#endif #endif
string localizationFile = $"Localization{Path.DirectorySeparatorChar}IW4MAdmin.{currentLocal}.json"; string localizationFile = $"Localization{Path.DirectorySeparatorChar}IW4MAdmin.{currentLocal}.json";
string localizationContents; string localizationContents;

View File

@ -138,7 +138,13 @@ namespace IW4MAdmin.Application
if (newConfig.Servers == null) if (newConfig.Servers == null)
{ {
ConfigHandler.Set(newConfig); ConfigHandler.Set(newConfig);
newConfig.Servers = ConfigurationGenerator.GenerateServerConfig(new List<ServerConfiguration>()); newConfig.Servers = new List<ServerConfiguration>();
do
{
newConfig.Servers.Add((ServerConfiguration)new ServerConfiguration().Generate());
} while (Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationSet["SETUP_SERVER_SAVE"]));
config = newConfig; config = newConfig;
await ConfigHandler.Save(); await ConfigHandler.Save();
} }

View File

@ -361,7 +361,7 @@ namespace IW4MAdmin
public override async Task ExecuteEvent(GameEvent E) public override async Task ExecuteEvent(GameEvent E)
{ {
//if (Throttled) //if (Throttled)
// return; // return;
await ProcessEvent(E); await ProcessEvent(E);
Manager.GetEventApi().OnServerEvent(this, E); Manager.GetEventApi().OnServerEvent(this, E);
@ -658,7 +658,7 @@ namespace IW4MAdmin
CustomCallback = await ScriptLoaded(); CustomCallback = await ScriptLoaded();
string mainPath = EventParser.GetGameDir(); string mainPath = EventParser.GetGameDir();
#if DEBUG #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 #endif
string logPath; string logPath;
if (GameName == Game.IW5) if (GameName == Game.IW5)

View File

@ -21,10 +21,6 @@ class HistoryGraph(Resource):
) )
graph = pygal.StackedLine( graph = pygal.StackedLine(
interpolate='cubic',
interpolation_precision=3,
#x_labels_major_every=100,
#x_labels_major_count=500,
stroke_style={'width': 0.4}, stroke_style={'width': 0.4},
show_dots=False, show_dots=False,
show_legend=False, show_legend=False,
@ -37,10 +33,15 @@ class HistoryGraph(Resource):
if len(instance_count) > 0: if len(instance_count) > 0:
graph.x_labels = [ timeago.format(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:]) instance_counts = [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:]) 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(), 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 }, 200
except Exception as e: except Exception as e:
return { 'message' : str(e) }, 500 return { 'message' : str(e) }, 500

View File

@ -5,12 +5,19 @@
<div class="col-12"> <div class="col-12">
<figure> <figure>
<div id="history_graph">{{history_graph|safe}}</div> <div id="history_graph">{{history_graph|safe}}</div>
<figcaption class="float-right pr-3 mr-4"> <figcaption class="float-right">
<span id="history_graph_zoom_out" class="h4 oi oi-zoom-out text-muted" style="cursor:pointer;"></span> <span id="history_graph_zoom_out" class="h4 oi oi-zoom-out text-muted" style="cursor:pointer;"></span>
<span id="history_graph_zoom_in" class="h4 oi oi-zoom-in text-muted" style="cursor:pointer;"></span> <span id="history_graph_zoom_in" class="h4 oi oi-zoom-in text-muted" style="cursor:pointer;"></span>
</figcaption> </figcaption>
<figcaption class="float-left">
<span class="h4 text-muted">{{instance_count}} instances</span>
<span class="h4 text-muted">&mdash; {{client_count}} clients</span>
</figcaption>
</figure> </figure>
</div>
<div class="col-12">
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
@ -20,6 +27,7 @@
<script> <script>
let dataPoints = {{data_points}}; let dataPoints = {{data_points}};
let zoomLevel = Math.ceil(dataPoints / 2); let zoomLevel = Math.ceil(dataPoints / 2);
let maxPoints = {{max_data_points}}
//console.log(dataPoints); //console.log(dataPoints);
function updateHistoryGraph() { function updateHistoryGraph() {
@ -33,7 +41,7 @@
$('#history_graph_zoom_out').click(function () { $('#history_graph_zoom_out').click(function () {
// console.log(zoomLevel); // console.log(zoomLevel);
zoomLevel = zoomLevel * 2 <= 1440 ? Math.ceil(zoomLevel * 2) : dataPoints; zoomLevel = zoomLevel * 2 <= maxPoints ? Math.ceil(zoomLevel * 2) : dataPoints;
updateHistoryGraph(); updateHistoryGraph();
}); });

View File

@ -14,5 +14,8 @@ def home():
'index.html', 'index.html',
title='API Overview', title='API Overview',
history_graph = _history_graph[0]['message'], history_graph = _history_graph[0]['message'],
data_points = _history_graph[0]['data_points'] data_points = _history_graph[0]['data_points'],
instance_count = _history_graph[0]['instance_count'],
client_count = _history_graph[0]['client_count'],
max_data_points = 1440
) )

View File

@ -20,6 +20,10 @@
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" /> <ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target> </Target>

View File

@ -18,6 +18,10 @@
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" /> <ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target> </Target>

View File

@ -18,6 +18,10 @@
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" /> <ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target> </Target>

View File

@ -19,4 +19,8 @@
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" /> <ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
</Project> </Project>

View File

@ -24,6 +24,10 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;&#xD;&#xA;copy &quot;$(ProjectDir)MaxMind\GeoIP.dat&quot; &quot;$(SolutionDir)BUILD\Plugins\GeoIP.dat&quot;" /> <Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;&#xD;&#xA;copy &quot;$(ProjectDir)MaxMind\GeoIP.dat&quot; &quot;$(SolutionDir)BUILD\Plugins\GeoIP.dat&quot;" />
</Target> </Target>

View File

@ -2,18 +2,18 @@
# IW4MAdmin # IW4MAdmin
### Quick Start Guide ### Quick Start Guide
### Version 2.0 ### Version 2.1
_______ _______
### About ### About
**IW4MAdmin** is an administration tool for [IW4x](https://iw4xcachep26muba.onion.link/), [T6M](https://plutonium.pw/), and most Call of Duty® dedicated servers. It allows complete control of your server; from changing maps, to banning players, **IW4MAdmin** monitors and records activity on your server(s). With plugin support, extending its functionality is a breeze. **IW4MAdmin** is an administration tool for [IW4x](https://iw4xcachep26muba.onion.link/), [Pluto T6](https://forum.plutonium.pw/category/33/plutonium-t6) [Pluto IW5](https://forum.plutonium.pw/category/5/plutonium-iw5), and most Call of Duty® dedicated servers. It allows complete control of your server; from changing maps, to banning players, **IW4MAdmin** monitors and records activity on your server(s). With plugin support, extending its functionality is a breeze.
### Setup ### Setup
**IW4MAdmin** requires minimal configuration to run. There is only one prerequisite. **IW4MAdmin** requires minimal configuration to run. There is only one prerequisite.
* [.NET Core 2.0.5 Runtime](https://www.microsoft.com/net/download/dotnet-core/runtime-2.0.5) *or newer* * [.NET Core 2.0.7 Runtime](https://www.microsoft.com/net/download/dotnet-core/runtime-2.0.7) *or newer*
1. Extract `IW4MAdmin-<version>.zip` 1. Extract `IW4MAdmin-<version>.zip`
2. Open command prompt or terminal in the extracted folder 2. Open command prompt or terminal in the extracted folder
3. Run `>dotnet IW4MAdmin.dll` 3. Run `dotnet IW4MAdmin.dll`
___ ___
### Configuration ### Configuration

View File

@ -1,4 +1,5 @@
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SharedLibraryCore.Configuration namespace SharedLibraryCore.Configuration
@ -6,7 +7,7 @@ namespace SharedLibraryCore.Configuration
public class ServerConfiguration : IBaseConfiguration public class ServerConfiguration : IBaseConfiguration
{ {
public string IPAddress { get; set; } public string IPAddress { get; set; }
public short Port { get; set; } public ushort Port { get; set; }
public string Password { get; set; } public string Password { get; set; }
public List<string> Rules { get; set; } public List<string> Rules { get; set; }
public List<string> AutoMessages { get; set; } public List<string> AutoMessages { get; set; }
@ -16,11 +17,34 @@ namespace SharedLibraryCore.Configuration
public IBaseConfiguration Generate() public IBaseConfiguration Generate()
{ {
UseT6MParser = Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationSet["SETUP_SERVER_USET6M"]); var loc = Utilities.CurrentLocalization.LocalizationSet;
while (string.IsNullOrEmpty(IPAddress))
{
string input = Utilities.PromptString(loc["SETUP_SERVER_IP"]);
if (System.Net.IPAddress.TryParse(input, out System.Net.IPAddress ip))
IPAddress = input;
}
while(Port < 1)
{
string input = Utilities.PromptString(loc["SETUP_SERVER_PORT"]);
if (UInt16.TryParse(input, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.CurrentCulture, out ushort port))
Port = port;
}
Password = Utilities.PromptString(loc["SETUP_SERVER_RCON"]);
AutoMessages = new List<string>();
Rules = new List<string>();
UseT6MParser = Utilities.PromptBool(loc["SETUP_SERVER_USET6M"]);
if (!UseT6MParser) if (!UseT6MParser)
UseIW5MParser = Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationSet["SETUP_SERVER_USEIW5M"]); UseIW5MParser = Utilities.PromptBool(loc["SETUP_SERVER_USEIW5M"]);
if (UseIW5MParser) if (UseIW5MParser)
ManualLogPath = Utilities.PromptString(Utilities.CurrentLocalization.LocalizationSet["SETUP_SERVER_MANUALLOG"]); ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_MANUALLOG"]);
return this; return this;
} }

View File

@ -23,6 +23,10 @@
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" /> <PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if not exist &quot;$(SolutionDir)BUILD&quot; (&#xD;&#xA;md &quot;$(SolutionDir)BUILD&quot;&#xD;&#xA;)&#xD;&#xA;if not exist &quot;$(SolutionDir)BUILD\Plugins&quot; (&#xD;&#xA;md &quot;$(SolutionDir)BUILD\Plugins&quot;&#xD;&#xA;)" /> <Exec Command="if not exist &quot;$(SolutionDir)BUILD&quot; (&#xD;&#xA;md &quot;$(SolutionDir)BUILD&quot;&#xD;&#xA;)&#xD;&#xA;if not exist &quot;$(SolutionDir)BUILD\Plugins&quot; (&#xD;&#xA;md &quot;$(SolutionDir)BUILD\Plugins&quot;&#xD;&#xA;)" />
</Target> </Target>

View File

@ -47,7 +47,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Bower" Version="1.3.11" /> <PackageReference Include="Bower" Version="1.3.11" />
<PackageReference Include="BuildBundlerMinifier" Version="2.6.375" /> <PackageReference Include="BuildBundlerMinifier" Version="2.6.375" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -56,6 +56,10 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.7" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project> </Project>

View File

@ -1,6 +1,7 @@
Version 2.1: Version 2.1:
CHANGELOG: CHANGELOG:
-add support for localization -add support for localization
-upgraded projects to .NET Core 2.0.7
Version 2.0: Version 2.0:
CHANGELOG: CHANGELOG: