1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

migrating Stats to .Net Core 2

moved buildscripts to application
added publish profile
This commit is contained in:
RaidMax
2018-04-08 16:50:58 -05:00
parent 599027c4b6
commit d0c2a86ce8
69 changed files with 1486 additions and 720 deletions

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.Sqlite;
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Database
{
@ -83,7 +84,7 @@ namespace SharedLibraryCore.Database
Assembly library;
try
{
library = Assembly.LoadFile(dllPath);
library = Assembly.LoadFrom(dllPath);
}
// not a valid assembly, ie plugin files
@ -91,14 +92,19 @@ namespace SharedLibraryCore.Database
{
continue;
}
var configurations = library.ExportedTypes.Where(c => c.GetInterfaces().FirstOrDefault(i => typeof(IModelConfiguration).IsAssignableFrom(i)) != null)
.Select( c => (IModelConfiguration)Activator.CreateInstance(c));
foreach (var configurable in configurations)
configurable.Configure(modelBuilder);
foreach (var type in library.ExportedTypes)
{
if (type.IsClass && type.IsSubclassOf(typeof(SharedEntity)))
{
var method = modelBuilder.GetType().GetMethod("Entity");
method = method.MakeGenericMethod(new Type[] { type });
method.Invoke(modelBuilder, null);
var method = modelBuilder.GetType().GetMethod("Entity", new[] { typeof(Type) });
method.Invoke(modelBuilder, new[] { type });
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@ -9,6 +10,8 @@ namespace SharedLibraryCore.Helpers
{
public class Vector3
{
[Key]
public int Vector3Id { get; set; }
public float X { get; protected set; }
public float Y { get; protected set; }
public float Z { get; protected set; }

View File

@ -23,5 +23,6 @@ namespace SharedLibraryCore.Interfaces
PenaltyService GetPenaltyService();
IDictionary<int, Player> GetPrivilegedClients();
IEventApi GetEventApi();
bool ShutdownRequested();
}
}

View File

@ -0,0 +1,12 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
{
public interface IModelConfiguration
{
void Configure(ModelBuilder builder);
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
<file name="msvcr90.dll" hashalg="SHA1" hash="98e8006e0a4542e69f1a3555b927758bd76ca07d"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>+CXED+6HzJlSphyMNOn27ujadC0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcp90.dll" hashalg="SHA1" hash="3aec3be680024a46813dee891a753bd58b3f3b12"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>MyKED+9DyS+1XcMeaC0Zlw2vFZ0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcm90.dll" hashalg="SHA1" hash="0195dd0896d74b62531e4f3c771904a3d996450e"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>EeyDE7og6WoPd2oBhYbMEnpFHhY=</dsig:DigestValue></asmv2:hash></file>
</assembly>

View File

@ -0,0 +1,415 @@
// <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))]
[Migration("20180408213153_Initial Create")]
partial class InitialCreate
{
protected override void BuildTargetModel(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("EFClientKill");
});
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("EFClientMessage");
});
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?>("EFClientStatisticsClientId");
b.Property<int?>("EFClientStatisticsServerId");
b.Property<int>("HitCount");
b.Property<float>("HitOffsetAverage");
b.Property<int>("Location");
b.HasKey("HitLocationCountId");
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
b.ToTable("EFHitLocationCount");
});
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("EFServer");
});
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("Aliases");
});
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
{
b.Property<int>("AliasLinkId")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.HasKey("AliasLinkId");
b.ToTable("AliasLinks");
});
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("Clients");
});
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("Penalties");
});
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("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics")
.WithMany("HitLocations")
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId");
});
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
}
}
}

View File

