add option to generate markdown table
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using OfficeOpenXml;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
internal class GenerateModlistFeature : PluginFunction, IPluginFeatureProvider<GenerateModlistFeature>
|
||||
internal class GenerateModlistAsExcelFeature : PluginFunction, IPluginFeatureProvider<GenerateModlistAsExcelFeature>
|
||||
{
|
||||
public static GenerateModlistFeature Instance { get; } = new();
|
||||
public static GenerateModlistAsExcelFeature Instance { get; } = new();
|
||||
|
||||
public GenerateModlistFeature() : base(FeatureTypes.Tools, "origin.genmodlist", FeatureNamesLangRes.GenerateModlistFeature)
|
||||
public GenerateModlistAsExcelFeature() : base(FeatureTypes.Tools, "origin.genmodlist.xlsx", FeatureNamesLangRes.GenerateModlistAsExcelFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.list_view, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
}
|
||||
@@ -20,7 +19,7 @@ internal class GenerateModlistFeature : PluginFunction, IPluginFeatureProvider<G
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
return null;
|
||||
|
||||
using var pkg = SharedFunctions.GenerateModlist(p.Api.CurWorkspace.InstallInfos);
|
||||
using var pkg = SharedFunctions.GenerateModlistAsExcel(p.Api.CurWorkspace.InstallInfos);
|
||||
if (pkg is null)
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Telerik.WinControls;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
internal class GenerateModlistAsMarkdownFeature : PluginFunction, IPluginFeatureProvider<GenerateModlistAsExcelFeature>
|
||||
{
|
||||
public static GenerateModlistAsExcelFeature 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);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurWorkspace?.InstallInfos is null)
|
||||
return null;
|
||||
|
||||
Clipboard.SetText(SharedFunctions.GenerateModlistAsMarkdown(p.Api.CurWorkspace.InstallInfos));
|
||||
|
||||
RadMessageBox.Show(p.Api.MainWindow, MsgBoxLangRes.ModlistCopiedToClipboard, MsgBoxLangRes.ModlistCopiedToClipboard_Title, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user