From 4c3e9b2784d9a336455c3e6dfd1926f130167b55 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 3 Jun 2021 22:56:11 +0200 Subject: [PATCH] Modules - Automatically determine IsAlwaysAvailable Plugins - Clean up old files --- src/Artemis.Core/Plugins/Modules/Module.cs | 15 +++++++++------ .../Services/PluginManagementService.cs | 5 +++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Artemis.Core/Plugins/Modules/Module.cs b/src/Artemis.Core/Plugins/Modules/Module.cs index 3aa7816e1..3e0af867d 100644 --- a/src/Artemis.Core/Plugins/Modules/Module.cs +++ b/src/Artemis.Core/Plugins/Modules/Module.cs @@ -67,8 +67,8 @@ namespace Artemis.Core.Modules /// 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(); /// /// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y) @@ -126,11 +126,14 @@ namespace Artemis.Core.Modules public ActivationRequirementType ActivationRequirementMode { get; set; } = ActivationRequirementType.Any; /// - /// Gets or sets a boolean indicating whether this module is always available to profiles or only when profiles - /// specifically target this module. - /// Note: If set to , are not evaluated. + /// Gets a boolean indicating whether this module is always available to profiles or only to profiles that specifically + /// target this module. + /// + /// Note: if there are any ; otherwise + /// + /// /// - public bool IsAlwaysAvailable { get; set; } + public bool IsAlwaysAvailable => ActivationRequirements.Count == 0; /// /// Gets whether updating this module is currently allowed @@ -265,7 +268,7 @@ namespace Artemis.Core.Modules /// internal override void InternalEnable() { - foreach ((DefaultCategoryName categoryName, var path) in _pendingDefaultProfilePaths) + foreach ((DefaultCategoryName categoryName, var path) in _pendingDefaultProfilePaths) AddDefaultProfile(categoryName, path); _pendingDefaultProfilePaths.Clear(); diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs index c9c698be7..00eb627a0 100644 --- a/src/Artemis.Core/Services/PluginManagementService.cs +++ b/src/Artemis.Core/Services/PluginManagementService.cs @@ -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)