Skip to content

Commit

Permalink
Force UI culture
Browse files Browse the repository at this point in the history
  • Loading branch information
Equinox- committed Feb 23, 2024
1 parent 61044ab commit cf8c625
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Meds.Watchdog/Entrypoint.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Meds.Dist;
using Meds.Shared;
Expand All @@ -8,7 +10,6 @@
using Meds.Watchdog.Utils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SteamKit2;

namespace Meds.Watchdog
Expand All @@ -17,6 +18,12 @@ public sealed class Entrypoint
{
public static async Task Main(string[] args)
{
var culture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = culture;
CultureInfo.CurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
CultureInfo.DefaultThreadCurrentCulture = culture;

if (args.Length == 3 && args[0] == "restore-game-binaries")
{
await CiUtils.RestoreGameBinaries(args[1], args[2]);
Expand Down
7 changes: 7 additions & 0 deletions Meds.Wrapper/Entrypoint.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using Meds.Shared;
using Meds.Wrapper.Shim;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -18,6 +19,12 @@ public static class Entrypoint

public static void Main(string[] args)
{
var culture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = culture;
CultureInfo.CurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
CultureInfo.DefaultThreadCurrentCulture = culture;

if (args.Length != 2)
throw new Exception("Wrapper should not be invoked manually. [installConfig] [runtimeConfig]");
var cfg = new Configuration(args[0], args[1]);
Expand Down
9 changes: 8 additions & 1 deletion Meds.Wrapper/Shim/PatchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ public static void Patch(Type type)

public static IEnumerable<(MyModContext mod, Type type)> ModTypes(string typeName)
{
foreach (var kv in MySession.Static.ModManager.Assemblies)
var mods = MySession.Static?.ModManager;
if (mods == null)
{
Entrypoint.LoggerFor(typeof(PatchHelper))?
.ZLogWarning("Tried to fetch mod types {0} but mod manager isn't initialized", typeName);
yield break;
}
foreach (var kv in mods.Assemblies)
{
var type = kv.Value.GetType(typeName);
if (type == null) continue;
Expand Down

0 comments on commit cf8c625

Please sign in to comment.