Auto-run - Moved to task-based approach (WIP)

This commit is contained in:
SpoinkyNL committed 2021-01-24 23:16:13 +01:00
1 parent b4458ddefd
commit 097a5275e2
12 files changed
+424 -43

No files matched your search

@@ -198,9 +198,9 @@ namespace Artemis.Core.Services
// ReSharper disable InconsistentlySynchronizedField - It's read-only, idc
_logger.Debug("Loaded {count} plugin(s)", _plugins.Count);
bool mustElevate = !isElevated && _plugins.Any(p => p.Entity.IsEnabled && p.Info.RequiresAdmin);
if (mustElevate)
bool adminRequired = _plugins.Any(p => p.Entity.IsEnabled && p.Info.RequiresAdmin);
if (!isElevated && adminRequired)
{
_logger.Information("Restarting because one or more plugins requires elevation");
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
@@ -208,6 +208,13 @@ namespace Artemis.Core.Services
return;
}
if (isElevated && !adminRequired)
{
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
Utilities.Restart(false, TimeSpan.Zero);
return;
}
foreach (Plugin plugin in _plugins.Where(p => p.Entity.IsEnabled))
EnablePlugin(plugin, false, ignorePluginLock);