fix top players row not fill full width

make stats web use view imports
add more games/maps to default settings (thanks to FryTechTiddys
#7622)
replace ConfigurationBuilder Config Handler implementation with Newtonsoft.Json as it wasn't deserializing "complex" classes properly
This commit is contained in:
RaidMax 2019-03-17 17:37:50 -05:00
parent c8ec0eefa9
commit bf0a0befc6
8 changed files with 461 additions and 121 deletions

View File

@ -98,10 +98,8 @@ if "%CurrentConfiguration%" == "Release" (
) )
echo making start scripts echo making start scripts
@(echo dotnet Lib/IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.cmd" @(echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.cmd"
@(echo dotnet Lib/IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.cmd" @(echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.cmd"
@(echo #!/bin/bash && echo dotnet Lib\IW4MAdmin.dll) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh" @(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh"
@(echo #!/bin/bash && echo dotnet Lib\IW4MAdmin.dll) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh" @(echo #!/bin/bash && echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh"
eCHO "%CurrentConfiguration%"

View File

@ -17,6 +17,184 @@
"Balance teams at ALL times" "Balance teams at ALL times"
], ],
"Maps": [ "Maps": [
{
"Game": "IW3",
"Maps": [
{
"Alias": "Ambush",
"Name": "mp_convoy"
},
{
"Alias": "Backlot",
"Name": "mp_backlot"
},
{
"Alias": "Bloc",
"Name": "mp_bloc"
},
{
"Alias": "Bog",
"Name": "mp_bog"
},
{
"Alias": "Countdown",
"Name": "mp_countdown"
},
{
"Alias": "Crash",
"Name": "mp_crash"
},
{
"Alias": "Crossfire",
"Name": "mp_crossfire"
},
{
"Alias": "District",
"Name": "mp_citystreets"
},
{
"Alias": "Downpour",
"Name": "mp_farm"
},
{
"Alias": "Overgrown",
"Name": "mp_overgrown"
},
{
"Alias": "Pipeline",
"Name": "mp_pipeline"
},
{
"Alias": "Shipment",
"Name": "mp_shipment"
},
{
"Alias": "Showdown",
"Name": "mp_showdown"
},
{
"Alias": "Strike",
"Name": "mp_strike"
},
{
"Alias": "Vacant",
"Name": "mp_vacant"
},
{
"Alias": "Wet Work",
"Name": "mp_cargoship"
},
{
"Alias": "Winter Crash",
"Name": "mp_crash_snow"
},
{
"Alias": "Broadcast",
"Name": "mp_broadcast"
},
{
"Alias": "Creek",
"Name": "mp_creek"
},
{
"Alias": "Chinatown",
"Name": "mp_carentan"
},
{
"Alias": "Killhouse",
"Name": "mp_killhouse"
}
]
},
{
"Game": "T4",
"Maps": [
{
"Alias": "Airfield",
"Name": "mp_airfield"
},
{
"Alias": "Asylum",
"Name": "mp_asylum"
},
{
"Alias": "Castle",
"Name": "mp_castle"
},
{
"Alias": "Cliffside",
"Name": "mp_shrine"
},
{
"Alias": "Courtyard",
"Name": "mp_courtyard"
},
{
"Alias": "Dome",
"Name": "mp_dome"
},
{
"Alias": "Downfall",
"Name": "mp_downfall"
},
{
"Alias": "Hanger",
"Name": "mp_hangar"
},
{
"Alias": "Makin",
"Name": "mp_makin"
},
{
"Alias": "Outskirts",
"Name": "mp_outskirts"
},
{
"Alias": "Roundhouse",
"Name": "mp_roundhouse"
},
{
"Alias": "Upheaval",
"Name": "mp_suburban"
},
{
"Alias": "Knee Deep",
"Name": "mp_kneedeep"
},
{
"Alias": "Nightfire",
"Name": "mp_nachtfeuer"
},
{
"Alias": "Station",
"Name": "mp_subway"
},
{
"Alias": "Banzai",
"Name": "mp_kwai"
},
{
"Alias": "Corrosion",
"Name": "mp_stalingrad"
},
{
"Alias": "Sub Pens",
"Name": "mp_docks"
},
{
"Alias": "Battery",
"Name": "mp_drum"
},
{
"Alias": "Breach",
"Name": "mp_bgate"
},
{
"Alias": "Revolution",
"Name": "mp_vodka"
}
]
},
{ {
"Game": "IW4", "Game": "IW4",
"Maps": [ "Maps": [
@ -246,6 +424,260 @@
} }
] ]
}, },
{
"Game": "T5",
"Maps": [
{
"Alias": "Array",
"Name": "mp_array"
},
{
"Alias": "Berlin Wall",
"Name": "mp_berlinwall2"
},
{
"Alias": "Convoy",
"Name": "mp_gridlock"
},
{
"Alias": "Cracked",
"Name": "mp_cracked"
},
{
"Alias": "Crisis",
"Name": "mp_crisis"
},
{
"Alias": "Discovery",
"Name": "mp_discovery"
},
{
"Alias": "Drive-In",
"Name": "mp_drivein"
},
{
"Alias": "Firing Range",
"Name": "mp_firingrange"
},
{
"Alias": "Grid",
"Name": "mp_duga"
},
{
"Alias": "Hangar 18",
"Name": "mp_area51"
},
{
"Alias": "Hanoi",
"Name": "mp_hanoi"
},
{
"Alias": "Hazard",
"Name": "mp_golfcourse"
},
{
"Alias": "Hotel",
"Name": "mp_hotel"
},
{
"Alias": "Jungle",
"Name": "mp_havoc"
},
{
"Alias": "Kowloon",
"Name": "mp_kowloon"
},
{
"Alias": "Launch",
"Name": "mp_cosmodrome"
},
{
"Alias": "Nuketown",
"Name": "mp_nuked"
},
{
"Alias": "Radiation",
"Name": "mp_radiation"
},
{
"Alias": "Silo",
"Name": "mp_silo"
},
{
"Alias": "Stadium",
"Name": "mp_stadium"
},
{
"Alias": "Stockpile",
"Name": "mp_outskirts"
},
{
"Alias": "Summit",
"Name": "mp_mountain"
},
{
"Alias": "Villa",
"Name": "mp_villa"
},
{
"Alias": "WMD",
"Name": "mp_russianbase"
},
{
"Alias": "Zoo",
"Name": "mp_zoo"
}
]
},
{
"Game": "IW5",
"Maps": [
{
"Alias": "Seatown",
"Name": "mp_seatown"
},
{
"Alias": "Lockdown",
"Name": "mp_alpha"
},
{
"Alias": "Mission",
"Name": "mp_bravo"
},
{
"Alias": "Carbon",
"Name": "mp_carbon"
},
{
"Alias": "Dome",
"Name": "mp_dome"
},
{
"Alias": "Arkaden",
"Name": "mp_plaza2"
},
{
"Alias": "Downturn",
"Name": "mp_exchange"
},
{
"Alias": "Bootleg",
"Name": "mp_bootleg"
},
{
"Alias": "Hardhat",
"Name": "mp_hardhat"
},
{
"Alias": "Interchange",
"Name": "mp_interchange"
},
{
"Alias": "Fallen",
"Name": "mp_lambeth"
},
{
"Alias": "Outpost",
"Name": "mp_radar"
},
{
"Alias": "Bakaara",
"Name": "mp_mogadishu"
},
{
"Alias": "Resistance",
"Name": "mp_paris"
},
{
"Alias": "Underground",
"Name": "mp_underground"
},
{
"Alias": "Village",
"Name": "mp_village"
},
{
"Alias": "Aground",
"Name": "mp_aground_ss"
},
{
"Alias": "Boardwalk",
"Name": "mp_boardwalk"
},
{
"Alias": "U-turn",
"Name": "mp_burn_ss"
},
{
"Alias": "Foundation",
"Name": "mp_cement"
},
{
"Alias": "Erosion",
"Name": "mp_courtyard_ss"
},
{
"Alias": "Intersection",
"Name": "mp_crosswalk_ss"
},
{
"Alias": "Getaway",
"Name": "mp_hillside_ss"
},
{
"Alias": "Piazza",
"Name": "mp_italy"
},
{
"Alias": "Sanctuary",
"Name": "mp_meteora"
},
{
"Alias": "Gulch",
"Name": "mp_moab"
},
{
"Alias": "Black Box",
"Name": "mp_morningwood"
},
{
"Alias": "Parish",
"Name": "mp_nola"
},
{
"Alias": "Overwatch",
"Name": "mp_overwatch"
},
{
"Alias": "Liberation",
"Name": "mp_park"
},
{
"Alias": "Oasis",
"Name": "mp_qadeem"
},
{
"Alias": "Lookout",
"Name": "mp_restrepo_ss"
},
{
"Alias": "Off Shore",
"Name": "mp_roughneck"
},
{
"Alias": "Decommission",
"Name": "mp_shipbreaker"
},
{
"Alias": "Vortex",
"Name": "mp_six_ss"
},
{
"Alias": "Terminal",
"Name": "mp_terminal_cls"
}
]
},
{ {
"Game": "T6", "Game": "T6",
"Maps": [ "Maps": [
@ -402,95 +834,6 @@
"Name": "zm_transit" "Name": "zm_transit"
} }
] ]
},
{
"Game": "IW3",
"Maps": [
{
"Alias": "Ambush",
"Name": "mp_convoy"
},
{
"Alias": "Backlot",
"Name": "mp_backlot"
},
{
"Alias": "Bloc",
"Name": "mp_bloc"
},
{
"Alias": "Bog",
"Name": "mp_bog"
},
{
"Alias": "Countdown",
"Name": "mp_countdown"
},
{
"Alias": "Crash",
"Name": "mp_crash"
},
{
"Alias": "Crossfire",
"Name": "mp_crossfire"
},
{
"Alias": "District",
"Name": "mp_citystreets"
},
{
"Alias": "Downpour",
"Name": "mp_farm"
},
{
"Alias": "Overgrown",
"Name": "mp_overgrown"
},
{
"Alias": "Pipeline",
"Name": "mp_pipeline"
},
{
"Alias": "Shipment",
"Name": "mp_shipment"
},
{
"Alias": "Showdown",
"Name": "mp_showdown"
},
{
"Alias": "Strike",
"Name": "mp_strike"
},
{
"Alias": "Vacant",
"Name": "mp_vacant"
},
{
"Alias": "Wet Work",
"Name": "mp_cargoship"
},
{
"Alias": "Winter Crash",
"Name": "mp_crash_snow"
},
{
"Alias": "Broadcast",
"Name": "mp_broadcast"
},
{
"Alias": "Creek",
"Name": "mp_creek"
},
{
"Alias": "Chinatown",
"Name": "mp_carentan"
},
{
"Alias": "Killhouse",
"Name": "mp_killhouse"
}
]
} }
] ]
} }

