a lot of work
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Ui;
|
||||
using Pilz.Features;
|
||||
using Telerik.WinControls.UI;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
|
||||
@@ -12,17 +12,15 @@ internal class CheckAllActionsHealthyFeature : PluginFunction, IPluginFeaturePro
|
||||
|
||||
public CheckAllActionsHealthyFeature() : base(FeatureTypes.Tools, "origin.checkallactionshearlthy", FeatureNamesLangRes.CheckAllActionsHealthy)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.heart_with_pulse, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p
|
||||
|| p.Api.MainWindow is not MainForm mainForm
|
||||
|| mainForm.Controls.Find("radGridView_Actions", true).FirstOrDefault() is not RadGridView gridView)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentGridRows is null)
|
||||
return null;
|
||||
|
||||
SharedFunctions.CheckActionHealthy(p.Api, [.. gridView.Rows]);
|
||||
Task.Run(() => SharedFunctions.CheckActionHealthy(p.Api, [.. p.Api.Model.CurrentGridRows])).Wait();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Ui.Models;
|
||||
using Pilz.Features;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
@@ -10,15 +12,15 @@ internal class ClearDirectLinksFeature : PluginFunction, IPluginFeatureProvider<
|
||||
|
||||
public ClearDirectLinksFeature() : base(FeatureTypes.Tools, "origin.cleardirectlinks", FeatureNamesLangRes.ClearDirectLinksFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.broom, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentGridRows is null)
|
||||
return null;
|
||||
|
||||
SharedFunctions.ClearDirectLinks(p.Api, [.. p.Api.CurWorkspace.InstallInfos.Actions]);
|
||||
SharedFunctions.ClearDirectLinks([.. p.Api.Model.CurrentGridRows]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Ui.Models;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Pilz.Features;
|
||||
using Telerik.WinControls;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
|
||||
@@ -11,20 +15,23 @@ internal class GenerateChangelogFeature : PluginFunction, IPluginFeatureProvider
|
||||
|
||||
public GenerateChangelogFeature() : base(FeatureTypes.Tools, "origin.genchangelog", FeatureNamesLangRes.GenerateChangelogFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.time_machine, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurActionSet is not UpdateInfo updateInfos)
|
||||
if (@params is not MainApiParameters p
|
||||
|| p.Api.Model.CurrentWorkspace?.InstallInfos is null
|
||||
|| p.Api.Model.SelectedTreeNode is not ActionSetTreeNode node
|
||||
|| node.Infos is not UpdateInfo updateInfo)
|
||||
return null;
|
||||
|
||||
var changelog = SharedFunctions.GenerateChangelog(p.Api.CurWorkspace.InstallInfos, updateInfos);
|
||||
if (!string.IsNullOrWhiteSpace(changelog))
|
||||
{
|
||||
Clipboard.SetText(changelog);
|
||||
RadMessageBox.Show(p.Api.MainWindow, MsgBoxLangRes.ChangelogCopiedToClipboard, MsgBoxLangRes.ChangelogCopiedToClipboard_Title, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
}
|
||||
var changelog = SharedFunctions.GenerateChangelog(p.Api.Model.CurrentWorkspace.InstallInfos, updateInfo);
|
||||
if (string.IsNullOrWhiteSpace(changelog))
|
||||
return null;
|
||||
|
||||
p.Api.MainWindow.Clipboard?.SetTextAsync(changelog);
|
||||
MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.ChangelogCopiedToClipboard_Title, MsgBoxLangRes.ChangelogCopiedToClipboard, ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Info).ShowAsPopupAsync(p.Api.MainWindow);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Utils;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Pilz.Features;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
internal class GenerateModlistAsExcelFeature : PluginFunction, IPluginFeatureProvider<GenerateModlistAsExcelFeature>
|
||||
@@ -11,28 +16,28 @@ internal class GenerateModlistAsExcelFeature : PluginFunction, IPluginFeaturePro
|
||||
|
||||
public GenerateModlistAsExcelFeature() : base(FeatureTypes.Tools, "origin.genmodlist.xlsx", FeatureNamesLangRes.GenerateModlistAsExcelFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.list_view, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentWorkspace?.InstallInfos is null)
|
||||
return null;
|
||||
|
||||
using var pkg = SharedFunctions.GenerateModlistAsExcel(p.Api.CurWorkspace.InstallInfos);
|
||||
if (pkg is null)
|
||||
// Generate excel
|
||||
using var pkg = SharedFunctions.GenerateModlistAsExcel(p.Api.Model.CurrentWorkspace.InstallInfos);
|
||||
|
||||
// Ask for save
|
||||
var file = Task.Run(() => TopLevel.GetTopLevel(p.Api.MainWindow)!.StorageProvider.SaveFilePickerAsync(new()
|
||||
{
|
||||
FileTypeChoices = [MyFilePickerFileTypes.Excel]
|
||||
})).Result;
|
||||
if (file is null)
|
||||
return null;
|
||||
|
||||
using var sfd = new RadSaveFileDialog
|
||||
{
|
||||
Filter = "*.xlsx|*.xlsx|*|*"
|
||||
};
|
||||
|
||||
if (sfd.ShowDialog(p.Api.MainWindow) == DialogResult.OK)
|
||||
{
|
||||
pkg.SaveAs(sfd.FileName);
|
||||
RadMessageBox.Show(p.Api.MainWindow, MsgBoxLangRes.ModlistGenerated, MsgBoxLangRes.ModlistGenerated_Title, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
}
|
||||
|
||||
// Save file
|
||||
pkg.SaveAs(file.Path.AbsolutePath);
|
||||
MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.ModlistGenerated_Title, MsgBoxLangRes.ModlistGenerated, ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Info).ShowAsPopupAsync(p.Api.MainWindow);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Pilz.Features;
|
||||
using Telerik.WinControls;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
|
||||
internal class GenerateModlistAsMarkdownFeature : PluginFunction, IPluginFeatureProvider<GenerateModlistAsMarkdownFeature>
|
||||
{
|
||||
public static GenerateModlistAsMarkdownFeature Instance { get; } = new();
|
||||
|
||||
public GenerateModlistAsMarkdownFeature() : base(FeatureTypes.Tools, "origin.genmodlist.md", FeatureNamesLangRes.GenerateModlistAsMarkdownFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.list_view, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentWorkspace?.InstallInfos is null)
|
||||
return null;
|
||||
|
||||
Clipboard.SetText(SharedFunctions.GenerateModlistAsMarkdown(p.Api.CurWorkspace.InstallInfos));
|
||||
p.Api.MainWindow.Clipboard?.SetTextAsync(SharedFunctions.GenerateModlistAsMarkdown(p.Api.Model.CurrentWorkspace.InstallInfos));
|
||||
|
||||
RadMessageBox.Show(p.Api.MainWindow, MsgBoxLangRes.ModlistCopiedToClipboard, MsgBoxLangRes.ModlistCopiedToClipboard_Title, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.ModlistCopiedToClipboard_Title, MsgBoxLangRes.ModlistCopiedToClipboard, ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Info).ShowAsPopupAsync(p.Api.MainWindow);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using Pilz.Features;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
|
||||
@@ -10,15 +12,15 @@ internal class UpdateDirectLinksFeature : PluginFunction, IPluginFeatureProvider
|
||||
|
||||
public UpdateDirectLinksFeature() : base(FeatureTypes.Tools, "origin.updatedirectlinks", FeatureNamesLangRes.UpdateDirectLinksFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.renew, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.renew, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentGridRows is null)
|
||||
return null;
|
||||
|
||||
SharedFunctions.FindNewDirectLinks(p.Api, [.. p.Api.CurWorkspace.InstallInfos.Actions]);
|
||||
Task.Run(() => SharedFunctions.FindNewDirectLinks([.. p.Api.Model.CurrentGridRows])).Wait();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using Pilz.Features;
|
||||
using Pilz.UI.Symbols;
|
||||
@@ -11,15 +12,15 @@ internal class UpdatesCollectorFeature : PluginFunction, IPluginFeatureProvider<
|
||||
|
||||
public UpdatesCollectorFeature() : base(FeatureTypes.Tools, "origin.updatescollector", FeatureNamesLangRes.UpdatesCollectorFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.search, SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.search, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
if (@params is not MainApiParameters p || p.Api.Model.CurrentWorkspace?.InstallInfos is null)
|
||||
return null;
|
||||
|
||||
SharedFunctions.CollectUpdates(p.Api, [.. p.Api.CurWorkspace.InstallInfos.Actions]);
|
||||
Task.Run(() => SharedFunctions.CollectUpdates(p.Api, [.. p.Api.Model.CurrentWorkspace.InstallInfos.Actions])).Wait();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user