add maintenance mode & improve & bugfixing

This commit is contained in:
2024-06-20 06:55:25 +02:00
parent c31cc3aa20
commit fc27fc1c34
9 changed files with 75 additions and 44 deletions

View File

@@ -1,6 +1,5 @@
using ModpackUpdater.Manager;
using ModpackUpdater.Model;
using Mono.Options;
using Newtonsoft.Json;
using Pilz.Configuration;
using Telerik.WinControls;
@@ -24,12 +23,12 @@ public static class Program
{
var options = new Options(args);
if (options.NoUi)
InstallWithoutGui(options.ModpackConfig, options.ProfileFolder, options.Silent, options.Side, options.AllowUpdaterAfterInstall);
InstallWithoutGui(options.UpdateOptions, options.Silent);
else
RunApp(options.ModpackConfig, options.ProfileFolder, options.Side, options.AllowUpdaterAfterInstall, !options.NoUpdate);
RunApp(options.UpdateOptions);
}
private static void RunApp(string modpackConfig, string profileFolder, Side side, bool allowUpdaterAfterInstall, bool allowUpdateCheck)
private static void RunApp(UpdateCheckOptionsAdv updateOptions)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
@@ -38,7 +37,7 @@ public static class Program
if (ThemeResolutionService.LoadPackageResource("ModpackUpdater.CustomThemes.Office2019DarkBluePurple.tssp"))
ThemeResolutionService.ApplicationThemeName = "Office2019DarkBluePurple";
Application.Run(new Form1(modpackConfig, profileFolder, side, allowUpdaterAfterInstall, allowUpdateCheck));
Application.Run(new Form1(updateOptions));
}
private static string GetSettingsPath(int? settingsVersion = 2)
@@ -72,11 +71,14 @@ public static class Program
File.Delete(settingsPath);
}
private static void InstallWithoutGui(string modpackConfig, string profileFolder, bool silent, Side side, bool allowUpdaterAfterInstall)
private static void InstallWithoutGui(UpdateCheckOptionsAdv updateOptions, bool silent)
{
var config = ModpackConfig.LoadFromUrl(modpackConfig);
var installer = new ModpackInstaller(config, profileFolder);
var result = installer.Check(side, allowUpdaterAfterInstall).Result;
var config = ModpackConfig.LoadFromUrl(updateOptions.ModpackConfig);
var installer = new ModpackInstaller(config, updateOptions.ProfileFolder);
var result = installer.Check(updateOptions).Result;
if (!silent && !updateOptions.NoUpdate && new AppUpdater().Check().Result)
Console.WriteLine("A new version is available!");
if (result.HasUpdates)
{