View File

@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Razor"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RazorCompileOnBuild>true</RazorCompileOnBuild> <RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompiledOnPublish>true</RazorCompiledOnPublish> <RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<ResolvedRazorCompileToolset>RazorSdk</ResolvedRazorCompileToolset>
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
</PropertyGroup> </PropertyGroup>
@ -16,7 +15,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="Views\_ViewImports.cshtml">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup> </ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">

View File

@ -25,6 +25,7 @@
return "0_no-place/menu_div_no_place.png"; return "0_no-place/menu_div_no_place.png";
} }
} }
@if (Model.Count == 0) @if (Model.Count == 0)
{ {
<div class="p-2 text-center">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex.Set["PLUGINS_STATS_TEXT_NOQUALIFY"]</div> <div class="p-2 text-center">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex.Set["PLUGINS_STATS_TEXT_NOQUALIFY"]</div>

View File

@ -10,15 +10,14 @@
</li> </li>
} }
</ul> </ul>
<div class="tab-content border-bottom row"> <div class="tab-content border-bottom row">
<div role="tabpanel" class="tab-pane active striped" id="server_0"> <div role="tabpanel" class="tab-pane active striped flex-fill" id="server_0">
@await Component.InvokeAsync("TopPlayers", new { count = 10, offset = 0 }) @await Component.InvokeAsync("TopPlayers", new { count = 10, offset = 0 })
</div> </div>
@foreach (var server in ViewBag.Servers) @foreach (var server in ViewBag.Servers)
{ {
<div role="tabpanel" class="tab-pane striped" id="server_@server.ID"> <div role="tabpanel" class="tab-pane striped flex-fill" id="server_@server.ID">
</div> </div>
} }
</div> </div>

