Rename ServerSettings to ServerStatics

This commit is contained in:
jvyden 2021-11-18 23:04:33 -05:00
parent 2f817f9aa8
commit 5de122f1d5
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
8 changed files with 14 additions and 14 deletions

View file

@ -8,8 +8,8 @@ namespace LBPUnion.ProjectLighthouse.Tests
{ {
public DatabaseFact() public DatabaseFact()
{ {
ServerSettings.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"; ServerStatics.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
if (!ServerSettings.DbConnected) if (!ServerStatics.DbConnected)
{ {
this.Skip = "Database not available"; this.Skip = "Database not available";
} }

View file

@ -28,7 +28,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);
string responseContent = await response.Content.ReadAsStringAsync(); string responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains("MM_AUTH=", responseContent); Assert.Contains("MM_AUTH=", responseContent);
Assert.Contains(ServerSettings.ServerName, responseContent); Assert.Contains(ServerStatics.ServerName, responseContent);
} }
[DatabaseFact] [DatabaseFact]
@ -41,7 +41,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
Assert.NotNull(loginResult.LbpEnvVer); Assert.NotNull(loginResult.LbpEnvVer);
Assert.Contains("MM_AUTH=", loginResult.AuthTicket); Assert.Contains("MM_AUTH=", loginResult.AuthTicket);
Assert.Equal(ServerSettings.ServerName, loginResult.LbpEnvVer); Assert.Equal(ServerStatics.ServerName, loginResult.LbpEnvVer);
} }
[DatabaseFact] [DatabaseFact]

View file

@ -65,7 +65,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
new LoginResult new LoginResult
{ {
AuthTicket = "MM_AUTH=" + token.UserToken, AuthTicket = "MM_AUTH=" + token.UserToken,
LbpEnvVer = ServerSettings.ServerName, LbpEnvVer = ServerStatics.ServerName,
}.Serialize() }.Serialize()
); );
} }

View file

@ -41,7 +41,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
.Include(s => s.Location) .Include(s => s.Location)
.Where(s => s.Creator!.Username == user.Username) .Where(s => s.Creator!.Username == user.Username)
.Skip(pageStart - 1) .Skip(pageStart - 1)
.Take(Math.Min(pageSize, ServerSettings.EntitledSlots)), .Take(Math.Min(pageSize, ServerStatics.EntitledSlots)),
string.Empty, string.Empty,
(current, slot) => current + slot.Serialize() (current, slot) => current + slot.Serialize()
); );
@ -55,7 +55,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
new Dictionary<string, object> new Dictionary<string, object>
{ {
{ {
"hint_start", pageStart + Math.Min(pageSize, ServerSettings.EntitledSlots) "hint_start", pageStart + Math.Min(pageSize, ServerStatics.EntitledSlots)
}, },
{ {
"total", user.UsedSlots "total", user.UsedSlots

View file

@ -30,7 +30,7 @@ namespace LBPUnion.ProjectLighthouse
public DbSet<RatedLevel> RatedLevels { get; set; } public DbSet<RatedLevel> RatedLevels { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseMySql(ServerSettings.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion); => options.UseMySql(ServerStatics.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion);
public async Task<User> CreateUser(string username) public async Task<User> CreateUser(string username)
{ {

View file

@ -29,7 +29,7 @@ namespace LBPUnion.ProjectLighthouse
Logger.Log("Welcome to Project Lighthouse!", LoggerLevelStartup.Instance); Logger.Log("Welcome to Project Lighthouse!", LoggerLevelStartup.Instance);
Logger.Log("Determining if the database is available...", LoggerLevelStartup.Instance); Logger.Log("Determining if the database is available...", LoggerLevelStartup.Instance);
bool dbConnected = ServerSettings.DbConnected; bool dbConnected = ServerStatics.DbConnected;
Logger.Log(dbConnected ? "Connected to the database." : "Database unavailable! Exiting.", LoggerLevelStartup.Instance); Logger.Log(dbConnected ? "Connected to the database." : "Database unavailable! Exiting.", LoggerLevelStartup.Instance);
if (!dbConnected) Environment.Exit(1); if (!dbConnected) Environment.Exit(1);

View file

@ -5,7 +5,7 @@ using LBPUnion.ProjectLighthouse.Logging;
namespace LBPUnion.ProjectLighthouse.Types.Settings namespace LBPUnion.ProjectLighthouse.Types.Settings
{ {
public static class ServerSettings public static class ServerStatics
{ {
/// <summary> /// <summary>
/// The maximum amount of slots allowed on users' earth /// The maximum amount of slots allowed on users' earth

View file

@ -100,7 +100,7 @@ namespace LBPUnion.ProjectLighthouse.Types
LbpSerializer.StringElement("game", this.Game) + LbpSerializer.StringElement("game", this.Game) +
this.SerializeSlots(gameVersion == GameVersion.LittleBigPlanetVita) + this.SerializeSlots(gameVersion == GameVersion.LittleBigPlanetVita) +
LbpSerializer.StringElement("lists", this.Lists) + LbpSerializer.StringElement("lists", this.Lists) +
LbpSerializer.StringElement("lists_quota", ServerSettings.ListsQuota) + // technically not a part of the user but LBP expects it LbpSerializer.StringElement("lists_quota", ServerStatics.ListsQuota) + // technically not a part of the user but LBP expects it
LbpSerializer.StringElement("biography", this.Biography) + LbpSerializer.StringElement("biography", this.Biography) +
LbpSerializer.StringElement("reviewCount", this.Reviews) + LbpSerializer.StringElement("reviewCount", this.Reviews) +
LbpSerializer.StringElement("commentCount", this.Comments) + LbpSerializer.StringElement("commentCount", this.Comments) +
@ -142,7 +142,7 @@ namespace LBPUnion.ProjectLighthouse.Types
/// <summary> /// <summary>
/// The number of slots remaining on the earth /// The number of slots remaining on the earth
/// </summary> /// </summary>
public int FreeSlots => ServerSettings.EntitledSlots - this.UsedSlots; public int FreeSlots => ServerStatics.EntitledSlots - this.UsedSlots;
private static readonly string[] slotTypes = private static readonly string[] slotTypes =
{ {
@ -172,12 +172,12 @@ namespace LBPUnion.ProjectLighthouse.Types
slotTypesLocal = slotTypes; slotTypesLocal = slotTypes;
} }
slots += LbpSerializer.StringElement("entitledSlots", ServerSettings.EntitledSlots); slots += LbpSerializer.StringElement("entitledSlots", ServerStatics.EntitledSlots);
slots += LbpSerializer.StringElement("freeSlots", this.FreeSlots); slots += LbpSerializer.StringElement("freeSlots", this.FreeSlots);
foreach (string slotType in slotTypesLocal) foreach (string slotType in slotTypesLocal)
{ {
slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerSettings.EntitledSlots); slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerStatics.EntitledSlots);
// ReSharper disable once StringLiteralTypo // ReSharper disable once StringLiteralTypo
slots += LbpSerializer.StringElement(slotType + slotType == "crossControl" ? "PurchsedSlots" : "PurchasedSlots", 0); slots += LbpSerializer.StringElement(slotType + slotType == "crossControl" ? "PurchsedSlots" : "PurchasedSlots", 0);
slots += LbpSerializer.StringElement(slotType + "FreeSlots", this.FreeSlots); slots += LbpSerializer.StringElement(slotType + "FreeSlots", this.FreeSlots);