migrate welcome plugin to .NET Core 2.0
more fixes to stats database for migration last connection set when client connects and disconnects update GeoIP datatbase
This commit is contained in:
parent
63db309c5e
commit
d233b8cb50
@ -1,8 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||
<Version>2.0.0</Version>
|
||||
<Authors>RaidMax</Authors>
|
||||
@ -15,6 +16,7 @@
|
||||
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
|
||||
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
|
||||
<ApplicationIcon />
|
||||
<AssemblyName>IW4MAdmin</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -43,7 +45,7 @@
|
||||
</Target>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="call $(ProjectDir)BuildScripts\PostBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)

if $(ProjectDir) == "*Undefined*" (
call BuildScripts\PostPublish.bat $(SolutionDir)
)
" />
|
||||
<Exec Command="call $(ProjectDir)BuildScripts\PostBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -3,7 +3,7 @@ set ProjectDir=%2
|
||||
set TargetDir=%3
|
||||
set OutDir=%4
|
||||
|
||||
echo "Copying dependency configs"
|
||||
echo Copying dependency configs
|
||||
copy "%SolutionDir%WebfrontCore\%OutDir%*.deps.json" "%TargetDir%"
|
||||
copy "%SolutionDir%SharedLibaryCore\%OutDir%*.deps.json" "%TargetDir%"
|
||||
|
||||
@ -12,4 +12,7 @@ if not exist "%TargetDir%Plugins" (
|
||||
md "%TargetDir%Plugins"
|
||||
)
|
||||
|
||||
xcopy /y "%SolutionDir%Build\Plugins" "%TargetDir%Plugins\"
|
||||
xcopy /y "%SolutionDir%Build\Plugins" "%TargetDir%Plugins\"
|
||||
|
||||
echo Copying plugins for publish
|
||||
xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Windows\Plugins\"
|
||||
|
@ -1,5 +1 @@
|
||||
set SolutionDir=%1
|
||||
|
||||
;echo "Copying files for publish"
|
||||
;xcopy /Y "%SolutionDir%WebfrontCore\Views" "%SolutionDir%Publish\Windows\Views\"
|
||||
;xcopy /Y "%SolutionDir%WebfrontCore\wwwroot" "%SolutionDir%Publish\Windows\wwwroot\"
|
||||
|
@ -1,11 +1,12 @@
|
||||
|
||||
using System;
|
||||
using SharedLibraryCore;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using SharedLibraryCore.Objects;
|
||||
using System.Reflection;
|
||||
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Objects;
|
||||
using SharedLibraryCore.Database;
|
||||
|
||||
namespace IW4MAdmin.Application
|
||||
{
|
||||
public class Program
|
||||
@ -29,6 +30,9 @@ namespace IW4MAdmin.Application
|
||||
|
||||
try
|
||||
{
|
||||
using (var db = new DatabaseContext())
|
||||
new ContextSeed(db).Seed().Wait();
|
||||
|
||||
CheckDirectories();
|
||||
|
||||
ServerManager = ApplicationManager.GetInstance();
|
||||
@ -66,7 +70,7 @@ namespace IW4MAdmin.Application
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Fatal Error during initialization: {e.Message}");
|
||||
while(e.InnerException != null)
|
||||
while (e.InnerException != null)
|
||||
{
|
||||
e = e.InnerException;
|
||||
Console.WriteLine($"Inner exception: {e.Message}");
|
||||
|
@ -9,7 +9,6 @@ using System.Text.RegularExpressions;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Objects;
|
||||
using SharedLibraryCore.Services;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Configuration;
|
||||
@ -95,7 +94,9 @@ namespace IW4MAdmin
|
||||
// client has connected in the past
|
||||
else
|
||||
{
|
||||
player.LastConnection = DateTime.UtcNow;
|
||||
client.Connections += 1;
|
||||
|
||||
var existingAlias = client.AliasLink.Children
|
||||
.FirstOrDefault(a => a.Name == polledPlayer.Name && a.IPAddress == polledPlayer.IPAddress);
|
||||
|
||||
@ -641,17 +642,13 @@ namespace IW4MAdmin
|
||||
string mainPath = (GameName == Game.IW4 && onelog.Value >= 0) ? "userraw" : "main";
|
||||
// patch for T5M:V2 log path
|
||||
mainPath = (GameName == Game.T5M) ? "rzodemo" : mainPath;
|
||||
// patch for T6M:PLUTONIUM
|
||||
mainPath = (GameName == Game.T6M) ? "t6r/data" : mainPath;
|
||||
|
||||
string logPath = (game.Value == "" || onelog?.Value == 1) ?
|
||||
$"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{mainPath}{Path.DirectorySeparatorChar}{logfile.Value}" :
|
||||
$"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{game.Value.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{logfile.Value}";
|
||||
|
||||
// fix to prevent wine drive prefix when running in mono
|
||||
if (Utilities.IsRunningOnMono())
|
||||
{
|
||||
logPath = Regex.Replace(logPath, @"[A-Z]:", "");
|
||||
}
|
||||
|
||||
if (!File.Exists(logPath))
|
||||
{
|
||||
Logger.WriteError($"Gamelog {logPath} does not exist!");
|
||||
@ -964,7 +961,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", IW4MAdmin.Application.Program.Version.ToString));
|
||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", Application.Program.Version.ToString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.16
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WelcomePlugin", "Plugins\Welcome\WelcomePlugin.csproj", "{AF097E6B-48D5-4452-9CCF-0A81A21F341D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{26E8B310-269E-46D4-A612-24601F16065F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8C8F3945-0AEF-4949-A1F7-B18E952E50BC}"
|
||||
@ -26,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "Application\
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stats", "Plugins\Stats\Stats.csproj", "{98BE4A81-8AFD-4957-83F7-009D353C6BCB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Welcome", "Plugins\Welcome\Welcome.csproj", "{179140D3-97AA-4CB4-8BF6-A0C73CA75701}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -38,22 +38,6 @@ Global
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x64.Build.0 = Debug|x64
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Debug|x86.Build.0 = Debug|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Mixed Platforms.ActiveCfg = Release-Stable|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|Mixed Platforms.Build.0 = Release-Stable|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x64.ActiveCfg = Release|x64
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x64.Build.0 = Release|x64
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x86.ActiveCfg = Release|x86
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release|x86.Build.0 = Release|x86
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
@ -150,15 +134,31 @@ Global
|
||||
{98BE4A81-8AFD-4957-83F7-009D353C6BCB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{98BE4A81-8AFD-4957-83F7-009D353C6BCB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{98BE4A81-8AFD-4957-83F7-009D353C6BCB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|x64.Build.0 = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{AF097E6B-48D5-4452-9CCF-0A81A21F341D} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{98BE4A81-8AFD-4957-83F7-009D353C6BCB} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{179140D3-97AA-4CB4-8BF6-A0C73CA75701} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {84F8F8E0-1F73-41E0-BD8D-BB6676E2EE87}
|
||||
|
@ -12,11 +12,9 @@ namespace IW4MAdmin.Plugins.Stats.Models
|
||||
{
|
||||
public class EFClientStatistics : SharedEntity
|
||||
{
|
||||
//[Key, Column(Order = 0)]
|
||||
public int ClientId { get; set; }
|
||||
[ForeignKey("ClientId")]
|
||||
public virtual EFClient Client { get; set; }
|
||||
//[Key, Column(Order = 1)]
|
||||
public int ServerId { get; set; }
|
||||
[ForeignKey("ServerId")]
|
||||
public virtual EFServer Server { get; set; }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace IW4MAdmin.Plugins.Stats.Models
|
||||
{
|
||||
@ -13,5 +14,12 @@ namespace IW4MAdmin.Plugins.Stats.Models
|
||||
public int HitCount { get; set; }
|
||||
[Required]
|
||||
public float HitOffsetAverage { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
[ForeignKey("ClientId"), Column(Order = 0 )]
|
||||
public EFClient Client { get; set; }
|
||||
public int ServerId { get; set; }
|
||||
[ForeignKey("ServerId"), Column(Order = 1)]
|
||||
public EFServer Server { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,23 @@ namespace Stats.Models
|
||||
{
|
||||
builder.Entity<EFClientStatistics>()
|
||||
.HasKey(cs => new { cs.ClientId, cs.ServerId });
|
||||
|
||||
// fix linking from SQLCe
|
||||
builder.Entity<EFHitLocationCount>()
|
||||
.Property(c => c.ClientId)
|
||||
.HasColumnName("EFClientStatistics_ClientId");
|
||||
|
||||
builder.Entity<EFHitLocationCount>()
|
||||
.Property(c => c.ServerId)
|
||||
.HasColumnName("EFClientStatistics_ServerId");
|
||||
|
||||
// force pluralization
|
||||
builder.Entity<EFClientKill>().ToTable("EFClientKills");
|
||||
builder.Entity<EFClientMessage>().ToTable("EFClientMessages");
|
||||
builder.Entity<EFClientStatistics>().ToTable("EFClientStatistics");
|
||||
builder.Entity<EFHitLocationCount>().ToTable("EFHitLocationCounts");
|
||||
builder.Entity<EFServer>().ToTable("EFServers");
|
||||
builder.Entity<EFServerStatistics>().ToTable("EFServerStatistics");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,12 @@
|
||||
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Database\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy "$(TargetPath)" $(SolutionDir)BUILD\Plugins"" />
|
||||
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)BUILD\Plugins"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
Binary file not shown.
@ -17,9 +17,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
using SharedLibraryCore;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
|
||||
|
||||
@ -59,24 +59,10 @@ namespace CountryLookupProj
|
||||
fileInput = new FileStream(fileName, FileMode.Open, FileAccess.Read);
|
||||
}
|
||||
|
||||
public string LookupCountryCode(string str)
|
||||
{
|
||||
IPAddress addr;
|
||||
try
|
||||
{
|
||||
addr = IPAddress.Parse(str);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return "--";
|
||||
}
|
||||
return LookupCountryCode(addr);
|
||||
}
|
||||
|
||||
private long AddrToNum(IPAddress addr)
|
||||
{
|
||||
long ipnum = 0;
|
||||
byte[] b = BitConverter.GetBytes(addr.Address);
|
||||
byte[] b = BitConverter.GetBytes((UInt32)addr.ToString().ConvertToIP());
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
long y = b[i];
|
BIN
Plugins/Welcome/MaxMind/GeoIP.dat
Normal file
BIN
Plugins/Welcome/MaxMind/GeoIP.dat
Normal file
Binary file not shown.
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Interfaces;
|
||||
using SharedLibrary.Objects;
|
||||
using SharedLibrary.Configuration;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Objects;
|
||||
using SharedLibraryCore.Configuration;
|
||||
|
||||
namespace Welcome_Plugin
|
||||
namespace IW4MAdmin.Plugins.Welcome
|
||||
{
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
@ -45,12 +45,6 @@ namespace Welcome_Plugin
|
||||
return "fourth";
|
||||
case 5:
|
||||
return "fifth";
|
||||
/* case 100:
|
||||
return "One-Hundreth (amazing!)";
|
||||
case 500:
|
||||
return "you're really ^5dedicated ^7to this server! This is your ^5500th^7";
|
||||
case 1000:
|
||||
return "you deserve a medal. it's your ^11000th^7";*/
|
||||
default:
|
||||
return connection.ToString() + Prefix;
|
||||
}
|
||||
@ -108,7 +102,7 @@ namespace Welcome_Plugin
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
joining.CurrentServer.Manager.GetLogger().WriteError("Could not open file Plugins/GeoIP.dat for Welcome Plugin");
|
||||
joining.CurrentServer.Manager.GetLogger().WriteError("Could not open file Plugins\\GeoIP.dat for Welcome Plugin");
|
||||
}
|
||||
msg = msg.Replace("{{TimesConnected}}", TimesConnected(joining));
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Welcome Plugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Welcome Plugin")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fd92be42-d165-449d-8648-fb1f6638b451")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
30
Plugins/Welcome/Welcome.csproj
Normal file
30
Plugins/Welcome/Welcome.csproj
Normal file
@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<PackageId>RaidMax.IW4MAdmin.Plugins.Welcome</PackageId>
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Product>Welcome Plugin for IW4MAdmin</Product>
|
||||
<Description>Welcome plugin for IW4MAdmin welcomes clients to the server</Description>
|
||||
<Copyright>2018</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="MaxMind\GeoIP.dat">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)BUILD\Plugins"
copy "$(ProjectDir)MaxMind\GeoIP.dat" "$(SolutionDir)BUILD\Plugins\GeoIP.dat"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
@ -1,11 +1,6 @@
|
||||
using SharedLibrary.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace Welcome_Plugin
|
||||
namespace IW4MAdmin.Plugins.Welcome
|
||||
{
|
||||
class WelcomeConfiguration : IBaseConfiguration
|
||||
{
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AF097E6B-48D5-4452-9CCF-0A81A21F341D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Welcome_Plugin</RootNamespace>
|
||||
<AssemblyName>WelcomePlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Nightly|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Stable|AnyCPU'">
|
||||
<OutputPath>bin\Release-Stable\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Nightly|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Stable|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release-Stable\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Nightly|x64'">
|
||||
<OutputPath>bin\x64\Release-Nightly\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Stable|x64'">
|
||||
<OutputPath>bin\x64\Release-Stable\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CountryLookup.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WelcomeConfiguration.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GeoIP.dat" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SharedLibrary\SharedLibrary.csproj">
|
||||
<Project>{d51eeceb-438a-47da-870f-7d7b41bc24d6}</Project>
|
||||
<Name>SharedLibrary</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Unix' ">copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\plugins\$(TargetName).dll"
|
||||
copy /Y "$(ProjectDir)GeoIP.dat" "$(SolutionDir)BUILD\plugins\GeoIP.dat"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net451" />
|
||||
</packages>
|
@ -17,6 +17,10 @@ namespace SharedLibraryCore.Database
|
||||
|
||||
public async Task Seed()
|
||||
{
|
||||
// make sure database exists
|
||||
//context.Database.EnsureCreated();
|
||||
context.Database.Migrate();
|
||||
|
||||
if (context.AliasLinks.Count() == 0)
|
||||
{
|
||||
context.AliasLinks.Add(new EFAliasLink()
|
||||
|
@ -63,6 +63,12 @@ namespace SharedLibraryCore.Database
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
// force full name for database conversion
|
||||
modelBuilder.Entity<EFClient>().ToTable("EFClients");
|
||||
modelBuilder.Entity<EFAlias>().ToTable("EFAlias");
|
||||
modelBuilder.Entity<EFAliasLink>().ToTable("EFAliasLinks");
|
||||
modelBuilder.Entity<EFPenalty>().ToTable("EFPenalties");
|
||||
|
||||
// https://aleemkhan.wordpress.com/2013/02/28/dynamically-adding-dbset-properties-in-dbcontext-for-entity-framework-code-first/
|
||||
#if !DEBUG
|
||||
foreach (string dllPath in Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins"))
|
||||
|
@ -12,7 +12,7 @@ using System;
|
||||
namespace SharedLibraryCore.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20180408213153_Initial Create")]
|
||||
[Migration("20180409183408_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -66,7 +66,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("ViewAnglesVector3Id");
|
||||
|
||||
b.ToTable("EFClientKill");
|
||||
b.ToTable("EFClientKills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b =>
|
||||
@ -90,7 +90,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("ServerId");
|
||||
|
||||
b.ToTable("EFClientMessage");
|
||||
b.ToTable("EFClientMessages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
|
||||
@ -125,9 +125,8 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int?>("EFClientStatisticsClientId");
|
||||
|
||||
b.Property<int?>("EFClientStatisticsServerId");
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnName("EFClientStatistics_ClientId");
|
||||
|
||||
b.Property<int>("HitCount");
|
||||
|
||||
@ -135,11 +134,16 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.Property<int>("Location");
|
||||
|
||||
b.Property<int>("ServerId")
|
||||
.HasColumnName("EFClientStatistics_ServerId");
|
||||
|
||||
b.HasKey("HitLocationCountId");
|
||||
|
||||
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
|
||||
b.HasIndex("ServerId");
|
||||
|
||||
b.ToTable("EFHitLocationCount");
|
||||
b.HasIndex("ClientId", "ServerId");
|
||||
|
||||
b.ToTable("EFHitLocationCounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServer", b =>
|
||||
@ -152,7 +156,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasKey("ServerId");
|
||||
|
||||
b.ToTable("EFServer");
|
||||
b.ToTable("EFServers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
||||
@ -195,7 +199,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("LinkId");
|
||||
|
||||
b.ToTable("Aliases");
|
||||
b.ToTable("EFAlias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
|
||||
@ -207,7 +211,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasKey("AliasLinkId");
|
||||
|
||||
b.ToTable("AliasLinks");
|
||||
b.ToTable("EFAliasLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
||||
@ -248,7 +252,7 @@ namespace SharedLibraryCore.Migrations
|
||||
b.HasIndex("NetworkId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Clients");
|
||||
b.ToTable("EFClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
||||
@ -281,7 +285,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("PunisherId");
|
||||
|
||||
b.ToTable("Penalties");
|
||||
b.ToTable("EFPenalties");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b =>
|
||||
@ -358,9 +362,20 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b =>
|
||||
{
|
||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics")
|
||||
.WithMany("HitLocations")
|
||||
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId");
|
||||
.HasForeignKey("ClientId", "ServerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
@ -9,7 +9,7 @@ namespace SharedLibraryCore.Migrations
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AliasLinks",
|
||||
name: "EFAliasLinks",
|
||||
columns: table => new
|
||||
{
|
||||
AliasLinkId = table.Column<int>(nullable: false)
|
||||
@ -18,11 +18,11 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AliasLinks", x => x.AliasLinkId);
|
||||
table.PrimaryKey("PK_EFAliasLinks", x => x.AliasLinkId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EFServer",
|
||||
name: "EFServers",
|
||||
columns: table => new
|
||||
{
|
||||
ServerId = table.Column<int>(nullable: false),
|
||||
@ -31,7 +31,7 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EFServer", x => x.ServerId);
|
||||
table.PrimaryKey("PK_EFServers", x => x.ServerId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -50,7 +50,7 @@ namespace SharedLibraryCore.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Aliases",
|
||||
name: "EFAlias",
|
||||
columns: table => new
|
||||
{
|
||||
AliasId = table.Column<int>(nullable: false)
|
||||
@ -63,11 +63,11 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Aliases", x => x.AliasId);
|
||||
table.PrimaryKey("PK_EFAlias", x => x.AliasId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Aliases_AliasLinks_LinkId",
|
||||
name: "FK_EFAlias_EFAliasLinks_LinkId",
|
||||
column: x => x.LinkId,
|
||||
principalTable: "AliasLinks",
|
||||
principalTable: "EFAliasLinks",
|
||||
principalColumn: "AliasLinkId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
@ -87,15 +87,15 @@ namespace SharedLibraryCore.Migrations
|
||||
{
|
||||
table.PrimaryKey("PK_EFServerStatistics", x => x.StatisticId);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFServerStatistics_EFServer_ServerId",
|
||||
name: "FK_EFServerStatistics_EFServers_ServerId",
|
||||
column: x => x.ServerId,
|
||||
principalTable: "EFServer",
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
name: "EFClients",
|
||||
columns: table => new
|
||||
{
|
||||
ClientId = table.Column<int>(nullable: false)
|
||||
@ -115,23 +115,23 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.ClientId);
|
||||
table.PrimaryKey("PK_EFClients", x => x.ClientId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Clients_AliasLinks_AliasLinkId",
|
||||
name: "FK_EFClients_EFAliasLinks_AliasLinkId",
|
||||
column: x => x.AliasLinkId,
|
||||
principalTable: "AliasLinks",
|
||||
principalTable: "EFAliasLinks",
|
||||
principalColumn: "AliasLinkId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Clients_Aliases_CurrentAliasId",
|
||||
name: "FK_EFClients_EFAlias_CurrentAliasId",
|
||||
column: x => x.CurrentAliasId,
|
||||
principalTable: "Aliases",
|
||||
principalTable: "EFAlias",
|
||||
principalColumn: "AliasId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EFClientKill",
|
||||
name: "EFClientKills",
|
||||
columns: table => new
|
||||
{
|
||||
KillId = table.Column<long>(nullable: false)
|
||||
@ -152,39 +152,39 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EFClientKill", x => x.KillId);
|
||||
table.PrimaryKey("PK_EFClientKills", x => x.KillId);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_Clients_AttackerId",
|
||||
name: "FK_EFClientKills_EFClients_AttackerId",
|
||||
column: x => x.AttackerId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_Vector3_DeathOriginVector3Id",
|
||||
name: "FK_EFClientKills_Vector3_DeathOriginVector3Id",
|
||||
column: x => x.DeathOriginVector3Id,
|
||||
principalTable: "Vector3",
|
||||
principalColumn: "Vector3Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_Vector3_KillOriginVector3Id",
|
||||
name: "FK_EFClientKills_Vector3_KillOriginVector3Id",
|
||||
column: x => x.KillOriginVector3Id,
|
||||
principalTable: "Vector3",
|
||||
principalColumn: "Vector3Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_EFServer_ServerId",
|
||||
name: "FK_EFClientKills_EFServers_ServerId",
|
||||
column: x => x.ServerId,
|
||||
principalTable: "EFServer",
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_Clients_VictimId",
|
||||
name: "FK_EFClientKills_EFClients_VictimId",
|
||||
column: x => x.VictimId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientKill_Vector3_ViewAnglesVector3Id",
|
||||
name: "FK_EFClientKills_Vector3_ViewAnglesVector3Id",
|
||||
column: x => x.ViewAnglesVector3Id,
|
||||
principalTable: "Vector3",
|
||||
principalColumn: "Vector3Id",
|
||||
@ -192,7 +192,7 @@ namespace SharedLibraryCore.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EFClientMessage",
|
||||
name: "EFClientMessages",
|
||||
columns: table => new
|
||||
{
|
||||
MessageId = table.Column<long>(nullable: false)
|
||||
@ -205,17 +205,17 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EFClientMessage", x => x.MessageId);
|
||||
table.PrimaryKey("PK_EFClientMessages", x => x.MessageId);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientMessage_Clients_ClientId",
|
||||
name: "FK_EFClientMessages_EFClients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientMessage_EFServer_ServerId",
|
||||
name: "FK_EFClientMessages_EFServers_ServerId",
|
||||
column: x => x.ServerId,
|
||||
principalTable: "EFServer",
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -237,21 +237,21 @@ namespace SharedLibraryCore.Migrations
|
||||
{
|
||||
table.PrimaryKey("PK_EFClientStatistics", x => new { x.ClientId, x.ServerId });
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientStatistics_Clients_ClientId",
|
||||
name: "FK_EFClientStatistics_EFClients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFClientStatistics_EFServer_ServerId",
|
||||
name: "FK_EFClientStatistics_EFServers_ServerId",
|
||||
column: x => x.ServerId,
|
||||
principalTable: "EFServer",
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Penalties",
|
||||
name: "EFPenalties",
|
||||
columns: table => new
|
||||
{
|
||||
PenaltyId = table.Column<int>(nullable: false)
|
||||
@ -267,160 +267,177 @@ namespace SharedLibraryCore.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Penalties", x => x.PenaltyId);
|
||||
table.PrimaryKey("PK_EFPenalties", x => x.PenaltyId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Penalties_AliasLinks_LinkId",
|
||||
name: "FK_EFPenalties_EFAliasLinks_LinkId",
|
||||
column: x => x.LinkId,
|
||||
principalTable: "AliasLinks",
|
||||
principalTable: "EFAliasLinks",
|
||||
principalColumn: "AliasLinkId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Penalties_Clients_OffenderId",
|
||||
name: "FK_EFPenalties_EFClients_OffenderId",
|
||||
column: x => x.OffenderId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Penalties_Clients_PunisherId",
|
||||
name: "FK_EFPenalties_EFClients_PunisherId",
|
||||
column: x => x.PunisherId,
|
||||
principalTable: "Clients",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EFHitLocationCount",
|
||||
name: "EFHitLocationCounts",
|
||||
columns: table => new
|
||||
{
|
||||
HitLocationCountId = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Active = table.Column<bool>(nullable: false),
|
||||
EFClientStatisticsClientId = table.Column<int>(nullable: true),
|
||||
EFClientStatisticsServerId = table.Column<int>(nullable: true),
|
||||
EFClientStatistics_ClientId = table.Column<int>(nullable: false),
|
||||
HitCount = table.Column<int>(nullable: false),
|
||||
HitOffsetAverage = table.Column<float>(nullable: false),
|
||||
Location = table.Column<int>(nullable: false)
|
||||
Location = table.Column<int>(nullable: false),
|
||||
EFClientStatistics_ServerId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EFHitLocationCount", x => x.HitLocationCountId);
|
||||
table.PrimaryKey("PK_EFHitLocationCounts", x => x.HitLocationCountId);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFHitLocationCount_EFClientStatistics_EFClientStatisticsClientId_EFClientStatisticsServerId",
|
||||
columns: x => new { x.EFClientStatisticsClientId, x.EFClientStatisticsServerId },
|
||||
name: "FK_EFHitLocationCounts_EFClients_EFClientStatistics_ClientId",
|
||||
column: x => x.EFClientStatistics_ClientId,
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFServers_EFClientStatistics_ServerId",
|
||||
column: x => x.EFClientStatistics_ServerId,
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFClientStatistics_EFClientStatistics_ClientId_EFClientStatistics_ServerId",
|
||||
columns: x => new { x.EFClientStatistics_ClientId, x.EFClientStatistics_ServerId },
|
||||
principalTable: "EFClientStatistics",
|
||||
principalColumns: new[] { "ClientId", "ServerId" },
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Aliases_LinkId",
|
||||
table: "Aliases",
|
||||
name: "IX_EFAlias_LinkId",
|
||||
table: "EFAlias",
|
||||
column: "LinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Clients_AliasLinkId",
|
||||
table: "Clients",
|
||||
column: "AliasLinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Clients_CurrentAliasId",
|
||||
table: "Clients",
|
||||
column: "CurrentAliasId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Clients_NetworkId",
|
||||
table: "Clients",
|
||||
column: "NetworkId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_AttackerId",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_AttackerId",
|
||||
table: "EFClientKills",
|
||||
column: "AttackerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_DeathOriginVector3Id",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_DeathOriginVector3Id",
|
||||
table: "EFClientKills",
|
||||
column: "DeathOriginVector3Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_KillOriginVector3Id",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_KillOriginVector3Id",
|
||||
table: "EFClientKills",
|
||||
column: "KillOriginVector3Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_ServerId",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_ServerId",
|
||||
table: "EFClientKills",
|
||||
column: "ServerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_VictimId",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_VictimId",
|
||||
table: "EFClientKills",
|
||||
column: "VictimId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientKill_ViewAnglesVector3Id",
|
||||
table: "EFClientKill",
|
||||
name: "IX_EFClientKills_ViewAnglesVector3Id",
|
||||
table: "EFClientKills",
|
||||
column: "ViewAnglesVector3Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientMessage_ClientId",
|
||||
table: "EFClientMessage",
|
||||
name: "IX_EFClientMessages_ClientId",
|
||||
table: "EFClientMessages",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientMessage_ServerId",
|
||||
table: "EFClientMessage",
|
||||
name: "IX_EFClientMessages_ServerId",
|
||||
table: "EFClientMessages",
|
||||
column: "ServerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClients_AliasLinkId",
|
||||
table: "EFClients",
|
||||
column: "AliasLinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClients_CurrentAliasId",
|
||||
table: "EFClients",
|
||||
column: "CurrentAliasId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClients_NetworkId",
|
||||
table: "EFClients",
|
||||
column: "NetworkId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFClientStatistics_ServerId",
|
||||
table: "EFClientStatistics",
|
||||
column: "ServerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFHitLocationCount_EFClientStatisticsClientId_EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCount",
|
||||
columns: new[] { "EFClientStatisticsClientId", "EFClientStatisticsServerId" });
|
||||
name: "IX_EFHitLocationCounts_EFClientStatistics_ServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
column: "EFClientStatistics_ServerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFHitLocationCounts_EFClientStatistics_ClientId_EFClientStatistics_ServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
columns: new[] { "EFClientStatistics_ClientId", "EFClientStatistics_ServerId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFPenalties_LinkId",
|
||||
table: "EFPenalties",
|
||||
column: "LinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFPenalties_OffenderId",
|
||||
table: "EFPenalties",
|
||||
column: "OffenderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFPenalties_PunisherId",
|
||||
table: "EFPenalties",
|
||||
column: "PunisherId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFServerStatistics_ServerId",
|
||||
table: "EFServerStatistics",
|
||||
column: "ServerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Penalties_LinkId",
|
||||
table: "Penalties",
|
||||
column: "LinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Penalties_OffenderId",
|
||||
table: "Penalties",
|
||||
column: "OffenderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Penalties_PunisherId",
|
||||
table: "Penalties",
|
||||
column: "PunisherId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFClientKill");
|
||||
name: "EFClientKills");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFClientMessage");
|
||||
name: "EFClientMessages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFHitLocationCount");
|
||||
name: "EFHitLocationCounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFPenalties");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFServerStatistics");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Penalties");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Vector3");
|
||||
|
||||
@ -428,16 +445,16 @@ namespace SharedLibraryCore.Migrations
|
||||
name: "EFClientStatistics");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
name: "EFClients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EFServer");
|
||||
name: "EFServers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Aliases");
|
||||
name: "EFAlias");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AliasLinks");
|
||||
name: "EFAliasLinks");
|
||||
}
|
||||
}
|
||||
}
|
@ -65,7 +65,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("ViewAnglesVector3Id");
|
||||
|
||||
b.ToTable("EFClientKill");
|
||||
b.ToTable("EFClientKills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b =>
|
||||
@ -89,7 +89,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("ServerId");
|
||||
|
||||
b.ToTable("EFClientMessage");
|
||||
b.ToTable("EFClientMessages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
|
||||
@ -124,9 +124,8 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int?>("EFClientStatisticsClientId");
|
||||
|
||||
b.Property<int?>("EFClientStatisticsServerId");
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnName("EFClientStatistics_ClientId");
|
||||
|
||||
b.Property<int>("HitCount");
|
||||
|
||||
@ -134,11 +133,16 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.Property<int>("Location");
|
||||
|
||||
b.Property<int>("ServerId")
|
||||
.HasColumnName("EFClientStatistics_ServerId");
|
||||
|
||||
b.HasKey("HitLocationCountId");
|
||||
|
||||
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
|
||||
b.HasIndex("ServerId");
|
||||
|
||||
b.ToTable("EFHitLocationCount");
|
||||
b.HasIndex("ClientId", "ServerId");
|
||||
|
||||
b.ToTable("EFHitLocationCounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServer", b =>
|
||||
@ -151,7 +155,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasKey("ServerId");
|
||||
|
||||
b.ToTable("EFServer");
|
||||
b.ToTable("EFServers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
||||
@ -194,7 +198,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("LinkId");
|
||||
|
||||
b.ToTable("Aliases");
|
||||
b.ToTable("EFAlias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
|
||||
@ -206,7 +210,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasKey("AliasLinkId");
|
||||
|
||||
b.ToTable("AliasLinks");
|
||||
b.ToTable("EFAliasLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
||||
@ -247,7 +251,7 @@ namespace SharedLibraryCore.Migrations
|
||||
b.HasIndex("NetworkId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Clients");
|
||||
b.ToTable("EFClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
||||
@ -280,7 +284,7 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
b.HasIndex("PunisherId");
|
||||
|
||||
b.ToTable("Penalties");
|
||||
b.ToTable("EFPenalties");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b =>
|
||||
@ -357,9 +361,20 @@ namespace SharedLibraryCore.Migrations
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b =>
|
||||
{
|
||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics")
|
||||
.WithMany("HitLocations")
|
||||
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId");
|
||||
.HasForeignKey("ClientId", "ServerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
||||
|
@ -130,7 +130,10 @@ namespace SharedLibraryCore.RCon
|
||||
#if DEBUG
|
||||
Log.WriteDebug($"Received {bytesRead} bytes from {ServerConnection.RemoteEndPoint}");
|
||||
#endif
|
||||
connectionState.ResponseString.Append(Encoding.UTF7.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0'));
|
||||
connectionState.ResponseString.Append(Encoding.UTF7.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0') + '\n');
|
||||
|
||||
if (!connectionState.Buffer.Take(4).ToArray().SequenceEqual(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }))
|
||||
throw new NetworkException("Unexpected packet received");
|
||||
|
||||
if (serverConnection.Available > 0)
|
||||
{
|
||||
@ -159,9 +162,9 @@ namespace SharedLibraryCore.RCon
|
||||
public async Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "")
|
||||
{
|
||||
// will this really prevent flooding?
|
||||
if ((DateTime.Now - LastQuery).TotalMilliseconds < 150)
|
||||
if ((DateTime.Now - LastQuery).TotalMilliseconds < 35)
|
||||
{
|
||||
await Task.Delay(150);
|
||||
await Task.Delay(35);
|
||||
}
|
||||
|
||||
LastQuery = DateTime.Now;
|
||||
@ -174,10 +177,10 @@ namespace SharedLibraryCore.RCon
|
||||
{
|
||||
case StaticHelpers.QueryType.DVAR:
|
||||
case StaticHelpers.QueryType.COMMAND:
|
||||
queryString = $"ÿÿÿÿrcon {RConPassword} {parameters}";
|
||||
queryString = $"ÿÿÿÿ\x02rcon {RConPassword} {parameters}";
|
||||
break;
|
||||
case StaticHelpers.QueryType.GET_STATUS:
|
||||
queryString = "ÿÿÿÿgetstatus";
|
||||
queryString = "ÿÿÿÿ\x02getstatus";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -288,8 +291,9 @@ namespace SharedLibraryCore.RCon
|
||||
|
||||
string[] splitResponse = queryResponse.Split(new char[]
|
||||
{
|
||||
StaticHelpers.SeperatorChar
|
||||
}, StringSplitOptions.RemoveEmptyEntries);
|
||||
'\n'
|
||||
}, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(line => line.Trim()).ToArray();
|
||||
return splitResponse;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ namespace SharedLibraryCore.Services
|
||||
{
|
||||
using (var context = new DatabaseContext())
|
||||
return await context.Clients
|
||||
.Where(c => c.Level == Objects.Player.Permission.Owner)
|
||||
.Where(c => c.Level == Player.Permission.Owner)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@ -229,18 +229,18 @@ namespace SharedLibraryCore.Services
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
var iqClients = (from alias in context.Aliases
|
||||
.AsNoTracking()
|
||||
where alias.Name
|
||||
.Contains(name)
|
||||
join link in context.AliasLinks
|
||||
on alias.LinkId equals link.AliasLinkId
|
||||
join client in context.Clients
|
||||
.AsNoTracking()
|
||||
on alias.LinkId equals client.AliasLinkId
|
||||
select client)
|
||||
.Distinct()
|
||||
.Include(c => c.CurrentAlias)
|
||||
.Include(c => c.AliasLink.Children);
|
||||
.AsNoTracking()
|
||||
where alias.Name
|
||||
.Contains(name)
|
||||
join link in context.AliasLinks
|
||||
on alias.LinkId equals link.AliasLinkId
|
||||
join client in context.Clients
|
||||
.AsNoTracking()
|
||||
on alias.LinkId equals client.AliasLinkId
|
||||
select client)
|
||||
.Distinct()
|
||||
.Include(c => c.CurrentAlias)
|
||||
.Include(c => c.AliasLink.Children);
|
||||
|
||||
return await iqClients.ToListAsync();
|
||||
}
|
||||
@ -251,17 +251,17 @@ namespace SharedLibraryCore.Services
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
var iqClients = (from alias in context.Aliases
|
||||
.AsNoTracking()
|
||||
where alias.IPAddress == ipAddress
|
||||
join link in context.AliasLinks
|
||||
on alias.LinkId equals link.AliasLinkId
|
||||
join client in context.Clients
|
||||
.AsNoTracking()
|
||||
on alias.LinkId equals client.AliasLinkId
|
||||
select client)
|
||||
.Distinct()
|
||||
.Include(c => c.CurrentAlias)
|
||||
.Include(c => c.AliasLink.Children);
|
||||
.AsNoTracking()
|
||||
where alias.IPAddress == ipAddress
|
||||
join link in context.AliasLinks
|
||||
on alias.LinkId equals link.AliasLinkId
|
||||
join client in context.Clients
|
||||
.AsNoTracking()
|
||||
on alias.LinkId equals client.AliasLinkId
|
||||
select client)
|
||||
.Distinct()
|
||||
.Include(c => c.CurrentAlias)
|
||||
.Include(c => c.AliasLink.Children);
|
||||
|
||||
return await iqClients.ToListAsync();
|
||||
}
|
||||
@ -288,7 +288,7 @@ namespace SharedLibraryCore.Services
|
||||
.AsNoTracking()
|
||||
.Where(c => (DateTime.UtcNow - c.LastConnection).TotalDays >= inactiveDays)
|
||||
.ToListAsync();
|
||||
inactive.ForEach(c => c.Level = Objects.Player.Permission.User);
|
||||
inactive.ForEach(c => c.Level = Player.Permission.User);
|
||||
await context.SaveChangesAsync();
|
||||
return inactive;
|
||||
}
|
||||
|
@ -51,11 +51,14 @@ namespace SharedLibraryCore.Services
|
||||
return this.GetQuery(predicate, orderExpression).AsEnumerable();
|
||||
}
|
||||
|
||||
|
||||
public virtual IQueryable<TEntity> GetQuery(Expression<Func<TEntity, bool>> predicate = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderExpression = null)
|
||||
{
|
||||
IQueryable<TEntity> qry = this.DBSet;
|
||||
|
||||
foreach (var property in this.Context.Model.FindEntityType(typeof(TEntity)).GetNavigations())
|
||||
qry = qry.Include(property.Name);
|
||||
|
||||
|
||||
if (predicate != null)
|
||||
qry = qry.Where(predicate);
|
||||
|
||||
|
@ -14,36 +14,45 @@ namespace SharedLibraryCore.Services
|
||||
{
|
||||
public class PenaltyService : Interfaces.IEntityService<EFPenalty>
|
||||
{
|
||||
public async Task<EFPenalty> Create(EFPenalty entity)
|
||||
public async Task<EFPenalty> Create(EFPenalty newEntity)
|
||||
{
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
entity.Offender = context.Clients.Single(e => e.ClientId == entity.Offender.ClientId);
|
||||
entity.Punisher = context.Clients.Single(e => e.ClientId == entity.Punisher.ClientId);
|
||||
entity.Link = context.AliasLinks.Single(l => l.AliasLinkId == entity.Link.AliasLinkId);
|
||||
// create the actual EFPenalty
|
||||
EFPenalty addedEntity = new EFPenalty()
|
||||
{
|
||||
OffenderId = newEntity.Offender.ClientId,
|
||||
PunisherId = newEntity.Punisher.ClientId,
|
||||
LinkId = newEntity.Link.AliasLinkId,
|
||||
Type = newEntity.Type,
|
||||
Active = true,
|
||||
Expires = newEntity.Expires,
|
||||
Offense = newEntity.Offense,
|
||||
When = newEntity.When,
|
||||
};
|
||||
|
||||
if (entity.Expires == DateTime.MaxValue)
|
||||
entity.Expires = DateTime.Parse(System.Data.SqlTypes.SqlDateTime.MaxValue.ToString());
|
||||
if (addedEntity.Expires == DateTime.MaxValue)
|
||||
addedEntity.Expires = DateTime.Parse(System.Data.SqlTypes.SqlDateTime.MaxValue.ToString());
|
||||
|
||||
// make bans propogate to all aliases
|
||||
if (entity.Type == Objects.Penalty.PenaltyType.Ban)
|
||||
if (addedEntity.Type == Objects.Penalty.PenaltyType.Ban)
|
||||
{
|
||||
await context.Clients
|
||||
.Where(c => c.AliasLinkId == entity.Link.AliasLinkId)
|
||||
.Where(c => c.AliasLinkId == addedEntity.LinkId)
|
||||
.ForEachAsync(c => c.Level = Objects.Player.Permission.Banned);
|
||||
}
|
||||
|
||||
// make flags propogate to all aliases
|
||||
else if (entity.Type == Objects.Penalty.PenaltyType.Flag)
|
||||
else if (addedEntity.Type == Objects.Penalty.PenaltyType.Flag)
|
||||
{
|
||||
await context.Clients
|
||||
.Where(c => c.AliasLinkId == entity.Link.AliasLinkId)
|
||||
.Where(c => c.AliasLinkId == addedEntity.LinkId)
|
||||
.ForEachAsync(c => c.Level = Objects.Player.Permission.Flagged);
|
||||
}
|
||||
|
||||
context.Penalties.Add(entity);
|
||||
context.Penalties.Add(addedEntity);
|
||||
await context.SaveChangesAsync();
|
||||
return entity;
|
||||
return addedEntity;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ namespace SharedLibraryCore
|
||||
Name = client.CurrentAlias.Name,
|
||||
IPAddress = client.CurrentAlias.IPAddress,
|
||||
Level = client.Level,
|
||||
LastConnection = DateTime.UtcNow,
|
||||
LastConnection = client.LastConnection == DateTime.MinValue ? DateTime.UtcNow : client.LastConnection,
|
||||
CurrentAlias = client.CurrentAlias,
|
||||
CurrentAliasId = client.CurrentAlias.AliasId
|
||||
};
|
||||
@ -391,7 +391,9 @@ namespace SharedLibraryCore
|
||||
|
||||
public static async Task<DVAR<T>> GetDvarAsync<T>(this Server server, string dvarName)
|
||||
{
|
||||
string[] LineSplit = await server.RemoteConnection.SendQueryAsync(QueryType.DVAR, dvarName);
|
||||
string[] LineSplit = server.GameName != Game.T6M ?
|
||||
await server.RemoteConnection.SendQueryAsync(QueryType.DVAR, dvarName) :
|
||||
await server.RemoteConnection.SendQueryAsync(QueryType.COMMAND, $"get {dvarName}");
|
||||
|
||||
if (LineSplit.Length != 3)
|
||||
{
|
||||
|
@ -18,11 +18,6 @@ namespace WebfrontCore.Controllers
|
||||
protected bool Authorized { get; private set; }
|
||||
protected EFClient User { get; private set; }
|
||||
|
||||
/* public BaseController(DatabaseContext ctx)
|
||||
{
|
||||
Context = ctx;
|
||||
}*/
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
Manager = Program.Manager;
|
||||
|
@ -8,6 +8,11 @@ namespace WebfrontCore
|
||||
{
|
||||
public static IManager Manager;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
throw new System.Exception("Webfront core cannot be run as a standalone application");
|
||||
}
|
||||
|
||||
public static void Init(IManager mgr)
|
||||
{
|
||||
Manager = mgr;
|
||||
|
@ -20,19 +20,12 @@ namespace WebfrontCore
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||
.AddJsonFile("WebfrontSettings.json", optional: true, reloadOnChange: false)
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
Configuration = builder.Build();
|
||||
|
||||
_appHost = env;
|
||||
|
||||
using (var db = new DatabaseContext())
|
||||
{
|
||||
db.Database.EnsureCreated();
|
||||
db.Database.Migrate();
|
||||
new ContextSeed(db).Seed().Wait();
|
||||
}
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
|
@ -12,11 +12,11 @@
|
||||
<meta name="description" content="@ViewBag.Description">
|
||||
<meta name="keywords" content="@ViewBag.Keywords">
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||
<environment names="Development">
|
||||
<environment include="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/lib/open-iconic/font/css/open-iconic-bootstrap.css" />
|
||||
</environment>
|
||||
<environment names="Production">
|
||||
<environment include="Production">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/lib/open-iconic/font/css/open-iconic-bootstrap.min.css" />
|
||||
</environment>
|
||||
@ -103,7 +103,7 @@ else
|
||||
@RenderBody()
|
||||
<footer></footer>
|
||||
</div>
|
||||
<environment names="Development">
|
||||
<environment include="Development">
|
||||
<script type="text/javascript" src="~/lib/jQuery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="~/lib/moment/moment.js"></script>
|
||||
<script type="text/javascript" src="~/lib/moment-timezone/builds/moment-timezone-with-data.js"></script>
|
||||
@ -111,7 +111,7 @@ else
|
||||
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="~/js/global.js"></script>
|
||||
</environment>
|
||||
<environment names="Production">
|
||||
<environment include="Production">
|
||||
<script type="text/javascript" src="~/lib/jQuery/dist/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="~/lib/moment/min/moment.min.js"></script>
|
||||
<script type="text/javascript" src="~/lib/moment-timezone/builds/moment-timezone.min.js"></script>
|
||||
|
@ -1,2 +1 @@
|
||||
@using WebfrontCore
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
|
||||
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
|
||||
<Version>2.0.0</Version>
|
||||
@ -15,7 +17,7 @@
|
||||
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
|
||||
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<OutputType>Exe</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -26,7 +28,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\Account\" />
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -41,13 +42,17 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj" />
|
||||
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj">
|
||||
<Private></Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.json">
|
||||
<Content Update="WebfrontSettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ProjectExtensions><VisualStudio><UserProperties WebfrontSettings_1json__JSONSchema="http://json.schemastore.org/appsettings" /></VisualStudio></ProjectExtensions>
|
||||
|
||||
</Project>
|
||||
|
@ -9,9 +9,5 @@
|
||||
},
|
||||
"Web": {
|
||||
"Address": "http://127.0.0.1:5000"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"WindowsConnection": "Data Source=|DataDirectory|\\Database.sdf",
|
||||
"LinuxConnection": "Server=127.0.0.1;User=user;Database=IW4MAdmin;Password=password"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user