1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-04-21 17:15:43 +02:00

Force invariant culture for all applications

This commit is contained in:
chylex 2024-03-30 08:23:39 +01:00
parent c1cbb848a9
commit 94148add2d
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
4 changed files with 20 additions and 2 deletions
Agent/Phantom.Agent
Controller/Phantom.Controller
Utils/Phantom.Utils/Runtime
Web/Phantom.Web

View File

@ -18,12 +18,13 @@ const int ProtocolVersion = 1;
var shutdownCancellationTokenSource = new CancellationTokenSource();
var shutdownCancellationToken = shutdownCancellationTokenSource.Token;
ProgramCulture.UseInvariantCulture();
ThreadPool.SetMinThreads(workerThreads: 2, completionPortThreads: 1);
PosixSignals.RegisterCancellation(shutdownCancellationTokenSource, static () => {
PhantomLogger.Root.InformationHeading("Stopping Phantom Panel agent...");
});
ThreadPool.SetMinThreads(workerThreads: 2, completionPortThreads: 1);
try {
var fullVersion = AssemblyAttributes.GetFullVersion(Assembly.GetExecutingAssembly());

View File

@ -15,6 +15,8 @@ using Phantom.Utils.Tasks;
var shutdownCancellationTokenSource = new CancellationTokenSource();
var shutdownCancellationToken = shutdownCancellationTokenSource.Token;
ProgramCulture.UseInvariantCulture();
PosixSignals.RegisterCancellation(shutdownCancellationTokenSource, static () => {
PhantomLogger.Root.InformationHeading("Stopping Phantom Panel controller...");
});

View File

@ -0,0 +1,13 @@
using System.Globalization;
namespace Phantom.Utils.Runtime;
public static class ProgramCulture {
public static void UseInvariantCulture() {
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
}
}

View File

@ -17,6 +17,8 @@ using Phantom.Web.Services.Rpc;
var shutdownCancellationTokenSource = new CancellationTokenSource();
var shutdownCancellationToken = shutdownCancellationTokenSource.Token;
ProgramCulture.UseInvariantCulture();
PosixSignals.RegisterCancellation(shutdownCancellationTokenSource, static () => {
PhantomLogger.Root.InformationHeading("Stopping Phantom Panel web...");
});