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()
{
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";
}

View file

@ -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]

View file

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

View file

@ -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<string, object>
{
{
"hint_start", pageStart + Math.Min(pageSize, ServerSettings.EntitledSlots)
"hint_start", pageStart + Math.Min(pageSize, ServerStatics.EntitledSlots)
},
{
"total", user.UsedSlots

View file

@ -30,7 +30,7 @@ namespace LBPUnion.ProjectLighthouse
public DbSet<RatedLevel> RatedLevels { get; set; }
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)
{

View file

@ -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);

View file

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

View file

@ -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
/// <summary>
/// The number of slots remaining on the earth
/// </summary>
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);