Plugins - Separated VMs into folders

Plugins - Added help pages
This commit is contained in:
Robert committed 2023-04-13 17:41:54 +02:00
1 parent 2f270c9c03
commit b59e898dd3
29 files changed
+350 -43

No files matched your search

@@ -48,17 +48,17 @@ public class ArtemisPluginException : Exception
/// <summary>
/// Creates a new instance of the <see cref="ArtemisPluginException" /> class
/// </summary>
public ArtemisPluginException(string message, string helpDocument) : base(message)
public ArtemisPluginException(string message, string helpPageId) : base(message)
{
HelpDocument = helpDocument;
HelpPageId = helpPageId;
}
/// <summary>
/// Creates a new instance of the <see cref="ArtemisPluginException" /> class
/// </summary>
public ArtemisPluginException(string message, Exception inner, string helpDocument) : base(message, inner)
public ArtemisPluginException(string message, Exception inner, string helpPageId) : base(message, inner)
{
HelpDocument = helpDocument;
HelpPageId = helpPageId;
}
/// <summary>
@@ -67,8 +67,8 @@ public class ArtemisPluginException : Exception
public Plugin? Plugin { get; }
/// <summary>
/// Gets or sets the help document related to this exception.
/// Gets the ID of the help page to display for this exception.
/// </summary>
public string? HelpDocument { get; }
public string? HelpPageId { get; }
}
@@ -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; }
}
+3
View File
@@ -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>