mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Modules - Added IsActivatedOverride which indicates exactly that
Core - During creation ensure all local users can access the data folder Core - Wrap exceptions during module enable/disable in PluginExceptions
This commit is contained in:
1 parent
0beae810ea
commit
cf8e6e1b2b
4 files changed
+65
-16
No files matched your search
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Modules;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
@@ -156,20 +157,36 @@ namespace Artemis.Core.Services
|
||||
|
||||
private async Task ActivateModule(Module module, bool isOverride)
|
||||
{
|
||||
module.Activate(isOverride);
|
||||
try
|
||||
{
|
||||
module.Activate(isOverride);
|
||||
|
||||
// If this is a profile module, activate the last active profile after module activation
|
||||
if (module is ProfileModule profileModule)
|
||||
await _profileService.ActivateLastProfileAnimated(profileModule);
|
||||
// If this is a profile module, activate the last active profile after module activation
|
||||
if (module is ProfileModule profileModule)
|
||||
await _profileService.ActivateLastProfileAnimated(profileModule);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(new ArtemisPluginException(module.PluginInfo, "Failed to activate module and last profile.", e), "Failed to activate module and last profile");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeactivateModule(Module module, bool isOverride)
|
||||
{
|
||||
// If this is a profile module, activate the last active profile after module activation
|
||||
if (module.IsActivated && module is ProfileModule profileModule)
|
||||
await profileModule.ChangeActiveProfileAnimated(null, null);
|
||||
try
|
||||
{
|
||||
// If this is a profile module, activate the last active profile after module activation
|
||||
if (module.IsActivated && module is ProfileModule profileModule)
|
||||
await profileModule.ChangeActiveProfileAnimated(null, null);
|
||||
|
||||
module.Deactivate(isOverride);
|
||||
module.Deactivate(isOverride);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(new ArtemisPluginException(module.PluginInfo, "Failed to deactivate module and last profile.", e), "Failed to deactivate module and last profile");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulatePriorities()
|
||||
|
||||
Reference in new issue
Block a user