1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Nuget - Updated packages

Brush properties - Added default values
Brush properties - Removed option to always auto-expand groups
Layer properties - Remember expanded/collapsed groups
Storage - Added migration system
Storage - Added migration that removes profiles made in the old layer properties format
Layer timeline - Added back zoom functionality
This commit is contained in:
SpoinkyNL 2020-05-29 00:09:04 +02:00
parent 221c8bc7e7
commit dd000e7bed
58 changed files with 329 additions and 188 deletions

View File

@ -21,11 +21,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Ben.Demystifier" Version="0.1.6" /> <PackageReference Include="Ben.Demystifier" Version="0.1.6" />
<PackageReference Include="Castle.Core" Version="4.4.0" /> <PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="FastMember" Version="1.5.0" /> <PackageReference Include="FastMember" Version="1.5.0" />
<PackageReference Include="HidSharp" Version="2.1.0" /> <PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="LiteDB" Version="5.0.7" /> <PackageReference Include="LiteDB" Version="5.0.8" />
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.2.0" /> <PackageReference Include="McMaster.NETCore.Plugins" Version="1.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Ninject" Version="3.3.4" /> <PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" /> <PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
@ -35,8 +35,8 @@
<PackageReference Include="Serilog.Enrichers.Demystify" Version="1.0.0-dev-00019" /> <PackageReference Include="Serilog.Enrichers.Demystify" Version="1.0.0-dev-00019" />
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" /> <PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.1" /> <PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Reflection.Metadata" Version="1.8.0" /> <PackageReference Include="System.Reflection.Metadata" Version="1.8.0" />

View File

@ -55,7 +55,7 @@ namespace Artemis.Core.Models.Profile.Colors
if (right == null || left == right) if (right == null || left == right)
return left.Color; return left.Color;
position = (float) Math.Round((position - left.Position) / (right.Position - left.Position), 2); position = (float) Math.Round((position - left.Position) / (right.Position - left.Position), 2);
var a = (byte) ((right.Color.Alpha - left.Color.Alpha) * position + left.Color.Alpha); var a = (byte) ((right.Color.Alpha - left.Color.Alpha) * position + left.Color.Alpha);
var r = (byte) ((right.Color.Red - left.Color.Red) * position + left.Color.Red); var r = (byte) ((right.Color.Red - left.Color.Red) * position + left.Color.Red);
@ -65,15 +65,19 @@ namespace Artemis.Core.Models.Profile.Colors
} }
/// <summary> /// <summary>
/// [PH] Looping through HSV, adds 8 rainbow colors /// Gets a new ColorGradient with colors looping through the HSV-spectrum
/// </summary> /// </summary>
public void MakeFabulous() /// <returns></returns>
public static ColorGradient GetUnicornBarf()
{ {
var gradient = new ColorGradient();
for (var i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {
var color = i != 8 ? SKColor.FromHsv(i * 32, 100, 100) : SKColor.FromHsv(0, 100, 100); var color = i != 8 ? SKColor.FromHsv(i * 32, 100, 100) : SKColor.FromHsv(0, 100, 100);
Stops.Add(new ColorGradientStop(color, 0.125f * i)); gradient.Stops.Add(new ColorGradientStop(color, 0.125f * i));
} }
return gradient;
} }
#region PropertyChanged #region PropertyChanged

View File

