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

Core - Flattened namespaces

Shared UI - Flattened namespaces
Shared UI - General housekeeping
Project - Code cleanup
This commit is contained in:
SpoinkyNL 2020-09-01 00:14:08 +02:00
parent 029e39ec1d
commit 8718d01eae
454 changed files with 1678 additions and 1938 deletions

View File

@ -0,0 +1,29 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=events/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=exceptions/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=extensions/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Ccolors/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Cconditions/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Cconditions_005Cabstract/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Cconditions_005Coperators/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Cdatabindings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Cdatabindings_005Cmodifiers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Clayerproperties/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Clayerproperties_005Cattributes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Clayerproperties_005Ctypes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cprofile_005Clayershapes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Csurface/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Cdatamodelexpansions_005Cattributes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Cdatamodelexpansions_005Cinternal/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Clayerbrushes_005Cinternal/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Clayereffects_005Cinternal/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Cmodules_005Cactivationrequirements/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=plugins_005Csettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rgb_002Enet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=services_005Cinterfaces/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=services_005Cstorage/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=services_005Cstorage_005Cinterfaces/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=utilities/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Artemis.Core.Plugins;
namespace Artemis.Core
{
@ -15,6 +14,11 @@ namespace Artemis.Core
/// </summary>
public static readonly string ApplicationFolder = Path.GetDirectoryName(typeof(Constants).Assembly.Location);
/// <summary>
/// The full path to the Artemis executable
/// </summary>
public static readonly string ExecutablePath = ApplicationUtilities.GetCurrentLocation();
/// <summary>
/// The full path to the Artemis data folder
/// </summary>

View File

@ -1,7 +1,6 @@
using System;
using Artemis.Core.Models.Surface;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class SurfaceConfigurationEventArgs : EventArgs
{

View File

@ -1,7 +1,7 @@
using System;
using RGB.NET.Core;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class DeviceEventArgs : EventArgs
{

View File

@ -1,8 +1,7 @@
using System;
using Artemis.Core.RGB.NET;
using RGB.NET.Core;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class FrameRenderedEventArgs : EventArgs
{

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Modules;
using RGB.NET.Core;
using SkiaSharp;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class FrameRenderingEventArgs : EventArgs
{

View File

@ -1,7 +1,6 @@
using System;
using Artemis.Core.Models.Profile.LayerProperties;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class LayerPropertyEventArgs : EventArgs
{

View File

@ -1,7 +1,6 @@
using System;
using Artemis.Core.Plugins;
namespace Artemis.Core.Events
namespace Artemis.Core
{
public class PluginEventArgs : EventArgs
{

View File

@ -1,18 +1,17 @@
using System;
namespace Artemis.Core.Exceptions
namespace Artemis.Core
{
/// <summary>
/// Represents errors that occur withing the Artemis Core
/// </summary>
public class ArtemisCoreException : Exception
{
public ArtemisCoreException()
internal ArtemisCoreException(string message) : base(message)
{
}
public ArtemisCoreException(string message) : base(message)
{
}
public ArtemisCoreException(string message, Exception inner) : base(message, inner)
internal ArtemisCoreException(string message, Exception inner) : base(message, inner)
{
}
}

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.Exceptions
namespace Artemis.Core
{
public class ArtemisPluginException : Exception
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.Exceptions
namespace Artemis.Core
{
public class ArtemisPluginLockException : Exception
{

View File

@ -1,6 +1,6 @@
using System.IO;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class DirectoryInfoExtensions
{

View File

@ -1,7 +1,7 @@
using System;
using System.Runtime.CompilerServices;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class DoubleExtensions
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class FloatExtensions
{

View File

@ -22,7 +22,7 @@
using System;
using System.Collections.Generic;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class IEnumerableExtensions
{

View File

@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class ProcessExtensions
{
@ -30,4 +29,4 @@ namespace Artemis.Core.Extensions
QueryLimitedInformation = 0x00001000
}
}
}
}

View File

@ -1,7 +1,7 @@
using System.Text;
using RGB.NET.Core;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class RgbDeviceExtensions
{

View File

@ -1,7 +1,7 @@
using RGB.NET.Core;
using SkiaSharp;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class RgbRectangleExtensions
{

View File

@ -2,7 +2,7 @@
using RGB.NET.Core;
using SkiaSharp;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
// ReSharper disable once InconsistentNaming - I didn't come up with SKColor
public static class SKColorExtensions
@ -29,7 +29,7 @@ namespace Artemis.Core.Extensions
private static byte ClampToByte(float value)
{
return (byte)Math.Clamp(value, 0, 255);
return (byte) Math.Clamp(value, 0, 255);
}
}
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Artemis.Core.Extensions
namespace Artemis.Core
{
public static class TypeExtensions
{
@ -65,7 +65,7 @@ namespace Artemis.Core.Extensions
// From https://stackoverflow.com/a/2224421/5015269 but inverted and renamed to match similar framework methods
/// <summary>
/// Determines whether an instance of a specified type can be casted to a variable of the current type
/// Determines whether an instance of a specified type can be casted to a variable of the current type
/// </summary>
/// <param name="to"></param>
/// <param name="from"></param>

View File

@ -4,7 +4,7 @@ using SkiaSharp;
namespace Artemis.Core.JsonConverters
{
public class SKColorConverter : JsonConverter<SKColor>
internal class SKColorConverter : JsonConverter<SKColor>
{
public override void WriteJson(JsonWriter writer, SKColor value, JsonSerializer serializer)
{

View File

@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Artemis.Core.Annotations;
using Artemis.Core.Properties;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Models.Profile.Colors
namespace Artemis.Core
{
/// <summary>
/// A gradient containing a list of <see cref="ColorGradientStop" />s
@ -136,7 +136,7 @@ namespace Artemis.Core.Models.Profile.Colors
/// <inheritdoc />
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
internal virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{

View File

@ -1,9 +1,9 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Artemis.Core.Annotations;
using Artemis.Core.Properties;
using SkiaSharp;
namespace Artemis.Core.Models.Profile.Colors
namespace Artemis.Core
{
/// <summary>
/// A color with a position, usually contained in a <see cref="ColorGradient" />

View File

@ -1,8 +1,8 @@
using System.Collections.Generic;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.Abstract;
namespace Artemis.Core.Models.Profile.Conditions.Abstract
namespace Artemis.Core
{
/// <summary>
/// An abstract class for display condition parts
@ -10,7 +10,7 @@ namespace Artemis.Core.Models.Profile.Conditions.Abstract
public abstract class DisplayConditionPart
{
private readonly List<DisplayConditionPart> _children = new List<DisplayConditionPart>();
/// <summary>
/// Gets the parent of this part
/// </summary>

View File

@ -1,12 +1,10 @@
using System;
using System.Linq;
using Artemis.Core.Models.Profile.Conditions.Abstract;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities.Profile;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.Conditions;
namespace Artemis.Core.Models.Profile.Conditions
namespace Artemis.Core
{
/// <summary>
/// A group containing zero to many <see cref="DisplayConditionPart" />s which it evaluates using a boolean specific

View File

@ -2,15 +2,12 @@
using System.Collections;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.Conditions.Abstract;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities.Profile;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.Conditions;
namespace Artemis.Core.Models.Profile.Conditions
namespace Artemis.Core
{
public class DisplayConditionList : DisplayConditionPart
{
@ -33,6 +30,8 @@ namespace Artemis.Core.Models.Profile.Conditions
public DataModel ListDataModel { get; private set; }
public string ListPropertyPath { get; private set; }
public Func<object, IList> CompiledListAccessor { get; set; }
public override bool Evaluate()
{
if (CompiledListAccessor == null)
@ -59,6 +58,47 @@ namespace Artemis.Core.Models.Profile.Conditions
};
}
public void UpdateList(DataModel dataModel, string path)
{
if (dataModel != null && path == null)
throw new ArtemisCoreException("If a data model is provided, a path is also required");
if (dataModel == null && path != null)
throw new ArtemisCoreException("If path is provided, a data model is also required");
if (dataModel != null)
{
if (!dataModel.ContainsPath(path))
throw new ArtemisCoreException($"Data model of type {dataModel.GetType().Name} does not contain a property at path '{path}'");
if (dataModel.GetListTypeAtPath(path) == null)
throw new ArtemisCoreException($"The path '{path}' does not contain a list");
}
// Remove the old root group that was tied to the old data model
while (Children.Any())
RemoveChild(Children[0]);
ListDataModel = dataModel;
ListPropertyPath = path;
if (dataModel == null)
return;
// Create a new root group
AddChild(new DisplayConditionGroup(this));
CreateExpression();
}
public void CreateExpression()
{
var parameter = Expression.Parameter(typeof(object), "listDataModel");
var accessor = ListPropertyPath.Split('.').Aggregate<string, Expression>(
Expression.Convert(parameter, ListDataModel.GetType()),
(expression, s) => Expression.Convert(Expression.Property(expression, s), typeof(IList)));
var lambda = Expression.Lambda<Func<object, IList>>(accessor, parameter);
CompiledListAccessor = lambda.Compile();
}
internal override void ApplyToEntity()
{
// Target list
@ -103,51 +143,9 @@ namespace Artemis.Core.Models.Profile.Conditions
Entity.Children.Clear();
AddChild(new DisplayConditionGroup(this));
}
Children[0].Initialize(dataModelService);
}
public void UpdateList(DataModel dataModel, string path)
{
if (dataModel != null && path == null)
throw new ArtemisCoreException("If a data model is provided, a path is also required");
if (dataModel == null && path != null)
throw new ArtemisCoreException("If path is provided, a data model is also required");
if (dataModel != null)
{
if (!dataModel.ContainsPath(path))
throw new ArtemisCoreException($"Data model of type {dataModel.GetType().Name} does not contain a property at path '{path}'");
if (dataModel.GetListTypeAtPath(path) == null)
throw new ArtemisCoreException($"The path '{path}' does not contain a list");
}
// Remove the old root group that was tied to the old data model
while (Children.Any())
RemoveChild(Children[0]);
ListDataModel = dataModel;
ListPropertyPath = path;
if (dataModel == null)
return;
// Create a new root group
AddChild(new DisplayConditionGroup(this));
CreateExpression();
}
public void CreateExpression()
{
var parameter = Expression.Parameter(typeof(object), "listDataModel");
var accessor = ListPropertyPath.Split('.').Aggregate<string, Expression>(
Expression.Convert(parameter, ListDataModel.GetType()),
(expression, s) => Expression.Convert(Expression.Property(expression, s), typeof(IList)));
var lambda = Expression.Lambda<Func<object, IList>>(accessor, parameter);
CompiledListAccessor = lambda.Compile();
}
public Func<object, IList> CompiledListAccessor { get; set; }
}
public enum ListOperator

View File

@ -1,16 +1,13 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Exceptions;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.Conditions.Abstract;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.Conditions;
using Newtonsoft.Json;
namespace Artemis.Core.Models.Profile.Conditions
namespace Artemis.Core
{
public class DisplayConditionListPredicate : DisplayConditionPart
{

View File

@ -2,11 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
namespace Artemis.Core.Models.Profile.Conditions
namespace Artemis.Core
{
/// <summary>
/// A display condition operator is used by the conditions system to perform a specific boolean check

View File

@ -1,16 +1,13 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Exceptions;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.Conditions.Abstract;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.Conditions;
using Newtonsoft.Json;
namespace Artemis.Core.Models.Profile.Conditions
namespace Artemis.Core
{
/// <summary>
/// A predicate in a display condition using either two data model values or one data model value and a
@ -198,8 +195,10 @@ namespace Artemis.Core.Models.Profile.Conditions
var leftType = LeftDataModel.GetTypeAtPath(LeftPropertyPath);
if (!displayConditionOperator.SupportsType(leftType))
{
throw new ArtemisCoreException($"Cannot apply operator {displayConditionOperator.GetType().Name} to this predicate because " +
$"it does not support left side type {leftType.Name}");
}
Operator = displayConditionOperator;
CreateExpression();

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class EqualsConditionOperator : DisplayConditionOperator
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class GreaterThanConditionOperator : DisplayConditionOperator
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class GreaterThanOrEqualConditionOperator : DisplayConditionOperator
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class LessThanConditionOperator : DisplayConditionOperator
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class LessThanOrEqualConditionOperator : DisplayConditionOperator
{

View File

@ -2,11 +2,11 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class NotEqualConditionOperator : DisplayConditionOperator
{
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> { typeof(object) };
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(object)};
public override string Description => "Does not equal";
public override string Icon => "NotEqualVariant";

View File

@ -3,17 +3,17 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringContainsConditionOperator : DisplayConditionOperator
{
private readonly MethodInfo _toLower;
private readonly MethodInfo _contains;
private readonly MethodInfo _toLower;
public StringContainsConditionOperator()
{
_toLower = typeof(string).GetMethod("ToLower", new Type[] { });
_contains = typeof(string).GetMethod("Contains", new[] {typeof(string) });
_contains = typeof(string).GetMethod("Contains", new[] {typeof(string)});
}
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(string)};

View File

@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringEndsWithConditionOperator : DisplayConditionOperator
{
private readonly MethodInfo _toLower;
private readonly MethodInfo _endsWith;
private readonly MethodInfo _toLower;
public StringEndsWithConditionOperator()
{
_toLower = typeof(string).GetMethod("ToLower", new Type[] { });
_endsWith = typeof(string).GetMethod("EndsWith", new[] { typeof(string) });
_endsWith = typeof(string).GetMethod("EndsWith", new[] {typeof(string)});
}
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> { typeof(string) };
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(string)};
public override string Description => "Ends with";
public override string Icon => "ContainEnd";

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringEqualsConditionOperator : DisplayConditionOperator
{

View File

@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringNotContainsConditionOperator : DisplayConditionOperator
{
private readonly MethodInfo _toLower;
private readonly MethodInfo _contains;
private readonly MethodInfo _toLower;
public StringNotContainsConditionOperator()
{
_toLower = typeof(string).GetMethod("ToLower", new Type[] { });
_contains = typeof(string).GetMethod("Contains", new[] { typeof(string) });
_contains = typeof(string).GetMethod("Contains", new[] {typeof(string)});
}
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> { typeof(string) };
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(string)};
public override string Description => "Does not contain";
public override string Icon => "FormatStrikethrough";

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringNotEqualConditionOperator : DisplayConditionOperator
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringNullConditionOperator : DisplayConditionOperator
{

View File

@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Artemis.Core.Models.Profile.Conditions.Operators
namespace Artemis.Core
{
internal class StringStartsWithConditionOperator : DisplayConditionOperator
{
private readonly MethodInfo _toLower;
private readonly MethodInfo _startsWith;
private readonly MethodInfo _toLower;
public StringStartsWithConditionOperator()
{
_toLower = typeof(string).GetMethod("ToLower", new Type[] { });
_startsWith = typeof(string).GetMethod("StartsWith", new[] { typeof(string) });
_startsWith = typeof(string).GetMethod("StartsWith", new[] {typeof(string)});
}
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> { typeof(string) };
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(string)};
public override string Description => "Starts with";
public override string Icon => "ContainStart";

View File

@ -1,8 +1,7 @@
using System.Collections.Generic;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.DataModelExpansions;
namespace Artemis.Core.Models.Profile.DataBindings
namespace Artemis.Core
{
/// <summary>
/// A data binding that binds a certain <see cref="BaseLayerProperty" /> to a value inside a <see cref="DataModel" />

View File

@ -1,14 +1,12 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.DataBindings.Modifiers;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile.DataBindings;
using Newtonsoft.Json;
namespace Artemis.Core.Models.Profile.DataBindings
namespace Artemis.Core
{
/// <summary>
/// Modifies a data model value in a way defined by the modifier type

View File

@ -2,20 +2,17 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins;
using Artemis.Core.Services;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Models.Profile.DataBindings.Modifiers
namespace Artemis.Core
{
/// <summary>
/// A modifier that changes the source value of a data binding in some way
/// A modifier that changes the source value of a data binding in some way
/// </summary>
public abstract class DataBindingModifierType
{
private bool _registered;
private IDataBindingService _dataBindingService;
private bool _registered;
/// <summary>
/// Gets the plugin info this data binding modifier belongs to

View File

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.Utilities;
using Artemis.Core.LayerEffects;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Entities.Profile.Abstract;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public sealed class Folder : RenderProfileElement
{
@ -183,7 +182,7 @@ namespace Artemis.Core.Models.Profile
profileElement.Render(deltaTime, folderCanvas, _folderBitmap.Info);
folderCanvas.Restore();
}
// If required, apply the opacity override of the module to the root folder
if (IsRootFolder && Profile.Module.OpacityOverride < 1)
{

View File

@ -2,21 +2,14 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerShapes;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
using Artemis.Core.Services;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Entities.Profile.Abstract;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
/// <summary>
/// Represents a layer on a profile. To create new layers use the <see cref="RenderElementService" /> by injecting
@ -232,10 +225,10 @@ namespace Artemis.Core.Models.Profile
switch (General.ShapeType.CurrentValue)
{
case LayerShapeType.Ellipse:
LayerShape = new Ellipse(this);
LayerShape = new EllipseShape(this);
break;
case LayerShapeType.Rectangle:
LayerShape = new Rectangle(this);
LayerShape = new RectangleShape(this);
break;
default:
throw new ArgumentOutOfRangeException();
@ -291,9 +284,7 @@ namespace Artemis.Core.Models.Profile
if (stickToMainSegment)
{
if (!DisplayContinuously)
{
TimelinePosition = StartSegmentLength + timeOverride;
}
else
{
var progress = timeOverride.TotalMilliseconds % MainSegmentLength.TotalMilliseconds;

View File

@ -1,7 +1,7 @@
using System;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.LayerBrushes;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
/// <summary>
/// A reference to a <see cref="LayerBrushDescriptor" />

View File

@ -1,8 +1,6 @@
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public class LayerGeneralProperties : LayerPropertyGroup
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Models.Profile.LayerProperties.Attributes
namespace Artemis.Core
{
public class PropertyDescriptionAttribute : Attribute
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Models.Profile.LayerProperties.Attributes
namespace Artemis.Core
{
public class PropertyGroupDescriptionAttribute : Attribute
{

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Artemis.Core.Events;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile.LayerProperties
namespace Artemis.Core
{
/// <summary>
/// For internal use only, to implement your own layer property type, extend <see cref="LayerProperty{T}" /> instead.

View File

@ -1,8 +1,7 @@
using System;
using Artemis.Core.Utilities;
using Stylet;
namespace Artemis.Core.Models.Profile.LayerProperties
namespace Artemis.Core
{
/// <summary>
/// For internal use only, use <see cref="LayerPropertyKeyframe{T}" /> instead.

View File

@ -3,12 +3,10 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Artemis.Core.Exceptions;
using Artemis.Core.Utilities;
using Artemis.Storage.Entities.Profile;
using Newtonsoft.Json;
namespace Artemis.Core.Models.Profile.LayerProperties
namespace Artemis.Core
{
/// <summary>
/// Represents a property on a layer. Properties are saved in storage and can optionally be modified from the UI.
@ -175,7 +173,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties
}
/// <inheritdoc />
public override Type GetPropertyType() => typeof(T);
public override Type GetPropertyType()
{
return typeof(T);
}
/// <inheritdoc />
public override List<PropertyInfo> GetDataBindingProperties()

View File

@ -1,13 +1,12 @@
using System;
using Artemis.Core.Utilities;
namespace Artemis.Core.Models.Profile.LayerProperties
namespace Artemis.Core
{
public class LayerPropertyKeyframe<T> : BaseLayerPropertyKeyframe
{
private LayerProperty<T> _layerProperty;
private TimeSpan _position;
private T _value;
private LayerProperty<T> _layerProperty;
public LayerPropertyKeyframe(T value, TimeSpan position, Easings.Functions easingFunction, LayerProperty<T> layerProperty) : base(layerProperty)
{

View File

@ -1,8 +1,6 @@
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.Colors;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class ColorGradientLayerProperty : LayerProperty<ColorGradient>

View File

@ -1,7 +1,6 @@
using System;
using Artemis.Core.Exceptions;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class EnumLayerProperty<T> : LayerProperty<T> where T : Enum

View File

@ -1,4 +1,4 @@
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class FloatLayerProperty : LayerProperty<float>

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class IntLayerProperty : LayerProperty<int>

View File

@ -1,6 +1,4 @@
using Artemis.Core.Exceptions;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <summary>
/// A special layer property used to configure the selected layer brush

View File

@ -1,8 +1,7 @@
using System;
using Artemis.Core.Extensions;
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class SKColorLayerProperty : LayerProperty<SKColor>

View File

@ -1,6 +1,6 @@
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class SKPointLayerProperty : LayerProperty<SKPoint>

View File

@ -3,7 +3,7 @@ using System.Linq;
using System.Reflection;
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
namespace Artemis.Core
{
/// <inheritdoc />
public class SKSizeLayerProperty : LayerProperty<SKSize>
@ -17,16 +17,16 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
return p.CurrentValue;
}
public override List<PropertyInfo> GetDataBindingProperties()
{
return typeof(SKSize).GetProperties().Where(p => p.CanWrite).ToList();
}
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
var widthDiff = NextKeyframe.Value.Width - CurrentKeyframe.Value.Width;
var heightDiff = NextKeyframe.Value.Height - CurrentKeyframe.Value.Height;
CurrentValue = new SKSize(CurrentKeyframe.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe.Value.Height + heightDiff * keyframeProgressEased);
}
public override List<PropertyInfo> GetDataBindingProperties()
{
return typeof(SKSize).GetProperties().Where(p => p.CanWrite).ToList();
}
}
}

View File

@ -2,19 +2,13 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Annotations;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
using Artemis.Core.Properties;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public abstract class LayerPropertyGroup : IDisposable
{
@ -89,6 +83,13 @@ namespace Artemis.Core.Models.Profile
/// </summary>
public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly();
public void Dispose()
{
DisableProperties();
foreach (var layerPropertyGroup in _layerPropertyGroups)
layerPropertyGroup.Dispose();
}
/// <summary>
/// Recursively gets all layer properties on this group and any subgroups
/// </summary>
@ -108,13 +109,6 @@ namespace Artemis.Core.Models.Profile
return _allLayerProperties;
}
public void Dispose()
{
DisableProperties();
foreach (var layerPropertyGroup in _layerPropertyGroups)
layerPropertyGroup.Dispose();
}
/// <summary>
/// Called before property group is activated to allow you to populate <see cref="LayerProperty{T}.DefaultValue" /> on
/// the properties you want

View File

@ -1,13 +1,17 @@
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerShapes
namespace Artemis.Core
{
public class Ellipse : LayerShape
/// <summary>
/// Represents an ellipse layer shape
/// </summary>
public class EllipseShape : LayerShape
{
public Ellipse(Layer layer) : base(layer)
internal EllipseShape(Layer layer) : base(layer)
{
}
/// <inheritdoc />
public override void CalculateRenderProperties()
{
var path = new SKPath();

View File

@ -1,10 +1,13 @@
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerShapes
namespace Artemis.Core
{
/// <summary>
/// Represents the shape of a layer
/// </summary>
public abstract class LayerShape
{
protected LayerShape(Layer layer)
internal LayerShape(Layer layer)
{
Layer = layer;
}
@ -19,6 +22,9 @@ namespace Artemis.Core.Models.Profile.LayerShapes
/// </summary>
public SKPath Path { get; protected set; }
/// <summary>
/// Calculates the <see cref="Path" />
/// </summary>
public abstract void CalculateRenderProperties();
}
}

View File

@ -1,13 +1,17 @@
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerShapes
namespace Artemis.Core
{
public class Rectangle : LayerShape
/// <summary>
/// Represents a rectangular layer shape
/// </summary>
public class RectangleShape : LayerShape
{
public Rectangle(Layer layer) : base(layer)
internal RectangleShape(Layer layer) : base(layer)
{
}
/// <inheritdoc />
public override void CalculateRenderProperties()
{
var path = new SKPath();

View File

@ -1,8 +1,6 @@
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public class LayerTransformProperties : LayerPropertyGroup
{

View File

@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Modules;
using Artemis.Storage.Entities.Profile;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public sealed class Profile : ProfileElement
{

View File

@ -1,8 +1,8 @@
using System;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Modules;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public class ProfileDescriptor
{

View File

@ -5,23 +5,10 @@ using System.Linq;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public abstract class ProfileElement : PropertyChangedBase, IDisposable
{
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected bool _disposed;
private bool _enabled;
private Guid _entityId;
@ -86,6 +73,12 @@ namespace Artemis.Core.Models.Profile
set => SetAndNotify(ref _enabled, value);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Updates the element
/// </summary>
@ -201,6 +194,13 @@ namespace Artemis.Core.Models.Profile
return $"{nameof(EntityId)}: {EntityId}, {nameof(Order)}: {Order}, {nameof(Name)}: {Name}";
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
}
}
/// <summary>
/// Applies the profile element's properties to the underlying storage entity
/// </summary>

View File

@ -1,4 +1,4 @@
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
/// <summary>
/// An enum defining the right side type of a profile entity

View File

@ -1,11 +1,6 @@
using System.Collections.Generic;
using Artemis.Storage.Entities.Profile;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public abstract class PropertiesProfileElement : ProfileElement
{
}
}

View File

@ -2,18 +2,31 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Annotations;
using Artemis.Core.Models.Profile.Conditions;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.LayerEffects;
using Artemis.Core.Properties;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Entities.Profile.Abstract;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
namespace Artemis.Core
{
public abstract class RenderProfileElement : ProfileElement
{
/// <summary>
/// Returns a list of all keyframes on all properties and effects of this layer
/// </summary>
public virtual List<BaseLayerPropertyKeyframe> GetAllKeyframes()
{
var keyframes = new List<BaseLayerPropertyKeyframe>();
foreach (var layerEffect in LayerEffects)
{
foreach (var baseLayerProperty in layerEffect.BaseProperties.GetAllLayerProperties())
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
}
return keyframes;
}
protected void ApplyRenderElementDefaults()
{
MainSegmentLength = TimeSpan.FromSeconds(5);
@ -54,21 +67,6 @@ namespace Artemis.Core.Models.Profile
}
}
/// <summary>
/// Returns a list of all keyframes on all properties and effects of this layer
/// </summary>
public virtual List<BaseLayerPropertyKeyframe> GetAllKeyframes()
{
var keyframes = new List<BaseLayerPropertyKeyframe>();
foreach (var layerEffect in LayerEffects)
{
foreach (var baseLayerProperty in layerEffect.BaseProperties.GetAllLayerProperties())
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
}
return keyframes;
}
#region Properties
private SKPath _path;
@ -215,7 +213,7 @@ namespace Artemis.Core.Models.Profile
/// <summary>
/// Overrides the progress of the element
/// Overrides the progress of the element
/// </summary>
/// <param name="timeOverride"></param>
/// <param name="stickToMainSegment"></param>

View File

@ -1,20 +1,18 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins;
using Artemis.Storage.Entities.Surface;
using RGB.NET.Core;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Models.Surface
namespace Artemis.Core
{
public class ArtemisDevice : PropertyChangedBase
{
private SKRect _renderRectangle;
private SKPath _renderPath;
private ReadOnlyCollection<ArtemisLed> _leds;
private SKPath _renderPath;
private SKRect _renderRectangle;
internal ArtemisDevice(IRGBDevice rgbDevice, Plugin plugin, ArtemisSurface surface)
{

View File

@ -1,14 +1,13 @@
using Artemis.Core.Extensions;
using RGB.NET.Core;
using RGB.NET.Core;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Models.Surface
namespace Artemis.Core
{
public class ArtemisLed : PropertyChangedBase
{
private SKRect _renderRectangle;
private SKRect _absoluteRenderRectangle;
private SKRect _renderRectangle;
public ArtemisLed(Led led, ArtemisDevice device)
{

View File

@ -5,14 +5,14 @@ using Artemis.Storage.Entities.Surface;
using RGB.NET.Core;
using Stylet;
namespace Artemis.Core.Models.Surface
namespace Artemis.Core
{
public class ArtemisSurface : PropertyChangedBase
{
private double _scale;
private string _name;
private bool _isActive;
private List<ArtemisDevice> _devices;
private bool _isActive;
private string _name;
private double _scale;
internal ArtemisSurface(RGBSurface rgbSurface, string name, double scale)
{

View File

@ -1,9 +1,5 @@
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using Artemis.Storage;
using Artemis.Storage.Migrations.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
@ -15,8 +11,12 @@ using Serilog;
namespace Artemis.Core.Ninject
{
/// <summary>
/// The main <see cref="NinjectModule" /> of the Artemis Core that binds all services
/// </summary>
public class CoreModule : NinjectModule
{
/// <inheritdoc />
public override void Load()
{
if (Kernel == null)

View File

@ -1,8 +1,5 @@
using System.Linq;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using Artemis.Storage.Repositories.Interfaces;
using Ninject.Activation;
@ -31,8 +28,10 @@ namespace Artemis.Core.Ninject
pluginInfo = _pluginService.GetPluginByAssembly(parentRequest.Service.Assembly)?.PluginInfo;
// Fall back to assembly based detection
if (pluginInfo == null)
{
throw new ArtemisCoreException("PluginSettings can only be injected with the PluginInfo parameter provided " +
"or into a class defined in a plugin assembly");
}
return new PluginSettings(pluginInfo, _pluginRepository);
}

View File

@ -1,13 +1,10 @@
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services;
using Artemis.Core.Services;
using Ninject;
using Ninject.Activation;
namespace Artemis.Core.Ninject
{
public class SettingsServiceProvider : Provider<ISettingsService>
internal class SettingsServiceProvider : Provider<ISettingsService>
{
private readonly SettingsService _instance;

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.DataModelExpansions.Attributes
namespace Artemis.Core.DataModelExpansions
{
public class DataModelIgnoreAttribute : Attribute
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.DataModelExpansions.Attributes
namespace Artemis.Core.DataModelExpansions
{
[AttributeUsage(AttributeTargets.Property)]
public class DataModelPropertyAttribute : Attribute

View File

@ -4,12 +4,9 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
using Artemis.Core.Plugins.DataModelExpansions.Internal;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Modules;
namespace Artemis.Core.Plugins.DataModelExpansions
namespace Artemis.Core.DataModelExpansions
{
public abstract class DataModel
{

View File

@ -1,10 +1,8 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Artemis.Core.Plugins.DataModelExpansions.Internal;
using Artemis.Core.Utilities;
namespace Artemis.Core.Plugins.DataModelExpansions
namespace Artemis.Core.DataModelExpansions
{
/// <summary>
/// Allows you to expand the application-wide datamodel
@ -32,7 +30,8 @@ namespace Artemis.Core.Plugins.DataModelExpansions
}
/// <summary>
/// Stop hiding the provided property using a lambda expression, e.g. ShowProperty(dm => dm.TimeDataModel.CurrentTimeUTC)
/// Stop hiding the provided property using a lambda expression, e.g. ShowProperty(dm =>
/// dm.TimeDataModel.CurrentTimeUTC)
/// </summary>
/// <param name="propertyLambda">A lambda expression pointing to the property to stop ignoring</param>
public void ShowProperty<TProperty>(Expression<Func<T, TProperty>> propertyLambda)

View File

@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
namespace Artemis.Core.Plugins.DataModelExpansions.Internal
namespace Artemis.Core.DataModelExpansions
{
/// <summary>
/// For internal use only, to implement your own layer property type, extend <see cref="DataModelExpansion{T}" />

View File

@ -1,11 +1,10 @@
using System;
using System.IO;
using Artemis.Core.Extensions;
using Ninject;
using RGB.NET.Core;
using Serilog;
namespace Artemis.Core.Plugins.DeviceProviders
namespace Artemis.Core.DeviceProviders
{
/// <inheritdoc />
/// <summary>

View File

@ -1,7 +1,6 @@
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Stylet;
using Stylet;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
public abstract class BrushConfigurationViewModel : Screen
{

View File

@ -1,11 +1,9 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Plugins.LayerBrushes.Internal
namespace Artemis.Core.LayerBrushes
{
/// <summary>
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
@ -127,7 +125,7 @@ namespace Artemis.Core.Plugins.LayerBrushes.Internal
Regular,
/// <summary>
/// An RGB.NET brush that uses RGB.NET's per-LED rendering engine.
/// An RGB.NET brush that uses RGB.NET's per-LED rendering engine.
/// </summary>
RgbNet
}

View File

@ -1,9 +1,7 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
namespace Artemis.Core.Plugins.LayerBrushes.Internal
namespace Artemis.Core.LayerBrushes
{
/// <summary>
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead

View File

@ -1,9 +1,7 @@
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using SkiaSharp;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
public abstract class LayerBrush<T> : PropertiesLayerBrush<T> where T : LayerPropertyGroup
{

View File

@ -1,7 +1,6 @@
using System;
using Artemis.Core.Plugins.LayerBrushes.Internal;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
/// <inheritdoc />
public class LayerBrushConfigurationDialog<T> : LayerBrushConfigurationDialog where T : BrushConfigurationViewModel

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
/// <summary>
/// A class that describes a layer brush

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.LayerBrushes.Internal;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
/// <summary>
/// Allows you to create one or more <see cref="LayerBrush{T}" />s usable by profile layers.

View File

@ -1,10 +1,7 @@
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using SkiaSharp;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
public abstract class PerLedLayerBrush<T> : PropertiesLayerBrush<T> where T : LayerPropertyGroup
{

View File

@ -1,13 +1,11 @@
using System;
using System.Linq;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using RGB.NET.Core;
using RGB.NET.Groups;
using SkiaSharp;
namespace Artemis.Core.Plugins.LayerBrushes
namespace Artemis.Core.LayerBrushes
{
/// <summary>
/// An RGB.NET brush that uses RGB.NET's per-LED rendering engine.

View File

@ -1,6 +1,6 @@
using Stylet;
namespace Artemis.Core.Plugins.LayerEffects
namespace Artemis.Core.LayerEffects
{
public abstract class EffectConfigurationViewModel : Screen
{

View File

@ -1,16 +1,16 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
using SkiaSharp;
using Stylet;
namespace Artemis.Core.Plugins.LayerEffects
namespace Artemis.Core.LayerEffects
{
/// <summary>
/// For internal use only, please use <see cref="LayerEffect{T}" /> instead
/// </summary>
public abstract class BaseLayerEffect : PropertyChangedBase, IDisposable
{
private LayerEffectConfigurationDialog _configurationDialog;
private LayerEffectDescriptor _descriptor;
private bool _enabled;
private Guid _entityId;
@ -18,7 +18,6 @@ namespace Artemis.Core.Plugins.LayerEffects
private string _name;
private int _order;
private RenderProfileElement _profileElement;
private LayerEffectConfigurationDialog _configurationDialog;
/// <summary>
/// Gets the unique ID of this effect
@ -76,7 +75,7 @@ namespace Artemis.Core.Plugins.LayerEffects
}
/// <summary>
/// Gets the <see cref="LayerEffectDescriptor"/> that registered this effect
/// Gets the <see cref="LayerEffectDescriptor" /> that registered this effect
/// </summary>
public LayerEffectDescriptor Descriptor
{

View File

@ -1,9 +1,7 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services;
namespace Artemis.Core.Plugins.LayerEffects
namespace Artemis.Core.LayerEffects
{
public abstract class LayerEffect<T> : BaseLayerEffect where T : LayerPropertyGroup
{

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.LayerEffects
namespace Artemis.Core.LayerEffects
{
/// <inheritdoc />
public class LayerEffectConfigurationDialog<T> : LayerEffectConfigurationDialog where T : EffectConfigurationViewModel

View File

@ -1,6 +1,6 @@
using System;
namespace Artemis.Core.Plugins.LayerEffects
namespace Artemis.Core.LayerEffects
{
/// <summary>
/// A class that describes a layer effect

Some files were not shown because too many files have changed in this diff Show More