more logging

This commit is contained in:
2024-12-05 07:22:01 +01:00
parent 3e1ab72162
commit 3b79335e85
2 changed files with 10 additions and 9 deletions

View File

@@ -12,9 +12,12 @@ namespace ModpackUpdater.Apps.Client;
public static class Program
{
private static readonly SettingsManager settingsManager;
private static readonly ILogger log = new ConsoleLogger();
public static ISettings Settings => settingsManager.Instance;
public static ILogger Log => log;
[DllImport("kernel32.dll")]
static extern nint GetConsoleWindow();
@@ -100,21 +103,21 @@ public static class Program
// Check for update
var installer = new ModpackInstaller(config, info)
{
Log = new ConsoleLogger(),
Log = Log,
};
var result = installer.Check(updateOptions).Result;
if (!silent && !updateOptions.NoUpdate && new AppUpdater().Check().Result)
Console.WriteLine("A new version is available!");
Log.Info("A new version is available!");
if (result.HasUpdates)
{
var success = installer.Install(result).Result;
if (!silent)
Console.WriteLine($"Installation {(success ?? false ? "completed successfully" : "failed")}!");
Log.Info($"Installation {(success ?? false ? "completed successfully" : "failed")}!");
}
else if (!silent)
Console.WriteLine("No updates available");
Log.Info("No updates available");
}
private static string CheckModpackConfigUrl(string configUrl, ModpackInfo info)