mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Data model - Added data model visualization view model
Debugger - Split debugger into different tabs Debugger - Added data model debugger
This commit is contained in:
1 parent
291a343428
commit
796c0dc671
33 files changed
+565
-236
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
@@ -16,6 +17,20 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
get => (T) InternalDataModel;
|
||||
internal set => InternalDataModel = value;
|
||||
}
|
||||
|
||||
internal override void InternalEnablePlugin()
|
||||
{
|
||||
DataModel = Activator.CreateInstance<T>();
|
||||
DataModel.PluginInfo = PluginInfo;
|
||||
DataModel.DataModelDescription = GetDataModelDescription();
|
||||
base.InternalEnablePlugin();
|
||||
}
|
||||
|
||||
internal override void InternalDisablePlugin()
|
||||
{
|
||||
DataModel = null;
|
||||
base.InternalDisablePlugin();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,11 +8,13 @@ namespace Artemis.Core.Plugins.Abstract.DataModels
|
||||
/// <summary>
|
||||
/// Gets the plugin info this data model belongs to
|
||||
/// </summary>
|
||||
[DataModelIgnore]
|
||||
public PluginInfo PluginInfo { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="DataModelPropertyAttribute" /> describing this data model
|
||||
/// </summary>
|
||||
[DataModelIgnore]
|
||||
public DataModelPropertyAttribute DataModelDescription { get; internal set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
@@ -44,9 +45,18 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
||||
}
|
||||
|
||||
internal override DataModelPropertyAttribute InternalGetDataModelDescription()
|
||||
internal override void InternalEnablePlugin()
|
||||
{
|
||||
return GetDataModelDescription();
|
||||
DataModel = Activator.CreateInstance<T>();
|
||||
DataModel.PluginInfo = PluginInfo;
|
||||
DataModel.DataModelDescription = GetDataModelDescription();
|
||||
base.InternalEnablePlugin();
|
||||
}
|
||||
|
||||
internal override void InternalDisablePlugin()
|
||||
{
|
||||
DataModel = null;
|
||||
base.InternalDisablePlugin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +101,5 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract IEnumerable<ModuleViewModel> GetViewModels();
|
||||
|
||||
internal virtual DataModelPropertyAttribute InternalGetDataModelDescription()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Castle.Core.Internal;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
@@ -9,7 +11,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
public abstract class Plugin : IDisposable
|
||||
{
|
||||
public PluginInfo PluginInfo { get; internal set; }
|
||||
public PluginInfo PluginInfo { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the plugin is enabled
|
||||
@@ -47,26 +49,39 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void SetEnabled(bool enable)
|
||||
internal void SetEnabled(bool enable, bool isAutoEnable = false)
|
||||
{
|
||||
if (enable && !Enabled)
|
||||
{
|
||||
Enabled = true;
|
||||
PluginInfo.Enabled = true;
|
||||
|
||||
// If enable failed, put it back in a disabled state
|
||||
try
|
||||
{
|
||||
EnablePlugin();
|
||||
if (isAutoEnable && PluginInfo.GetLockFileCreated())
|
||||
{
|
||||
// Don't wrap existing lock exceptions, simply rethrow them
|
||||
if (PluginInfo.LoadException is ArtemisPluginLockException)
|
||||
throw PluginInfo.LoadException;
|
||||
|
||||
throw new ArtemisPluginLockException(PluginInfo.LoadException);
|
||||
}
|
||||
|
||||
Enabled = true;
|
||||
PluginInfo.Enabled = true;
|
||||
PluginInfo.CreateLockFile();
|
||||
|
||||
InternalEnablePlugin();
|
||||
OnPluginEnabled();
|
||||
PluginInfo.LoadException = null;
|
||||
}
|
||||
catch
|
||||
// If enable failed, put it back in a disabled state
|
||||
catch (Exception e)
|
||||
{
|
||||
Enabled = false;
|
||||
PluginInfo.Enabled = false;
|
||||
PluginInfo.LoadException = e;
|
||||
throw;
|
||||
}
|
||||
|
||||
OnPluginEnabled();
|
||||
PluginInfo.DeleteLockFile();
|
||||
}
|
||||
else if (!enable && Enabled)
|
||||
{
|
||||
@@ -74,12 +89,21 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
PluginInfo.Enabled = false;
|
||||
|
||||
// Even if disable failed, still leave it in a disabled state to avoid more issues
|
||||
DisablePlugin();
|
||||
|
||||
InternalDisablePlugin();
|
||||
OnPluginDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual void InternalEnablePlugin()
|
||||
{
|
||||
EnablePlugin();
|
||||
}
|
||||
|
||||
internal virtual void InternalDisablePlugin()
|
||||
{
|
||||
DisablePlugin();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler PluginEnabled;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
@@ -18,7 +19,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
public T DataModel
|
||||
{
|
||||
get => (T)InternalDataModel;
|
||||
get => (T) InternalDataModel;
|
||||
internal set => InternalDataModel = value;
|
||||
}
|
||||
|
||||
@@ -42,12 +43,21 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// <returns></returns>
|
||||
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
||||
{
|
||||
return new DataModelPropertyAttribute { Name = PluginInfo.Name, Description = PluginInfo.Description };
|
||||
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
||||
}
|
||||
|
||||
internal override void InternalEnablePlugin()
|
||||
{
|
||||
DataModel = Activator.CreateInstance<T>();
|
||||
DataModel.PluginInfo = PluginInfo;
|
||||
DataModel.DataModelDescription = GetDataModelDescription();
|
||||
base.InternalEnablePlugin();
|
||||
}
|
||||
|
||||
internal override DataModelPropertyAttribute InternalGetDataModelDescription()
|
||||
internal override void InternalDisablePlugin()
|
||||
{
|
||||
return GetDataModelDescription();
|
||||
DataModel = null;
|
||||
base.InternalDisablePlugin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user