View File

@ -0,0 +1 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -1,47 +1,42 @@
using Microsoft.Extensions.Configuration; using Newtonsoft.Json;
using Newtonsoft.Json;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SharedLibraryCore.Configuration namespace SharedLibraryCore.Configuration
{ {
public class BaseConfigurationHandler<T> : IConfigurationHandler<T> where T : IBaseConfiguration public class BaseConfigurationHandler<T> : IConfigurationHandler<T> where T : IBaseConfiguration
{ {
readonly string Filename; readonly string _configurationPath;
IConfigurationRoot ConfigurationRoot { get; set; }
T _configuration; T _configuration;
public BaseConfigurationHandler(string fn) public BaseConfigurationHandler(string fn)
{ {
Filename = fn; _configurationPath = Path.Join(Utilities.OperatingDirectory, "Configuration", $"{fn}.json");
Build(); Build();
} }
public void Build() public void Build()
{ {
ConfigurationRoot = new ConfigurationBuilder() var configContent = File.ReadAllText(_configurationPath);
.AddJsonFile(Path.Join(Utilities.OperatingDirectory, "Configuration", $"{Filename}.json"), true) _configuration = JsonConvert.DeserializeObject<T>(configContent);
.Build();
_configuration = ConfigurationRoot.Get<T>();
if (_configuration == null) if (_configuration == null)
{
_configuration = default(T); _configuration = default(T);
}
} }
public Task Save() public Task Save()
{ {
var appConfigJSON = JsonConvert.SerializeObject(_configuration, Formatting.Indented); var appConfigJSON = JsonConvert.SerializeObject(_configuration, Formatting.Indented);
return File.WriteAllTextAsync(Path.Join(Utilities.OperatingDirectory, "Configuration", $"{Filename}.json"), appConfigJSON); return File.WriteAllTextAsync(_configurationPath, appConfigJSON);
} }
public T Configuration() => _configuration; public T Configuration()
{
return _configuration;
}
public void Set(T config) public void Set(T config)
{ {

View File

@ -3,8 +3,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<RazorCompileOnBuild>false</RazorCompileOnBuild> <RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompileOnPublish>true</RazorCompileOnPublish> <RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion> <TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId> <PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
@ -37,6 +37,7 @@
<Content Remove="Views\Plugins\Stats\Index.cshtml" /> <Content Remove="Views\Plugins\Stats\Index.cshtml" />
<Content Remove="Views\Plugins\Stats\_MessageContext.cshtml" /> <Content Remove="Views\Plugins\Stats\_MessageContext.cshtml" />
<Content Remove="Views\Plugins\Stats\_PenaltyInfo.cshtml" /> <Content Remove="Views\Plugins\Stats\_PenaltyInfo.cshtml" />
<Content Remove="Views\Plugins\_ViewImports.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -47,6 +48,7 @@
<None Include="Views\Plugins\Stats\Index.cshtml" /> <None Include="Views\Plugins\Stats\Index.cshtml" />
<None Include="Views\Plugins\Stats\_MessageContext.cshtml" /> <None Include="Views\Plugins\Stats\_MessageContext.cshtml" />
<None Include="Views\Plugins\Stats\_PenaltyInfo.cshtml" /> <None Include="Views\Plugins\Stats\_PenaltyInfo.cshtml" />
<None Include="Views\Plugins\_ViewImports.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>