@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Windows.Media.Animation;
using Artemis.Core.Extensions; using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.LayerProperties; using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes; using Artemis.Core.Models.Profile.LayerProperties.Attributes;
@ -22,6 +21,7 @@ namespace Artemis.Core.Models.Profile
/// </summary> /// </summary>
public sealed class Layer : ProfileElement public sealed class Layer : ProfileElement
{ {
private readonly List<string> _expandedPropertyGroups;
private LayerShape _layerShape; private LayerShape _layerShape;
private List<ArtemisLed> _leds; private List<ArtemisLed> _leds;
private SKPath _path; private SKPath _path;
@ -38,6 +38,8 @@ namespace Artemis.Core.Models.Profile
Transform = new LayerTransformProperties {IsCorePropertyGroup = true}; Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
_leds = new List<ArtemisLed>(); _leds = new List<ArtemisLed>();
_expandedPropertyGroups = new List<string>();
General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized; General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized;
} }
@ -54,6 +56,9 @@ namespace Artemis.Core.Models.Profile
Transform = new LayerTransformProperties {IsCorePropertyGroup = true}; Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
_leds = new List<ArtemisLed>(); _leds = new List<ArtemisLed>();
_expandedPropertyGroups = new List<string>();
_expandedPropertyGroups.AddRange(layerEntity.ExpandedPropertyGroups);
General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized; General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized;
} }
@ -99,10 +104,10 @@ namespace Artemis.Core.Models.Profile
} }
} }
[PropertyGroupDescription(Name = "General", Description = "A collection of general properties", ExpandByDefault = true)] [PropertyGroupDescription(Name = "General", Description = "A collection of general properties")]
public LayerGeneralProperties General { get; set; } public LayerGeneralProperties General { get; set; }
[PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties", ExpandByDefault = true)] [PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties")]
public LayerTransformProperties Transform { get; set; } public LayerTransformProperties Transform { get; set; }
/// <summary> /// <summary>
@ -115,6 +120,19 @@ namespace Artemis.Core.Models.Profile
return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}"; return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}";
} }
public bool IsPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup)
{
return _expandedPropertyGroups.Contains(layerPropertyGroup.Path);
}
public void SetPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup, bool expanded)
{
if (!expanded && IsPropertyGroupExpanded(layerPropertyGroup))
_expandedPropertyGroups.Remove(layerPropertyGroup.Path);
else if (expanded && !IsPropertyGroupExpanded(layerPropertyGroup))
_expandedPropertyGroups.Add(layerPropertyGroup.Path);
}
#region Storage #region Storage
internal override void ApplyToEntity() internal override void ApplyToEntity()
@ -125,6 +143,8 @@ namespace Artemis.Core.Models.Profile
LayerEntity.Order = Order; LayerEntity.Order = Order;
LayerEntity.Name = Name; LayerEntity.Name = Name;
LayerEntity.ProfileId = Profile.EntityId; LayerEntity.ProfileId = Profile.EntityId;
LayerEntity.ExpandedPropertyGroups.Clear();
LayerEntity.ExpandedPropertyGroups.AddRange(_expandedPropertyGroups);
General.ApplyToEntity(); General.ApplyToEntity();
Transform.ApplyToEntity(); Transform.ApplyToEntity();

View File

@ -1,5 +1,4 @@
using Artemis.Core.Models.Profile.LayerProperties; using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types; using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp; using SkiaSharp;
@ -19,17 +18,15 @@ namespace Artemis.Core.Models.Profile
[PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")] [PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")]
public LayerBrushReferenceLayerProperty BrushReference { get; set; } public LayerBrushReferenceLayerProperty BrushReference { get; set; }
protected override void PopulateDefaults()
{
ShapeType.DefaultValue = LayerShapeType.Rectangle;
FillType.DefaultValue = LayerFillType.Stretch;
BlendMode.DefaultValue = SKBlendMode.SrcOver;
}
protected override void OnPropertiesInitialized() protected override void OnPropertiesInitialized()
{ {
// Populate defaults
if (!ShapeType.IsLoadedFromStorage)
ShapeType.BaseValue = LayerShapeType.Rectangle;
if (!FillType.IsLoadedFromStorage)
FillType.BaseValue = LayerFillType.Stretch;
if (!BlendMode.IsLoadedFromStorage)
BlendMode.BaseValue = SKBlendMode.SrcOver;
// TODO: SpoinkyNL 28-4-2020: Select preferred default brush type with a fallback to the first available
} }
} }
} }

View File

@ -141,5 +141,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
} }
#endregion #endregion
public abstract void ApplyDefaultValue();
} }
} }

View File

@ -55,6 +55,12 @@ namespace Artemis.Core.Models.Profile.LayerProperties
internal set => _currentValue = value; internal set => _currentValue = value;
} }
/// <summary>
/// Gets or sets the default value of this layer property. If set, this value is automatically applied if the property has no
/// value in storage
/// </summary>
public T DefaultValue { get; set; }
/// <summary> /// <summary>
/// Gets a read-only list of all the keyframes on this layer property /// Gets a read-only list of all the keyframes on this layer property
/// </summary> /// </summary>
@ -275,5 +281,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties
EasingFunction = (int) k.EasingFunction EasingFunction = (int) k.EasingFunction
})); }));
} }
public override void ApplyDefaultValue()
{
CurrentValue = DefaultValue;
}
} }
} }

View File

