Skip to content

Commit

Permalink
Merge branch 'ACEmulator:master' into getcellcrash
Browse files Browse the repository at this point in the history
  • Loading branch information
LtRipley36706 authored Jul 20, 2024
2 parents 3a9c2c2 + 83e0971 commit 8edc540
Show file tree
Hide file tree
Showing 108 changed files with 6,360 additions and 5,431 deletions.
2 changes: 1 addition & 1 deletion AppVeyor/dbversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.280
0.9.281
2 changes: 1 addition & 1 deletion Source/ACE.Adapter/ACE.Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Source/ACE.Common/ACE.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Database/ACE.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<ItemGroup>
<PackageReference Include="log4net" Version="2.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.29" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 7 additions & 13 deletions Source/ACE.Database/Models/Auth/Accesslevel.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
using System;
using System.Collections.Generic;

#nullable disable
namespace ACE.Database.Models.Auth;

namespace ACE.Database.Models.Auth
public partial class Accesslevel
{
public partial class Accesslevel
{
public Accesslevel()
{
Account = new HashSet<Account>();
}
public uint Level { get; set; }

public uint Level { get; set; }
public string Name { get; set; }
public string Prefix { get; set; }
public string Name { get; set; }

public virtual ICollection<Account> Account { get; set; }
}
public string Prefix { get; set; }

public virtual ICollection<Account> Account { get; set; } = new List<Account>();
}
61 changes: 39 additions & 22 deletions Source/ACE.Database/Models/Auth/Account.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
using System;
using System.Collections.Generic;

#nullable disable
namespace ACE.Database.Models.Auth;

namespace ACE.Database.Models.Auth
public partial class Account
{
public partial class Account
{
public uint AccountId { get; set; }
public string AccountName { get; set; }
public string PasswordHash { get; set; }
public string PasswordSalt { get; set; }
public uint AccessLevel { get; set; }
public string EmailAddress { get; set; }
public DateTime CreateTime { get; set; }
public byte[] CreateIP { get; set; }
public DateTime? LastLoginTime { get; set; }
public byte[] LastLoginIP { get; set; }
public uint TotalTimesLoggedIn { get; set; }
public DateTime? BannedTime { get; set; }
public uint? BannedByAccountId { get; set; }
public DateTime? BanExpireTime { get; set; }
public string BanReason { get; set; }

public virtual Accesslevel AccessLevelNavigation { get; set; }
}
public uint AccountId { get; set; }

public string AccountName { get; set; }

/// <summary>
/// base64 encoded version of the hashed passwords. 88 characters are needed to base64 encode SHA512 output.
/// </summary>
public string PasswordHash { get; set; }

/// <summary>
/// This is no longer used, except to indicate if bcrypt is being employed for migration purposes. Previously: base64 encoded version of the password salt. 512 byte salts (88 characters when base64 encoded) are recommend for SHA512.
/// </summary>
public string PasswordSalt { get; set; }

public uint AccessLevel { get; set; }

public string EmailAddress { get; set; }

public DateTime CreateTime { get; set; }

public byte[] CreateIP { get; set; }

public DateTime? LastLoginTime { get; set; }

public byte[] LastLoginIP { get; set; }

public uint TotalTimesLoggedIn { get; set; }

public DateTime? BannedTime { get; set; }

public uint? BannedByAccountId { get; set; }

public DateTime? BanExpireTime { get; set; }

public string BanReason { get; set; }

public virtual Accesslevel AccessLevelNavigation { get; set; }
}
240 changes: 111 additions & 129 deletions Source/ACE.Database/Models/Auth/AuthDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,148 +1,130 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;

#nullable disable
namespace ACE.Database.Models.Auth;

