diff --git a/Libraries/Core/Controllers/GameController.cs b/Libraries/Core/Controllers/GameController.cs index e77d0ec7..180b12cb 100644 --- a/Libraries/Core/Controllers/GameController.cs +++ b/Libraries/Core/Controllers/GameController.cs @@ -486,14 +486,16 @@ public class GameController( continue; } - fullProfile.SptData.Mods.Add(new ModDetails() - { - Author = mod.PackageJson.Author, - Version = mod.PackageJson.Version, - Name = mod.PackageJson.Name, - Url = mod.PackageJson.Url, - DateAdded = _timeUtil.GetTimeStamp() - }); + fullProfile.SptData.Mods.Add( + new ModDetails + { + Author = mod.PackageJson.Author, + Version = mod.PackageJson.Version, + Name = mod.PackageJson.Name, + Url = mod.PackageJson.Url, + DateAdded = _timeUtil.GetTimeStamp() + } + ); } } diff --git a/Libraries/Core/Controllers/LauncherController.cs b/Libraries/Core/Controllers/LauncherController.cs index 6a16a057..319ae66b 100644 --- a/Libraries/Core/Controllers/LauncherController.cs +++ b/Libraries/Core/Controllers/LauncherController.cs @@ -223,7 +223,8 @@ public class LauncherController( { var profile = _profileHelper.GetFullProfile(sessionId); - if (profile?.SptData?.Mods is not null) { + if (profile?.SptData?.Mods is not null) + { return getProfileModsGroupedByModName(profile?.SptData?.Mods); } @@ -234,8 +235,10 @@ public class LauncherController( { // Group all mods used by profile by name var modsGroupedByName = new Dictionary>(); - foreach (var mod in profileMods) { - if (!modsGroupedByName.ContainsKey(mod.Name)) { + foreach (var mod in profileMods) + { + if (!modsGroupedByName.ContainsKey(mod.Name)) + { modsGroupedByName[mod.Name] = []; } @@ -244,13 +247,15 @@ public class LauncherController( // Find the highest versioned mod and add to results array var result = new List(); - foreach (var modName in modsGroupedByName) { + foreach (var modName in modsGroupedByName) + { var modDatas = modsGroupedByName[modName.Key]; - var modVersions = modDatas.Select((x) => x.Version); + var modVersions = modDatas.Select(x => x.Version); // var highestVersion = MaxSatisfying(modVersions, "*"); ?? TODO: Node used SemVer here - var chosenVersion = modDatas.FirstOrDefault((x) => x.Name == modName.Key ); // && x.Version == highestVersion - if (chosenVersion is null) { + var chosenVersion = modDatas.FirstOrDefault(x => x.Name == modName.Key); // && x.Version == highestVersion + if (chosenVersion is null) + { continue; } diff --git a/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs b/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs index 9f884dcf..4ac33c6d 100644 --- a/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs +++ b/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs @@ -14,7 +14,7 @@ public record HealthTreatmentRequestData : InventoryBaseActionRequestData } /** - * Id of stack to take money from + * Id of stack to take money from * Amount of money to take off player for treatment */ [JsonPropertyName("items")] diff --git a/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs b/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs index fc40ca7a..28106c97 100644 --- a/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs +++ b/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace Core.Models.Spt.Mod; +namespace Core.Models.Spt.Mod; public record PackageJsonData { diff --git a/Libraries/Core/Models/Spt/Mod/SptMod.cs b/Libraries/Core/Models/Spt/Mod/SptMod.cs index f47e1577..33873231 100644 --- a/Libraries/Core/Models/Spt/Mod/SptMod.cs +++ b/Libraries/Core/Models/Spt/Mod/SptMod.cs @@ -6,8 +6,16 @@ namespace Core.Models.Spt.Mod; public class SptMod { [JsonPropertyName("PackageJson")] - public PackageJsonData PackageJson { get; set; } + public PackageJsonData PackageJson + { + get; + set; + } [JsonPropertyName("Assembly")] - public Assembly Assembly { get; set; } + public Assembly Assembly + { + get; + set; + } } diff --git a/Libraries/Core/Services/BackupService.cs b/Libraries/Core/Services/BackupService.cs index 426b93f1..c4d9273a 100644 --- a/Libraries/Core/Services/BackupService.cs +++ b/Libraries/Core/Services/BackupService.cs @@ -15,6 +15,7 @@ public class BackupService protected const string _profileDir = "./user/profiles"; protected readonly List _activeServerMods; + protected ApplicationContext _applicationContext; protected BackupConfig _backupConfig; // Runs Init() every x minutes @@ -23,7 +24,6 @@ public class BackupService protected JsonUtil _jsonUtil; protected ISptLogger _logger; protected TimeUtil _timeUtil; - protected ApplicationContext _applicationContext; public BackupService( ISptLogger logger, @@ -32,7 +32,7 @@ public class BackupService ConfigServer configServer, FileUtil fileUtil, ApplicationContext applicationContext - ) + ) { _logger = logger; _jsonUtil = jsonUtil; @@ -77,10 +77,10 @@ public class BackupService /** * Initializes the backup process. - * + * * This method orchestrates the profile backup service. Handles copying profiles to a backup directory and cleaning * up old backups if the number exceeds the configured maximum. - * + * * @returns A promise that resolves when the backup process is complete. */ public void Init() @@ -148,7 +148,7 @@ public class BackupService /** * Check to see if the backup service is enabled via the config. - * + * * @returns True if enabled, false otherwise. */ protected bool IsEnabled() @@ -169,7 +169,7 @@ public class BackupService /** * Generates the target directory path for the backup. The directory path is constructed using the `directory` from * the configuration and the current backup date. - * + * * @returns The target directory path for the backup. */ protected string GenerateBackupTargetDir() @@ -180,7 +180,7 @@ public class BackupService /** * Generates a formatted backup date string in the format `YYYY-MM-DD_hh-mm-ss`. - * + * * @returns The formatted backup date string. */ protected string GenerateBackupDate() @@ -192,10 +192,10 @@ public class BackupService /** * Cleans up old backups in the backup directory. - * + * * This method reads the backup directory, and sorts backups by modification time. If the number of backups exceeds * the configured maximum, it deletes the oldest backups. - * + * * @returns A promise that resolves when the cleanup is complete. */ protected void CleanBackups() @@ -232,7 +232,7 @@ public class BackupService /** * Retrieves and sorts the backup file paths from the specified directory. - * + * * @param dir - The directory to search for backup files. * @returns A promise that resolves to a List of sorted backup file paths. */ @@ -246,7 +246,7 @@ public class BackupService /** * Compares two backup folder names based on their extracted dates. - * + * * @param a - The name of the first backup folder. * @param b - The name of the second backup folder. * @returns The difference in time between the two dates in milliseconds, or `null` if either date is invalid. @@ -266,7 +266,7 @@ public class BackupService /** * Extracts a date from a folder name string formatted as `YYYY-MM-DD_hh-mm-ss`. - * + * * @param folderName - The name of the folder from which to extract the date. * @returns A DateTime object if the folder name is in the correct format, otherwise null. */ @@ -292,7 +292,7 @@ public class BackupService /** * Removes excess backups from the backup directory. - * + * * @param backups - A List of backup file names to be removed. * @returns A promise that resolves when all specified backups have been removed. */ @@ -312,7 +312,7 @@ public class BackupService /** * Get a List of active server mod details. - * + * * @returns A List of mod names. */ protected List GetActiveServerMods() diff --git a/Server/ModDllLoader.cs b/Server/ModDllLoader.cs index 5ea531e4..249867ad 100644 --- a/Server/ModDllLoader.cs +++ b/Server/ModDllLoader.cs @@ -1,7 +1,6 @@ using System.Reflection; using System.Text.Json; using Core.Models.Spt.Mod; -using Core.Models.Utils; namespace Server; diff --git a/Server/Program.cs b/Server/Program.cs index 8c7ec0e9..020fc0c8 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -1,6 +1,5 @@ using System.Runtime; using Core.Context; -using Core.Models.Enums; using Core.Models.External; using Core.Models.Spt.Config; using Core.Servers;