mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Modules - Remove Name and Icon in favor PluginFeature attribute
This commit is contained in:
1 parent
730207ccd0
commit
2179c889a3
14 files changed
+54
-90
No files matched your search
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Artemis.Core;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Artemis.UI.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides utilities for UI-related plugin tasks
|
||||
/// </summary>
|
||||
public static class PluginUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Transforms the provided icon so that it is usable by the <see cref="ArtemisIcon" /> control
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin the icon belongs to</param>
|
||||
/// <param name="icon">
|
||||
/// The icon, may be a string representation of a <see cref="PackIconKind" /> or a relative path
|
||||
/// pointing to a .svg file
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public static object GetPluginIcon(Plugin plugin, string icon)
|
||||
{
|
||||
if (icon == null)
|
||||
return PackIconKind.QuestionMarkCircle;
|
||||
|
||||
// Icon is provided as a path
|
||||
if (icon.EndsWith(".svg"))
|
||||
{
|
||||
string iconPath = plugin.ResolveRelativePath(icon);
|
||||
if (!File.Exists(iconPath))
|
||||
return PackIconKind.QuestionMarkCircle;
|
||||
return iconPath;
|
||||
}
|
||||
|
||||
// Icon is provided as string to avoid having to reference MaterialDesignThemes
|
||||
bool parsedIcon = Enum.TryParse(icon, true, out PackIconKind iconEnum);
|
||||
if (parsedIcon == false)
|
||||
iconEnum = PackIconKind.QuestionMarkCircle;
|
||||
return iconEnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user