some fixes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -348,3 +348,4 @@ MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
*.json
|
||||
|
||||
@@ -17,16 +17,16 @@ internal class Options
|
||||
{
|
||||
options = new OptionSet
|
||||
{
|
||||
{ "silent", "Do not output anything.", s => Silent = s != null },
|
||||
{ "h|help", "Writes the help text as output.", h => Help = h != null },
|
||||
{ "n|noui", "Install without user interface.", n => NoUi = n != null },
|
||||
{ "silent", "Do not output anything.", s => Silent = true },
|
||||
{ "h|help", "Writes the help text as output.", h => Help = true },
|
||||
{ "n|noui", "Install without user interface.", n => NoUi = true },
|
||||
{ "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p },
|
||||
{ "c|config=", "Sets the modpack update info url.", c => UpdateOptions.ModpackConfig = c },
|
||||
{ "s|side=", "Sets the installation side.\nDefault side is Client.\nAvailable: Client, Server", s => UpdateOptions.Side = Enum.Parse<Side>(s)},
|
||||
{ "u|uai", "Allow an update directly after install. This only has effect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = uai != null},
|
||||
{ "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = noupdate != null},
|
||||
{ "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = m != null},
|
||||
{ "i|nonpublic", "Include non public (currently hidden) updates.", i => UpdateOptions.IncludeNonPublic = i != null},
|
||||
{ "u|uai", "Disallow an update directly after install. This only has effect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = false},
|
||||
{ "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = true},
|
||||
{ "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = true},
|
||||
{ "i|nonpublic", "Include non public (currently hidden) updates.", i => UpdateOptions.IncludeNonPublic = true},
|
||||
{ "k|key=", "An key for retriving extra files on updates.", k => UpdateOptions.ExtrasKey = k},
|
||||
};
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
}
|
||||
|
||||
installInfos = await DownloadInstallInfos();
|
||||
result.CurrentVersion = modpackInfo.Version ?? new Version("0.0.0.0");
|
||||
var curVersion = result.CurrentVersion;
|
||||
|
||||
// Check install actions
|
||||
if (!exists)
|
||||
@@ -70,7 +72,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
{
|
||||
result.Actions.AddRange(actions);
|
||||
result.LatestVersion = installInfos.Version;
|
||||
result.CurrentVersion = installInfos.Version;
|
||||
curVersion = installInfos.Version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,15 +89,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
{
|
||||
var updatesOrderes = updateInfos.Updates.Where(n => n.IsPublic || options.IncludeNonPublic).OrderByDescending(n => n.Version);
|
||||
result.LatestVersion = updatesOrderes.First().Version;
|
||||
if (exists)
|
||||
result.CurrentVersion = modpackInfo.Version;
|
||||
result.IsInstalled = true;
|
||||
|
||||
var checkingVersionIndex = 0;
|
||||
var checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex);
|
||||
var actionsZeroIndex = result.Actions.Count; // Ensure we insert update actions behind install actions
|
||||
|
||||
while (checkingVersion is not null && checkingVersion.Version > result.CurrentVersion)
|
||||
while (checkingVersion is not null && checkingVersion.Version > curVersion)
|
||||
{
|
||||
var actionsToAdd = new List<UpdateAction>();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ModpackInfo
|
||||
|
||||
public void Save()
|
||||
{
|
||||
File.WriteAllText(Conversions.ToString(GetFilePath(LocaLPath)), JsonConvert.SerializeObject(this));
|
||||
File.WriteAllText(GetFilePath(LocaLPath), JsonConvert.SerializeObject(this));
|
||||
}
|
||||
|
||||
public void Save(string mcRoot)
|
||||
|
||||
Reference in New Issue
Block a user