@ -1,5 +1,6 @@
using Artemis.Core.Exceptions; using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.Colors; using Artemis.Core.Models.Profile.Colors;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile.LayerProperties.Types namespace Artemis.Core.Models.Profile.LayerProperties.Types
{ {
@ -11,6 +12,18 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
KeyframesSupported = false; KeyframesSupported = false;
} }
internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage)
{
base.ApplyToLayerProperty(entity, layerPropertyGroup, fromStorage);
// Don't allow color gradients to be null
if (BaseValue == null)
{
BaseValue = DefaultValue ?? new ColorGradient();
}
}
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased) protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{ {
throw new ArtemisCoreException("Color Gradients do not support keyframes."); throw new ArtemisCoreException("Color Gradients do not support keyframes.");

View File

@ -13,11 +13,11 @@ using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile namespace Artemis.Core.Models.Profile
{ {
public class LayerPropertyGroup public abstract class LayerPropertyGroup
{ {
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
private readonly List<BaseLayerProperty> _layerProperties; private readonly List<BaseLayerProperty> _layerProperties;
private readonly List<LayerPropertyGroup> _layerPropertyGroups; private readonly List<LayerPropertyGroup> _layerPropertyGroups;
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
protected LayerPropertyGroup() protected LayerPropertyGroup()
{ {
@ -26,17 +26,22 @@ namespace Artemis.Core.Models.Profile
} }
/// <summary> /// <summary>
/// The layer this property group applies to /// The layer this property group applies to
/// </summary> /// </summary>
public Layer Layer { get; internal set; } public Layer Layer { get; internal set; }
/// <summary>
/// The path of this property group
/// </summary>
public string Path { get; internal set; }
/// <summary> /// <summary>
/// The parent group of this layer property group, set after construction /// The parent group of this layer property group, set after construction
/// </summary> /// </summary>
public LayerPropertyGroup Parent { get; internal set; } public LayerPropertyGroup Parent { get; internal set; }
/// <summary> /// <summary>
/// Gets whether this property group's properties are all initialized /// Gets whether this property group's properties are all initialized
/// </summary> /// </summary>
public bool PropertiesInitialized { get; private set; } public bool PropertiesInitialized { get; private set; }
@ -61,10 +66,39 @@ namespace Artemis.Core.Models.Profile
public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly(); public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly();
/// <summary> /// <summary>
/// Called when all layer properties in this property group have been initialized /// Recursively gets all layer properties on this group and any subgroups
/// </summary> /// </summary>
protected virtual void OnPropertiesInitialized() /// <returns></returns>
public IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
{ {
if (!PropertiesInitialized)
return new List<BaseLayerProperty>();
if (_allLayerProperties != null)
return _allLayerProperties;
var result = new List<BaseLayerProperty>(LayerProperties);
foreach (var layerPropertyGroup in LayerPropertyGroups)
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
_allLayerProperties = result.AsReadOnly();
return _allLayerProperties;
}
/// <summary>
/// Called before properties are fully initialized to allow you to populate
/// <see cref="LayerProperty{T}.DefaultValue" /> on the properties you want
/// </summary>
protected abstract void PopulateDefaults();
/// <summary>
/// Called when all layer properties in this property group have been initialized, you may access all properties on the
/// group here
/// </summary>
protected abstract void OnPropertiesInitialized();
protected virtual void OnPropertyGroupInitialized()
{
PropertyGroupInitialized?.Invoke(this, EventArgs.Empty);
} }
internal void InitializeProperties(ILayerService layerService, Layer layer, [NotNull] string path) internal void InitializeProperties(ILayerService layerService, Layer layer, [NotNull] string path)
@ -76,6 +110,7 @@ namespace Artemis.Core.Models.Profile
throw new ArtemisCoreException("Layer property group already initialized, wut"); throw new ArtemisCoreException("Layer property group already initialized, wut");
Layer = layer; Layer = layer;
Path = path.TrimEnd('.');
// Get all properties with a PropertyDescriptionAttribute // Get all properties with a PropertyDescriptionAttribute
foreach (var propertyInfo in GetType().GetProperties()) foreach (var propertyInfo in GetType().GetProperties())
@ -110,9 +145,12 @@ namespace Artemis.Core.Models.Profile
} }
} }
PopulateDefaults();
foreach (var layerProperty in _layerProperties.Where(p => !p.IsLoadedFromStorage))
layerProperty.ApplyDefaultValue();
OnPropertiesInitialized(); OnPropertiesInitialized();
PropertiesInitialized = true; PropertiesInitialized = true;
OnPropertyGroupInitialized(); OnPropertyGroupInitialized();
} }
@ -152,25 +190,6 @@ namespace Artemis.Core.Models.Profile
OnPropertyGroupOverriding(new PropertyGroupUpdatingEventArgs(overrideTime)); OnPropertyGroupOverriding(new PropertyGroupUpdatingEventArgs(overrideTime));
} }
/// <summary>
/// Recursively gets all layer properties on this group and any subgroups
/// </summary>
/// <returns></returns>
public IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
{
if (!PropertiesInitialized)
return new List<BaseLayerProperty>();
if (_allLayerProperties != null)
return _allLayerProperties;
var result = new List<BaseLayerProperty>(LayerProperties);
foreach (var layerPropertyGroup in LayerPropertyGroups)
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
_allLayerProperties = result.AsReadOnly();
return _allLayerProperties;
}
private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance) private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance)
{ {
var pluginGuid = IsCorePropertyGroup || instance.IsCoreProperty ? Constants.CorePluginInfo.Guid : layer.LayerBrush.PluginInfo.Guid; var pluginGuid = IsCorePropertyGroup || instance.IsCoreProperty ? Constants.CorePluginInfo.Guid : layer.LayerBrush.PluginInfo.Guid;
@ -203,10 +222,5 @@ namespace Artemis.Core.Models.Profile
} }
#endregion #endregion
protected virtual void OnPropertyGroupInitialized()
{
PropertyGroupInitialized?.Invoke(this, EventArgs.Empty);
}
} }
} }

