From 5de122f1d5f10b15961a6e65ab4a9b856eab34f1 Mon Sep 17 00:00:00 2001 From: jvyden Date: Thu, 18 Nov 2021 23:04:33 -0500 Subject: [PATCH] Rename ServerSettings to ServerStatics --- ProjectLighthouse.Tests/DatabaseFact.cs | 4 ++-- ProjectLighthouse.Tests/Tests/AuthenticationTests.cs | 4 ++-- ProjectLighthouse/Controllers/LoginController.cs | 2 +- ProjectLighthouse/Controllers/SlotsController.cs | 4 ++-- ProjectLighthouse/Database.cs | 2 +- ProjectLighthouse/Program.cs | 2 +- .../Settings/{ServerSettings.cs => ServerStatics.cs} | 2 +- ProjectLighthouse/Types/User.cs | 8 ++++---- 8 files changed, 14 insertions(+), 14 deletions(-) rename ProjectLighthouse/Types/Settings/{ServerSettings.cs => ServerStatics.cs} (96%) diff --git a/ProjectLighthouse.Tests/DatabaseFact.cs b/ProjectLighthouse.Tests/DatabaseFact.cs index 7fdc1524..216ea62a 100644 --- a/ProjectLighthouse.Tests/DatabaseFact.cs +++ b/ProjectLighthouse.Tests/DatabaseFact.cs @@ -8,8 +8,8 @@ namespace LBPUnion.ProjectLighthouse.Tests { public DatabaseFact() { - ServerSettings.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"; - if (!ServerSettings.DbConnected) + ServerStatics.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"; + if (!ServerStatics.DbConnected) { this.Skip = "Database not available"; } diff --git a/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs b/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs index 893648e0..24684ec6 100644 --- a/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs +++ b/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs @@ -28,7 +28,7 @@ namespace LBPUnion.ProjectLighthouse.Tests Assert.True(response.IsSuccessStatusCode); string responseContent = await response.Content.ReadAsStringAsync(); Assert.Contains("MM_AUTH=", responseContent); - Assert.Contains(ServerSettings.ServerName, responseContent); + Assert.Contains(ServerStatics.ServerName, responseContent); } [DatabaseFact] @@ -41,7 +41,7 @@ namespace LBPUnion.ProjectLighthouse.Tests Assert.NotNull(loginResult.LbpEnvVer); Assert.Contains("MM_AUTH=", loginResult.AuthTicket); - Assert.Equal(ServerSettings.ServerName, loginResult.LbpEnvVer); + Assert.Equal(ServerStatics.ServerName, loginResult.LbpEnvVer); } [DatabaseFact] diff --git a/ProjectLighthouse/Controllers/LoginController.cs b/ProjectLighthouse/Controllers/LoginController.cs index d3e4df74..6bce4863 100644 --- a/ProjectLighthouse/Controllers/LoginController.cs +++ b/ProjectLighthouse/Controllers/LoginController.cs @@ -65,7 +65,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers new LoginResult { AuthTicket = "MM_AUTH=" + token.UserToken, - LbpEnvVer = ServerSettings.ServerName, + LbpEnvVer = ServerStatics.ServerName, }.Serialize() ); } diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index 48e45184..38a2f5c3 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -41,7 +41,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers .Include(s => s.Location) .Where(s => s.Creator!.Username == user.Username) .Skip(pageStart - 1) - .Take(Math.Min(pageSize, ServerSettings.EntitledSlots)), + .Take(Math.Min(pageSize, ServerStatics.EntitledSlots)), string.Empty, (current, slot) => current + slot.Serialize() ); @@ -55,7 +55,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers new Dictionary { { - "hint_start", pageStart + Math.Min(pageSize, ServerSettings.EntitledSlots) + "hint_start", pageStart + Math.Min(pageSize, ServerStatics.EntitledSlots) }, { "total", user.UsedSlots diff --git a/ProjectLighthouse/Database.cs b/ProjectLighthouse/Database.cs index 20898272..58d725bc 100644 --- a/ProjectLighthouse/Database.cs +++ b/ProjectLighthouse/Database.cs @@ -30,7 +30,7 @@ namespace LBPUnion.ProjectLighthouse public DbSet RatedLevels { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) - => options.UseMySql(ServerSettings.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion); + => options.UseMySql(ServerStatics.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion); public async Task CreateUser(string username) { diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs index d3136b16..be5bc197 100644 --- a/ProjectLighthouse/Program.cs +++ b/ProjectLighthouse/Program.cs @@ -29,7 +29,7 @@ namespace LBPUnion.ProjectLighthouse Logger.Log("Welcome to Project Lighthouse!", 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); if (!dbConnected) Environment.Exit(1); diff --git a/ProjectLighthouse/Types/Settings/ServerSettings.cs b/ProjectLighthouse/Types/Settings/ServerStatics.cs similarity index 96% rename from ProjectLighthouse/Types/Settings/ServerSettings.cs rename to ProjectLighthouse/Types/Settings/ServerStatics.cs index daaa3e95..fe1a3a78 100644 --- a/ProjectLighthouse/Types/Settings/ServerSettings.cs +++ b/ProjectLighthouse/Types/Settings/ServerStatics.cs @@ -5,7 +5,7 @@ using LBPUnion.ProjectLighthouse.Logging; namespace LBPUnion.ProjectLighthouse.Types.Settings { - public static class ServerSettings + public static class ServerStatics { /// /// The maximum amount of slots allowed on users' earth diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 83c0806a..d872d2df 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -100,7 +100,7 @@ namespace LBPUnion.ProjectLighthouse.Types LbpSerializer.StringElement("game", this.Game) + this.SerializeSlots(gameVersion == GameVersion.LittleBigPlanetVita) + 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("reviewCount", this.Reviews) + LbpSerializer.StringElement("commentCount", this.Comments) + @@ -142,7 +142,7 @@ namespace LBPUnion.ProjectLighthouse.Types /// /// The number of slots remaining on the earth /// - public int FreeSlots => ServerSettings.EntitledSlots - this.UsedSlots; + public int FreeSlots => ServerStatics.EntitledSlots - this.UsedSlots; private static readonly string[] slotTypes = { @@ -172,12 +172,12 @@ namespace LBPUnion.ProjectLighthouse.Types slotTypesLocal = slotTypes; } - slots += LbpSerializer.StringElement("entitledSlots", ServerSettings.EntitledSlots); + slots += LbpSerializer.StringElement("entitledSlots", ServerStatics.EntitledSlots); slots += LbpSerializer.StringElement("freeSlots", this.FreeSlots); foreach (string slotType in slotTypesLocal) { - slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerSettings.EntitledSlots); + slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerStatics.EntitledSlots); // ReSharper disable once StringLiteralTypo slots += LbpSerializer.StringElement(slotType + slotType == "crossControl" ? "PurchsedSlots" : "PurchasedSlots", 0); slots += LbpSerializer.StringElement(slotType + "FreeSlots", this.FreeSlots);