.NET Format Style Fixes

This commit is contained in:
chompDev
2025-07-18 15:21:55 +00:00
committed by Format Bot
parent 1af50bfd34
commit 0ba517436e
3 changed files with 52 additions and 37 deletions
@@ -85,9 +85,9 @@ namespace SPTarkov.Server.Core.Migration.Migrations
);
//Directly injecting CreateProfileService causes a circular dependency which I can't be bothered to fix just for this
(serviceProvider
.GetService(typeof(CreateProfileService)) as CreateProfileService)!
.AddMissingInternalContainersToProfile(profile.CharacterData.PmcData);
(
serviceProvider.GetService(typeof(CreateProfileService)) as CreateProfileService
)!.AddMissingInternalContainersToProfile(profile.CharacterData.PmcData);
}
if (profile.CharacterData.PmcData.Hideout.Customization is null)
@@ -135,15 +135,15 @@ namespace SPTarkov.Server.Core.Migration.Migrations
.ToList();
//Directly injecting RewardHelper causes a circular dependency which I can't be bothered to fix just for this
(serviceProvider
.GetService(typeof(RewardHelper)) as RewardHelper)!
.ApplyRewards(
filteredRewards,
CustomisationSource.ACHIEVEMENT,
profile,
profile.CharacterData.PmcData,
achievementId
);
(
serviceProvider.GetService(typeof(RewardHelper)) as RewardHelper
)!.ApplyRewards(
filteredRewards,
CustomisationSource.ACHIEVEMENT,
profile,
profile.CharacterData.PmcData,
achievementId
);
}
}
+31 -23
View File
@@ -77,7 +77,9 @@ 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
@@ -103,35 +105,41 @@ public static class Program
new WebSocketOptions
{
// Every minute a heartbeat is sent to keep the connection alive.
KeepAliveInterval = TimeSpan.FromSeconds(60)
KeepAliveInterval = TimeSpan.FromSeconds(60),
}
);
app.Use(
async (HttpContext context, RequestDelegate _) =>
{
await context.RequestServices.GetService<HttpServer>()!.HandleRequest(context);
}
);
app.Use(async (HttpContext context, RequestDelegate _) =>
{
await context.RequestServices.GetService<HttpServer>()!.HandleRequest(context);
});
}
private static void ConfigureKestrel(WebApplicationBuilder builder)
{
builder.WebHost.ConfigureKestrel((_, options) =>
{
var httpConfig = options.ApplicationServices.GetService<ConfigServer>()?.GetConfig<HttpConfig>()!;
var certHelper = options.ApplicationServices.GetService<CertificateHelper>()!;
options.Listen(
IPAddress.Parse(httpConfig.Ip),
httpConfig.Port,
listenOptions =>
{
listenOptions.UseHttps(opts =>
builder.WebHost.ConfigureKestrel(
(_, options) =>
{
var httpConfig = options
.ApplicationServices.GetService<ConfigServer>()
?.GetConfig<HttpConfig>()!;
var certHelper = options.ApplicationServices.GetService<CertificateHelper>()!;
options.Listen(
IPAddress.Parse(httpConfig.Ip),
httpConfig.Port,
listenOptions =>
{
opts.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
opts.ServerCertificate = certHelper.LoadOrGenerateCertificatePfx();
opts.ClientCertificateMode = ClientCertificateMode.NoCertificate;
});
}
);
});
listenOptions.UseHttps(opts =>
{
opts.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
opts.ServerCertificate = certHelper.LoadOrGenerateCertificatePfx();
opts.ClientCertificateMode = ClientCertificateMode.NoCertificate;
});
}
);
}
);
}
private static WebApplicationBuilder CreateNewHostBuilder(string[]? args = null)
@@ -5,7 +5,11 @@ 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)
{
@@ -16,7 +20,10 @@ public class SptServerBackgroundService(IReadOnlyList<SptMod> loadedMods, Bundle
if (mod.ModMetadata?.IsBundleMod == true)
{
// Convert to relative path
var relativeModPath = Path.GetRelativePath(Directory.GetCurrentDirectory(), mod.Directory)
var relativeModPath = Path.GetRelativePath(
Directory.GetCurrentDirectory(),
mod.Directory
)
.Replace('\\', '/');
bundleLoader.AddBundles(relativeModPath);