use modpack config for finding updates
This commit is contained in:
@@ -73,7 +73,7 @@ internal static class SharedFunctions
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Collect updates
|
// Collect updates
|
||||||
var ucDialog = new UpdatesCollectorUi(actions);
|
var ucDialog = new UpdatesCollectorUi(api.CurWorkspace, actions);
|
||||||
if (!ucDialog.ShowDialog(api.MainWindow).IsOk() || ucDialog.CurrentUpdates is null)
|
if (!ucDialog.ShowDialog(api.MainWindow).IsOk() || ucDialog.CurrentUpdates is null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using ModpackUpdater.Manager;
|
using ModpackUpdater.Apps.Manager.Api.Model;
|
||||||
|
using ModpackUpdater.Manager;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace ModpackUpdater.Apps.Manager.Ui;
|
namespace ModpackUpdater.Apps.Manager.Ui;
|
||||||
@@ -12,6 +13,7 @@ public partial class UpdatesCollectorUi : RadForm
|
|||||||
|
|
||||||
public record ModUpdates(IEnumerable<ModUpdateInfo> List);
|
public record ModUpdates(IEnumerable<ModUpdateInfo> List);
|
||||||
|
|
||||||
|
private readonly IWorkspace workspace;
|
||||||
private readonly ModpackFactory factory = new();
|
private readonly ModpackFactory factory = new();
|
||||||
private readonly InstallAction[] actions;
|
private readonly InstallAction[] actions;
|
||||||
|
|
||||||
@@ -21,10 +23,13 @@ public partial class UpdatesCollectorUi : RadForm
|
|||||||
|
|
||||||
public int SelectedVersion => radListView_VersionTags.SelectedIndex;
|
public int SelectedVersion => radListView_VersionTags.SelectedIndex;
|
||||||
|
|
||||||
public UpdatesCollectorUi(params InstallAction[] actions)
|
public UpdatesCollectorUi(IWorkspace workspace, params InstallAction[] actions)
|
||||||
{
|
{
|
||||||
|
this.workspace = workspace;
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
radListView_Updates.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
|
radListView_Updates.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
|
||||||
radListView_VersionTags.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
|
radListView_VersionTags.AutoSizeColumnsMode = ListViewAutoSizeColumnsMode.Fill;
|
||||||
}
|
}
|
||||||
@@ -35,7 +40,7 @@ public partial class UpdatesCollectorUi : RadForm
|
|||||||
|
|
||||||
foreach (var action in actions)
|
foreach (var action in actions)
|
||||||
{
|
{
|
||||||
var updates = await factory.FindUpdates(action);
|
var updates = await factory.FindUpdates(action, workspace.ModpackConfig?.MinecraftVersion, workspace.ModpackConfig?.ModLoader ?? ModLoader.Any);
|
||||||
|
|
||||||
if (updates == null || updates.Length == 0 || updates[0].Value == action.SourceTag)
|
if (updates == null || updates.Length == 0 || updates[0].Value == action.SourceTag)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ModpackFactory
|
|||||||
return action.SourceUrl;
|
return action.SourceUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<KeyValuePair<string, string>[]> FindUpdates(InstallAction action, ModLoader modLoader = ModLoader.Any, string? gameVersion = null)
|
public async Task<KeyValuePair<string, string>[]> FindUpdates(InstallAction action, string? gameVersion, ModLoader modLoader)
|
||||||
{
|
{
|
||||||
if (action.SourceType == SourceType.GitHub)
|
if (action.SourceType == SourceType.GitHub)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user