View File

@ -1,5 +1,4 @@
using Artemis.Core.Models.Profile.LayerProperties; using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types; using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp; using SkiaSharp;
@ -22,13 +21,14 @@ namespace Artemis.Core.Models.Profile
[PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f)] [PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f)]
public FloatLayerProperty Opacity { get; set; } public FloatLayerProperty Opacity { get; set; }
protected override void PopulateDefaults()
{
Scale.DefaultValue = new SKSize(100, 100);
Opacity.DefaultValue = 100;
}
protected override void OnPropertiesInitialized() protected override void OnPropertiesInitialized()
{ {
// Populate defaults
if (!Scale.IsLoadedFromStorage)
Scale.BaseValue = new SKSize(100, 100);
if (!Opacity.IsLoadedFromStorage)
Opacity.BaseValue = 100;
} }
} }
} }

View File

@ -131,5 +131,10 @@ namespace Artemis.Core.Models.Profile
/// Applies the profile element's properties to the underlying storage entity /// Applies the profile element's properties to the underlying storage entity
/// </summary> /// </summary>
internal abstract void ApplyToEntity(); internal abstract void ApplyToEntity();
public override string ToString()
{
return $"{nameof(EntityId)}: {EntityId}, {nameof(Order)}: {Order}, {nameof(Name)}: {Name}";
}
} }
} }

View File

