mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Plugins - Separated VMs into folders
Plugins - Added help pages
This commit is contained in:
1 parent
2f270c9c03
commit
b59e898dd3
29 files changed
+350
-43
No files matched your search
@@ -0,0 +1,22 @@
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a plugin related help page
|
||||
/// </summary>
|
||||
public interface IPluginHelpPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the plugin the help page belongs to.
|
||||
/// </summary>
|
||||
Plugin Plugin { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title of the help page.
|
||||
/// </summary>
|
||||
public string Title { get; }
|
||||
|
||||
/// <summary>
|
||||
/// An ID used to quickly lead users to the help page in case of an error.
|
||||
/// </summary>
|
||||
public string Id { get; }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a plugin related help page
|
||||
/// </summary>
|
||||
public class MarkdownPluginHelpPage : IPluginHelpPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="MarkdownPluginHelpPage" /> class.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin to display the markdown for.</param>
|
||||
/// <param name="markdownFile">A file path relative to the plugin or absolute, pointing to the markdown to display</param>
|
||||
/// <param name="id">The ID of the help page, used to quickly lead users to it in case of errors.</param>
|
||||
/// <exception cref="FileNotFoundException"></exception>
|
||||
public MarkdownPluginHelpPage(Plugin plugin, string title, string id, string markdownFile)
|
||||
{
|
||||
Plugin = plugin;
|
||||
Title = title;
|
||||
Id = id;
|
||||
MarkdownFile = Path.IsPathRooted(markdownFile) ? markdownFile : Plugin.ResolveRelativePath(markdownFile);
|
||||
|
||||
if (!File.Exists(MarkdownFile))
|
||||
throw new FileNotFoundException($"Could not find markdown file at \"{MarkdownFile}\"");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Plugin Plugin { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Title { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the absolute path to the markdown that is to be displayed.
|
||||
/// </summary>
|
||||
public string MarkdownFile { get; }
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class Plugin : CorePropertyChanged, IDisposable
|
||||
|
||||
Features = new ReadOnlyCollection<PluginFeatureInfo>(_features);
|
||||
Profilers = new ReadOnlyCollection<Profiler>(_profilers);
|
||||
HelpPages = new List<IPluginHelpPage>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,6 +59,8 @@ public class Plugin : CorePropertyChanged, IDisposable
|
||||
/// </summary>
|
||||
public IPluginConfigurationDialog? ConfigurationDialog { get; set; }
|
||||
|
||||
public List<IPluginHelpPage> HelpPages { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the user enabled the plugin or not
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user