mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Debugger - Added datamodel debugger
Shared UI - Added data model VMs
This commit is contained in:
1 parent
e05de0d780
commit
e4c1c99e27
39 files changed
+2737
-54
No files matched your search
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Ninject;
|
||||
using Artemis.Core.ScriptingProviders;
|
||||
using Artemis.Storage;
|
||||
@@ -23,17 +21,19 @@ namespace Artemis.Core.Services
|
||||
internal class CoreService : ICoreService
|
||||
{
|
||||
internal static IKernel? Kernel;
|
||||
|
||||
private readonly Stopwatch _frameStopWatch;
|
||||
private readonly ILogger _logger;
|
||||
private readonly PluginSetting<LogEventLevel> _loggingLevel;
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IScriptingService _scriptingService;
|
||||
private readonly IRgbService _rgbService;
|
||||
private readonly IScriptingService _scriptingService;
|
||||
private readonly List<Exception> _updateExceptions = new();
|
||||
|
||||
private int _frames;
|
||||
private DateTime _lastExceptionLog;
|
||||
private DateTime _lastFrameRateSample;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public CoreService(IKernel kernel,
|
||||
@@ -151,6 +151,15 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
_rgbService.CloseRender();
|
||||
_frameStopWatch.Stop();
|
||||
_frames++;
|
||||
|
||||
if ((DateTime.Now - _lastFrameRateSample).TotalSeconds >= 1)
|
||||
{
|
||||
FrameRate = _frames;
|
||||
_frames = 0;
|
||||
_lastFrameRateSample = DateTime.Now;
|
||||
}
|
||||
|
||||
FrameTime = _frameStopWatch.Elapsed;
|
||||
|
||||
LogUpdateExceptions();
|
||||
@@ -181,6 +190,7 @@ namespace Artemis.Core.Services
|
||||
Initialized?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public int FrameRate { get; private set; }
|
||||
public TimeSpan FrameTime { get; private set; }
|
||||
public bool ProfileRenderingDisabled { get; set; }
|
||||
public List<string> StartupArguments { get; set; }
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace Artemis.Core.Services
|
||||
/// </summary>
|
||||
TimeSpan FrameTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of frames rendered each second
|
||||
/// </summary>
|
||||
public int FrameRate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether profiles are rendered each frame by calling their Render method
|
||||
/// </summary>
|
||||
|
||||
@@ -579,9 +579,9 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
if (plugin.IsEnabled)
|
||||
throw new ArtemisCoreException("Cannot remove the settings of an enabled plugin");
|
||||
|
||||
|
||||
_pluginRepository.RemoveSettings(plugin.Guid);
|
||||
foreach (DeviceEntity deviceEntity in _deviceRepository.GetAll().Where(e => e.DeviceProvider == plugin.Guid.ToString()))
|
||||
foreach (DeviceEntity deviceEntity in _deviceRepository.GetAll().Where(e => e.DeviceProvider == plugin.Guid.ToString()))
|
||||
_deviceRepository.Remove(deviceEntity);
|
||||
|
||||
plugin.Settings?.ClearSettings();
|
||||
@@ -602,7 +602,10 @@ namespace Artemis.Core.Services
|
||||
if (!saveState)
|
||||
{
|
||||
OnPluginFeatureEnableFailed(new PluginFeatureEventArgs(pluginFeature));
|
||||
throw new ArtemisCoreException("Cannot enable a feature that requires elevation without saving it's state.");
|
||||
if (isAutoEnable)
|
||||
_logger.Warning("Skipped auto-enabling plugin feature {feature} - {plugin} because it requires elevation but state isn't being saved", pluginFeature, pluginFeature.Plugin);
|
||||
else
|
||||
throw new ArtemisCoreException("Cannot enable a feature that requires elevation without saving it's state.");
|
||||
}
|
||||
|
||||
pluginFeature.Entity.IsEnabled = true;
|
||||
|
||||
@@ -32,5 +32,15 @@ namespace Artemis.Core
|
||||
|
||||
return Enum.GetValues(t).Cast<Enum>().Select(e => (e, e.Humanize())).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Humanizes the given enum value using the Humanizer library
|
||||
/// </summary>
|
||||
/// <param name="value">The enum value to humanize</param>
|
||||
/// <returns>A humanized string describing the given value</returns>
|
||||
public static string HumanizeValue(Enum value)
|
||||
{
|
||||
return value.Humanize();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user