Plugins - Added help pages

This commit is contained in:
Robert committed 2023-04-14 11:55:53 +02:00
1 parent b59e898dd3
commit 949106e470
12 files changed
+134 -43

No files matched your search

+3
View File
@@ -188,6 +188,9 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
}
}
[JsonProperty]
internal List<PluginInfoHelpPage> HelpPages { get; set; } = new();
/// <summary>
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
/// </summary>
@@ -0,0 +1,26 @@
using Newtonsoft.Json;
namespace Artemis.Core;
/// <summary>
/// Represents basic info about a plugin and contains a reference to the instance of said plugin
/// </summary>
internal class PluginInfoHelpPage
{
[JsonConstructor]
public PluginInfoHelpPage(string title, string markdownFile, string id)
{
Title = title;
MarkdownFile = markdownFile;
Id = id;
}
[JsonProperty(Required = Required.Always)]
public string Title { get; }
[JsonProperty(Required = Required.Always)]
public string MarkdownFile { get; }
[JsonProperty(Required = Required.Always)]
public string Id { get; }
}
@@ -350,6 +350,9 @@ internal class PluginManagementService : IPluginManagementService
// Load the entity and fall back on creating a new one
Plugin plugin = new(pluginInfo, directory, _pluginRepository.GetPluginByGuid(pluginInfo.Guid));
foreach (PluginInfoHelpPage pluginInfoHelpPage in pluginInfo.HelpPages)
plugin.HelpPages.Add(new MarkdownPluginHelpPage(plugin, pluginInfoHelpPage.Title, pluginInfoHelpPage.Id, pluginInfoHelpPage.MarkdownFile));
OnPluginLoading(new PluginEventArgs(plugin));
// Locate the main assembly entry