@ -2,6 +2,8 @@
using Artemis.Core.Exceptions; using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using Artemis.Storage;
using Artemis.Storage.Migrations.Interfaces;
using Artemis.Storage.Repositories.Interfaces; using Artemis.Storage.Repositories.Interfaces;
using LiteDB; using LiteDB;
using Ninject.Activation; using Ninject.Activation;
@ -60,6 +62,18 @@ namespace Artemis.Core.Ninject
} }
}).InSingletonScope(); }).InSingletonScope();
Kernel.Bind<StorageMigrationService>().ToSelf().InSingletonScope();
// Bind all migrations as singletons
Kernel.Bind(x =>
{
x.FromAssemblyContaining<IStorageMigration>()
.SelectAllClasses()
.InheritedFrom<IStorageMigration>()
.BindAllInterfaces()
.Configure(c => c.InSingletonScope());
});
// Bind all repositories as singletons // Bind all repositories as singletons
Kernel.Bind(x => Kernel.Bind(x =>
{ {

View File

@ -9,6 +9,8 @@ using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces; using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Storage;
using Artemis.Storage.Migrations.Interfaces;
using Newtonsoft.Json; using Newtonsoft.Json;
using RGB.NET.Core; using RGB.NET.Core;
using Serilog; using Serilog;
@ -30,8 +32,9 @@ namespace Artemis.Core.Services
private List<Module> _modules; private List<Module> _modules;
private PluginSetting<LogEventLevel> _loggingLevel; private PluginSetting<LogEventLevel> _loggingLevel;
internal CoreService(ILogger logger, ISettingsService settingsService, IPluginService pluginService, IRgbService rgbService, // ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else
ISurfaceService surfaceService, IProfileService profileService) internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
IRgbService rgbService, ISurfaceService surfaceService, IProfileService profileService)
{ {
_logger = logger; _logger = logger;
_pluginService = pluginService; _pluginService = pluginService;
@ -48,6 +51,7 @@ namespace Artemis.Core.Services
_pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>(); _pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>(); _pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
ConfigureJsonConvert(); ConfigureJsonConvert();
} }
@ -99,7 +103,7 @@ namespace Artemis.Core.Services
_logger.Information("Initialized without an active surface entity"); _logger.Information("Initialized without an active surface entity");
_profileService.ActivateDefaultProfiles(); _profileService.ActivateDefaultProfiles();
OnInitialized(); OnInitialized();
} }

View File

@ -100,11 +100,13 @@ namespace Artemis.Core.Services.Storage
public void DeleteProfile(Profile profile) public void DeleteProfile(Profile profile)
{ {
_logger.Debug("Removing profile " + profile);
_profileRepository.Remove(profile.ProfileEntity); _profileRepository.Remove(profile.ProfileEntity);
} }
public void UpdateProfile(Profile profile, bool includeChildren) public void UpdateProfile(Profile profile, bool includeChildren)
{ {
_logger.Debug("Updating profile " + profile);
var memento = JsonConvert.SerializeObject(profile.ProfileEntity); var memento = JsonConvert.SerializeObject(profile.ProfileEntity);
profile.RedoStack.Clear(); profile.RedoStack.Clear();
profile.UndoStack.Push(memento); profile.UndoStack.Push(memento);

View File

@ -5,6 +5,7 @@
<LangVersion>7</LangVersion> <LangVersion>7</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="LiteDB" Version="5.0.7" /> <PackageReference Include="LiteDB" Version="5.0.8" />
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -11,6 +11,7 @@ namespace Artemis.Storage.Entities.Profile
Leds = new List<LedEntity>(); Leds = new List<LedEntity>();
PropertyEntities = new List<PropertyEntity>(); PropertyEntities = new List<PropertyEntity>();
Condition = new List<ProfileConditionEntity>(); Condition = new List<ProfileConditionEntity>();
ExpandedPropertyGroups = new List<string>();
} }
public Guid Id { get; set; } public Guid Id { get; set; }
@ -22,6 +23,7 @@ namespace Artemis.Storage.Entities.Profile
public List<LedEntity> Leds { get; set; } public List<LedEntity> Leds { get; set; }
public List<PropertyEntity> PropertyEntities { get; set; } public List<PropertyEntity> PropertyEntities { get; set; }
public List<ProfileConditionEntity> Condition { get; set; } public List<ProfileConditionEntity> Condition { get; set; }
public List<string> ExpandedPropertyGroups { get; set; }
[BsonRef("ProfileEntity")] [BsonRef("ProfileEntity")]
public ProfileEntity Profile { get; set; } public ProfileEntity Profile { get; set; }

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Migrations.Interfaces;
using LiteDB;
namespace Artemis.Storage.Migrations
{
public class AttributeBasedPropertiesMigration : IStorageMigration
{
public int UserVersion => 1;
public void Apply(LiteRepository repository)
{
if (repository.Database.CollectionExists("ProfileEntity"))
repository.Database.DropCollection("ProfileEntity");
}
}
}

View File

@ -0,0 +1,10 @@
using LiteDB;
namespace Artemis.Storage.Migrations.Interfaces
{
public interface IStorageMigration
{
int UserVersion { get; }
void Apply(LiteRepository repository);
}
}

View File

@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.Storage.Migrations.Interfaces;
using LiteDB;
using Serilog;
namespace Artemis.Storage
{
public class StorageMigrationService
{
private readonly ILogger _logger;
private readonly LiteRepository _repository;
private readonly List<IStorageMigration> _migrations;
public StorageMigrationService(ILogger logger, LiteRepository repository, List<IStorageMigration> migrations)
{
_logger = logger;
_repository = repository;
_migrations = migrations;
ApplyPendingMigrations();
}
public void ApplyPendingMigrations()
{
foreach (var storageMigration in _migrations.OrderBy(m => m.UserVersion))
{
if (_repository.Database.UserVersion >= storageMigration.UserVersion)
continue;
_logger.Information("Applying storage migration {storageMigration} to update DB from v{oldVersion} to v{newVersion}",
storageMigration.GetType().Name, _repository.Database.UserVersion, storageMigration.UserVersion);
storageMigration.Apply(_repository);
_repository.Database.UserVersion = storageMigration.UserVersion;
}
}
}
}

View File

@ -20,15 +20,15 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.0.1" /> <PackageReference Include="AvalonEdit" Version="6.0.1" />
<PackageReference Include="Humanizer.Core" Version="2.7.9" /> <PackageReference Include="Humanizer.Core" Version="2.8.11" />
<PackageReference Include="MaterialDesignExtensions" Version="3.0.0" /> <PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" /> <PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
<PackageReference Include="Ninject" Version="3.3.4" /> <PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" /> <PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" /> <PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.1" /> <PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />

View File

@ -115,21 +115,21 @@
<Resource Include="Resources\Cursors\aero_rotate.cur" /> <Resource Include="Resources\Cursors\aero_rotate.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.0" /> <PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="FluentValidation" Version="8.6.2" /> <PackageReference Include="FluentValidation" Version="8.6.2" />
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" /> <PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.10" /> <PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.10" />
<PackageReference Include="Humanizer.Core" Version="2.7.9" /> <PackageReference Include="Humanizer.Core" Version="2.8.11" />
<PackageReference Include="MaterialDesignExtensions" Version="3.0.0" /> <PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" /> <PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" /> <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="Ninject" Version="3.3.4" /> <PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" /> <PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" /> <PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
<PackageReference Include="Serilog" Version="2.9.0" /> <PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.1" /> <PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" /> <PackageReference Include="System.Drawing.Common" Version="4.7.0" />

View File

@ -12,7 +12,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract
Children = new List<LayerPropertyBaseViewModel>(); Children = new List<LayerPropertyBaseViewModel>();
} }
public bool IsExpanded { get; set; } public virtual bool IsExpanded { get; set; }
public abstract bool IsVisible { get; } public abstract bool IsVisible { get; }
public List<LayerPropertyBaseViewModel> Children { get; set; } public List<LayerPropertyBaseViewModel> Children { get; set; }

View File

