Datamodel - WIP stuff, need this on a diff. PC

This commit is contained in:
SpoinkyNL committed 2020-06-23 22:49:27 +02:00
1 parent 35944e064d
commit 566bdd3a89
23 files changed
+392 -161

No files matched your search

+54 -12
View File
@@ -1,17 +1,65 @@
using System.Collections.Generic;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Abstract.DataModels;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Artemis.Core.Plugins.Abstract.ViewModels;
using SkiaSharp;
namespace Artemis.Core.Plugins.Abstract
{
/// <inheritdoc />
/// <summary>
/// Allows you to add support for new games/applications while utilizing your own data model
/// </summary>
public abstract class Module<T> : Module where T : DataModel
{
/// <summary>
/// The data model driving this module
/// </summary>
public T DataModel
{
get => (T) InternalDataModel;
internal set => InternalDataModel = value;
}
/// <summary>
/// Gets or sets whether this module must also expand the main data model
/// <para>
/// Note: If expanding the main data model is all you want your plugin to do, create a
/// <see cref="BaseDataModelExpansion" /> plugin instead.
/// </para>
/// </summary>
public bool ExpandsDataModel
{
get => InternalExpandsMainDataModel;
set => InternalExpandsMainDataModel = value;
}
/// <summary>
/// Override to provide your own data model description. By default this returns a description matching your plugin
/// name and description
/// </summary>
/// <returns></returns>
public virtual DataModelPropertyAttribute GetDataModelDescription()
{
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
}
internal override DataModelPropertyAttribute InternalGetDataModelDescription()
{
return GetDataModelDescription();
}
}
/// <summary>
/// Allows you to add support for new games/applications
/// </summary>
public abstract class Module : Plugin
{
internal DataModel InternalDataModel { get; set; }
internal bool InternalExpandsMainDataModel { get; set; }
/// <summary>
/// The modules display name that's shown in the menu
/// </summary>
@@ -23,17 +71,6 @@ namespace Artemis.Core.Plugins.Abstract
/// </summary>
public string DisplayIcon { get; set; }
/// <summary>
/// The optional datamodel driving this module
/// </summary>
public DataModel DataModel { get; set; }
/// <summary>
/// Whether or not this module expands upon the main data model. If set to true any data in main data model can be
/// accessed by profiles in this module
/// </summary>
public bool ExpandsMainDataModel { get; protected set; }
/// <summary>
/// Called each frame when the module must update
/// </summary>
@@ -54,5 +91,10 @@ namespace Artemis.Core.Plugins.Abstract
/// </summary>
/// <returns></returns>
public abstract IEnumerable<ModuleViewModel> GetViewModels();
internal virtual DataModelPropertyAttribute InternalGetDataModelDescription()
{
return null;
}
}
}