Auto-update - Don't check for updates until after core init finished

Tray - Attempt to more reliably hide icon on application close
Auto-run - Implemented dropping of permissions
This commit is contained in:
Robert committed 2021-01-25 19:33:21 +01:00
1 parent 097a5275e2
commit ca7af1d142
12 files changed
+150 -54

No files matched your search

+8 -3
View File
@@ -63,6 +63,7 @@ namespace Artemis.Core.Services
_loggingLevel = settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Debug);
_renderScale = settingsService.GetSetting("Core.RenderScale", 0.5);
_frameStopWatch = new Stopwatch();
StartupArguments = new List<string>();
UpdatePluginCache();
@@ -77,7 +78,7 @@ namespace Artemis.Core.Services
public TimeSpan FrameTime { get; private set; }
public bool ModuleRenderingDisabled { get; set; }
public List<string>? StartupArguments { get; set; }
public List<string> StartupArguments { get; set; }
public bool IsElevated { get; set; }
public void Dispose()
@@ -109,12 +110,16 @@ namespace Artemis.Core.Services
// Just this line should prevent a certain someone from removing HidSharp as an unused dependency as well
Version? hidSharpVersion = Assembly.GetAssembly(typeof(HidDevice))!.GetName().Version;
_logger.Debug("Forcing plugins to use HidSharp {hidSharpVersion}", hidSharpVersion);
DeserializationLogger.Initialize(Kernel);
// Initialize the services
_pluginManagementService.CopyBuiltInPlugins();
_pluginManagementService.LoadPlugins(StartupArguments != null && StartupArguments.Contains("--ignore-plugin-lock"), IsElevated);
_pluginManagementService.LoadPlugins(
StartupArguments.Contains("--ignore-plugin-lock"),
StartupArguments.Contains("--force-elevation"),
IsElevated
);
ArtemisSurface surfaceConfig = _surfaceService.ActiveSurface;
_logger.Information("Initialized with active surface entity {surfaceConfig}-{guid}", surfaceConfig.Name, surfaceConfig.EntityId);
@@ -26,7 +26,7 @@ namespace Artemis.Core.Services
/// <summary>
/// Gets or sets a list of startup arguments
/// </summary>
List<string>? StartupArguments { get; set; }
List<string> StartupArguments { get; set; }
/// <summary>
/// Gets a boolean indicating whether Artemis is running in an elevated environment (admin permissions)
@@ -26,7 +26,7 @@ namespace Artemis.Core.Services
/// <summary>
/// Loads all installed plugins. If plugins already loaded this will reload them all
/// </summary>
void LoadPlugins(bool ignorePluginLock, bool isElevated);
void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated);
/// <summary>
/// Unloads all installed plugins.
@@ -172,7 +172,7 @@ namespace Artemis.Core.Services
#region Plugins
public void LoadPlugins(bool ignorePluginLock, bool isElevated)
public void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated)
{
if (LoadingPlugins)
throw new ArtemisCoreException("Cannot load plugins while a previous load hasn't been completed yet.");
@@ -208,9 +208,10 @@ namespace Artemis.Core.Services
return;
}
if (isElevated && !adminRequired)
if (isElevated && !adminRequired && !stayElevated)
{
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
_logger.Information("Restarting because no plugin requires elevation and --force-elevation was not supplied");
Utilities.Restart(false, TimeSpan.Zero);
return;
}