more logging
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -62,8 +62,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
}
|
||||
|
||||
installInfos = await DownloadInstallInfos();
|
||||
result.CurrentVersion = modpackInfo.Version ?? installInfos.Version;
|
||||
var curVersion = result.CurrentVersion;
|
||||
result.CurrentVersion = modpackInfo.Version ?? new Version("0.0.0.0");
|
||||
|
||||
// Check install actions
|
||||
if (!exists)
|
||||
@@ -77,7 +76,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
{
|
||||
result.Actions.AddRange(actions);
|
||||
result.LatestVersion = installInfos.Version;
|
||||
curVersion = installInfos.Version;
|
||||
result.CurrentVersion = installInfos.Version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +95,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
var checkingVersionIndex = 0;
|
||||
var checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex);
|
||||
var actionsZeroIndex = result.Actions.Count; // Ensure we insert update actions behind install actions
|
||||
result.IsInstalled = true;
|
||||
|
||||
while (checkingVersion is not null && checkingVersion.Version > curVersion)
|
||||
while (checkingVersion is not null && checkingVersion.Version > result.CurrentVersion)
|
||||
{
|
||||
var actionsToAdd = new List<UpdateAction>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user