@ -160,7 +160,7 @@
<!-- Time --> <!-- Time -->
<timeline:PropertyTimelineHeader Margin="0 25 0 0" <timeline:PropertyTimelineHeader Margin="0 25 0 0"
Fill="{DynamicResource MaterialDesignBody}" Fill="{DynamicResource MaterialDesignBody}"
PixelsPerSecond="{Binding PixelsPerSecond}" PixelsPerSecond="{Binding ProfileEditorService.PixelsPerSecond}"
HorizontalOffset="{Binding ContentHorizontalOffset, ElementName=TimelineHeaderScrollViewer}" HorizontalOffset="{Binding ContentHorizontalOffset, ElementName=TimelineHeaderScrollViewer}"
VisibleWidth="{Binding ActualWidth, ElementName=TimelineHeaderScrollViewer}" VisibleWidth="{Binding ActualWidth, ElementName=TimelineHeaderScrollViewer}"
Width="{Binding ActualWidth, ElementName=PropertyTimeLine}" /> Width="{Binding ActualWidth, ElementName=PropertyTimeLine}" />
@ -198,13 +198,12 @@
Background="{DynamicResource MaterialDesignCardBackground}"> Background="{DynamicResource MaterialDesignCardBackground}">
<!-- Zoom control --> <!-- Zoom control -->
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Text="{Binding PixelsPerSecond}" VerticalAlignment="Center" />
<Slider Orientation="Horizontal" <Slider Orientation="Horizontal"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="10" Margin="10"
Minimum="31" Minimum="31"
Maximum="350" Maximum="350"
Value="{Binding PixelsPerSecond}" Value="{Binding ProfileEditorService.PixelsPerSecond}"
Width="319" /> Width="319" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@ -54,6 +54,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
ProfileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected; ProfileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected;
ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged; ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
base.OnInitialActivate(); base.OnInitialActivate();
} }
@ -62,6 +63,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
{ {
ProfileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected; ProfileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected;
ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged; ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged;
ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
base.OnClose(); base.OnClose();
} }
@ -83,6 +85,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
NotifyOfPropertyChange(() => TimeCaretPosition); NotifyOfPropertyChange(() => TimeCaretPosition);
} }
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(TimeCaretPosition));
}
#region View model managament #region View model managament
private void PopulateProperties(ProfileElement profileElement) private void PopulateProperties(ProfileElement profileElement)

View File

@ -18,7 +18,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
LayerPropertyGroup = layerPropertyGroup; LayerPropertyGroup = layerPropertyGroup;
PropertyGroupDescription = propertyGroupDescription; PropertyGroupDescription = propertyGroupDescription;
IsExpanded = PropertyGroupDescription.ExpandByDefault;
TreePropertyGroupViewModel = new TreePropertyGroupViewModel(this); TreePropertyGroupViewModel = new TreePropertyGroupViewModel(this);
TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this); TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this);
@ -26,6 +25,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
PopulateChildren(); PopulateChildren();
} }
public override bool IsExpanded
{
get => LayerPropertyGroup.Layer.IsPropertyGroupExpanded(LayerPropertyGroup);
set => LayerPropertyGroup.Layer.SetPropertyGroupExpanded(LayerPropertyGroup, value);
}
public override bool IsVisible => !LayerPropertyGroup.IsHidden; public override bool IsVisible => !LayerPropertyGroup.IsHidden;
public IProfileEditorService ProfileEditorService { get; } public IProfileEditorService ProfileEditorService { get; }

View File

@ -19,6 +19,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
LayerPropertyViewModel.LayerProperty.KeyframeAdded += LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeAdded += LayerPropertyOnKeyframeModified;
LayerPropertyViewModel.LayerProperty.KeyframeRemoved += LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeRemoved += LayerPropertyOnKeyframeModified;
LayerPropertyViewModel.LayerProperty.KeyframesToggled += LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframesToggled += LayerPropertyOnKeyframeModified;
_profileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
} }
private void LayerPropertyOnKeyframeModified(object sender, EventArgs e) private void LayerPropertyOnKeyframeModified(object sender, EventArgs e)
@ -26,6 +27,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
UpdateKeyframes(); UpdateKeyframes();
} }
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
{
foreach (var timelineKeyframeViewModel in TimelineKeyframeViewModels)
timelineKeyframeViewModel.Update(_profileEditorService.PixelsPerSecond);
}
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; } public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
public override void UpdateKeyframes() public override void UpdateKeyframes()
@ -55,6 +62,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public override void Dispose() public override void Dispose()
{ {
_profileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
LayerPropertyViewModel.LayerProperty.KeyframeAdded -= LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeAdded -= LayerPropertyOnKeyframeModified;
LayerPropertyViewModel.LayerProperty.KeyframeRemoved -= LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeRemoved -= LayerPropertyOnKeyframeModified;
LayerPropertyViewModel.LayerProperty.KeyframesToggled -= LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframesToggled -= LayerPropertyOnKeyframeModified;

View File

@ -82,6 +82,8 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<TreeView ItemsSource="{Binding LayerPropertyGroups}" <TreeView ItemsSource="{Binding LayerPropertyGroups}"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
Background="{DynamicResource MaterialDesignToolBarBackground}" Background="{DynamicResource MaterialDesignToolBarBackground}"
PreviewMouseWheel="{s:Action PropertyTreePreviewMouseWheel}" PreviewMouseWheel="{s:Action PropertyTreePreviewMouseWheel}"

View File

@ -17,9 +17,9 @@
</UserControl.Resources> </UserControl.Resources>
<Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}"> <Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}">
<Grid.LayoutTransform> <Grid.RenderTransform>
<RotateTransform Angle="{Binding Device.Rotation}" /> <RotateTransform Angle="{Binding Device.Rotation}" />
</Grid.LayoutTransform> </Grid.RenderTransform>
<!-- Device image with fallback --> <!-- Device image with fallback -->
<Image VerticalAlignment="Stretch" <Image VerticalAlignment="Stretch"

View File

@ -22,9 +22,9 @@
<Grid> <Grid>
<!-- Content --> <!-- Content -->
<Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}"> <Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}">
<Grid.LayoutTransform> <Grid.RenderTransform>
<RotateTransform Angle="{Binding Device.Rotation}" /> <RotateTransform Angle="{Binding Device.Rotation}" />
</Grid.LayoutTransform> </Grid.RenderTransform>
<controls:DeviceVisualizer Device="{Binding Device}"/> <controls:DeviceVisualizer Device="{Binding Device}"/>

