add option to include/exclude extra files

This commit is contained in:
2024-06-20 22:19:18 +02:00
parent c97a04c4ce
commit 4ea4a70e50
4 changed files with 5 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
if (installInfos is not null && installInfos.Actions.Count != 0) if (installInfos is not null && installInfos.Actions.Count != 0)
{ {
var actions = installInfos.Actions.Where(n => n.Side.IsSide(options.Side)); var actions = installInfos.Actions.Where(n => n.Side.IsSide(options.Side) && (!n.IsExtra || options.IncludeExtraActions));
if (actions.Any()) if (actions.Any())
{ {
result.Actions.AddRange(installInfos.Actions); result.Actions.AddRange(installInfos.Actions);
@@ -88,7 +88,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
foreach (var action in checkingVersion.Actions) foreach (var action in checkingVersion.Actions)
{ {
if (action.Side.IsSide(options.Side) && !result.Actions.Any(n => n.DestPath == action.DestPath)) if (action.Side.IsSide(options.Side) && (!action.IsExtra || options.IncludeExtraActions) && !result.Actions.Any(n => n.DestPath == action.DestPath))
actionsToAdd.Add(action); actionsToAdd.Add(action);
} }

View File

@@ -7,4 +7,5 @@ public class UpdateCheckOptions
public bool IgnoreMaintenance { get; set; } public bool IgnoreMaintenance { get; set; }
public bool AllowUpdaterAfterInstall { get; set; } = true; public bool AllowUpdaterAfterInstall { get; set; } = true;
public Side Side { get; set; } = Side.Client; public Side Side { get; set; } = Side.Client;
public bool IncludeExtraActions { get; set; }
} }

View File

@@ -7,4 +7,5 @@ public class InstallAction
public string DestPath { get; set; } public string DestPath { get; set; }
public string DownloadUrl { get; set; } public string DownloadUrl { get; set; }
public Side Side { get; set; } = Side.Both; public Side Side { get; set; } = Side.Both;
public bool IsExtra { get; set; }
} }

View File

@@ -24,6 +24,7 @@ internal class Options
{ "uai", "Allow an update directly after install. This only has affect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = uai != null}, { "uai", "Allow an update directly after install. This only has affect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = uai != null},
{ "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = noupdate != null}, { "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = noupdate != null},
{ "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = m != null}, { "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = m != null},
{ "e|extraactions", "Include extra actions.", e => UpdateOptions.IncludeExtraActions = e != null},
}; };
additionals.AddRange(options.Parse(args)); additionals.AddRange(options.Parse(args));