namespace ACE.Database.Models.Auth
public partial class AuthDbContext : DbContext
{
public partial class AuthDbContext : DbContext
public AuthDbContext()
{
public AuthDbContext()
{
}

public AuthDbContext(DbContextOptions<AuthDbContext> options)
: base(options)
{
}

public virtual DbSet<Accesslevel> Accesslevel { get; set; }
public virtual DbSet<Account> Account { get; set; }
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
var config = Common.ConfigManager.Config.MySql.Authentication;
public AuthDbContext(DbContextOptions<AuthDbContext> options)
: base(options)
{
}

var connectionString = $"server={config.Host};port={config.Port};user={config.Username};password={config.Password};database={config.Database};{config.ConnectionOptions}";
public virtual DbSet<Accesslevel> Accesslevel { get; set; }

optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), builder =>
{
builder.EnableRetryOnFailure(10);
});
}
}
public virtual DbSet<Account> Account { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
modelBuilder.HasCharSet("utf8")
.UseCollation("utf8_general_ci");

modelBuilder.Entity<Accesslevel>(entity =>
{
entity.HasKey(e => e.Level)
.HasName("PRIMARY");

entity.ToTable("accesslevel");

entity.HasIndex(e => e.Level, "level")
.IsUnique();

entity.Property(e => e.Level)
.ValueGeneratedNever()
.HasColumnName("level");
var config = Common.ConfigManager.Config.MySql.Authentication;

entity.Property(e => e.Name)
.IsRequired()
.HasMaxLength(45)
.HasColumnName("name");
var connectionString = $"server={config.Host};port={config.Port};user={config.Username};password={config.Password};database={config.Database};{config.ConnectionOptions}";

entity.Property(e => e.Prefix)
.HasMaxLength(45)
.HasColumnName("prefix")
.HasDefaultValueSql("''");
});

modelBuilder.Entity<Account>(entity =>
optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), builder =>
{
entity.ToTable("account");

entity.HasIndex(e => e.AccessLevel, "accesslevel_idx");

entity.HasIndex(e => e.AccountName, "accountName_uidx")
.IsUnique();

entity.Property(e => e.AccountId).HasColumnName("accountId");

entity.Property(e => e.AccessLevel).HasColumnName("accessLevel");

entity.Property(e => e.AccountName)
.IsRequired()
.HasMaxLength(50)
.HasColumnName("accountName");

entity.Property(e => e.BanExpireTime)
.HasColumnType("datetime")
.HasColumnName("ban_Expire_Time");

entity.Property(e => e.BanReason)
.HasMaxLength(1000)
.HasColumnName("ban_Reason");

entity.Property(e => e.BannedByAccountId).HasColumnName("banned_By_Account_Id");

entity.Property(e => e.BannedTime)
.HasColumnType("datetime")
.HasColumnName("banned_Time");

entity.Property(e => e.CreateIP)
.HasMaxLength(16)
.HasColumnName("create_I_P");

entity.Property(e => e.CreateTime)
.HasColumnType("datetime")
.HasColumnName("create_Time")
.HasDefaultValueSql("CURRENT_TIMESTAMP");

entity.Property(e => e.EmailAddress)
.HasMaxLength(320)
.HasColumnName("email_Address");

entity.Property(e => e.LastLoginIP)
.HasMaxLength(16)
.HasColumnName("last_Login_I_P");

entity.Property(e => e.LastLoginTime)
.HasColumnType("datetime")
.HasColumnName("last_Login_Time");

entity.Property(e => e.PasswordHash)
.IsRequired()
.HasMaxLength(88)
.HasColumnName("passwordHash")
.HasComment("base64 encoded version of the hashed passwords. 88 characters are needed to base64 encode SHA512 output.");

entity.Property(e => e.PasswordSalt)
.IsRequired()
.HasMaxLength(88)
.HasColumnName("passwordSalt")
.HasDefaultValueSql("'use bcrypt'")
.HasComment("This is no longer used, except to indicate if bcrypt is being employed for migration purposes. Previously: base64 encoded version of the password salt. 512 byte salts (88 characters when base64 encoded) are recommend for SHA512.");

entity.Property(e => e.TotalTimesLoggedIn).HasColumnName("total_Times_Logged_In");

entity.HasOne(d => d.AccessLevelNavigation)
.WithMany(p => p.Account)
.HasForeignKey(d => d.AccessLevel)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_accesslevel");
builder.EnableRetryOnFailure(10);
});

OnModelCreatingPartial(modelBuilder);
}
}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.UseCollation("utf8_general_ci")
.HasCharSet("utf8mb3");

modelBuilder.Entity<Accesslevel>(entity =>
{
entity.HasKey(e => e.Level).HasName("PRIMARY");

entity.ToTable("accesslevel");

entity.HasIndex(e => e.Level, "level").IsUnique();

entity.Property(e => e.Level)
.ValueGeneratedNever()
.HasColumnName("level");
entity.Property(e => e.Name)
.IsRequired()
.HasMaxLength(45)
.HasColumnName("name");
entity.Property(e => e.Prefix)
.HasMaxLength(45)
.HasDefaultValueSql("''")
.HasColumnName("prefix");
});

modelBuilder.Entity<Account>(entity =>
{
entity.HasKey(e => e.AccountId).HasName("PRIMARY");

entity.ToTable("account");

entity.HasIndex(e => e.AccessLevel, "accesslevel_idx");

entity.HasIndex(e => e.AccountName, "accountName_uidx").IsUnique();

entity.Property(e => e.AccountId).HasColumnName("accountId");
entity.Property(e => e.AccessLevel).HasColumnName("accessLevel");
entity.Property(e => e.AccountName)
.IsRequired()
.HasMaxLength(50)
.HasColumnName("accountName");
entity.Property(e => e.BanExpireTime)
.HasColumnType("datetime")
.HasColumnName("ban_Expire_Time");
entity.Property(e => e.BanReason)
.HasMaxLength(1000)
.HasColumnName("ban_Reason");
entity.Property(e => e.BannedByAccountId).HasColumnName("banned_By_Account_Id");
entity.Property(e => e.BannedTime)
.HasColumnType("datetime")
.HasColumnName("banned_Time");
entity.Property(e => e.CreateIP)
.HasMaxLength(16)
.HasColumnName("create_I_P");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasColumnType("datetime")
.HasColumnName("create_Time");
entity.Property(e => e.EmailAddress)
.HasMaxLength(320)
.HasColumnName("email_Address");
entity.Property(e => e.LastLoginIP)
.HasMaxLength(16)
.HasColumnName("last_Login_I_P");
entity.Property(e => e.LastLoginTime)
.HasColumnType("datetime")
.HasColumnName("last_Login_Time");
entity.Property(e => e.PasswordHash)
.IsRequired()
.HasMaxLength(88)
.HasComment("base64 encoded version of the hashed passwords. 88 characters are needed to base64 encode SHA512 output.")
.HasColumnName("passwordHash");
entity.Property(e => e.PasswordSalt)
.IsRequired()
.HasMaxLength(88)
.HasDefaultValueSql("'use bcrypt'")
.HasComment("This is no longer used, except to indicate if bcrypt is being employed for migration purposes. Previously: base64 encoded version of the password salt. 512 byte salts (88 characters when base64 encoded) are recommend for SHA512.")
.HasColumnName("passwordSalt");
entity.Property(e => e.TotalTimesLoggedIn).HasColumnName("total_Times_Logged_In");

entity.HasOne(d => d.AccessLevelNavigation).WithMany(p => p.Account)
.HasForeignKey(d => d.AccessLevel)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_accesslevel");
});

OnModelCreatingPartial(modelBuilder);
}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
Loading

0 comments on commit 8edc540

Please sign in to comment.