View File

@ -77,8 +77,7 @@ namespace Artemis.UI.Services
OnPixelsPerSecondChanged(); OnPixelsPerSecondChanged();
} }
} }
public LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription) public LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription)
{ {
// Go through the pain of instantiating a generic type VM now via reflection to make things a lot simpler down the line // Go through the pain of instantiating a generic type VM now via reflection to make things a lot simpler down the line

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System; using System.IO;
using System.IO;
using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a779b2f8-c253-4c4b-8634-6eb8f594e96d")] [assembly: Guid("a779b2f8-c253-4c4b-8634-6eb8f594e96d")]

View File

@ -24,7 +24,7 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" /> <PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj"> <ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,7 +1,4 @@
using System; using Artemis.Core.Plugins.Abstract;
using System.Collections.Generic;
using System.Text;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Abstract.ViewModels; using Artemis.Core.Plugins.Abstract.ViewModels;
namespace Artemis.Plugins.Devices.DMX.ViewModels namespace Artemis.Plugins.Devices.DMX.ViewModels
@ -11,7 +8,6 @@ namespace Artemis.Plugins.Devices.DMX.ViewModels
public DMXConfigurationViewModel(Plugin plugin) : base(plugin) public DMXConfigurationViewModel(Plugin plugin) : base(plugin)
{ {
var dmxInstance = RGB.NET.Devices.DMX.DMXDeviceProvider.Instance; var dmxInstance = RGB.NET.Devices.DMX.DMXDeviceProvider.Instance;
} }
} }
} }

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("235a45c7-24ad-4f47-b9d4-cd67e610a04d")] [assembly: Guid("235a45c7-24ad-4f47-b9d4-cd67e610a04d")]

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -2,8 +2,6 @@
using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using RGB.NET.Core;
using RGB.NET.Devices.Roccat;
namespace Artemis.Plugins.Devices.Roccat namespace Artemis.Plugins.Devices.Roccat
{ {

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -1,5 +1,4 @@
using System.IO; using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using RGB.NET.Core; using RGB.NET.Core;

View File

@ -24,7 +24,7 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" /> <PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj"> <ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -14,7 +14,6 @@ namespace Artemis.Plugins.Devices.WS281X
// ReSharper disable once UnusedMember.Global // ReSharper disable once UnusedMember.Global
public class WS281XDeviceProvider : DeviceProvider public class WS281XDeviceProvider : DeviceProvider
{ {
public PluginSettings Settings { get; }
private readonly IRgbService _rgbService; private readonly IRgbService _rgbService;
public WS281XDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo, RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance) public WS281XDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo, RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance)
@ -24,6 +23,8 @@ namespace Artemis.Plugins.Devices.WS281X
HasConfigurationViewModel = true; HasConfigurationViewModel = true;
} }
public PluginSettings Settings { get; }
public override void EnablePlugin() public override void EnablePlugin()
{ {
var definitions = Settings.GetSetting<List<DeviceDefinition>>("DeviceDefinitions"); var definitions = Settings.GetSetting<List<DeviceDefinition>>("DeviceDefinitions");

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] [assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")]

View File

@ -23,7 +23,7 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />

View File

@ -19,19 +19,15 @@ namespace Artemis.Plugins.LayerBrushes.Color
[PropertyDescription(Description = "The gradient of the brush")] [PropertyDescription(Description = "The gradient of the brush")]
public ColorGradientLayerProperty Gradient { get; set; } public ColorGradientLayerProperty Gradient { get; set; }
protected override void PopulateDefaults()
{
GradientType.DefaultValue = LayerBrushes.Color.GradientType.Solid;
Color.DefaultValue = new SKColor(255, 0, 0);
Gradient.DefaultValue = ColorGradient.GetUnicornBarf();
}
protected override void OnPropertiesInitialized() protected override void OnPropertiesInitialized()
{ {
// Populate defaults
if (!GradientType.IsLoadedFromStorage)
GradientType.BaseValue = LayerBrushes.Color.GradientType.Solid;
if (!Color.IsLoadedFromStorage)
Color.BaseValue = new SKColor(255, 0, 0);
if (!Gradient.IsLoadedFromStorage)
{
Gradient.BaseValue = new ColorGradient();
Gradient.BaseValue.MakeFabulous();
}
GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged; GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged;
} }

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0f288a66-6eb0-4589-8595-e33a3a3eaea2")] [assembly: Guid("0f288a66-6eb0-4589-8595-e33a3a3eaea2")]

View File

@ -23,8 +23,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.1" /> <PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />

View File

@ -34,26 +34,18 @@ namespace Artemis.Plugins.LayerBrushes.Noise
[PropertyDescription(Description = "The speed at which the noise moves", MinInputValue = 0f, MaxInputValue = 64f)] [PropertyDescription(Description = "The speed at which the noise moves", MinInputValue = 0f, MaxInputValue = 64f)]
public FloatLayerProperty AnimationSpeed { get; set; } public FloatLayerProperty AnimationSpeed { get; set; }
protected override void PopulateDefaults()
{
MainColor.DefaultValue = new SKColor(255, 0, 0);
SecondaryColor.DefaultValue = new SKColor(0, 0, 255);
GradientColor.DefaultValue = ColorGradient.GetUnicornBarf();
Scale.DefaultValue = new SKSize(100, 100);
Hardness.DefaultValue = 500f;
AnimationSpeed.DefaultValue = 25f;
}
protected override void OnPropertiesInitialized() protected override void OnPropertiesInitialized()
{ {
// Populate defaults
if (!MainColor.IsLoadedFromStorage)
MainColor.BaseValue = new SKColor(255, 0, 0);
if (!SecondaryColor.IsLoadedFromStorage)
SecondaryColor.BaseValue = new SKColor(0, 0, 255);
if (!GradientColor.IsLoadedFromStorage)
{
GradientColor.BaseValue = new ColorGradient();
GradientColor.BaseValue.MakeFabulous();
}
if (!Scale.IsLoadedFromStorage)
Scale.BaseValue = new SKSize(100, 100);
if (!Hardness.IsLoadedFromStorage)
Hardness.BaseValue = 500f;
if (!AnimationSpeed.IsLoadedFromStorage)
AnimationSpeed.BaseValue = 25f;
ColorType.BaseValueChanged += ColorTypeOnBaseValueChanged; ColorType.BaseValueChanged += ColorTypeOnBaseValueChanged;
} }

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7f4c7ab0-4c9b-452d-afed-34544c903def")] [assembly: Guid("7f4c7ab0-4c9b-452d-afed-34544c903def")]

View File

@ -23,8 +23,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" /> <PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.1" /> <PackageReference Include="Stylet" Version="1.3.2" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />

View File

@ -1,7 +1,6 @@
using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Abstract.DataModels; using Artemis.Core.Plugins.Abstract.DataModels;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes; using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using SkiaSharp;
namespace Artemis.Plugins.Modules.General namespace Artemis.Plugins.Modules.General
{ {
@ -24,14 +23,14 @@ namespace Artemis.Plugins.Modules.General
public class PlayerInfo : DataModel public class PlayerInfo : DataModel
{ {
public PlayerInfo(Module module) : base(module)
{
}
[DataModelProperty(Name = "A test string", Description = "This is a test string that's not of any use outside testing!")] [DataModelProperty(Name = "A test string", Description = "This is a test string that's not of any use outside testing!")]
public string TestString { get; set; } public string TestString { get; set; }
[DataModelProperty(Name = "A test boolean", Description = "This is a test boolean that's not of any use outside testing!")] [DataModelProperty(Name = "A test boolean", Description = "This is a test boolean that's not of any use outside testing!")]
public bool TestBoolean { get; set; } public bool TestBoolean { get; set; }
public PlayerInfo(Module module) : base(module)
{
}
} }
} }

View File

@ -21,7 +21,7 @@ namespace Artemis.Plugins.Modules.General
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now); var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
} }
public override void EnablePlugin() public override void EnablePlugin()
{ {
} }

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
@ -7,4 +6,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e592f239-faa0-4840-9c85-46e5867d06d5")] [assembly: Guid("e592f239-faa0-4840-9c85-46e5867d06d5")]