repair manager project

This commit is contained in:
2025-06-26 18:53:00 +02:00
parent d85a41c158
commit 04848d4622
31 changed files with 129 additions and 122 deletions

View File

@@ -1,9 +1,11 @@
using Castle.Core.Logging;
using Gtk;
using Microsoft.Win32;
using ModpackUpdater.Manager;
using Newtonsoft.Json;
using Pilz;
using Pilz.Configuration;
using Pilz.UI.Gtk.Symbols;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
@@ -18,10 +20,9 @@ public static class Program
private static readonly ILogger log = new ConsoleLogger();
private static Application uiApp;
public static IGtkSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
public static ISettings Settings => settingsManager.Instance;
public static ILogger Log => log;
internal static Options Options { get; private set; }
[DllImport("kernel32.dll")]
@@ -54,6 +55,9 @@ public static class Program
private static void RunApp(UpdateCheckOptionsAdv updateOptions)
{
if (UsesWindowsDarkTheme())
Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark");
Application.Init();
uiApp = new Application("ModpackUpdater.Apps.Client", GLib.ApplicationFlags.None);
@@ -170,4 +174,19 @@ public static class Program
return info.ConfigUrl;
return configUrl;
}
private static bool UsesWindowsDarkTheme()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
try
{
return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default;
}
catch (Exception)
{
}
}
return default;
}
}