1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Modules - Automatically determine IsAlwaysAvailable

Plugins - Clean up old files
This commit is contained in:
Robert 2021-06-03 22:56:11 +02:00
parent ceeaa4bf6d
commit 4c3e9b2784
2 changed files with 14 additions and 6 deletions

View File

@ -67,8 +67,8 @@ namespace Artemis.Core.Modules
/// </summary>
public abstract class Module : PluginFeature
{
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
/// <summary>
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
@ -126,11 +126,14 @@ namespace Artemis.Core.Modules
public ActivationRequirementType ActivationRequirementMode { get; set; } = ActivationRequirementType.Any;
/// <summary>
/// Gets or sets a boolean indicating whether this module is always available to profiles or only when profiles
/// specifically target this module.
/// <para>Note: If set to <see langword="true" />, <see cref="ActivationRequirements" /> are not evaluated.</para>
/// Gets a boolean indicating whether this module is always available to profiles or only to profiles that specifically
/// target this module.
/// <para>
/// Note: <see langword="true" /> if there are any <see cref="ActivationRequirements" />; otherwise
/// <see langword="false" />
/// </para>
/// </summary>
public bool IsAlwaysAvailable { get; set; }
public bool IsAlwaysAvailable => ActivationRequirements.Count == 0;
/// <summary>
/// Gets whether updating this module is currently allowed
@ -265,7 +268,7 @@ namespace Artemis.Core.Modules
/// <inheritdoc />
internal override void InternalEnable()
{
foreach ((DefaultCategoryName categoryName, var path) in _pendingDefaultProfilePaths)
foreach ((DefaultCategoryName categoryName, var path) in _pendingDefaultProfilePaths)
AddDefaultProfile(categoryName, path);
_pendingDefaultProfilePaths.Clear();

View File

@ -66,6 +66,11 @@ namespace Artemis.Core.Services
OnCopyingBuildInPlugins();
DirectoryInfo pluginDirectory = new(Path.Combine(Constants.DataFolder, "plugins"));
if (Directory.Exists(Path.Combine(pluginDirectory.FullName, "Artemis.Plugins.Modules.Overlay-29e3ff97")))
Directory.Delete(Path.Combine(pluginDirectory.FullName, "Artemis.Plugins.Modules.Overlay-29e3ff97"), true);
if (Directory.Exists(Path.Combine(pluginDirectory.FullName, "Artemis.Plugins.DataModelExpansions.TestData-ab41d601")))
Directory.Delete(Path.Combine(pluginDirectory.FullName, "Artemis.Plugins.DataModelExpansions.TestData-ab41d601"), true);
// Iterate built-in plugins
DirectoryInfo builtInPluginDirectory = new(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
if (!builtInPluginDirectory.Exists)