migrating to .NET Core 2.0

This commit is contained in:
RaidMax 2018-04-08 01:44:42 -05:00
parent 57fd5fae22
commit fdde7dfdba
121 changed files with 534 additions and 1157 deletions

1
.gitignore vendored
View File

@ -202,3 +202,4 @@ ModelManifest.xml
/.vs/IW4MAdmin/v15
/.vs/IW4MAdmin/v15
/.vs/IW4MAdmin/v15/Browse.VC.db
**/wwwroot/lib

View File

@ -4,33 +4,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StatsPlugin", "Plugins\SimpleStats\StatsPlugin.csproj", "{4785AB75-66F3-4391-985D-63A5A049A0FA}"
ProjectSection(ProjectDependencies) = postProject
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibrary\SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WelcomePlugin", "Plugins\Welcome\WelcomePlugin.csproj", "{AF097E6B-48D5-4452-9CCF-0A81A21F341D}"
ProjectSection(ProjectDependencies) = postProject
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
EndProjectSection
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}"
ProjectSection(SolutionItems) = preProject
_customcallbacks.gsc = _customcallbacks.gsc
AfterPublish.bat = AfterPublish.bat
README.md = README.md
version.txt = version.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Plugins\Tests\Tests.csproj", "{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebfrontCore", "WebfrontCore\WebfrontCore.csproj", "{65340D7D-5831-406C-ACAD-B13BA634BDE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfanityDeterment", "Plugins\ProfanityDeterment\ProfanityDeterment.csproj", "{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedLibraryCore", "SharedLibraryCore\SharedLibraryCore.csproj", "{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebfrontCore", "WebfrontCore\WebfrontCore.csproj", "{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -83,38 +76,6 @@ Global
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|x64.Build.0 = Release-Stable|x64
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|x86.ActiveCfg = Release-Stable|x86
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|x86.Build.0 = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Mixed Platforms.Build.0 = Debug|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x64.ActiveCfg = Debug|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x64.Build.0 = Debug|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x86.ActiveCfg = Debug|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|x86.Build.0 = Debug|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.Build.0 = Release|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Mixed Platforms.ActiveCfg = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Mixed Platforms.Build.0 = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x64.ActiveCfg = Release|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x64.Build.0 = Release|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x86.ActiveCfg = Release|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|x86.Build.0 = Release|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Nightly|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|Mixed Platforms.Build.0 = Release-Nightly|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.ActiveCfg = Release-Nightly|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.Build.0 = Release-Nightly|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.ActiveCfg = Release-Nightly|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.Build.0 = Release-Nightly|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x64.ActiveCfg = Release-Stable|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x64.Build.0 = Release-Stable|x64
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x86.ActiveCfg = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x86.Build.0 = Release-Stable|x86
{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
@ -177,38 +138,6 @@ Global
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|x64.Build.0 = Release-Stable|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|x86.ActiveCfg = Release-Stable|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|x86.Build.0 = Release-Stable|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|x64.ActiveCfg = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|x64.Build.0 = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|x86.ActiveCfg = Debug|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Debug|x86.Build.0 = Debug|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|Any CPU.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|x64.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|x64.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|x86.ActiveCfg = Release|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release|x86.Build.0 = Release|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|Any CPU.ActiveCfg = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|Any CPU.Build.0 = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|x64.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|x64.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|x86.ActiveCfg = Release|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Nightly|x86.Build.0 = Release|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|Mixed Platforms.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|Mixed Platforms.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|x64.ActiveCfg = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|x64.Build.0 = Release|Any CPU
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|x86.ActiveCfg = Release|x86
{65340D7D-5831-406C-ACAD-B13BA634BDE2}.Release-Stable|x86.Build.0 = Release|x86
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -241,6 +170,70 @@ Global
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Release-Stable|x64.Build.0 = Release|Any CPU
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Release-Stable|x86.ActiveCfg = Release|x86
{3EA31029-C76F-4C8E-AFD4-79F77DEA7033}.Release-Stable|x86.Build.0 = Release|x86
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|x64.ActiveCfg = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|x64.Build.0 = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|x86.ActiveCfg = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Debug|x86.Build.0 = Debug|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|Any CPU.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|x64.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|x64.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|x86.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release|x86.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|x64.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|x64.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|x86.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Nightly|x86.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|Any CPU.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|Mixed Platforms.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|Mixed Platforms.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|x64.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|x64.Build.0 = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|x86.ActiveCfg = Release|Any CPU
{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}.Release-Stable|x86.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|x64.ActiveCfg = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|x64.Build.0 = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|x86.ActiveCfg = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Debug|x86.Build.0 = Debug|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|Any CPU.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|x64.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|x64.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|x86.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release|x86.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|x64.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|x64.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|x86.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Nightly|x86.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|Any CPU.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|Mixed Platforms.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|Mixed Platforms.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x64.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x64.Build.0 = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.ActiveCfg = Release|Any CPU
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,3 +0,0 @@
set SolutionDir=%1
set ProjectDir=%2
set TargetDir=%3

View File

@ -1,20 +0,0 @@
set SolutionDir=%1
set ProjectDir=%2
set TargetDir=%3
if not exist "%SolutionDir%BUILD" (
echo "Making build dir"
mkdir "%SolutionDir%BUILD"
)
if not exist "%SolutionDir%BUILD\Plugins" (
echo "Making plugin dir"
mkdir "%SolutionDir%BUILD\Plugins"
)
if not exist "%SolutionDir%BUILD\userraw\scripts" (
echo "Making userraw dir"
mkdir "%SolutionDir%BUILD\userraw\scripts"
)
copy "%SolutionDir%_customcallbacks.gsc" "%SolutionDir%BUILD\userraw\scripts\_customcallbacks.gsc"

View File

@ -1,30 +0,0 @@
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.SqlServerCompact;
using System.Data.SqlServerCe;
namespace SharedLibrary.Database
{
public class ContextConfiguration : DbConfiguration
{
public ContextConfiguration()
{
if (!Utilities.IsRunningOnMono())
{
SetExecutionStrategy("System.Data.SqlServerCe.4.0", () => new DefaultExecutionStrategy());
SetProviderFactory("System.Data.SqlServerCe.4.0", new SqlCeProviderFactory());
SetProviderServices("System.Data.SqlServerCe.4.0", SqlCeProviderServices.Instance);
SetDefaultConnectionFactory(new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0"));
}
else
{
SetExecutionStrategy("MySql.Data.MySqlClient", () => new DefaultExecutionStrategy());
SetProviderFactory("MySql.Data.MySqlClient", new MySql.Data.MySqlClient.MySqlClientFactory());
SetProviderServices("MySql.Data.MySqlClient", new MySql.Data.MySqlClient.MySqlProviderServices());
SetDefaultConnectionFactory(new MySql.Data.Entity.MySqlConnectionFactory());
}
}
}
}

View File

@ -1,29 +0,0 @@
using SharedLibrary.Interfaces;
using System;
using System.Data.SqlServerCe;
namespace SharedLibrary.Database
{
public class Repair
{
public static void Run(ILogger log)
{
if (!System.IO.File.Exists($"{Utilities.OperatingDirectory}Database.sdf"))
return;
SqlCeEngine engine = new SqlCeEngine(@"Data Source=|DataDirectory|\Database.sdf");
if (false == engine.Verify())
{
log.WriteWarning("Database is corrupted.");
try
{
engine.Repair(null, RepairOption.DeleteCorruptedRows);
}
catch (SqlCeException ex)
{
log.WriteError(ex.Message);
}
}
}
}
}

View File

@ -1,77 +0,0 @@
using System;
using SimpleCrypto;
namespace SharedLibrary.Helpers
{
public class Hashing
{
/// <summary>
/// Generate password hash and salt
/// </summary>
/// <param name="password">plaintext password</param>
/// <returns></returns>
public static string[] Hash(string password, string saltStr = null)
{
string hash;
string salt;
var CryptoSvc = new PBKDF2();
// generate new hash
if (saltStr == null)
{
hash = CryptoSvc.Compute(password);
salt = CryptoSvc.Salt;
return new string[]
{
hash,
salt
};
}
else
{
hash = CryptoSvc.Compute(password, saltStr);
return new string[]
{
hash,
""
};
}
/*//https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/consumer-apis/password-hashing
byte[] salt;
if (saltStr == null)
{
salt = new byte[128 / 8];
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(salt);
}
}
else
{
salt = Convert.FromBase64String(saltStr);
}
// derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations)
string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
password: password,
salt: salt,
prf: KeyDerivationPrf.HMACSHA1,
iterationCount: 10000,
numBytesRequested: 256 / 8));
return new string[]
{
hashed,
Convert.ToBase64String(salt)
};*/
}
}
}

View File

@ -1,56 +0,0 @@
namespace SharedLibrary.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<SharedLibrary.Database.DatabaseContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
if (Utilities.IsRunningOnMono())
{
SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
}
}
protected override void Seed(SharedLibrary.Database.DatabaseContext context)
{
context.AliasLinks.AddOrUpdate(new SharedLibrary.Database.Models.EFAliasLink()
{
AliasLinkId = 1
});
var currentAlias = new SharedLibrary.Database.Models.EFAlias()
{
AliasId = 1,
Active = true,
DateAdded = DateTime.UtcNow,
IPAddress = 0,
Name = "IW4MAdmin",
LinkId = 1
};
context.Aliases.AddOrUpdate(currentAlias);
context.Clients.AddOrUpdate(new SharedLibrary.Database.Models.EFClient()
{
ClientId = 1,
Active = false,
Connections = 0,
FirstConnection = DateTime.UtcNow,
LastConnection = DateTime.UtcNow,
Level = Objects.Player.Permission.Console,
Masked = true,
NetworkId = 0,
AliasLinkId = 1,
CurrentAliasId = 1,
});
base.Seed(context);
}
}
}

View File

@ -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("SharedLibrary")]
[assembly: AssemblyDescription("Common library components for IW4MAdmin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ForeverNone LLC")]
[assembly: AssemblyProduct("IW4MAdmin")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("c434bf30-cd8f-4270-a386-e3b970f02f21")]
// 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")]

View File

@ -1,287 +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>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D51EECEB-438A-47DA-870F-7D7B41BC24D6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SharedLibrary</RootNamespace>
<AssemblyName>SharedLibrary</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Nightly|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>false</RegisterForComInterop>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</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>..\..\..\RuleSet1.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>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
<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="Configuration\MapConfiguration.cs" />
<Compile Include="Configuration\ServerConfiguration.cs" />
<Compile Include="Database\ContextConfiguration.cs" />
<Compile Include="Database\Importer.cs" />
<Compile Include="Database\DatabaseContext.cs" />
<Compile Include="Database\Models\EFAlias.cs" />
<Compile Include="Database\Models\EFAliasLink.cs" />
<Compile Include="Database\Models\EFClient.cs" />
<Compile Include="Database\Models\EFPenalty.cs" />
<Compile Include="Database\Models\SharedEntity.cs" />
<Compile Include="Database\Repair.cs" />
<Compile Include="Dtos\ChatInfo.cs" />
<Compile Include="Dtos\CommandResponseInfo.cs" />
<Compile Include="Dtos\PlayerInfo.cs" />
<Compile Include="Dtos\ClientInfo.cs" />
<Compile Include="Dtos\ProfileMeta.cs" />
<Compile Include="Dtos\PenaltyInfo.cs" />
<Compile Include="Dtos\ServerInfo.cs" />
<Compile Include="Dtos\SharedInfo.cs" />
<Compile Include="Exceptions\DatabaseException.cs" />
<Compile Include="Helpers\AsyncStatus.cs" />
<Compile Include="Commands\NativeCommands.cs" />
<Compile Include="Exceptions\CommandException.cs" />
<Compile Include="Exceptions\DvarException.cs" />
<Compile Include="Exceptions\NetworkException.cs" />
<Compile Include="Exceptions\SerializationException.cs" />
<Compile Include="Exceptions\ServerException.cs" />
<Compile Include="Helpers\BaseConfigurationHandler.cs" />
<Compile Include="Helpers\Hashing.cs" />
<Compile Include="Helpers\ParseEnum.cs" />
<Compile Include="Helpers\Vector3.cs" />
<Compile Include="Interfaces\IBaseConfiguration.cs" />
<Compile Include="Interfaces\IConfigurationHandler.cs" />
<Compile Include="Interfaces\IEntityService.cs" />
<Compile Include="Interfaces\ILogger.cs" />
<Compile Include="Interfaces\IManager.cs" />
<Compile Include="Interfaces\ISerializable.cs" />
<Compile Include="Helpers\MessageToken.cs" />
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Objects\Alias.cs" />
<Compile Include="Objects\Penalty.cs" />
<Compile Include="Command.cs" />
<Compile Include="Event.cs" />
<Compile Include="File.cs" />
<Compile Include="Dvar.cs" />
<Compile Include="Map.cs" />
<Compile Include="Helpers\PlayerHistory.cs" />
<Compile Include="Objects\Player.cs" />
<Compile Include="Interfaces\IPlugin.cs" />
<Compile Include="Objects\Report.cs" />
<Compile Include="PluginImporter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RCon\Connection.cs" />
<Compile Include="RCon\StaticHelpers.cs" />
<Compile Include="Server.cs" />
<Compile Include="Configuration\ApplicationConfiguration.cs" />
<Compile Include="Services\AliasService.cs" />
<Compile Include="Services\ClientService.cs" />
<Compile Include="Services\GenericRepository.cs" />
<Compile Include="Services\MetaService.cs" />
<Compile Include="Services\PenaltyService.cs" />
<Compile Include="Utilities.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Dtos\EventInfo.cs" />
<Content Include="LibSQLCe\x86\Microsoft.VC90.CRT\msvcr90.dll" />
<Content Include="LibSQLCe\x86\Microsoft.VC90.CRT\README_ENU.txt" />
<Content Include="LibSQLCe\x86\sqlceca40.dll" />
<Content Include="LibSQLCe\x86\sqlcecompact40.dll" />
<Content Include="LibSQLCe\x86\sqlceer40EN.dll" />
<Content Include="LibSQLCe\x86\sqlceme40.dll" />
<Content Include="LibSQLCe\x86\sqlceqp40.dll" />
<Content Include="LibSQLCe\x86\sqlcese40.dll" />
<None Include="BuildScripts\PostBuild.bat" />
<None Include="BuildScripts\PreBuild.bat" />
<None Include="LibSQLCe\x86\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework">
<Version>6.2.0</Version>
</PackageReference>
<PackageReference Include="EntityFramework.SqlServerCompact">
<Version>6.2.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="MySql.Data">
<Version>6.10.6</Version>
</PackageReference>
<PackageReference Include="MySql.Data.Entity">
<Version>6.9.11</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>11.0.2</Version>
</PackageReference>
<PackageReference Include="SimpleCrypto">
<Version>0.3.30.26</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>call $(ProjectDir)BuildScripts\PreBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir)</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>call $(ProjectDir)BuildScripts\PostBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir)</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>

View File

@ -1,22 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -2,9 +2,9 @@
using System.Linq;
using System.Threading.Tasks;
using SharedLibrary.Objects;
using SharedLibraryCore.Objects;
namespace SharedLibrary
namespace SharedLibraryCore
{
public class CommandArgument
{

View File

@ -1,16 +1,16 @@
using SharedLibrary.Database;
using SharedLibrary.Database.Models;
using SharedLibrary.Exceptions;
using SharedLibrary.Objects;
using SharedLibrary.Services;
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Objects;
using SharedLibraryCore.Services;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Commands
namespace SharedLibraryCore.Commands
{
public class CQuit : Command
{
@ -575,7 +575,7 @@ namespace SharedLibrary.Commands
public override async Task ExecuteAsync(Event E)
{
var db_players = (await (E.Owner.Manager.GetClientService() as ClientService)
IList<EFClient> db_players = (await (E.Owner.Manager.GetClientService() as ClientService)
.GetClientByName(E.Data))
.OrderByDescending(p => p.LastConnection)
.ToList();

View File

@ -1,9 +1,9 @@
using SharedLibrary.Interfaces;
using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
namespace SharedLibrary.Configuration
namespace SharedLibraryCore.Configuration
{
public class ApplicationConfiguration : IBaseConfiguration
{

View File

@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SharedLibrary.Server;
using static SharedLibraryCore.Server;
namespace SharedLibrary.Configuration
namespace SharedLibraryCore.Configuration
{
public class MapConfiguration
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace SharedLibrary.Configuration
namespace SharedLibraryCore.Configuration
{
public class ServerConfiguration
{

View File

@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace SharedLibraryCore.Database
{
public class ContextSeed
{
private DatabaseContext context;
public ContextSeed(DatabaseContext ctx)
{
context = ctx;
}
public async Task Seed()
{
if (context.AliasLinks.Count() == 0)
{
context.AliasLinks.Add(new EFAliasLink()
{
AliasLinkId = 1
});
var currentAlias = new EFAlias()
{
AliasId = 1,
Active = true,
DateAdded = DateTime.UtcNow,
IPAddress = 0,
Name = "IW4MAdmin",
LinkId = 1
};
context.Aliases.Add(currentAlias);
context.Clients.Add(new EFClient()
{
ClientId = 1,
Active = false,
Connections = 0,
FirstConnection = DateTime.UtcNow,
LastConnection = DateTime.UtcNow,
Level = Objects.Player.Permission.Console,
Masked = true,
NetworkId = 0,
AliasLinkId = 1,
CurrentAliasId = 1,
});
await context.SaveChangesAsync();
}
}
}
}

View File

@ -1,22 +1,14 @@
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary.Database.Models;
using System.Data.SqlServerCe;
using System.Data.Entity.ModelConfiguration.Conventions;
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database.Models;
using System.Reflection;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.SqlServerCompact;
using System.IO;
using System.Data.Common;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.Sqlite;
namespace SharedLibrary.Database
namespace SharedLibraryCore.Database
{
[DbConfigurationType(typeof(ContextConfiguration))]
public class DatabaseContext : DbContext
{
public DbSet<EFClient> Clients { get; set; }
@ -24,47 +16,60 @@ namespace SharedLibrary.Database
public DbSet<EFAliasLink> AliasLinks { get; set; }
public DbSet<EFPenalty> Penalties { get; set; }
public static string ConnectionString;
public DatabaseContext(DbContextOptions<DatabaseContext> opt) : base(opt) { }
public DatabaseContext() : base(ConnectionString)
public DatabaseContext()
{
// todo: make this work with MySQL
if (!Utilities.IsRunningOnMono())
System.Data.Entity.Database.SetInitializer(new MigrateDatabaseToLatestVersion<DatabaseContext, Migrations.Configuration>());
//Database.CreateIfNotExists();
Configuration.LazyLoadingEnabled = true;
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
modelBuilder.Entity<EFPenalty>()
.HasRequired(p => p.Offender)
string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = $"{currentPath}{Path.DirectorySeparatorChar}Database.db".Substring(6) };
var connectionString = connectionStringBuilder.ToString();
var connection = new SqliteConnection(connectionString);
optionsBuilder.UseSqlite(connection);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// make network id unique
modelBuilder.Entity<EFClient>(entity =>
{
entity.HasIndex(e => e.NetworkId).IsUnique();
});
modelBuilder.Entity<EFPenalty>(entity =>
{
entity.HasOne(p => p.Offender)
.WithMany(c => c.ReceivedPenalties)
.HasForeignKey(c => c.OffenderId)
.WillCascadeOnDelete(false);
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<EFPenalty>()
.HasRequired(p => p.Punisher)
.WithMany(c => c.AdministeredPenalties)
entity.HasOne(p => p.Punisher)
.WithMany(p => p.AdministeredPenalties)
.HasForeignKey(c => c.PunisherId)
.WillCascadeOnDelete(false);
.OnDelete(DeleteBehavior.Restrict);
});
modelBuilder.Entity<EFAliasLink>()
.HasMany(e => e.Children)
.WithRequired(a => a.Link)
.HasForeignKey(a => a.LinkId)
.WillCascadeOnDelete(true);
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Entity<EFAliasLink>(entity =>
{
entity.HasMany(e => e.Children)
.WithOne(a => a.Link)
.HasForeignKey(k => k.LinkId)
.OnDelete(DeleteBehavior.Restrict);
});
// https://aleemkhan.wordpress.com/2013/02/28/dynamically-adding-dbset-properties-in-dbcontext-for-entity-framework-code-first/
#if !DEBUG
foreach (string dllPath in System.IO.Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins"))
foreach (string dllPath in Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins"))
#else
IEnumerable<string> directoryFiles;
try
{
directoryFiles = Directory.GetFiles($@"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}x86{Path.DirectorySeparatorChar}Debug{Path.DirectorySeparatorChar}Plugins").Where(f => f.Contains(".dll"));
directoryFiles = Directory.GetFiles($@"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}Debug{Path.DirectorySeparatorChar}netcoreapp2.0{Path.DirectorySeparatorChar}Plugins").Where(f => f.Contains(".dll"));
}
catch (Exception)

View File

@ -1,12 +1,13 @@
using SharedLibrary.Database.Models;
using SharedLibrary.Objects;
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Database
namespace SharedLibraryCore.Database
{
//https://stackoverflow.com/questions/5940225/fastest-way-of-inserting-in-entity-framework
public static class Importer
@ -18,9 +19,6 @@ namespace SharedLibrary.Database
try
{
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
int count = 0;
foreach (var entityToInsert in clients)
@ -83,9 +81,6 @@ namespace SharedLibrary.Database
{
context.Dispose();
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
}
}
@ -99,9 +94,6 @@ namespace SharedLibrary.Database
try
{
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
int count = 0;
foreach (var entityToInsert in penalties)
@ -161,9 +153,6 @@ namespace SharedLibrary.Database
{
context.Dispose();
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
}
}
@ -177,9 +166,6 @@ namespace SharedLibrary.Database
try
{
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
int count = 0;
foreach (var entityToInsert in SQLiteData)
@ -217,9 +203,6 @@ namespace SharedLibrary.Database
{
context.Dispose();
context = new DatabaseContext();
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
}
}
return context;

View File

@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace SharedLibrary.Database.Models
namespace SharedLibraryCore.Database.Models
{
public class EFAlias : SharedEntity
{

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace SharedLibrary.Database.Models
namespace SharedLibraryCore.Database.Models
{
public class EFAliasLink : SharedEntity
{

View File

@ -3,13 +3,12 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace SharedLibrary.Database.Models
namespace SharedLibraryCore.Database.Models
{
public class EFClient : SharedEntity
{
[Key]
public int ClientId { get; set; }
[Index(IsUnique = true)]
public long NetworkId { get; set; }
[Required]
public int Connections { get; set; }

View File

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Database.Models
namespace SharedLibraryCore.Database.Models
{
public class EFPenalty : SharedEntity
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Database.Models
namespace SharedLibraryCore.Database.Models
{
public class SharedEntity
{

View File

@ -1,6 +1,6 @@
using System;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class ChatInfo
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class ClientInfo
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class CommandResponseInfo
{

View File

@ -1,6 +1,6 @@
using System;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class EventInfo
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class PenaltyInfo : SharedInfo
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class PlayerInfo
{

View File

@ -1,11 +1,10 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class ProfileMeta : SharedInfo
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class ServerInfo
{

View File

@ -1,5 +1,5 @@

namespace SharedLibrary.Dtos
namespace SharedLibraryCore.Dtos
{
public class SharedInfo
{

View File

@ -1,4 +1,4 @@
namespace SharedLibrary
namespace SharedLibraryCore
{
public class DVAR<T>
{

View File

@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using SharedLibrary.Objects;
using SharedLibraryCore.Objects;
namespace SharedLibrary
namespace SharedLibraryCore
{
public class Event
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class CommandException : ServerException
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class DatabaseException : Exception
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class DvarException : ServerException
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class NetworkException : ServerException
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class SerializeException : Exception
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Exceptions
namespace SharedLibraryCore.Exceptions
{
public class ServerException : Exception
{

View File

@ -5,7 +5,7 @@ using System.IO;
using System.Net;
using System.Net.Http;
namespace SharedLibrary
namespace SharedLibraryCore
{
public class RemoteFile : IFile
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
public sealed class AsyncStatus
{

View File

@ -1,6 +1,6 @@
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SharedLibrary.Interfaces;
using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.IO;
@ -8,7 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Configuration
namespace SharedLibraryCore.Configuration
{
public class BaseConfigurationHandler<T> : IConfigurationHandler<T> where T : IBaseConfiguration
{

View File

@ -0,0 +1,42 @@
using SimpleCrypto;
namespace SharedLibraryCore.Helpers
{
public class Hashing
{
/// <summary>
/// Generate password hash and salt
/// </summary>
/// <param name="password">plaintext password</param>
/// <returns></returns>
public static string[] Hash(string password, string saltStr = null)
{
string hash;
string salt;
var CryptoSvc = new PBKDF2();
// generate new hash
if (saltStr == null)
{
hash = CryptoSvc.Compute(password);
salt = CryptoSvc.Salt;
return new string[]
{
hash,
salt
};
}
else
{
hash = CryptoSvc.Compute(password, saltStr);
return new string[]
{
hash,
""
};
}
}
}
}

View File

@ -1,6 +1,6 @@
using System;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
public class MessageToken
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
public class ParseEnum<T>
{

View File

@ -1,6 +1,6 @@
using System;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
public class PlayerHistory
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
/// <summary>
/// Excuse this monstrosity

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace SharedLibrary.Helpers
namespace SharedLibraryCore.Helpers
{
public class Vector3
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IBaseConfiguration
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IConfigurationHandler<T> where T : IBaseConfiguration
{

View File

@ -5,7 +5,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IEntityService<T>
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface ILogger
{

View File

@ -1,12 +1,10 @@
using System.Collections.Generic;
using SharedLibrary.Objects;
using SharedLibrary.Database.Models;
using SharedLibrary.Services;
using SharedLibraryCore.Objects;
using SharedLibraryCore.Services;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using SharedLibrary.Configuration;
using SharedLibraryCore.Configuration;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IManager
{

View File

@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
public interface IPlugin
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.IO;
namespace SharedLibrary.Interfaces
namespace SharedLibraryCore.Interfaces
{
interface ISerializable<T>
{

View File

@ -1,7 +1,7 @@
using System;
using System.Reflection;
namespace SharedLibrary
namespace SharedLibraryCore
{
public class Map
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Objects
namespace SharedLibraryCore.Objects
{
public class Alias : Database.Models.EFAlias
{

View File

@ -1,7 +1,7 @@
using System;
using SharedLibrary;
using SharedLibraryCore;
namespace SharedLibrary.Objects
namespace SharedLibraryCore.Objects
{
public class Penalty : Database.Models.EFPenalty
{

View File

@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace SharedLibrary.Objects
namespace SharedLibraryCore.Objects
{
public class Player : Database.Models.EFClient
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Objects
namespace SharedLibraryCore.Objects
{
public class Report
{

View File

@ -2,9 +2,9 @@
using System.IO;
using System.Collections.Generic;
using System.Reflection;
using SharedLibrary.Interfaces;
using SharedLibraryCore.Interfaces;
namespace SharedLibrary.Plugins
namespace SharedLibraryCore.Plugins
{
public class PluginImporter
{

View File

@ -1,5 +1,5 @@
using SharedLibrary.Exceptions;
using SharedLibrary.Interfaces;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Interfaces;
using System;
using System.Linq;
using System.Net;
@ -8,7 +8,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SharedLibrary.RCon
namespace SharedLibraryCore.RCon
{
class ConnectionState
{

View File

@ -1,12 +1,6 @@
using SharedLibrary.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System;
namespace SharedLibrary.RCon
namespace SharedLibraryCore.RCon
{
public static class StaticHelpers
{

View File

@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using SharedLibrary.RCon;
using SharedLibrary.Commands;
using System.Threading.Tasks;
using SharedLibrary.Helpers;
using SharedLibrary.Objects;
using SharedLibrary.Dtos;
using SharedLibrary.Configuration;
namespace SharedLibrary
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Objects;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Configuration;
namespace SharedLibraryCore
{
public abstract class Server
{
@ -171,6 +167,7 @@ namespace SharedLibrary
}
if (CommandResult.Count > 15)
CommandResult.RemoveAt(0);
CommandResult.Add(new CommandResponseInfo()
{
Response = Utilities.StripColors(Message),

View File

@ -4,13 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq.Expressions;
using System.Data.Entity;
using SharedLibrary.Interfaces;
using SharedLibrary.Database.Models;
using SharedLibrary.Database;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Database;
using Microsoft.EntityFrameworkCore;
namespace SharedLibrary.Services
namespace SharedLibraryCore.Services
{
public class AliasService : IEntityService<EFAlias>
{

View File

@ -3,14 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using SharedLibrary.Database;
using SharedLibrary.Database.Models;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using System.Linq.Expressions;
using SharedLibrary.Objects;
using SharedLibraryCore.Objects;
using Microsoft.EntityFrameworkCore;
namespace SharedLibrary.Services
namespace SharedLibraryCore.Services
{
public class ClientService : Interfaces.IEntityService<EFClient>
@ -94,9 +94,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
return context.Clients
.AsNoTracking()
.Include(c => c.CurrentAlias)
@ -110,8 +107,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
//context.Configuration.ProxyCreationEnabled = false;
return await new DatabaseContext().Clients
.AsNoTracking()
.Include(c => c.CurrentAlias)
@ -206,10 +201,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
var iqMatching = from alias in context.Aliases
where alias.IPAddress == clientIP
join client in context.Clients
@ -225,10 +216,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
return await new DatabaseContext().Clients
.AsNoTracking()
.Include(c => c.CurrentAlias)
@ -241,10 +228,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
var iqClients = (from alias in context.Aliases
.AsNoTracking()
where alias.Name
@ -267,10 +250,6 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
var iqClients = (from alias in context.Aliases
.AsNoTracking()
where alias.IPAddress == ipAddress

View File

@ -1,13 +1,13 @@
using SharedLibrary.Database;
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Services
namespace SharedLibraryCore.Services
{
// https://stackoverflow.com/questions/43677906/crud-operations-with-entityframework-using-generic-type
public class GenericRepository<TEntity> where TEntity : class
@ -74,7 +74,7 @@ namespace SharedLibrary.Services
public virtual TEntity Insert(TEntity entity)
{
return this.DBSet.Add(entity);
return DBSet.Add(entity).Entity;
}
public virtual void Update<T>(T entity) where T : class

View File

@ -1,11 +1,9 @@
using SharedLibrary.Dtos;
using SharedLibraryCore.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Services
namespace SharedLibraryCore.Services
{
public class MetaService
{

View File

@ -3,14 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using SharedLibrary.Database;
using SharedLibrary.Database.Models;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using System.Linq.Expressions;
using SharedLibrary.Dtos;
using SharedLibraryCore.Dtos;
using Microsoft.EntityFrameworkCore;
namespace SharedLibrary.Services
namespace SharedLibraryCore.Services
{
public class PenaltyService : Interfaces.IEntityService<EFPenalty>
{
@ -126,9 +126,9 @@ namespace SharedLibrary.Services
{
using (var context = new DatabaseContext())
{
context.Configuration.LazyLoadingEnabled = false;
/*context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;*/
if (victim)
{

View File

@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
<Version>2.0.0</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
</PropertyGroup>
<ItemGroup>
<None Remove="LibSQLCe\x86\Microsoft.VC90.CRT\msvcr90.dll" />
<None Remove="LibSQLCe\x86\Microsoft.VC90.CRT\README_ENU.txt" />
<None Remove="LibSQLCe\x86\sqlceca40.dll" />
<None Remove="LibSQLCe\x86\sqlcecompact40.dll" />
<None Remove="LibSQLCe\x86\sqlceer40EN.dll" />
<None Remove="LibSQLCe\x86\sqlceme40.dll" />
<None Remove="LibSQLCe\x86\sqlceqp40.dll" />
<None Remove="LibSQLCe\x86\sqlcese40.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="LibSQLCe\x86\Microsoft.VC90.CRT\msvcr90.dll" />
<Content Include="LibSQLCe\x86\Microsoft.VC90.CRT\README_ENU.txt" />
<Content Include="LibSQLCe\x86\sqlceca40.dll" />
<Content Include="LibSQLCe\x86\sqlcecompact40.dll" />
<Content Include="LibSQLCe\x86\sqlceer40EN.dll" />
<Content Include="LibSQLCe\x86\sqlceme40.dll" />
<Content Include="LibSQLCe\x86\sqlceqp40.dll" />
<Content Include="LibSQLCe\x86\sqlcese40.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup>
</Project>

View File

@ -4,18 +4,17 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System.Management;
using SharedLibrary.Objects;
using static SharedLibrary.Server;
using SharedLibraryCore.Objects;
using static SharedLibraryCore.Server;
using System.Reflection;
using System.IO;
using System.Diagnostics;
using System.Threading.Tasks;
using static SharedLibrary.RCon.StaticHelpers;
using static SharedLibraryCore.RCon.StaticHelpers;
using System.Runtime.InteropServices;
namespace SharedLibrary
namespace SharedLibraryCore
{
public static class Utilities
{

View File

@ -1,4 +1,6 @@
using SharedLibrary;
using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Objects;
using System;
using System.Collections.Generic;
@ -6,7 +8,7 @@ namespace WebfrontCore.Application.API
{
class EventAPI
{
public static Queue<SharedLibrary.Dtos.EventInfo> Events = new Queue<SharedLibrary.Dtos.EventInfo>();
public static Queue<EventInfo> Events = new Queue<EventInfo>();
static DateTime LastFlagEvent;
static string[] FlaggedMessageContains =
{
@ -24,7 +26,7 @@ namespace WebfrontCore.Application.API
public static void OnServerEventOccurred(object sender, Event E)
{
if (E.Type == Event.GType.Say && E.Origin.Level < SharedLibrary.Objects.Player.Permission.Trusted)
if (E.Type == Event.GType.Say && E.Origin.Level < Player.Permission.Trusted)
{
bool flaggedMessage = false;
foreach (string msg in FlaggedMessageContains)
@ -41,9 +43,9 @@ namespace WebfrontCore.Application.API
FlaggedMessageCount = 0;
E.Owner.Broadcast("If you suspect someone of ^5CHEATING ^7use the ^5!report ^7command").Wait();
Events.Enqueue(new SharedLibrary.Dtos.EventInfo(
SharedLibrary.Dtos.EventInfo.EventType.ALERT,
SharedLibrary.Dtos.EventInfo.EventVersion.IW4MAdmin,
Events.Enqueue(new EventInfo(
EventInfo.EventType.ALERT,
EventInfo.EventVersion.IW4MAdmin,
"Chat indicates there may be a cheater",
"Alert",
E.Owner.Hostname, ""));
@ -58,9 +60,9 @@ namespace WebfrontCore.Application.API
if (E.Type == Event.GType.Report)
{
Events.Enqueue(new SharedLibrary.Dtos.EventInfo(
SharedLibrary.Dtos.EventInfo.EventType.ALERT,
SharedLibrary.Dtos.EventInfo.EventVersion.IW4MAdmin,
Events.Enqueue(new EventInfo(
EventInfo.EventType.ALERT,
EventInfo.EventVersion.IW4MAdmin,
$"**{E.Origin.Name}** has reported **{E.Target.Name}** for: {E.Data.Trim()}",
E.Target.Name, E.Origin.Name, ""));
}

View File

@ -1,5 +1,5 @@
using SharedLibrary;
using SharedLibrary.Configuration;
using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -3,7 +3,7 @@ using System.IO;
namespace IW4MAdmin
{
class Logger : SharedLibrary.Interfaces.ILogger
class Logger : SharedLibraryCore.Interfaces.ILogger
{
enum LogType
{

View File

@ -1,12 +1,10 @@

using System;
using System.Runtime.InteropServices;
using SharedLibrary;
using SharedLibraryCore;
using System.Threading.Tasks;
using System.IO;
using SharedLibrary.Objects;
using SharedLibraryCore.Objects;
using System.Reflection;
using System.Linq;
namespace IW4MAdmin
{
@ -31,13 +29,9 @@ namespace IW4MAdmin
try
{
/*var v1 = SharedLibrary.Helpers.Vector3.Parse("(737, 1117, 268)");
var v2 = SharedLibrary.Helpers.Vector3.Parse("(1510, 672.98, -228.66)");
double angleBetween = v1.AngleBetween(v2);*/
CheckDirectories();
ServerManager = ApplicationManager.GetInstance();
SharedLibrary.Database.Repair.Run(ServerManager.Logger);
ServerManager.Init().Wait();
Task.Run(() => ServerManager.Start());

View File

@ -5,17 +5,17 @@ using System.Threading;
using System.IO;
using System.Threading.Tasks;
using SharedLibrary;
using SharedLibrary.Interfaces;
using SharedLibrary.Commands;
using SharedLibrary.Helpers;
using SharedLibrary.Exceptions;
using SharedLibrary.Objects;
using SharedLibrary.Services;
using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Commands;
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Objects;
using SharedLibraryCore.Services;
using WebfrontCore.Application.API;
using Microsoft.Extensions.Configuration;
using WebfrontCore;
using SharedLibrary.Configuration;
using SharedLibraryCore.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -136,9 +136,9 @@ namespace IW4MAdmin
#region PLUGINS
SharedLibrary.Plugins.PluginImporter.Load(this);
SharedLibraryCore.Plugins.PluginImporter.Load(this);
foreach (var Plugin in SharedLibrary.Plugins.PluginImporter.ActivePlugins)
foreach (var Plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
{
try
{
@ -232,7 +232,7 @@ namespace IW4MAdmin
Commands.Add(new CKillServer());
Commands.Add(new CSetPassword());
foreach (Command C in SharedLibrary.Plugins.PluginImporter.ActiveCommands)
foreach (Command C in SharedLibraryCore.Plugins.PluginImporter.ActiveCommands)
Commands.Add(C);
#endregion

View File

@ -6,13 +6,13 @@ using System.Linq;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using SharedLibrary;
using SharedLibrary.Interfaces;
using SharedLibrary.Objects;
using SharedLibrary.Services;
using SharedLibrary.Database.Models;
using SharedLibrary.Dtos;
using SharedLibrary.Configuration;
using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Objects;
using SharedLibraryCore.Services;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Configuration;
using WebfrontCore.Application.Misc;
@ -229,7 +229,7 @@ namespace IW4MAdmin
if (C == null)
{
await E.Origin.Tell("You entered an unknown command");
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} entered unknown command \"{CommandString}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} entered unknown command \"{CommandString}\"");
}
E.Data = E.Data.RemoveWords(1);
@ -238,14 +238,14 @@ namespace IW4MAdmin
if (E.Origin.Level < C.Permission)
{
await E.Origin.Tell("You do not have access to that command");
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} does not have access to \"{C.Name}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} does not have access to \"{C.Name}\"");
}
if (Args.Length < (C.RequiredArgumentCount))
{
await E.Origin.Tell($"Not enough arguments supplied");
await E.Origin.Tell(C.Syntax);
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
}
if (C.RequiresTarget || Args.Length > 0)
@ -293,7 +293,7 @@ namespace IW4MAdmin
if (matchingPlayers.Count > 1)
{
await E.Origin.Tell("Multiple players match that name");
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} had multiple players found for {C.Name}");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} had multiple players found for {C.Name}");
}
else if (matchingPlayers.Count == 1)
{
@ -307,7 +307,7 @@ namespace IW4MAdmin
{
await E.Origin.Tell($"Not enough arguments supplied!");
await E.Origin.Tell(C.Syntax);
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
}
}
}
@ -320,7 +320,7 @@ namespace IW4MAdmin
await E.Origin.Tell("Multiple players match that name");
foreach (var p in matchingPlayers)
await E.Origin.Tell($"[^3{p.ClientNumber}^7] {p.Name}");
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} had multiple players found for {C.Name}");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} had multiple players found for {C.Name}");
}
else if (matchingPlayers.Count == 1)
{
@ -337,7 +337,7 @@ namespace IW4MAdmin
{
await E.Origin.Tell($"Not enough arguments supplied!");
await E.Origin.Tell(C.Syntax);
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
}
}
}
@ -345,7 +345,7 @@ namespace IW4MAdmin
if (E.Target == null && C.RequiresTarget)
{
await E.Origin.Tell("Unable to find specified player.");
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} specified invalid player for \"{C.Name}\"");
throw new SharedLibraryCore.Exceptions.CommandException($"{E.Origin} specified invalid player for \"{C.Name}\"");
}
}
E.Data = E.Data.Trim();
@ -360,7 +360,7 @@ namespace IW4MAdmin
await ProcessEvent(E);
((ApplicationManager)Manager).ServerEventOccurred(this, E);
foreach (IPlugin P in SharedLibrary.Plugins.PluginImporter.ActivePlugins)
foreach (IPlugin P in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
{
//#if !DEBUG
try
@ -394,7 +394,7 @@ namespace IW4MAdmin
}
// when the server has lost connection
catch (SharedLibrary.Exceptions.NetworkException)
catch (SharedLibraryCore.Exceptions.NetworkException)
{
Throttled = true;
return ClientNum;
@ -456,7 +456,7 @@ namespace IW4MAdmin
LastPoll = DateTime.Now;
}
catch (SharedLibrary.Exceptions.NetworkException e)
catch (SharedLibraryCore.Exceptions.NetworkException e)
{
ConnectionErrors++;
if (ConnectionErrors == 1)
@ -473,7 +473,7 @@ namespace IW4MAdmin
if ((DateTime.Now - tickTime).TotalMilliseconds >= 1000)
{
foreach (var Plugin in SharedLibrary.Plugins.PluginImporter.ActivePlugins)
foreach (var Plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
{
if (cts.IsCancellationRequested)
break;
@ -483,11 +483,11 @@ namespace IW4MAdmin
tickTime = DateTime.Now;
}
if ((lastCount - playerCountStart).TotalMinutes >= SharedLibrary.Helpers.PlayerHistory.UpdateInterval)
if ((lastCount - playerCountStart).TotalMinutes >= SharedLibraryCore.Helpers.PlayerHistory.UpdateInterval)
{
while (PlayerHistory.Count > ((60 / SharedLibrary.Helpers.PlayerHistory.UpdateInterval) * 12)) // 12 times a hour for 12 hours
while (PlayerHistory.Count > ((60 / SharedLibraryCore.Helpers.PlayerHistory.UpdateInterval) * 12)) // 12 times a hour for 12 hours
PlayerHistory.Dequeue();
PlayerHistory.Enqueue(new SharedLibrary.Helpers.PlayerHistory(ClientNum));
PlayerHistory.Enqueue(new SharedLibraryCore.Helpers.PlayerHistory(ClientNum));
playerCountStart = DateTime.Now;
}
@ -542,7 +542,7 @@ namespace IW4MAdmin
l_size = LogFile.Length();
if (!((ApplicationManager)Manager).Running)
{
foreach (var plugin in SharedLibrary.Plugins.PluginImporter.ActivePlugins)
foreach (var plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
await plugin.OnUnloadAsync();
for (int i = 0; i < Players.Count; i++)
@ -551,7 +551,7 @@ namespace IW4MAdmin
return true;
}
//#if !DEBUG
catch (SharedLibrary.Exceptions.NetworkException)
catch (SharedLibraryCore.Exceptions.NetworkException)
{
Logger.WriteError($"Could not communicate with {IP}:{Port}");
return false;
@ -611,7 +611,7 @@ namespace IW4MAdmin
Website = website.Value;
}
catch (SharedLibrary.Exceptions.DvarException)
catch (SharedLibraryCore.Exceptions.DvarException)
{
Website = "this server's website";
}
@ -656,7 +656,7 @@ namespace IW4MAdmin
{
Logger.WriteError($"Gamelog {logPath} does not exist!");
#if !DEBUG
throw new SharedLibrary.Exceptions.ServerException($"Invalid gamelog file {logPath}");
throw new SharedLibraryCore.Exceptions.ServerException($"Invalid gamelog file {logPath}");
#endif
}
else
@ -714,7 +714,7 @@ namespace IW4MAdmin
C = await ValidateCommand(E);
}
catch (SharedLibrary.Exceptions.CommandException e)
catch (SharedLibraryCore.Exceptions.CommandException e)
{
Logger.WriteInfo(e.Message);
}
@ -963,8 +963,8 @@ namespace IW4MAdmin
override public void InitializeTokens()
{
Manager.GetMessageTokens().Add(new SharedLibrary.Helpers.MessageToken("TOTALPLAYERS", Manager.GetClientService().GetTotalClientsAsync().Result.ToString));
Manager.GetMessageTokens().Add(new SharedLibrary.Helpers.MessageToken("VERSION", Program.Version.ToString));
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", Manager.GetClientService().GetTotalClientsAsync().Result.ToString));
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", Program.Version.ToString));
}
}
}

View File

@ -5,7 +5,7 @@ set TargetDir=%3
if not exist "%TargetDir%x86" (
echo "Copying SQLCe binaries"
md "%TargetDir%x86"
xcopy /y "%SolutionDir%SharedLibrary\LibSQLCe\x86" "%TargetDir%x86\"
xcopy /y "%SolutionDir%SharedLibraryCore\LibSQLCe\x86" "%TargetDir%x86\"
)
if not exist "%TargetDir%Plugins" (

View File

@ -5,5 +5,5 @@ set TargetDir=%3
if "TargetDir" == "*Undefined*" (
echo "Copying extra files to publish dir"
xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Plugins\"
xcopy /Y "%SolutionDir%SharedLibrary\LibSQLCe\x86" "%SolutionDir%Publish\x86\"
xcopy /Y "%SolutionDir%SharedLibraryCore\LibSQLCe\x86" "%SolutionDir%Publish\x86\"
)

View File

@ -1,8 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using System;
using SharedLibraryCore.Dtos;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebfrontCore.Application.API;
namespace WebfrontCore.Controllers.API
@ -14,7 +13,7 @@ namespace WebfrontCore.Controllers.API
public ActionResult Index()
{
var events = EventAPI.Events;
var eventsDto = new List<SharedLibrary.Dtos.EventInfo>();
var eventsDto = new List<EventInfo>();
while (events.Count > 0)
eventsDto.Add(events.Dequeue());
return Json(eventsDto);

View File

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using System.Security.Claims;
using System;
using Microsoft.AspNetCore.Authentication;
namespace WebfrontCore.Controllers
{
@ -19,7 +20,7 @@ namespace WebfrontCore.Controllers
try
{
var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[clientId];
string[] hashedPassword = await Task.FromResult(SharedLibrary.Helpers.Hashing.Hash(password, client.PasswordSalt));
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
if (hashedPassword[0] == client.Password)
{
@ -32,7 +33,7 @@ namespace WebfrontCore.Controllers
var claimsIdentity = new ClaimsIdentity(claims, "login");
var claimsPrinciple = new ClaimsPrincipal(claimsIdentity);
await HttpContext.Authentication.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties()
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
{
AllowRefresh = true,
ExpiresUtc = DateTime.UtcNow.AddDays(30),
@ -55,7 +56,7 @@ namespace WebfrontCore.Controllers
[HttpGet]
public async Task<IActionResult> LogoutAsync()
{
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return RedirectToAction("Index", "Home");
}
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SharedLibrary;
using SharedLibraryCore;
using WebfrontCore.ViewModels;
namespace WebfrontCore.Controllers

View File

@ -1,9 +1,10 @@
using IW4MAdmin;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using SharedLibrary;
using SharedLibrary.Database.Models;
using SharedLibrary.Objects;
using SharedLibraryCore;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
@ -14,9 +15,15 @@ namespace WebfrontCore.Controllers
public class BaseController : Controller
{
protected ApplicationManager Manager;
protected readonly DatabaseContext Context;
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 = IW4MAdmin.Program.ServerManager;

View File

@ -1,7 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibrary;
using SharedLibrary.Dtos;
using SharedLibrary.Services;
using SharedLibraryCore;
using SharedLibraryCore.Database;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@ -14,6 +15,7 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> ProfileAsync(int id)
{
var client = await Manager.GetClientService().Get(id);
var clientDto = new PlayerInfo()
{
Name = client.Name,
@ -46,7 +48,7 @@ namespace WebfrontCore.Controllers
var administeredPenaltiesMeta = await Manager.GetPenaltyService()
.ReadGetClientPenaltiesAsync(client.ClientId, false);
if (Authorized && client.Level > SharedLibrary.Objects.Player.Permission.Trusted)
if (Authorized && client.Level > SharedLibraryCore.Objects.Player.Permission.Trusted)
clientDto.Meta.Add(new ProfileMeta()
{
Key = "Masked",
@ -91,7 +93,7 @@ namespace WebfrontCore.Controllers
var admins = (await Manager.GetClientService().GetPrivilegedClients())
.Where(a => a.Active)
.OrderByDescending(a => a.Level);
var adminsDict = new Dictionary<SharedLibrary.Objects.Player.Permission, IList<ClientInfo>>();
var adminsDict = new Dictionary<SharedLibraryCore.Objects.Player.Permission, IList<ClientInfo>>();
foreach (var admin in admins)
{

View File

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibrary;
using SharedLibrary.Dtos;
using SharedLibrary.Objects;
using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Objects;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -4,7 +4,7 @@ using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SharedLibrary.Dtos;
using SharedLibraryCore.Dtos;
namespace WebfrontCore.Controllers
{

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibrary;
using SharedLibrary.Database.Models;
using SharedLibrary.Dtos;
using SharedLibrary.Services;
using SharedLibraryCore;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@ -30,7 +30,7 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> PublicAsync()
{
var penalties = await (new GenericRepository<EFPenalty>())
.FindAsync(p => p.Type == SharedLibrary.Objects.Penalty.PenaltyType.Ban && p.Active);
.FindAsync(p => p.Type == SharedLibraryCore.Objects.Penalty.PenaltyType.Ban && p.Active);
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
{

View File

@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibrary.Dtos;
using SharedLibraryCore.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,7 +1,5 @@
using System;
using System.IO;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebfrontCore
{
@ -9,26 +7,14 @@ namespace WebfrontCore
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
BuildWebHost(args).Run();
}
var host = new WebHostBuilder()
.UseKestrel()
public static IWebHost BuildWebHost(string[] args) =>
new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseKestrel()
.UseStartup<Startup>()
.UseUrls(config["Web:Address"])
.Build();
if (!SharedLibrary.Utilities.IsRunningOnMono())
{
host.Run();
}
else
{
Console.ReadLine();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More