added MySQL support
fixed login bug IW3 official support
This commit is contained in:
parent
0e3d280595
commit
ece519251a
@ -15,4 +15,6 @@ if not exist "%TargetDir%Plugins" (
|
|||||||
xcopy /y "%SolutionDir%Build\Plugins" "%TargetDir%Plugins\"
|
xcopy /y "%SolutionDir%Build\Plugins" "%TargetDir%Plugins\"
|
||||||
|
|
||||||
echo Copying plugins for publish
|
echo Copying plugins for publish
|
||||||
xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Windows\Plugins\"
|
del %SolutionDir%BUILD\Plugins\Tests.dll
|
||||||
|
xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Windows\Plugins\"
|
||||||
|
xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\WindowsPrerelease\Plugins\"
|
11
Application/EventParsers/IW3EventParser.cs
Normal file
11
Application/EventParsers/IW3EventParser.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
|
{
|
||||||
|
class IW3EventParser : IW4EventParser
|
||||||
|
{
|
||||||
|
public override string GetGameDir() => "main";
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ using SharedLibraryCore;
|
|||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
|
|
||||||
namespace Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class IW4EventParser : IEventParser
|
class IW4EventParser : IEventParser
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class IW5EventParser : IW4EventParser
|
class IW5EventParser : IW4EventParser
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ using SharedLibraryCore;
|
|||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
|
|
||||||
namespace Application.EventParsers
|
namespace IW4MAdmin.Application.EventParsers
|
||||||
{
|
{
|
||||||
class T6MEventParser : IEventParser
|
class T6MEventParser : IEventParser
|
||||||
{
|
{
|
||||||
|
@ -36,13 +36,13 @@ namespace IW4MAdmin.Application
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var db = new DatabaseContext())
|
|
||||||
new ContextSeed(db).Seed().Wait();
|
|
||||||
|
|
||||||
CheckDirectories();
|
CheckDirectories();
|
||||||
|
|
||||||
ServerManager = ApplicationManager.GetInstance();
|
ServerManager = ApplicationManager.GetInstance();
|
||||||
|
|
||||||
|
using (var db = new DatabaseContext(ServerManager.GetApplicationSettings().Configuration().ConnectionString))
|
||||||
|
new ContextSeed(db).Seed().Wait();
|
||||||
|
|
||||||
var api = API.Master.Endpoint.Get();
|
var api = API.Master.Endpoint.Get();
|
||||||
var version = new API.Master.VersionInfo()
|
var version = new API.Master.VersionInfo()
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,7 @@ using SharedLibraryCore.Exceptions;
|
|||||||
|
|
||||||
using Application.Misc;
|
using Application.Misc;
|
||||||
using Application.RconParsers;
|
using Application.RconParsers;
|
||||||
using Application.EventParsers;
|
using IW4MAdmin.Application.EventParsers;
|
||||||
|
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin
|
||||||
{
|
{
|
||||||
@ -608,7 +607,7 @@ namespace IW4MAdmin
|
|||||||
else if (GameName == Game.UKN)
|
else if (GameName == Game.UKN)
|
||||||
Logger.WriteWarning($"Game name not recognized: {version}");
|
Logger.WriteWarning($"Game name not recognized: {version}");
|
||||||
else
|
else
|
||||||
EventParser = new IW4EventParser();
|
EventParser = new IW3EventParser(); // this uses the 'main' folder for log paths
|
||||||
|
|
||||||
var shortversion = await this.GetDvarAsync<string>("shortversion");
|
var shortversion = await this.GetDvarAsync<string>("shortversion");
|
||||||
var hostname = await this.GetDvarAsync<string>("sv_hostname");
|
var hostname = await this.GetDvarAsync<string>("sv_hostname");
|
||||||
@ -658,7 +657,7 @@ namespace IW4MAdmin
|
|||||||
CustomCallback = await ScriptLoaded();
|
CustomCallback = await ScriptLoaded();
|
||||||
string mainPath = EventParser.GetGameDir();
|
string mainPath = EventParser.GetGameDir();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
basepath.Value = @"\\192.168.88.253\Call of Duty Black Ops II";
|
basepath.Value = @"\\192.168.88.253\Call of Duty 4";
|
||||||
#endif
|
#endif
|
||||||
string logPath;
|
string logPath;
|
||||||
if (GameName == Game.IW5)
|
if (GameName == Game.IW5)
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
<ProjectGuid>f5051a32-6bd0-4128-abba-c202ee15fc5c</ProjectGuid>
|
<ProjectGuid>f5051a32-6bd0-4128-abba-c202ee15fc5c</ProjectGuid>
|
||||||
<ProjectHome>.</ProjectHome>
|
<ProjectHome>.</ProjectHome>
|
||||||
<ProjectTypeGuids>{789894c7-04a9-4a11-a6b5-3f4435165112};{1b580a1a-fdb3-4b32-83e1-6407eb2722e6};{349c5851-65df-11da-9384-00065b846f21};{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
|
<ProjectTypeGuids>{789894c7-04a9-4a11-a6b5-3f4435165112};{1b580a1a-fdb3-4b32-83e1-6407eb2722e6};{349c5851-65df-11da-9384-00065b846f21};{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
|
||||||
<StartupFile>runserver.py</StartupFile>
|
<StartupFile>
|
||||||
|
</StartupFile>
|
||||||
<SearchPath>
|
<SearchPath>
|
||||||
</SearchPath>
|
</SearchPath>
|
||||||
<WorkingDirectory>.</WorkingDirectory>
|
<WorkingDirectory>.</WorkingDirectory>
|
||||||
@ -81,7 +82,6 @@
|
|||||||
<Compile Include="master\schema\__init__.py">
|
<Compile Include="master\schema\__init__.py">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="runserver.py" />
|
|
||||||
<Compile Include="master\__init__.py" />
|
<Compile Include="master\__init__.py" />
|
||||||
<Compile Include="master\views.py" />
|
<Compile Include="master\views.py" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
"""
|
|
||||||
This script runs the Master application using a development server.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from os import environ
|
|
||||||
from master import app
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(host='0.0.0.0', port=80, debug=True)
|
|
@ -5,6 +5,7 @@ using SharedLibraryCore;
|
|||||||
using SharedLibraryCore.Configuration;
|
using SharedLibraryCore.Configuration;
|
||||||
using SharedLibraryCore.Exceptions;
|
using SharedLibraryCore.Exceptions;
|
||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using SharedLibraryCore.Objects;
|
||||||
|
|
||||||
namespace IW4MAdmin.Plugins.Login
|
namespace IW4MAdmin.Plugins.Login
|
||||||
{
|
{
|
||||||
@ -36,11 +37,13 @@ namespace IW4MAdmin.Plugins.Login
|
|||||||
|
|
||||||
if (E.Type == GameEvent.EventType.Command)
|
if (E.Type == GameEvent.EventType.Command)
|
||||||
{
|
{
|
||||||
if (E.Origin.Level < SharedLibraryCore.Objects.Player.Permission.Moderator)
|
if (E.Origin.Level < Player.Permission.Moderator)
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
E.Owner.Manager.GetPrivilegedClients().TryGetValue(E.Origin.ClientId, out Player client);
|
||||||
|
|
||||||
if (((Command)E.Extra).Name == new SharedLibraryCore.Commands.CSetPassword().Name &&
|
if (((Command)E.Extra).Name == new SharedLibraryCore.Commands.CSetPassword().Name &&
|
||||||
E.Owner.Manager.GetPrivilegedClients()[E.Origin.ClientId].Password == null)
|
client?.Password == null)
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
if (((Command)E.Extra).Name == new Commands.CLogin().Name)
|
if (((Command)E.Extra).Name == new Commands.CLogin().Name)
|
||||||
|
@ -19,6 +19,7 @@ namespace SharedLibraryCore.Configuration
|
|||||||
public string WebfrontBindUrl { get; set; }
|
public string WebfrontBindUrl { get; set; }
|
||||||
public string CustomParserEncoding { get; set; }
|
public string CustomParserEncoding { get; set; }
|
||||||
public string CustomLocale { get; set; }
|
public string CustomLocale { get; set; }
|
||||||
|
public string ConnectionString { get; set; }
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public List<ServerConfiguration> Servers { get; set; }
|
public List<ServerConfiguration> Servers { get; set; }
|
||||||
public int AutoMessagePeriod { get; set; }
|
public int AutoMessagePeriod { get; set; }
|
||||||
|
@ -17,20 +17,35 @@ namespace SharedLibraryCore.Database
|
|||||||
public DbSet<EFAliasLink> AliasLinks { get; set; }
|
public DbSet<EFAliasLink> AliasLinks { get; set; }
|
||||||
public DbSet<EFPenalty> Penalties { get; set; }
|
public DbSet<EFPenalty> Penalties { get; set; }
|
||||||
|
|
||||||
|
private static string _ConnectionString;
|
||||||
|
|
||||||
public DatabaseContext(DbContextOptions<DatabaseContext> opt) : base(opt) { }
|
public DatabaseContext(DbContextOptions<DatabaseContext> opt) : base(opt) { }
|
||||||
|
|
||||||
|
public DatabaseContext(string connStr)
|
||||||
|
{
|
||||||
|
_ConnectionString = connStr;
|
||||||
|
}
|
||||||
|
|
||||||
public DatabaseContext()
|
public DatabaseContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
|
if (string.IsNullOrEmpty(_ConnectionString))
|
||||||
var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = $"{currentPath}{Path.DirectorySeparatorChar}Database.db".Substring(6) };
|
{
|
||||||
var connectionString = connectionStringBuilder.ToString();
|
string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
|
||||||
var connection = new SqliteConnection(connectionString);
|
var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = $"{currentPath}{Path.DirectorySeparatorChar}Database.db".Substring(6) };
|
||||||
|
var connectionString = connectionStringBuilder.ToString();
|
||||||
|
var connection = new SqliteConnection(connectionString);
|
||||||
|
|
||||||
optionsBuilder.UseSqlite(connection);
|
optionsBuilder.UseSqlite(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
optionsBuilder.UseMySql(_ConnectionString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,9 +113,9 @@ namespace SharedLibraryCore.Database
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var configurations = library.ExportedTypes.Where(c => c.GetInterfaces().FirstOrDefault(i => typeof(IModelConfiguration).IsAssignableFrom(i)) != null)
|
var configurations = library.ExportedTypes.Where(c => c.GetInterfaces().FirstOrDefault(i => typeof(IModelConfiguration).IsAssignableFrom(i)) != null)
|
||||||
.Select( c => (IModelConfiguration)Activator.CreateInstance(c));
|
.Select(c => (IModelConfiguration)Activator.CreateInstance(c));
|
||||||
|
|
||||||
foreach (var configurable in configurations)
|
foreach (var configurable in configurations)
|
||||||
configurable.Configure(modelBuilder);
|
configurable.Configure(modelBuilder);
|
||||||
|
@ -1,429 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.Internal;
|
|
||||||
using SharedLibraryCore.Database;
|
|
||||||
using SharedLibraryCore.Objects;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace SharedLibraryCore.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(DatabaseContext))]
|
|
||||||
partial class DatabaseContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("KillId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("AttackerId");
|
|
||||||
|
|
||||||
b.Property<int>("Damage");
|
|
||||||
|
|
||||||
b.Property<int?>("DeathOriginVector3Id");
|
|
||||||
|
|
||||||
b.Property<int>("DeathType");
|
|
||||||
|
|
||||||
b.Property<int>("HitLoc");
|
|
||||||
|
|
||||||
b.Property<int?>("KillOriginVector3Id");
|
|
||||||
|
|
||||||
b.Property<int>("Map");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId");
|
|
||||||
|
|
||||||
b.Property<int>("VictimId");
|
|
||||||
|
|
||||||
b.Property<int?>("ViewAnglesVector3Id");
|
|
||||||
|
|
||||||
b.Property<int>("Weapon");
|
|
||||||
|
|
||||||
b.Property<DateTime>("When");
|
|
||||||
|
|
||||||
b.HasKey("KillId");
|
|
||||||
|
|
||||||
b.HasIndex("AttackerId");
|
|
||||||
|
|
||||||
b.HasIndex("DeathOriginVector3Id");
|
|
||||||
|
|
||||||
b.HasIndex("KillOriginVector3Id");
|
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.HasIndex("VictimId");
|
|
||||||
|
|
||||||
b.HasIndex("ViewAnglesVector3Id");
|
|
||||||
|
|
||||||
b.ToTable("EFClientKills");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("MessageId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("ClientId");
|
|
||||||
|
|
||||||
b.Property<string>("Message");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId");
|
|
||||||
|
|
||||||
b.Property<DateTime>("TimeSent");
|
|
||||||
|
|
||||||
b.HasKey("MessageId");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.ToTable("EFClientMessages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ClientId");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId");
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("Deaths");
|
|
||||||
|
|
||||||
b.Property<int>("Kills");
|
|
||||||
|
|
||||||
b.Property<double>("SPM");
|
|
||||||
|
|
||||||
b.Property<double>("Skill");
|
|
||||||
|
|
||||||
b.Property<int>("TimePlayed");
|
|
||||||
|
|
||||||
b.HasKey("ClientId", "ServerId");
|
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.ToTable("EFClientStatistics");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("HitLocationCountId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("ClientId")
|
|
||||||
.HasColumnName("EFClientStatistics_ClientId");
|
|
||||||
|
|
||||||
b.Property<int>("HitCount");
|
|
||||||
|
|
||||||
b.Property<float>("HitOffsetAverage");
|
|
||||||
|
|
||||||
b.Property<int>("Location");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId")
|
|
||||||
.HasColumnName("EFClientStatistics_ServerId");
|
|
||||||
|
|
||||||
b.HasKey("HitLocationCountId");
|
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId", "ServerId");
|
|
||||||
|
|
||||||
b.ToTable("EFHitLocationCounts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ServerId");
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("Port");
|
|
||||||
|
|
||||||
b.HasKey("ServerId");
|
|
||||||
|
|
||||||
b.ToTable("EFServers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("StatisticId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("ServerId");
|
|
||||||
|
|
||||||
b.Property<long>("TotalKills");
|
|
||||||
|
|
||||||
b.Property<long>("TotalPlayTime");
|
|
||||||
|
|
||||||
b.HasKey("StatisticId");
|
|
||||||
|
|
||||||
b.HasIndex("ServerId");
|
|
||||||
|
|
||||||
b.ToTable("EFServerStatistics");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("AliasId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateAdded");
|
|
||||||
|
|
||||||
b.Property<int>("IPAddress");
|
|
||||||
|
|
||||||
b.Property<int>("LinkId");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasKey("AliasId");
|
|
||||||
|
|
||||||
b.HasIndex("LinkId");
|
|
||||||
|
|
||||||
b.ToTable("EFAlias");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("AliasLinkId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.HasKey("AliasLinkId");
|
|
||||||
|
|
||||||
b.ToTable("EFAliasLinks");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ClientId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<int>("AliasLinkId");
|
|
||||||
|
|
||||||
b.Property<int>("Connections");
|
|
||||||
|
|
||||||
b.Property<int>("CurrentAliasId");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FirstConnection");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastConnection");
|
|
||||||
|
|
||||||
b.Property<int>("Level");
|
|
||||||
|
|
||||||
b.Property<bool>("Masked");
|
|
||||||
|
|
||||||
b.Property<long>("NetworkId");
|
|
||||||
|
|
||||||
b.Property<string>("Password");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordSalt");
|
|
||||||
|
|
||||||
b.Property<int>("TotalConnectionTime");
|
|
||||||
|
|
||||||
b.HasKey("ClientId");
|
|
||||||
|
|
||||||
b.HasIndex("AliasLinkId");
|
|
||||||
|
|
||||||
b.HasIndex("CurrentAliasId");
|
|
||||||
|
|
||||||
b.HasIndex("NetworkId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("EFClients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("PenaltyId")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<bool>("Active");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Expires");
|
|
||||||
|
|
||||||
b.Property<int>("LinkId");
|
|
||||||
|
|
||||||
b.Property<int>("OffenderId");
|
|
||||||
|
|
||||||
b.Property<string>("Offense")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Property<int>("PunisherId");
|
|
||||||
|
|
||||||
b.Property<int>("Type");
|
|
||||||
|
|
||||||
b.Property<DateTime>("When");
|
|
||||||
|
|
||||||
b.HasKey("PenaltyId");
|
|
||||||
|
|
||||||
b.HasIndex("LinkId");
|
|
||||||
|
|
||||||
b.HasIndex("OffenderId");
|
|
||||||
|
|
||||||
b.HasIndex("PunisherId");
|
|
||||||
|
|
||||||
b.ToTable("EFPenalties");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Vector3Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<float>("X");
|
|
||||||
|
|
||||||
b.Property<float>("Y");
|
|
||||||
|
|
||||||
b.Property<float>("Z");
|
|
||||||
|
|
||||||
b.HasKey("Vector3Id");
|
|
||||||
|
|
||||||
b.ToTable("Vector3");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Attacker")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AttackerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Helpers.Vector3", "DeathOrigin")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("DeathOriginVector3Id");
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Helpers.Vector3", "KillOrigin")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("KillOriginVector3Id");
|
|
||||||
|
|
||||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ServerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Victim")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("VictimId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Helpers.Vector3", "ViewAngles")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ViewAnglesVector3Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", 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);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", 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);
|
|
||||||
});
|
|
||||||
|
|
||||||
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("ClientId", "ServerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ServerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link")
|
|
||||||
.WithMany("Children")
|
|
||||||
.HasForeignKey("LinkId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "AliasLink")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AliasLinkId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFAlias", "CurrentAlias")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrentAliasId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link")
|
|
||||||
.WithMany("ReceivedPenalties")
|
|
||||||
.HasForeignKey("LinkId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Offender")
|
|
||||||
.WithMany("ReceivedPenalties")
|
|
||||||
.HasForeignKey("OffenderId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Punisher")
|
|
||||||
.WithMany("AdministeredPenalties")
|
|
||||||
.HasForeignKey("PunisherId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -130,6 +130,7 @@ namespace SharedLibraryCore.RCon
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
Log.WriteDebug($"Received {bytesRead} bytes from {ServerConnection.RemoteEndPoint}");
|
Log.WriteDebug($"Received {bytesRead} bytes from {ServerConnection.RemoteEndPoint}");
|
||||||
#endif
|
#endif
|
||||||
|
FailedReceives = 0;
|
||||||
connectionState.ResponseString.Append(Utilities.EncodingType.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0') + '\n');
|
connectionState.ResponseString.Append(Utilities.EncodingType.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0') + '\n');
|
||||||
|
|
||||||
if (!connectionState.Buffer.Take(4).ToArray().SequenceEqual(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }))
|
if (!connectionState.Buffer.Take(4).ToArray().SequenceEqual(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }))
|
||||||
|
@ -107,7 +107,7 @@ namespace SharedLibraryCore.Services
|
|||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
return await new DatabaseContext().Clients
|
return await context.Clients
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Include(c => c.CurrentAlias)
|
.Include(c => c.CurrentAlias)
|
||||||
.Include(c => c.AliasLink.Children)
|
.Include(c => c.AliasLink.Children)
|
||||||
@ -216,7 +216,7 @@ namespace SharedLibraryCore.Services
|
|||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
return await new DatabaseContext().Clients
|
return await context.Clients
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Include(c => c.CurrentAlias)
|
.Include(c => c.CurrentAlias)
|
||||||
.Where(c => c.Level >= Player.Permission.Trusted)
|
.Where(c => c.Level >= Player.Permission.Trusted)
|
||||||
|
@ -15,6 +15,11 @@ namespace SharedLibraryCore.Services
|
|||||||
private dynamic _context;
|
private dynamic _context;
|
||||||
private DbSet<TEntity> _dbSet;
|
private DbSet<TEntity> _dbSet;
|
||||||
|
|
||||||
|
~GenericRepository()
|
||||||
|
{
|
||||||
|
_context.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
protected DbContext Context
|
protected DbContext Context
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" />
|
||||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
|
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
|
<!--<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>-->
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
|
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
|
||||||
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
|
||||||
|
Loading…
Reference in New Issue
Block a user