Format Style Fixes

This commit is contained in:
sp-tarkov-bot
2025-07-28 19:39:29 +00:00
parent 51430d55c9
commit b14b74bf24
357 changed files with 7345 additions and 24604 deletions
+1 -5
View File
@@ -5,11 +5,7 @@ using SPTarkov.Server.Core.Utils.Logger;
namespace SPTarkov.Server.Logger;
[Injectable]
public class SptLoggerProvider(
JsonUtil jsonUtil,
FileUtil fileUtil,
SptLoggerQueueManager queueManager
) : ILoggerProvider, ILoggerFactory
public class SptLoggerProvider(JsonUtil jsonUtil, FileUtil fileUtil, SptLoggerQueueManager queueManager) : ILoggerProvider, ILoggerFactory
{
private readonly List<ILoggerProvider> _loggerProviders = [];
+1 -6
View File
@@ -8,12 +8,7 @@ public class SptLoggerWrapper : ILogger
{
private readonly SptLogger<SptLoggerWrapper> _logger;
public SptLoggerWrapper(
string category,
JsonUtil jsonUtil,
FileUtil fileUtil,
SptLoggerQueueManager queueManager
)
public SptLoggerWrapper(string category, JsonUtil jsonUtil, FileUtil fileUtil, SptLoggerQueueManager queueManager)
{
_logger = new SptLogger<SptLoggerWrapper>(fileUtil, jsonUtil, queueManager);
_logger.OverrideCategory(category);
+5 -18
View File
@@ -58,11 +58,7 @@ public class ModDllLoader
{
if (string.Equals(file.Extension, ".dll", StringComparison.OrdinalIgnoreCase))
{
assemblyList.Add(
AssemblyLoadContext.Default.LoadFromAssemblyPath(
Path.GetFullPath(file.FullName)
)
);
assemblyList.Add(AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.GetFullPath(file.FullName)));
}
}
@@ -102,10 +98,7 @@ public class ModDllLoader
/// <param name="path">Path of the mod directory</param>
/// <returns>Mod metadata</returns>
/// <exception cref="Exception">Thrown if duplicate metadata implementations are found</exception>
private static AbstractModMetadata LoadModMetadata(
IEnumerable<Assembly> assemblies,
string path
)
private static AbstractModMetadata LoadModMetadata(IEnumerable<Assembly> assemblies, string path)
{
AbstractModMetadata? result = null;
@@ -113,15 +106,11 @@ public class ModDllLoader
{
foreach (var module in allAsmModules)
{
var modMetadata = module
.GetTypes()
.SingleOrDefault(t => typeof(AbstractModMetadata).IsAssignableFrom(t));
var modMetadata = module.GetTypes().SingleOrDefault(t => typeof(AbstractModMetadata).IsAssignableFrom(t));
if (result != null && modMetadata != null)
{
throw new Exception(
$"Duplicate mod metadata found for mod at path: {Path.GetFullPath(path)}"
);
throw new Exception($"Duplicate mod metadata found for mod at path: {Path.GetFullPath(path)}");
}
if (modMetadata != null)
@@ -133,9 +122,7 @@ public class ModDllLoader
if (result == null)
{
throw new Exception(
$"Failed to load mod metadata for: {Path.GetFullPath(path)} \ndid you override `AbstractModMetadata`?"
);
throw new Exception($"Failed to load mod metadata for: {Path.GetFullPath(path)} \ndid you override `AbstractModMetadata`?");
}
return result;
+1 -3
View File
@@ -9,9 +9,7 @@ public class ModLoadOrder(ICloner cloner)
protected Dictionary<string, AbstractModMetadata> mods = new();
protected Dictionary<string, AbstractModMetadata> modsAvailable = new();
public Dictionary<string, AbstractModMetadata> SetModList(
Dictionary<string, AbstractModMetadata> mods
)
public Dictionary<string, AbstractModMetadata> SetModList(Dictionary<string, AbstractModMetadata> mods)
{
this.mods = mods;
modsAvailable = cloner.Clone(this.mods);
+8 -31
View File
@@ -33,9 +33,7 @@ public class ModValidator(
{
ValidateMods(mods);
var sortedModLoadOrder = modLoadOrder.SetModList(
imported.ToDictionary(m => m.Key, m => m.Value.ModMetadata)
);
var sortedModLoadOrder = modLoadOrder.SetModList(imported.ToDictionary(m => m.Key, m => m.Value.ModMetadata));
var finalList = new List<SptMod>();
foreach (var orderMod in SortModsLoadOrder())
{
@@ -138,9 +136,7 @@ public class ModValidator(
{
foreach (var missingMod in missingFromOrderJSON.Keys)
{
logger.Debug(
localisationService.GetText("modloader-mod_order_missing_from_json", missingMod)
);
logger.Debug(localisationService.GetText("modloader-mod_order_missing_from_json", missingMod));
}
}
@@ -225,9 +221,7 @@ public class ModValidator(
// Error and prevent loading if sptVersion property is not a valid semver string
if (!(semVer.IsValid(mod.SptVersion) || semVer.IsValidRange(mod.SptVersion)))
{
logger.Error(
localisationService.GetText("modloader-invalid_sptversion_field", modName)
);
logger.Error(localisationService.GetText("modloader-invalid_sptversion_field", modName));
return false;
}
@@ -299,10 +293,7 @@ public class ModValidator(
return skippedMods.Contains($"{pkg.Author}-{pkg.Name}");
}
protected bool AreModDependenciesFulfilled(
AbstractModMetadata pkg,
Dictionary<string, AbstractModMetadata> loadedMods
)
protected bool AreModDependenciesFulfilled(AbstractModMetadata pkg, Dictionary<string, AbstractModMetadata> loadedMods)
{
if (pkg.ModDependencies == null)
{
@@ -317,12 +308,7 @@ public class ModValidator(
// Raise dependency version incompatible if the dependency is not found in the mod list
if (!loadedMods.ContainsKey(modDependency))
{
logger.Error(
localisationService.GetText(
"modloader-missing_dependency",
new { mod = modName, modDependency }
)
);
logger.Error(localisationService.GetText("modloader-missing_dependency", new { mod = modName, modDependency }));
return false;
}
@@ -347,10 +333,7 @@ public class ModValidator(
return true;
}
protected bool IsModCompatible(
AbstractModMetadata mod,
Dictionary<string, AbstractModMetadata> loadedMods
)
protected bool IsModCompatible(AbstractModMetadata mod, Dictionary<string, AbstractModMetadata> loadedMods)
{
var incompatbileModsList = mod.Incompatibilities;
if (incompatbileModsList == null)
@@ -391,11 +374,7 @@ public class ModValidator(
var modName = mod.ModMetadata.Name;
var modPath = GetModPath(modName);
var modIsCalledBepinEx = string.Equals(
modName,
"bepinex",
StringComparison.OrdinalIgnoreCase
);
var modIsCalledBepinEx = string.Equals(modName, "bepinex", StringComparison.OrdinalIgnoreCase);
var modIsCalledUser = string.Equals(modName, "user", StringComparison.OrdinalIgnoreCase);
var modIsCalledSrc = string.Equals(modName, "src", StringComparison.OrdinalIgnoreCase);
var modIsCalledDb = string.Equals(modName, "db", StringComparison.OrdinalIgnoreCase);
@@ -427,9 +406,7 @@ public class ModValidator(
if (!semVer.IsValid(config.Version))
{
logger.Error(
localisationService.GetText("modloader-invalid_version_property", modName)
);
logger.Error(localisationService.GetText("modloader-invalid_version_property", modName));
issue = true;
}
+5 -15
View File
@@ -30,9 +30,7 @@ public static class Program
// Some users don't know how to create a shortcut...
if (!IsRunFromInstallationFolder())
{
Console.WriteLine(
"You have not created a shortcut properly. Please hold alt when dragging to create a shortcut."
);
Console.WriteLine("You have not created a shortcut properly. Please hold alt when dragging to create a shortcut.");
await Task.Delay(-1);
return;
}
@@ -59,9 +57,7 @@ public static class Program
// update the loadedMods list with our validated sorted mods
loadedMods = sortedLoadedMods;
diHandler.AddInjectableTypesFromAssemblies(
sortedLoadedMods.SelectMany(a => a.Assemblies)
);
diHandler.AddInjectableTypesFromAssemblies(sortedLoadedMods.SelectMany(a => a.Assemblies));
}
diHandler.InjectAll();
@@ -77,9 +73,7 @@ public static class Program
ConfigureWebApp(app);
// In case of exceptions we snatch a Server logger
var serverExceptionLogger = app
.Services.GetService<ILoggerFactory>()!
.CreateLogger("Server");
var serverExceptionLogger = app.Services.GetService<ILoggerFactory>()!.CreateLogger("Server");
// We need any logger instance to use as a finalizer when the app closes
var loggerFinalizer = app.Services.GetService<ISptLogger<App>>()!;
try
@@ -123,9 +117,7 @@ public static class Program
{
// This method is not expected to be async so we need to wait for the Task instead of using await keyword
options.ApplicationServices.GetService<OnWebAppBuildModLoader>()!.OnLoad().Wait();
var httpConfig = options
.ApplicationServices.GetService<ConfigServer>()
?.GetConfig<HttpConfig>()!;
var httpConfig = options.ApplicationServices.GetService<ConfigServer>()?.GetConfig<HttpConfig>()!;
// Probe the http ip and port to see if its being used, this method will throw an exception and crash
// the server if the IP/Port combination is already in use
@@ -224,9 +216,7 @@ public static class Program
var dirFiles = Directory.GetFiles(Directory.GetCurrentDirectory());
// This file is guaranteed to exist if ran from the correct location, even if the game does not exist here.
return dirFiles.Any(dirFile =>
dirFile.EndsWith("sptLogger.json") || dirFile.EndsWith("sptLogger.Development.json")
);
return dirFiles.Any(dirFile => dirFile.EndsWith("sptLogger.json") || dirFile.EndsWith("sptLogger.Development.json"));
}
[DllImport("kernel32.dll", SetLastError = true)]
+1 -4
View File
@@ -30,10 +30,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.7" />
<PackageReference
Include="Microsoft.Extensions.DependencyInjection.Abstractions"
Version="9.0.7"
/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.7" />
</ItemGroup>
@@ -5,11 +5,7 @@ using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Services;
public class SptServerBackgroundService(
IReadOnlyList<SptMod> loadedMods,
BundleLoader bundleLoader,
App app
) : BackgroundService
public class SptServerBackgroundService(IReadOnlyList<SptMod> loadedMods, BundleLoader bundleLoader, App app) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{