@ -0,0 +1,443 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace SharedLibraryCore.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AliasLinks",
columns: table => new
{
AliasLinkId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AliasLinks", x => x.AliasLinkId);
});
migrationBuilder.CreateTable(
name: "EFServer",
columns: table => new
{
ServerId = table.Column<int>(nullable: false),
Active = table.Column<bool>(nullable: false),
Port = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFServer", x => x.ServerId);
});
migrationBuilder.CreateTable(
name: "Vector3",
columns: table => new
{
Vector3Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
X = table.Column<float>(nullable: false),
Y = table.Column<float>(nullable: false),
Z = table.Column<float>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vector3", x => x.Vector3Id);
});
migrationBuilder.CreateTable(
name: "Aliases",
columns: table => new
{
AliasId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
DateAdded = table.Column<DateTime>(nullable: false),
IPAddress = table.Column<int>(nullable: false),
LinkId = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Aliases", x => x.AliasId);
table.ForeignKey(
name: "FK_Aliases_AliasLinks_LinkId",
column: x => x.LinkId,
principalTable: "AliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "EFServerStatistics",
columns: table => new
{
StatisticId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
ServerId = table.Column<int>(nullable: false),
TotalKills = table.Column<long>(nullable: false),
TotalPlayTime = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFServerStatistics", x => x.StatisticId);
table.ForeignKey(
name: "FK_EFServerStatistics_EFServer_ServerId",
column: x => x.ServerId,
principalTable: "EFServer",
principalColumn: "ServerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
ClientId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
AliasLinkId = table.Column<int>(nullable: false),
Connections = table.Column<int>(nullable: false),
CurrentAliasId = table.Column<int>(nullable: false),
FirstConnection = table.Column<DateTime>(nullable: false),
LastConnection = table.Column<DateTime>(nullable: false),
Level = table.Column<int>(nullable: false),
Masked = table.Column<bool>(nullable: false),
NetworkId = table.Column<long>(nullable: false),
Password = table.Column<string>(nullable: true),
PasswordSalt = table.Column<string>(nullable: true),
TotalConnectionTime = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.ClientId);
table.ForeignKey(
name: "FK_Clients_AliasLinks_AliasLinkId",
column: x => x.AliasLinkId,
principalTable: "AliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Clients_Aliases_CurrentAliasId",
column: x => x.CurrentAliasId,
principalTable: "Aliases",
principalColumn: "AliasId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFClientKill",
columns: table => new
{
KillId = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
AttackerId = table.Column<int>(nullable: false),
Damage = table.Column<int>(nullable: false),
DeathOriginVector3Id = table.Column<int>(nullable: true),
DeathType = table.Column<int>(nullable: false),
HitLoc = table.Column<int>(nullable: false),
KillOriginVector3Id = table.Column<int>(nullable: true),
Map = table.Column<int>(nullable: false),
ServerId = table.Column<int>(nullable: false),
VictimId = table.Column<int>(nullable: false),
ViewAnglesVector3Id = table.Column<int>(nullable: true),
Weapon = table.Column<int>(nullable: false),
When = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientKill", x => x.KillId);
table.ForeignKey(
name: "FK_EFClientKill_Clients_AttackerId",
column: x => x.AttackerId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientKill_Vector3_DeathOriginVector3Id",
column: x => x.DeathOriginVector3Id,
principalTable: "Vector3",
principalColumn: "Vector3Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EFClientKill_Vector3_KillOriginVector3Id",
column: x => x.KillOriginVector3Id,
principalTable: "Vector3",
principalColumn: "Vector3Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EFClientKill_EFServer_ServerId",
column: x => x.ServerId,
principalTable: "EFServer",
principalColumn: "ServerId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientKill_Clients_VictimId",
column: x => x.VictimId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientKill_Vector3_ViewAnglesVector3Id",
column: x => x.ViewAnglesVector3Id,
principalTable: "Vector3",
principalColumn: "Vector3Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "EFClientMessage",
columns: table => new
{
MessageId = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
ClientId = table.Column<int>(nullable: false),
Message = table.Column<string>(nullable: true),
ServerId = table.Column<int>(nullable: false),
TimeSent = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientMessage", x => x.MessageId);
table.ForeignKey(
name: "FK_EFClientMessage_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientMessage_EFServer_ServerId",
column: x => x.ServerId,
principalTable: "EFServer",
principalColumn: "ServerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFClientStatistics",
columns: table => new
{
ClientId = table.Column<int>(nullable: false),
ServerId = table.Column<int>(nullable: false),
Active = table.Column<bool>(nullable: false),
Deaths = table.Column<int>(nullable: false),
Kills = table.Column<int>(nullable: false),
SPM = table.Column<double>(nullable: false),
Skill = table.Column<double>(nullable: false),
TimePlayed = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientStatistics", x => new { x.ClientId, x.ServerId });
table.ForeignKey(
name: "FK_EFClientStatistics_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientStatistics_EFServer_ServerId",
column: x => x.ServerId,
principalTable: "EFServer",
principalColumn: "ServerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Penalties",
columns: table => new
{
PenaltyId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
Expires = table.Column<DateTime>(nullable: false),
LinkId = table.Column<int>(nullable: false),
OffenderId = table.Column<int>(nullable: false),
Offense = table.Column<string>(nullable: false),
PunisherId = table.Column<int>(nullable: false),
Type = table.Column<int>(nullable: false),
When = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Penalties", x => x.PenaltyId);
table.ForeignKey(
name: "FK_Penalties_AliasLinks_LinkId",
column: x => x.LinkId,
principalTable: "AliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Penalties_Clients_OffenderId",
column: x => x.OffenderId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Penalties_Clients_PunisherId",
column: x => x.PunisherId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "EFHitLocationCount",
columns: table => new
{
HitLocationCountId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
EFClientStatisticsClientId = table.Column<int>(nullable: true),
EFClientStatisticsServerId = table.Column<int>(nullable: true),
HitCount = table.Column<int>(nullable: false),
HitOffsetAverage = table.Column<float>(nullable: false),
Location = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFHitLocationCount", x => x.HitLocationCountId);
table.ForeignKey(
name: "FK_EFHitLocationCount_EFClientStatistics_EFClientStatisticsClientId_EFClientStatisticsServerId",
columns: x => new { x.EFClientStatisticsClientId, x.EFClientStatisticsServerId },
principalTable: "EFClientStatistics",
principalColumns: new[] { "ClientId", "ServerId" },
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Aliases_LinkId",
table: "Aliases",
column: "LinkId");
migrationBuilder.CreateIndex(
name: "IX_Clients_AliasLinkId",
table: "Clients",
column: "AliasLinkId");
migrationBuilder.CreateIndex(
name: "IX_Clients_CurrentAliasId",
table: "Clients",
column: "CurrentAliasId");
migrationBuilder.CreateIndex(
name: "IX_Clients_NetworkId",
table: "Clients",
column: "NetworkId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_AttackerId",
table: "EFClientKill",
column: "AttackerId");
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_DeathOriginVector3Id",
table: "EFClientKill",
column: "DeathOriginVector3Id");
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_KillOriginVector3Id",
table: "EFClientKill",
column: "KillOriginVector3Id");
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_ServerId",
table: "EFClientKill",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_VictimId",
table: "EFClientKill",
column: "VictimId");
migrationBuilder.CreateIndex(
name: "IX_EFClientKill_ViewAnglesVector3Id",
table: "EFClientKill",
column: "ViewAnglesVector3Id");
migrationBuilder.CreateIndex(
name: "IX_EFClientMessage_ClientId",
table: "EFClientMessage",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_EFClientMessage_ServerId",
table: "EFClientMessage",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_EFClientStatistics_ServerId",
table: "EFClientStatistics",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_EFHitLocationCount_EFClientStatisticsClientId_EFClientStatisticsServerId",
table: "EFHitLocationCount",
columns: new[] { "EFClientStatisticsClientId", "EFClientStatisticsServerId" });
migrationBuilder.CreateIndex(
name: "IX_EFServerStatistics_ServerId",
table: "EFServerStatistics",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_Penalties_LinkId",
table: "Penalties",
column: "LinkId");
migrationBuilder.CreateIndex(
name: "IX_Penalties_OffenderId",
table: "Penalties",
column: "OffenderId");
migrationBuilder.CreateIndex(
name: "IX_Penalties_PunisherId",
table: "Penalties",
column: "PunisherId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFClientKill");
migrationBuilder.DropTable(
name: "EFClientMessage");
migrationBuilder.DropTable(
name: "EFHitLocationCount");
migrationBuilder.DropTable(
name: "EFServerStatistics");
migrationBuilder.DropTable(
name: "Penalties");
migrationBuilder.DropTable(
name: "Vector3");
migrationBuilder.DropTable(
name: "EFClientStatistics");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "EFServer");
migrationBuilder.DropTable(
name: "Aliases");
migrationBuilder.DropTable(
name: "AliasLinks");
}
}
}

View File

@ -0,0 +1,414 @@
// <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("EFClientKill");
});
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("EFClientMessage");
});
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?>("EFClientStatisticsClientId");
b.Property<int?>("EFClientStatisticsServerId");
b.Property<int>("HitCount");
b.Property<float>("HitOffsetAverage");
b.Property<int>("Location");
b.HasKey("HitLocationCountId");
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
b.ToTable("EFHitLocationCount");
});
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("EFServer");
});
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("Aliases");
});
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
{
b.Property<int>("AliasLinkId")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.HasKey("AliasLinkId");
b.ToTable("AliasLinks");
});
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("Clients");
});
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("Penalties");
});
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("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics")
.WithMany("HitLocations")
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId");
});
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
}
}
}

View File

@ -22,6 +22,7 @@ namespace SharedLibraryCore
T4,
T5,
T5M,
T6M,
}
public Server(Interfaces.IManager mgr, ServerConfiguration config)

View File

@ -11,28 +11,6 @@
<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" />

View File

@ -294,6 +294,8 @@ namespace SharedLibraryCore
return Game.T5M;
if (gameName.Contains("IW5"))
return Game.IW5;
if (gameName.Contains("COD_T6_S"))
return Game.T6M;
return Game.UKN;
}