From ae330c376958057aa58f1bfcbdace0ff7896ffdc Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 14 Jan 2020 19:18:24 +0100 Subject: [PATCH] Code cleanup --- .../Extensions/FloatExtensions.cs | 2 +- .../JsonConverters/SKColorConverter.cs | 2 - .../KeyframeEngines/SKSizeKeyframeEngine.cs | 4 +- src/Artemis.Core/Models/Profile/Layer.cs | 5 +- .../LayerProperties/BaseLayerProperty.cs | 2 +- .../Profile/LayerProperties/LayerProperty.cs | 7 +- .../Models/Profile/LayerShapes/LayerShape.cs | 5 +- .../Plugins/LayerBrush/LayerBrushSettings.cs | 17 +- .../Plugins/Models/PluginSetting.cs | 2 +- .../Plugins/Models/PluginSettings.cs | 2 +- src/Artemis.Core/RGB.NET/BitmapBrush.cs | 1 - src/Artemis.Core/Services/CoreService.cs | 16 +- src/Artemis.Core/Services/LayerService.cs | 5 +- src/Artemis.Core/Services/SettingsService.cs | 4 +- .../Services/Storage/ProfileService.cs | 2 - src/Artemis.Core/packages.config | 1 + .../Properties/AssemblyInfo.cs | 3 +- .../ColorBrush.cs | 8 +- .../ColorBrushViewModel.cs | 2 +- .../packages.config | 1 + .../NoiseBrushProvider.cs | 3 +- .../NoiseBrushSettings.cs | 9 - .../Properties/AssemblyInfo.cs | 3 +- .../Utilities/OpenSimplexNoise.cs | 341 +++++++++++------- .../app.config | 1 + .../packages.config | 1 + .../packages.config | 1 + src/Artemis.UI.Shared/ColorPicker.xaml.cs | 7 +- .../Converters/ColorToSolidColorConverter.cs | 3 +- .../Properties/AssemblyInfo.cs | 14 +- .../Properties/Settings.settings | 1 + src/Artemis.UI.Shared/UserControl1.xaml | 12 +- src/Artemis.UI.Shared/UserControl1.xaml.cs | 19 +- src/Artemis.UI.Shared/packages.config | 1 + src/Artemis.UI/App.xaml | 4 +- .../Behaviors/InputBindingBehavior.cs | 2 +- src/Artemis.UI/Bootstrapper.cs | 1 - src/Artemis.UI/Events/MainWindowKeyEvent.cs | 6 +- .../GradientEditor/GradientEditorView.xaml | 22 +- .../Screens/Module/ModuleRootView.xaml | 14 +- .../Screens/Module/ModuleRootViewModel.cs | 2 +- .../LayerProperties/LayerPropertiesView.xaml | 6 +- .../LayerPropertiesView.xaml.cs | 5 - .../LayerProperties/LayerPropertyViewModel.cs | 3 +- .../FloatPropertyInputViewModel.cs | 1 - .../PropertyInput/IntPropertyInputView.xaml | 2 +- .../IntPropertyInputViewModel.cs | 1 - .../PropertyInput/PropertyInputViewModel.cs | 1 - .../SKPointPropertyInputViewModel.cs | 3 +- .../SKSizePropertyInputView.xaml | 2 +- .../SKSizePropertyInputViewModel.cs | 3 +- .../PropertyTree/PropertyTreeViewModel.cs | 3 +- .../Timeline/PropertyTimelineViewModel.cs | 2 +- .../Timeline/PropertyTrackEasingViewModel.cs | 2 +- .../ProfileEditor/ProfileEditorView.xaml | 4 +- .../ProfileTree/TreeItem/TreeItemViewModel.cs | 4 +- .../Visualization/ProfileLayerViewModel.cs | 3 - .../Visualization/ProfileView.xaml | 3 +- .../Visualization/ProfileViewModel.cs | 1 - .../Visualization/Tools/EditToolViewModel.cs | 10 +- src/Artemis.UI/Screens/News/NewsViewModel.cs | 1 - src/Artemis.UI/Screens/RootViewModel.cs | 16 +- .../Screens/Settings/SettingsView.xaml | 12 +- .../Screens/Settings/SettingsViewModel.cs | 4 +- .../Tabs/Devices/DeviceSettingsViewModel.cs | 2 +- .../Screens/Sidebar/SidebarView.xaml.cs | 19 +- .../Screens/Sidebar/SidebarViewModel.cs | 9 +- src/Artemis.UI/Screens/Splash/SplashView.xaml | 34 +- .../SurfaceEditor/SurfaceEditorViewModel.cs | 6 +- .../Screens/Workshop/WorkshopViewModel.cs | 3 +- .../Interfaces/IProfileEditorService.cs | 2 - src/Artemis.UI/Utilities/ThemeWatcher.cs | 10 +- src/Artemis.UI/packages.config | 1 + 73 files changed, 372 insertions(+), 364 deletions(-) diff --git a/src/Artemis.Core/Extensions/FloatExtensions.cs b/src/Artemis.Core/Extensions/FloatExtensions.cs index a5496896b..45441588e 100644 --- a/src/Artemis.Core/Extensions/FloatExtensions.cs +++ b/src/Artemis.Core/Extensions/FloatExtensions.cs @@ -6,7 +6,7 @@ namespace Artemis.Core.Extensions { public static int RoundToInt(this float number) { - return (int)Math.Round(number, MidpointRounding.AwayFromZero); + return (int) Math.Round(number, MidpointRounding.AwayFromZero); } } } \ No newline at end of file diff --git a/src/Artemis.Core/JsonConverters/SKColorConverter.cs b/src/Artemis.Core/JsonConverters/SKColorConverter.cs index d3fe0f69e..e2b17cd40 100644 --- a/src/Artemis.Core/JsonConverters/SKColorConverter.cs +++ b/src/Artemis.Core/JsonConverters/SKColorConverter.cs @@ -14,9 +14,7 @@ namespace Artemis.Core.JsonConverters public override SKColor ReadJson(JsonReader reader, Type objectType, SKColor existingValue, bool hasExistingValue, JsonSerializer serializer) { if (reader.Value is string value && !string.IsNullOrWhiteSpace(value)) - { return SKColor.Parse(value); - } return SKColor.Empty; } diff --git a/src/Artemis.Core/Models/Profile/KeyframeEngines/SKSizeKeyframeEngine.cs b/src/Artemis.Core/Models/Profile/KeyframeEngines/SKSizeKeyframeEngine.cs index b69590872..ea9e8fe45 100644 --- a/src/Artemis.Core/Models/Profile/KeyframeEngines/SKSizeKeyframeEngine.cs +++ b/src/Artemis.Core/Models/Profile/KeyframeEngines/SKSizeKeyframeEngine.cs @@ -12,8 +12,8 @@ namespace Artemis.Core.Models.Profile.KeyframeEngines protected override object GetInterpolatedValue() { - var currentKeyframe = (Keyframe)CurrentKeyframe; - var nextKeyframe = (Keyframe)NextKeyframe; + var currentKeyframe = (Keyframe) CurrentKeyframe; + var nextKeyframe = (Keyframe) NextKeyframe; var widthDiff = nextKeyframe.Value.Width - currentKeyframe.Value.Width; var heightDiff = nextKeyframe.Value.Height - currentKeyframe.Value.Height; diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index d0878d9a9..3132d7210 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -328,7 +328,7 @@ namespace Artemis.Core.Models.Profile var propertyEntity = LayerEntity.PropertyEntities.FirstOrDefault(p => p.Id == layerProperty.Id && p.ValueType == layerProperty.Type.Name); // TODO: Catch serialization exceptions and log them - if (propertyEntity != null) + if (propertyEntity != null) layerProperty.ApplyToProperty(propertyEntity); _properties.Add(layerProperty.Id, layerProperty); @@ -354,7 +354,8 @@ namespace Artemis.Core.Models.Profile private void CreateDefaultProperties() { - var transformProperty = new LayerProperty(this, null, "Core.Transform", "Transform", "The default properties collection every layer has, allows you to transform the shape.") {ExpandByDefault = true}; + var transformProperty = new LayerProperty(this, null, "Core.Transform", "Transform", "The default properties collection every layer has, allows you to transform the shape.") + {ExpandByDefault = true}; AnchorPointProperty = new LayerProperty(this, transformProperty, "Core.AnchorPoint", "Anchor Point", "The point at which the shape is attached to its position."); PositionProperty = new LayerProperty(this, transformProperty, "Core.Position", "Position", "The position of the shape."); SizeProperty = new LayerProperty(this, transformProperty, "Core.Size", "Size", "The size of the shape.") {InputAffix = "%"}; diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs index ead38477f..ed8906600 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs @@ -74,7 +74,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties public string InputAffix { get; set; } /// - /// Gets or sets whether this property can use keyframes, True by default. + /// Gets or sets whether this property can use keyframes, True by default. /// public bool CanUseKeyframes { get; set; } diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index 54c393ff0..8eb2c16a9 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Linq; namespace Artemis.Core.Models.Profile.LayerProperties @@ -26,8 +25,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties { get { - var currentValue = base.GetCurrentValue(); - return currentValue == null ? default : (T)currentValue; + var currentValue = GetCurrentValue(); + return currentValue == null ? default : (T) currentValue; } } diff --git a/src/Artemis.Core/Models/Profile/LayerShapes/LayerShape.cs b/src/Artemis.Core/Models/Profile/LayerShapes/LayerShape.cs index 229287c62..eb4231581 100644 --- a/src/Artemis.Core/Models/Profile/LayerShapes/LayerShape.cs +++ b/src/Artemis.Core/Models/Profile/LayerShapes/LayerShape.cs @@ -43,7 +43,10 @@ namespace Artemis.Core.Models.Profile.LayerShapes /// Updates Position and Size using the provided unscaled rectangle /// /// An unscaled rectangle which is relative to the layer (1.0 being full width/height, 0.5 being half). - /// An optional timespan to indicate where to set the properties, if null the properties' base values will be used. + /// + /// An optional timespan to indicate where to set the properties, if null the properties' base values + /// will be used. + /// public void SetFromUnscaledRectangle(SKRect rect, TimeSpan? time) { if (!Layer.Leds.Any()) diff --git a/src/Artemis.Core/Plugins/LayerBrush/LayerBrushSettings.cs b/src/Artemis.Core/Plugins/LayerBrush/LayerBrushSettings.cs index 000944f99..8ba064593 100644 --- a/src/Artemis.Core/Plugins/LayerBrush/LayerBrushSettings.cs +++ b/src/Artemis.Core/Plugins/LayerBrush/LayerBrushSettings.cs @@ -1,21 +1,18 @@ using System; +using System.Xml.Serialization; +using Newtonsoft.Json; using Stylet; namespace Artemis.Core.Plugins.LayerBrush { public abstract class LayerBrushSettings : PropertyChangedBase { - private Action _propertyChangedDispatcher = Execute.DefaultPropertyChangedDispatcher; - /// - /// Gets or sets the dispatcher to use to dispatch PropertyChanged events. Defaults to Execute.DefaultPropertyChangedDispatcher + /// Gets or sets the dispatcher to use to dispatch PropertyChanged events. Defaults to + /// Execute.DefaultPropertyChangedDispatcher /// - [System.Xml.Serialization.XmlIgnore] - [Newtonsoft.Json.JsonIgnore] - public override Action PropertyChangedDispatcher - { - get { return this._propertyChangedDispatcher; } - set { this._propertyChangedDispatcher = value; } - } + [XmlIgnore] + [JsonIgnore] + public override Action PropertyChangedDispatcher { get; set; } = Execute.DefaultPropertyChangedDispatcher; } } \ No newline at end of file diff --git a/src/Artemis.Core/Plugins/Models/PluginSetting.cs b/src/Artemis.Core/Plugins/Models/PluginSetting.cs index 2d6da3c0f..208b70f81 100644 --- a/src/Artemis.Core/Plugins/Models/PluginSetting.cs +++ b/src/Artemis.Core/Plugins/Models/PluginSetting.cs @@ -26,7 +26,7 @@ namespace Artemis.Core.Plugins.Models } catch (JsonReaderException) { - Value = default(T); + Value = default; } } diff --git a/src/Artemis.Core/Plugins/Models/PluginSettings.cs b/src/Artemis.Core/Plugins/Models/PluginSettings.cs index 8c1851f35..4d915e5a0 100644 --- a/src/Artemis.Core/Plugins/Models/PluginSettings.cs +++ b/src/Artemis.Core/Plugins/Models/PluginSettings.cs @@ -29,7 +29,7 @@ namespace Artemis.Core.Plugins.Models /// The name of the setting /// The default value to use if the setting does not exist yet /// - public PluginSetting GetSetting(string name, T defaultValue = default(T)) + public PluginSetting GetSetting(string name, T defaultValue = default) { lock (_settingEntities) { diff --git a/src/Artemis.Core/RGB.NET/BitmapBrush.cs b/src/Artemis.Core/RGB.NET/BitmapBrush.cs index 57bdee0b2..beb528044 100644 --- a/src/Artemis.Core/RGB.NET/BitmapBrush.cs +++ b/src/Artemis.Core/RGB.NET/BitmapBrush.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Runtime.CompilerServices; using Artemis.Core.Extensions; using Artemis.Core.Plugins.Models; using RGB.NET.Core; diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs index 9e0782079..5e1b6603b 100644 --- a/src/Artemis.Core/Services/CoreService.cs +++ b/src/Artemis.Core/Services/CoreService.cs @@ -42,14 +42,6 @@ namespace Artemis.Core.Services Task.Run(Initialize); } - private void ConfigureJsonConvert() - { - JsonConvert.DefaultSettings = () => new JsonSerializerSettings - { - Converters = new List { new SKColorConverter() } - }; - } - public void Dispose() { // Dispose services @@ -58,6 +50,14 @@ namespace Artemis.Core.Services public bool IsInitialized { get; set; } + private void ConfigureJsonConvert() + { + JsonConvert.DefaultSettings = () => new JsonSerializerSettings + { + Converters = new List {new SKColorConverter()} + }; + } + private async Task Initialize() { if (IsInitialized) diff --git a/src/Artemis.Core/Services/LayerService.cs b/src/Artemis.Core/Services/LayerService.cs index 1bbc10eba..55a68ecec 100644 --- a/src/Artemis.Core/Services/LayerService.cs +++ b/src/Artemis.Core/Services/LayerService.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Artemis.Core.Models.Profile; using Artemis.Core.Models.Profile.KeyframeEngines; using Artemis.Core.Models.Profile.LayerProperties; @@ -61,9 +60,7 @@ namespace Artemis.Core.Services } // If no settings found, provide a fresh instance of the settings type else if (settingsType != null) - { settingsInstance = Activator.CreateInstance(settingsType); - } var arguments = new IParameter[] { @@ -72,7 +69,7 @@ namespace Artemis.Core.Services new ConstructorArgument("descriptor", brushDescriptor) }; var layerElement = (LayerBrush) _kernel.Get(brushDescriptor.LayerBrushType, arguments); - layer.LayerBrush = (layerElement); + layer.LayerBrush = layerElement; return layerElement; } diff --git a/src/Artemis.Core/Services/SettingsService.cs b/src/Artemis.Core/Services/SettingsService.cs index 1a1366d45..d276b035f 100644 --- a/src/Artemis.Core/Services/SettingsService.cs +++ b/src/Artemis.Core/Services/SettingsService.cs @@ -16,7 +16,7 @@ namespace Artemis.Core.Services _pluginSettings = new PluginSettings(pluginInfo, pluginSettingRepository); } - public PluginSetting GetSetting(string name, T defaultValue = default(T)) + public PluginSetting GetSetting(string name, T defaultValue = default) { return _pluginSettings.GetSetting(name, defaultValue); } @@ -28,6 +28,6 @@ namespace Artemis.Core.Services /// public interface ISettingsService : IProtectedArtemisService { - PluginSetting GetSetting(string name, T defaultValue = default(T)); + PluginSetting GetSetting(string name, T defaultValue = default); } } \ No newline at end of file diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs index f0dd82bb5..86863dd60 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -160,9 +160,7 @@ namespace Artemis.Core.Services.Storage { // Only instantiate engines for properties without an existing engine instance foreach (var layerProperty in profile.GetAllLayers().SelectMany(l => l.Properties).Where(p => p.KeyframeEngine == null)) - { _layerService.InstantiateKeyframeEngine(layerProperty); - } } private void ActiveProfilesPopulateLeds(ArtemisSurface surface) diff --git a/src/Artemis.Core/packages.config b/src/Artemis.Core/packages.config index b00ab366b..8a736a304 100644 --- a/src/Artemis.Core/packages.config +++ b/src/Artemis.Core/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs b/src/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs index f08f0d2fa..27fe6aeeb 100644 --- a/src/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs +++ b/src/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs b/src/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs index 1d54fe85c..5b743516f 100644 --- a/src/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs +++ b/src/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs @@ -9,9 +9,9 @@ namespace Artemis.Plugins.LayerBrushes.Color { public class ColorBrush : LayerBrush { - private SKShader _shader; - private List _testColors; private SKPaint _paint; + private SKShader _shader; + private readonly List _testColors; public ColorBrush(Layer layer, ColorBrushSettings settings, LayerBrushDescriptor descriptor) : base(layer, settings, descriptor) { @@ -31,6 +31,8 @@ namespace Artemis.Plugins.LayerBrushes.Color Settings.PropertyChanged += (sender, args) => CreateShader(); } + public new ColorBrushSettings Settings { get; } + private void CreateShader() { var center = new SKPoint(Layer.Rectangle.MidX, Layer.Rectangle.MidY); @@ -61,8 +63,6 @@ namespace Artemis.Plugins.LayerBrushes.Color oldPaint?.Dispose(); } - public new ColorBrushSettings Settings { get; } - public override LayerBrushViewModel GetViewModel() { return new ColorBrushViewModel(this); diff --git a/src/Artemis.Plugins.LayerBrushes.Color/ColorBrushViewModel.cs b/src/Artemis.Plugins.LayerBrushes.Color/ColorBrushViewModel.cs index 437b22ae8..d13a65287 100644 --- a/src/Artemis.Plugins.LayerBrushes.Color/ColorBrushViewModel.cs +++ b/src/Artemis.Plugins.LayerBrushes.Color/ColorBrushViewModel.cs @@ -11,7 +11,7 @@ namespace Artemis.Plugins.LayerBrushes.Color ColorBrush = element; } - public new ColorBrush ColorBrush { get; } + public ColorBrush ColorBrush { get; } public IEnumerable BrushTypes => EnumUtilities.GetAllValuesAndDescriptions(typeof(GradientType)); } } \ No newline at end of file diff --git a/src/Artemis.Plugins.LayerBrushes.Color/packages.config b/src/Artemis.Plugins.LayerBrushes.Color/packages.config index 66df08a60..9597fbf92 100644 --- a/src/Artemis.Plugins.LayerBrushes.Color/packages.config +++ b/src/Artemis.Plugins.LayerBrushes.Color/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProvider.cs b/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProvider.cs index 6d3f71307..f2b0e8f50 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProvider.cs +++ b/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProvider.cs @@ -1,5 +1,4 @@ - -using Artemis.Core.Plugins.LayerBrush; +using Artemis.Core.Plugins.LayerBrush; using Artemis.Core.Plugins.Models; namespace Artemis.Plugins.LayerBrushes.Noise diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushSettings.cs b/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushSettings.cs index 2f045ba4a..7bc7b1265 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushSettings.cs +++ b/src/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushSettings.cs @@ -10,15 +10,6 @@ namespace Artemis.Plugins.LayerBrushes.Noise private SKColor _color; private float _xScale; private float _yScale; - - public NoiseBrushSettings() - { -// Color = new SKColor(0, 0, 0); -// BlendMode = SKBlendMode.Color; -// XScale = 0.5f; -// YScale = 0.5f; -// AnimationSpeed = 50f; - } public SKColor Color { diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs b/src/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs index 68a8ae3ae..e02904abd 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs +++ b/src/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/Utilities/OpenSimplexNoise.cs b/src/Artemis.Plugins.LayerBrushes.Noise/Utilities/OpenSimplexNoise.cs index 9917f7b5e..97d48c2b2 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/Utilities/OpenSimplexNoise.cs +++ b/src/Artemis.Plugins.LayerBrushes.Noise/Utilities/OpenSimplexNoise.cs @@ -5,167 +5,228 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities { public class OpenSimplexNoise { - private const double STRETCH_2D = -0.211324865405187; //(1/Math.sqrt(2+1)-1)/2; - private const double STRETCH_3D = -1.0 / 6.0; //(1/Math.sqrt(3+1)-1)/3; - private const double STRETCH_4D = -0.138196601125011; //(1/Math.sqrt(4+1)-1)/4; - private const double SQUISH_2D = 0.366025403784439; //(Math.sqrt(2+1)-1)/2; - private const double SQUISH_3D = 1.0 / 3.0; //(Math.sqrt(3+1)-1)/3; - private const double SQUISH_4D = 0.309016994374947; //(Math.sqrt(4+1)-1)/4; + private const double STRETCH_2D = -0.211324865405187; //(1/Math.sqrt(2+1)-1)/2; + private const double STRETCH_3D = -1.0 / 6.0; //(1/Math.sqrt(3+1)-1)/3; + private const double STRETCH_4D = -0.138196601125011; //(1/Math.sqrt(4+1)-1)/4; + private const double SQUISH_2D = 0.366025403784439; //(Math.sqrt(2+1)-1)/2; + private const double SQUISH_3D = 1.0 / 3.0; //(Math.sqrt(3+1)-1)/3; + private const double SQUISH_4D = 0.309016994374947; //(Math.sqrt(4+1)-1)/4; private const double NORM_2D = 1.0 / 47.0; private const double NORM_3D = 1.0 / 103.0; private const double NORM_4D = 1.0 / 30.0; - private byte[] perm; - private byte[] perm2D; - private byte[] perm3D; - private byte[] perm4D; - - private static double[] gradients2D = new double[] + private static readonly double[] gradients2D = { - 5, 2, 2, 5, - -5, 2, -2, 5, - 5, -2, 2, -5, - -5, -2, -2, -5, + 5, 2, 2, 5, + -5, 2, -2, 5, + 5, -2, 2, -5, + -5, -2, -2, -5 }; - private static double[] gradients3D = + private static readonly double[] gradients3D = { - -11, 4, 4, -4, 11, 4, -4, 4, 11, - 11, 4, 4, 4, 11, 4, 4, 4, 11, - -11, -4, 4, -4, -11, 4, -4, -4, 11, - 11, -4, 4, 4, -11, 4, 4, -4, 11, - -11, 4, -4, -4, 11, -4, -4, 4, -11, - 11, 4, -4, 4, 11, -4, 4, 4, -11, - -11, -4, -4, -4, -11, -4, -4, -4, -11, - 11, -4, -4, 4, -11, -4, 4, -4, -11, + -11, 4, 4, -4, 11, 4, -4, 4, 11, + 11, 4, 4, 4, 11, 4, 4, 4, 11, + -11, -4, 4, -4, -11, 4, -4, -4, 11, + 11, -4, 4, 4, -11, 4, 4, -4, 11, + -11, 4, -4, -4, 11, -4, -4, 4, -11, + 11, 4, -4, 4, 11, -4, 4, 4, -11, + -11, -4, -4, -4, -11, -4, -4, -4, -11, + 11, -4, -4, 4, -11, -4, 4, -4, -11 }; - private static double[] gradients4D = + private static readonly double[] gradients4D = { - 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, - -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, - 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, - -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, - 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, - -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, - 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, - -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, - 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, - -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, - 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, - -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, - 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, - -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, - 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, - -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, + 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, + -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, + 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, + -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, + 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, + -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, + 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, + -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, + 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, + -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, + 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, + -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, + 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, + -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, + 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, + -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3 }; - private static Contribution2[] lookup2D; - private static Contribution3[] lookup3D; - private static Contribution4[] lookup4D; + private static readonly Contribution2[] lookup2D; + private static readonly Contribution3[] lookup3D; + private static readonly Contribution4[] lookup4D; + + private readonly byte[] perm; + private readonly byte[] perm2D; + private readonly byte[] perm3D; + private readonly byte[] perm4D; static OpenSimplexNoise() { - var base2D = new int[][] + var base2D = new[] { - new int[] { 1, 1, 0, 1, 0, 1, 0, 0, 0 }, - new int[] { 1, 1, 0, 1, 0, 1, 2, 1, 1 } + new[] {1, 1, 0, 1, 0, 1, 0, 0, 0}, + new[] {1, 1, 0, 1, 0, 1, 2, 1, 1} }; - var p2D = new int[] { 0, 0, 1, -1, 0, 0, -1, 1, 0, 2, 1, 1, 1, 2, 2, 0, 1, 2, 0, 2, 1, 0, 0, 0 }; - var lookupPairs2D = new int[] { 0, 1, 1, 0, 4, 1, 17, 0, 20, 2, 21, 2, 22, 5, 23, 5, 26, 4, 39, 3, 42, 4, 43, 3 }; + var p2D = new[] {0, 0, 1, -1, 0, 0, -1, 1, 0, 2, 1, 1, 1, 2, 2, 0, 1, 2, 0, 2, 1, 0, 0, 0}; + var lookupPairs2D = new[] {0, 1, 1, 0, 4, 1, 17, 0, 20, 2, 21, 2, 22, 5, 23, 5, 26, 4, 39, 3, 42, 4, 43, 3}; var contributions2D = new Contribution2[p2D.Length / 4]; - for (int i = 0; i < p2D.Length; i += 4) + for (var i = 0; i < p2D.Length; i += 4) { var baseSet = base2D[p2D[i]]; Contribution2 previous = null, current = null; - for (int k = 0; k < baseSet.Length; k += 3) + for (var k = 0; k < baseSet.Length; k += 3) { current = new Contribution2(baseSet[k], baseSet[k + 1], baseSet[k + 2]); if (previous == null) - { contributions2D[i / 4] = current; - } else - { previous.Next = current; - } previous = current; } + current.Next = new Contribution2(p2D[i + 1], p2D[i + 2], p2D[i + 3]); } lookup2D = new Contribution2[64]; for (var i = 0; i < lookupPairs2D.Length; i += 2) - { lookup2D[lookupPairs2D[i]] = contributions2D[lookupPairs2D[i + 1]]; - } - var base3D = new int[][] + var base3D = new[] { - new int[] { 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 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, 1, 1, 2, 2, 5, 1, 6, 0, 7, 0, 32, 2, 34, 2, 129, 1, 133, 1, 160, 5, 161, 5, 518, 0, 519, 0, 546, 4, 550, 4, 645, 3, 647, 3, 672, 5, 673, 5, 674, 4, 677, 3, 678, 4, 679, 3, 680, + 13, 681, 13, 682, 12, 685, 14, 686, 12, 687, 14, 712, 20, 714, 18, 809, 21, 813, 23, 840, 20, 841, 21, 1198, 19, 1199, 22, 1226, 18, 1230, 19, 1325, 23, 1327, 22, 1352, 15, 1353, 17, + 1354, 15, 1357, 17, 1358, 16, 1359, 16, 1360, 11, 1361, 10, 1362, 11, 1365, 10, 1366, 9, 1367, 9, 1392, 11, 1394, 11, 1489, 10, 1493, 10, 1520, 8, 1521, 8, 1878, 9, 1879, 9, 1906, 7, + 1910, 7, 2005, 6, 2007, 6, 2032, 8, 2033, 8, 2034, 7, 2037, 6, 2038, 7, 2039, 6 }; - var p3D = new int[] { 0, 0, 1, -1, 0, 0, 1, 0, -1, 0, 0, -1, 1, 0, 0, 0, 1, -1, 0, 0, -1, 0, 1, 0, 0, -1, 1, 0, 2, 1, 1, 0, 1, 1, 1, -1, 0, 2, 1, 0, 1, 1, 1, -1, 1, 0, 2, 0, 1, 1, 1, -1, 1, 1, 1, 3, 2, 1, 0, 3, 1, 2, 0, 1, 3, 2, 0, 1, 3, 1, 0, 2, 1, 3, 0, 2, 1, 3, 0, 1, 2, 1, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 2, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 0, 1, 1, -1, 1, 2, 0, 0, 0, 0, 1, -1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, -1, 2, 3, 1, 1, 1, 2, 0, 0, 2, 2, 3, 1, 1, 1, 2, 2, 0, 0, 2, 3, 1, 1, 1, 2, 0, 2, 0, 2, 1, 1, -1, 1, 2, 0, 0, 2, 2, 1, 1, -1, 1, 2, 2, 0, 0, 2, 1, -1, 1, 1, 2, 0, 0, 2, 2, 1, -1, 1, 1, 2, 0, 2, 0, 2, 1, 1, 1, -1, 2, 2, 0, 0, 2, 1, 1, 1, -1, 2, 0, 2, 0 }; - var lookupPairs3D = new int[] { 0, 2, 1, 1, 2, 2, 5, 1, 6, 0, 7, 0, 32, 2, 34, 2, 129, 1, 133, 1, 160, 5, 161, 5, 518, 0, 519, 0, 546, 4, 550, 4, 645, 3, 647, 3, 672, 5, 673, 5, 674, 4, 677, 3, 678, 4, 679, 3, 680, 13, 681, 13, 682, 12, 685, 14, 686, 12, 687, 14, 712, 20, 714, 18, 809, 21, 813, 23, 840, 20, 841, 21, 1198, 19, 1199, 22, 1226, 18, 1230, 19, 1325, 23, 1327, 22, 1352, 15, 1353, 17, 1354, 15, 1357, 17, 1358, 16, 1359, 16, 1360, 11, 1361, 10, 1362, 11, 1365, 10, 1366, 9, 1367, 9, 1392, 11, 1394, 11, 1489, 10, 1493, 10, 1520, 8, 1521, 8, 1878, 9, 1879, 9, 1906, 7, 1910, 7, 2005, 6, 2007, 6, 2032, 8, 2033, 8, 2034, 7, 2037, 6, 2038, 7, 2039, 6 }; var contributions3D = new Contribution3[p3D.Length / 9]; - for (int i = 0; i < p3D.Length; i += 9) + for (var i = 0; i < p3D.Length; i += 9) { var baseSet = base3D[p3D[i]]; Contribution3 previous = null, current = null; - for (int k = 0; k < baseSet.Length; k += 4) + for (var k = 0; k < baseSet.Length; k += 4) { current = new Contribution3(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3]); if (previous == null) - { contributions3D[i / 9] = current; - } else - { previous.Next = current; - } previous = current; } + current.Next = new Contribution3(p3D[i + 1], p3D[i + 2], p3D[i + 3], p3D[i + 4]); current.Next.Next = new Contribution3(p3D[i + 5], p3D[i + 6], p3D[i + 7], p3D[i + 8]); } lookup3D = new Contribution3[2048]; for (var i = 0; i < lookupPairs3D.Length; i += 2) - { lookup3D[lookupPairs3D[i]] = contributions3D[lookupPairs3D[i + 1]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2053, 2, 2057, 2, 2061, 2, 2081, 2, 2085, 2, 2089, 2, 2093, 2, 2304, 9, 2305, 9, + 2312, 9, 2313, 9, 16390, 1, 16391, 1, 16406, 1, 16407, 1, 16422, 1, 16423, 1, 16438, 1, 16439, 1, 16642, 8, 16646, 8, 16658, 8, 16662, 8, 18437, 6, 18439, 6, 18469, 6, 18471, 6, 18688, + 9, 18689, 9, 18690, 8, 18693, 6, 18694, 8, 18695, 6, 18696, 9, 18697, 9, 18706, 8, 18710, 8, 18725, 6, 18727, 6, 131128, 0, 131129, 0, 131130, 0, 131131, 0, 131132, 0, 131133, 0, + 131134, 0, 131135, 0, 131352, 7, 131354, 7, 131384, 7, 131386, 7, 133161, 5, 133165, 5, 133177, 5, 133181, 5, 133376, 9, 133377, 9, 133384, 9, 133385, 9, 133400, 7, 133402, 7, 133417, + 5, 133421, 5, 133432, 7, 133433, 5, 133434, 7, 133437, 5, 147510, 4, 147511, 4, 147518, 4, 147519, 4, 147714, 8, 147718, 8, 147730, 8, 147734, 8, 147736, 7, 147738, 7, 147766, 4, + 147767, 4, 147768, 7, 147770, 7, 147774, 4, 147775, 4, 149509, 6, 149511, 6, 149541, 6, 149543, 6, 149545, 5, 149549, 5, 149558, 4, 149559, 4, 149561, 5, 149565, 5, 149566, 4, 149567, + 4, 149760, 9, 149761, 9, 149762, 8, 149765, 6, 149766, 8, 149767, 6, 149768, 9, 149769, 9, 149778, 8, 149782, 8, 149784, 7, 149786, 7, 149797, 6, 149799, 6, 149801, 5, 149805, 5, + 149814, 4, 149815, 4, 149816, 7, 149817, 5, 149818, 7, 149821, 5, 149822, 4, 149823, 4, 149824, 37, 149825, 37, 149826, 36, 149829, 34, 149830, 36, 149831, 34, 149832, 37, 149833, 37, + 149842, 36, 149846, 36, 149848, 35, 149850, 35, 149861, 34, 149863, 34, 149865, 33, 149869, 33, 149878, 32, 149879, 32, 149880, 35, 149881, 33, 149882, 35, 149885, 33, 149886, 32, + 149887, 32, 150080, 49, 150082, 48, 150088, 49, 150098, 48, 150104, 47, 150106, 47, 151873, 46, 151877, 45, 151881, 46, 151909, 45, 151913, 44, 151917, 44, 152128, 49, 152129, 46, + 152136, 49, 152137, 46, 166214, 43, 166215, 42, 166230, 43, 166247, 42, 166262, 41, 166263, 41, 166466, 48, 166470, 43, 166482, 48, 166486, 43, 168261, 45, 168263, 42, 168293, 45, + 168295, 42, 168512, 31, 168513, 28, 168514, 31, 168517, 28, 168518, 25, 168519, 25, 280952, 40, 280953, 39, 280954, 40, 280957, 39, 280958, 38, 280959, 38, 281176, 47, 281178, 47, + 281208, 40, 281210, 40, 282985, 44, 282989, 44, 283001, 39, 283005, 39, 283208, 30, 283209, 27, 283224, 30, 283241, 27, 283256, 22, 283257, 22, 297334, 41, 297335, 41, 297342, 38, + 297343, 38, 297554, 29, 297558, 24, 297562, 29, 297590, 24, 297594, 21, 297598, 21, 299365, 26, 299367, 23, 299373, 26, 299383, 23, 299389, 20, 299391, 20, 299584, 31, 299585, 28, + 299586, 31, 299589, 28, 299590, 25, 299591, 25, 299592, 30, 299593, 27, 299602, 29, 299606, 24, 299608, 30, 299610, 29, 299621, 26, 299623, 23, 299625, 27, 299629, 26, 299638, 24, + 299639, 23, 299640, 22, 299641, 22, 299642, 21, 299645, 20, 299646, 21, 299647, 20, 299648, 61, 299649, 60, 299650, 61, 299653, 60, 299654, 59, 299655, 59, 299656, 58, 299657, 57, + 299666, 55, 299670, 54, 299672, 58, 299674, 55, 299685, 52, 299687, 51, 299689, 57, 299693, 52, 299702, 54, 299703, 51, 299704, 56, 299705, 56, 299706, 53, 299709, 50, 299710, 53, + 299711, 50, 299904, 61, 299906, 61, 299912, 58, 299922, 55, 299928, 58, 299930, 55, 301697, 60, 301701, 60, 301705, 57, 301733, 52, 301737, 57, 301741, 52, 301952, 79, 301953, 79, + 301960, 76, 301961, 76, 316038, 59, 316039, 59, 316054, 54, 316071, 51, 316086, 54, 316087, 51, 316290, 78, 316294, 78, 316306, 73, 316310, 73, 318085, 77, 318087, 77, 318117, 70, + 318119, 70, 318336, 79, 318337, 79, 318338, 78, 318341, 77, 318342, 78, 318343, 77, 430776, 56, 430777, 56, 430778, 53, 430781, 50, 430782, 53, 430783, 50, 431000, 75, 431002, 72, + 431032, 75, 431034, 72, 432809, 74, 432813, 69, 432825, 74, 432829, 69, 433032, 76, 433033, 76, 433048, 75, 433065, 74, 433080, 75, 433081, 74, 447158, 71, 447159, 68, 447166, 71, + 447167, 68, 447378, 73, 447382, 73, 447386, 72, 447414, 71, 447418, 72, 447422, 71, 449189, 70, 449191, 70, 449197, 69, 449207, 68, 449213, 69, 449215, 68, 449408, 67, 449409, 67, + 449410, 66, 449413, 64, 449414, 66, 449415, 64, 449416, 67, 449417, 67, 449426, 66, 449430, 66, 449432, 65, 449434, 65, 449445, 64, 449447, 64, 449449, 63, 449453, 63, 449462, 62, + 449463, 62, 449464, 65, 449465, 63, 449466, 65, 449469, 63, 449470, 62, 449471, 62, 449472, 19, 449473, 19, 449474, 18, 449477, 16, 449478, 18, 449479, 16, 449480, 19, 449481, 19, + 449490, 18, 449494, 18, 449496, 17, 449498, 17, 449509, 16, 449511, 16, 449513, 15, 449517, 15, 449526, 14, 449527, 14, 449528, 17, 449529, 15, 449530, 17, 449533, 15, 449534, 14, + 449535, 14, 449728, 19, 449729, 19, 449730, 18, 449734, 18, 449736, 19, 449737, 19, 449746, 18, 449750, 18, 449752, 17, 449754, 17, 449784, 17, 449786, 17, 451520, 19, 451521, 19, + 451525, 16, 451527, 16, 451528, 19, 451529, 19, 451557, 16, 451559, 16, 451561, 15, 451565, 15, 451577, 15, 451581, 15, 451776, 19, 451777, 19, 451784, 19, 451785, 19, 465858, 18, + 465861, 16, 465862, 18, 465863, 16, 465874, 18, 465878, 18, 465893, 16, 465895, 16, 465910, 14, 465911, 14, 465918, 14, 465919, 14, 466114, 18, 466118, 18, 466130, 18, 466134, 18, + 467909, 16, 467911, 16, 467941, 16, 467943, 16, 468160, 13, 468161, 13, 468162, 13, 468163, 13, 468164, 13, 468165, 13, 468166, 13, 468167, 13, 580568, 17, 580570, 17, 580585, 15, + 580589, 15, 580598, 14, 580599, 14, 580600, 17, 580601, 15, 580602, 17, 580605, 15, 580606, 14, 580607, 14, 580824, 17, 580826, 17, 580856, 17, 580858, 17, 582633, 15, 582637, 15, + 582649, 15, 582653, 15, 582856, 12, 582857, 12, 582872, 12, 582873, 12, 582888, 12, 582889, 12, 582904, 12, 582905, 12, 596982, 14, 596983, 14, 596990, 14, 596991, 14, 597202, 11, + 597206, 11, 597210, 11, 597214, 11, 597234, 11, 597238, 11, 597242, 11, 597246, 11, 599013, 10, 599015, 10, 599021, 10, 599023, 10, 599029, 10, 599031, 10, 599037, 10, 599039, 10, + 599232, 13, 599233, 13, 599234, 13, 599235, 13, 599236, 13, 599237, 13, 599238, 13, 599239, 13, 599240, 12, 599241, 12, 599250, 11, 599254, 11, 599256, 12, 599257, 12, 599258, 11, + 599262, 11, 599269, 10, 599271, 10, 599272, 12, 599273, 12, 599277, 10, 599279, 10, 599282, 11, 599285, 10, 599286, 11, 599287, 10, 599288, 12, 599289, 12, 599290, 11, 599293, 10, + 599294, 11, 599295, 10 }; - var p4D = new int[] { 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 2, 1, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 2, 0, 1, 1, 0, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 2, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 2, 0, 1, 0, 1, 1, -1, 1, 0, 1,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 2, 1, 1, -1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, 1, 1, -1, 1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 2, 1, -1, 1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 2, 1, -1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, 1, -1, 1, 1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 2, -1, 1, 1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, -1, 1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, -1, 1, 1, 1 }; - var lookupPairs4D = new int[] { 0, 3, 1, 2, 2, 3, 5, 2, 6, 1, 7, 1, 8, 3, 9, 2, 10, 3, 13, 2, 16, 3, 18, 3, 22, 1, 23, 1, 24, 3, 26, 3, 33, 2, 37, 2, 38, 1, 39, 1, 41, 2, 45, 2, 54, 1, 55, 1, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 256, 3, 258, 3, 264, 3, 266, 3, 272, 3, 274, 3, 280, 3, 282, 3, 2049, 2, 2053, 2, 2057, 2, 2061, 2, 2081, 2, 2085, 2, 2089, 2, 2093, 2, 2304, 9, 2305, 9, 2312, 9, 2313, 9, 16390, 1, 16391, 1, 16406, 1, 16407, 1, 16422, 1, 16423, 1, 16438, 1, 16439, 1, 16642, 8, 16646, 8, 16658, 8, 16662, 8, 18437, 6, 18439, 6, 18469, 6, 18471, 6, 18688, 9, 18689, 9, 18690, 8, 18693, 6, 18694, 8, 18695, 6, 18696, 9, 18697, 9, 18706, 8, 18710, 8, 18725, 6, 18727, 6, 131128, 0, 131129, 0, 131130, 0, 131131, 0, 131132, 0, 131133, 0, 131134, 0, 131135, 0, 131352, 7, 131354, 7, 131384, 7, 131386, 7, 133161, 5, 133165, 5, 133177, 5, 133181, 5, 133376, 9, 133377, 9, 133384, 9, 133385, 9, 133400, 7, 133402, 7, 133417, 5, 133421, 5, 133432, 7, 133433, 5, 133434, 7, 133437, 5, 147510, 4, 147511, 4, 147518, 4, 147519, 4, 147714, 8, 147718, 8, 147730, 8, 147734, 8, 147736, 7, 147738, 7, 147766, 4, 147767, 4, 147768, 7, 147770, 7, 147774, 4, 147775, 4, 149509, 6, 149511, 6, 149541, 6, 149543, 6, 149545, 5, 149549, 5, 149558, 4, 149559, 4, 149561, 5, 149565, 5, 149566, 4, 149567, 4, 149760, 9, 149761, 9, 149762, 8, 149765, 6, 149766, 8, 149767, 6, 149768, 9, 149769, 9, 149778, 8, 149782, 8, 149784, 7, 149786, 7, 149797, 6, 149799, 6, 149801, 5, 149805, 5, 149814, 4, 149815, 4, 149816, 7, 149817, 5, 149818, 7, 149821, 5, 149822, 4, 149823, 4, 149824, 37, 149825, 37, 149826, 36, 149829, 34, 149830, 36, 149831, 34, 149832, 37, 149833, 37, 149842, 36, 149846, 36, 149848, 35, 149850, 35, 149861, 34, 149863, 34, 149865, 33, 149869, 33, 149878, 32, 149879, 32, 149880, 35, 149881, 33, 149882, 35, 149885, 33, 149886, 32, 149887, 32, 150080, 49, 150082, 48, 150088, 49, 150098, 48, 150104, 47, 150106, 47, 151873, 46, 151877, 45, 151881, 46, 151909, 45, 151913, 44, 151917, 44, 152128, 49, 152129, 46, 152136, 49, 152137, 46, 166214, 43, 166215, 42, 166230, 43, 166247, 42, 166262, 41, 166263, 41, 166466, 48, 166470, 43, 166482, 48, 166486, 43, 168261, 45, 168263, 42, 168293, 45, 168295, 42, 168512, 31, 168513, 28, 168514, 31, 168517, 28, 168518, 25, 168519, 25, 280952, 40, 280953, 39, 280954, 40, 280957, 39, 280958, 38, 280959, 38, 281176, 47, 281178, 47, 281208, 40, 281210, 40, 282985, 44, 282989, 44, 283001, 39, 283005, 39, 283208, 30, 283209, 27, 283224, 30, 283241, 27, 283256, 22, 283257, 22, 297334, 41, 297335, 41, 297342, 38, 297343, 38, 297554, 29, 297558, 24, 297562, 29, 297590, 24, 297594, 21, 297598, 21, 299365, 26, 299367, 23, 299373, 26, 299383, 23, 299389, 20, 299391, 20, 299584, 31, 299585, 28, 299586, 31, 299589, 28, 299590, 25, 299591, 25, 299592, 30, 299593, 27, 299602, 29, 299606, 24, 299608, 30, 299610, 29, 299621, 26, 299623, 23, 299625, 27, 299629, 26, 299638, 24, 299639, 23, 299640, 22, 299641, 22, 299642, 21, 299645, 20, 299646, 21, 299647, 20, 299648, 61, 299649, 60, 299650, 61, 299653, 60, 299654, 59, 299655, 59, 299656, 58, 299657, 57, 299666, 55, 299670, 54, 299672, 58, 299674, 55, 299685, 52, 299687, 51, 299689, 57, 299693, 52, 299702, 54, 299703, 51, 299704, 56, 299705, 56, 299706, 53, 299709, 50, 299710, 53, 299711, 50, 299904, 61, 299906, 61, 299912, 58, 299922, 55, 299928, 58, 299930, 55, 301697, 60, 301701, 60, 301705, 57, 301733, 52, 301737, 57, 301741, 52, 301952, 79, 301953, 79, 301960, 76, 301961, 76, 316038, 59, 316039, 59, 316054, 54, 316071, 51, 316086, 54, 316087, 51, 316290, 78, 316294, 78, 316306, 73, 316310, 73, 318085, 77, 318087, 77, 318117, 70, 318119, 70, 318336, 79, 318337, 79, 318338, 78, 318341, 77, 318342, 78, 318343, 77, 430776, 56, 430777, 56, 430778, 53, 430781, 50, 430782, 53, 430783, 50, 431000, 75, 431002, 72, 431032, 75, 431034, 72, 432809, 74, 432813, 69, 432825, 74, 432829, 69, 433032, 76, 433033, 76, 433048, 75, 433065, 74, 433080, 75, 433081, 74, 447158, 71, 447159, 68, 447166, 71, 447167, 68, 447378, 73, 447382, 73, 447386, 72, 447414, 71, 447418, 72, 447422, 71, 449189, 70, 449191, 70, 449197, 69, 449207, 68, 449213, 69, 449215, 68, 449408, 67, 449409, 67, 449410, 66, 449413, 64, 449414, 66, 449415, 64, 449416, 67, 449417, 67, 449426, 66, 449430, 66, 449432, 65, 449434, 65, 449445, 64, 449447, 64, 449449, 63, 449453, 63, 449462, 62, 449463, 62, 449464, 65, 449465, 63, 449466, 65, 449469, 63, 449470, 62, 449471, 62, 449472, 19, 449473, 19, 449474, 18, 449477, 16, 449478, 18, 449479, 16, 449480, 19, 449481, 19, 449490, 18, 449494, 18, 449496, 17, 449498, 17, 449509, 16, 449511, 16, 449513, 15, 449517, 15, 449526, 14, 449527, 14, 449528, 17, 449529, 15, 449530, 17, 449533, 15, 449534, 14, 449535, 14, 449728, 19, 449729, 19, 449730, 18, 449734, 18, 449736, 19, 449737, 19, 449746, 18, 449750, 18, 449752, 17, 449754, 17, 449784, 17, 449786, 17, 451520, 19, 451521, 19, 451525, 16, 451527, 16, 451528, 19, 451529, 19, 451557, 16, 451559, 16, 451561, 15, 451565, 15, 451577, 15, 451581, 15, 451776, 19, 451777, 19, 451784, 19, 451785, 19, 465858, 18, 465861, 16, 465862, 18, 465863, 16, 465874, 18, 465878, 18, 465893, 16, 465895, 16, 465910, 14, 465911, 14, 465918, 14, 465919, 14, 466114, 18, 466118, 18, 466130, 18, 466134, 18, 467909, 16, 467911, 16, 467941, 16, 467943, 16, 468160, 13, 468161, 13, 468162, 13, 468163, 13, 468164, 13, 468165, 13, 468166, 13, 468167, 13, 580568, 17, 580570, 17, 580585, 15, 580589, 15, 580598, 14, 580599, 14, 580600, 17, 580601, 15, 580602, 17, 580605, 15, 580606, 14, 580607, 14, 580824, 17, 580826, 17, 580856, 17, 580858, 17, 582633, 15, 582637, 15, 582649, 15, 582653, 15, 582856, 12, 582857, 12, 582872, 12, 582873, 12, 582888, 12, 582889, 12, 582904, 12, 582905, 12, 596982, 14, 596983, 14, 596990, 14, 596991, 14, 597202, 11, 597206, 11, 597210, 11, 597214, 11, 597234, 11, 597238, 11, 597242, 11, 597246, 11, 599013, 10, 599015, 10, 599021, 10, 599023, 10, 599029, 10, 599031, 10, 599037, 10, 599039, 10, 599232, 13, 599233, 13, 599234, 13, 599235, 13, 599236, 13, 599237, 13, 599238, 13, 599239, 13, 599240, 12, 599241, 12, 599250, 11, 599254, 11, 599256, 12, 599257, 12, 599258, 11, 599262, 11, 599269, 10, 599271, 10, 599272, 12, 599273, 12, 599277, 10, 599279, 10, 599282, 11, 599285, 10, 599286, 11, 599287, 10, 599288, 12, 599289, 12, 599290, 11, 599293, 10, 599294, 11, 599295, 10 }; var contributions4D = new Contribution4[p4D.Length / 16]; - for (int i = 0; i < p4D.Length; i += 16) + for (var i = 0; i < p4D.Length; i += 16) { var baseSet = base4D[p4D[i]]; Contribution4 previous = null, current = null; - for (int k = 0; k < baseSet.Length; k += 5) + for (var k = 0; k < baseSet.Length; k += 5) { current = new Contribution4(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3], baseSet[k + 4]); if (previous == null) - { contributions4D[i / 16] = current; - } else - { previous.Next = current; - } previous = current; } + current.Next = new Contribution4(p4D[i + 1], p4D[i + 2], p4D[i + 3], p4D[i + 4], p4D[i + 5]); current.Next.Next = new Contribution4(p4D[i + 6], p4D[i + 7], p4D[i + 8], p4D[i + 9], p4D[i + 10]); current.Next.Next.Next = new Contribution4(p4D[i + 11], p4D[i + 12], p4D[i + 13], p4D[i + 14], p4D[i + 15]); @@ -173,16 +234,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities lookup4D = new Contribution4[1048576]; for (var i = 0; i < lookupPairs4D.Length; i += 2) - { lookup4D[lookupPairs4D[i]] = contributions4D[lookupPairs4D[i + 1]]; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int FastFloor(double x) - { - var xi = (int)x; - return x < xi ? xi - 1 : xi; } public OpenSimplexNoise() @@ -197,29 +249,32 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities perm3D = new byte[256]; perm4D = new byte[256]; var source = new byte[256]; - for (int i = 0; i < 256; i++) - { - source[i] = (byte)i; - } + for (var i = 0; i < 256; i++) + source[i] = (byte) i; seed = seed * 6364136223846793005L + 1442695040888963407L; seed = seed * 6364136223846793005L + 1442695040888963407L; seed = seed * 6364136223846793005L + 1442695040888963407L; - for (int i = 255; i >= 0; i--) + for (var i = 255; i >= 0; i--) { seed = seed * 6364136223846793005L + 1442695040888963407L; - int r = (int)((seed + 31) % (i + 1)); + var r = (int) ((seed + 31) % (i + 1)); if (r < 0) - { - r += (i + 1); - } + r += i + 1; perm[i] = source[r]; - perm2D[i] = (byte)(perm[i] & 0x0E); - perm3D[i] = (byte)((perm[i] % 24) * 3); - perm4D[i] = (byte)(perm[i] & 0xFC); + perm2D[i] = (byte) (perm[i] & 0x0E); + perm3D[i] = (byte) (perm[i] % 24 * 3); + perm4D[i] = (byte) (perm[i] & 0xFC); source[r] = source[i]; } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int FastFloor(double x) + { + var xi = (int) x; + return x < xi ? xi - 1 : xi; + } + public double Evaluate(double x, double y) { var stretchOffset = (x + y) * STRETCH_2D; @@ -239,10 +294,10 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities var inSum = xins + yins; var hash = - (int)(xins - yins + 1) | - (int)(inSum) << 1 | - (int)(inSum + yins) << 2 | - (int)(inSum + xins) << 4; + (int) (xins - yins + 1) | + ((int) inSum << 1) | + ((int) (inSum + yins) << 2) | + ((int) (inSum + xins) << 4); var c = lookup2D[hash]; @@ -263,8 +318,10 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities attn *= attn; value += attn * attn * valuePart; } + c = c.Next; } + return value * NORM_2D; } @@ -292,13 +349,13 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities var inSum = xins + yins + zins; var hash = - (int)(yins - zins + 1) | - (int)(xins - yins + 1) << 1 | - (int)(xins - zins + 1) << 2 | - (int)inSum << 3 | - (int)(inSum + zins) << 5 | - (int)(inSum + yins) << 7 | - (int)(inSum + xins) << 9; + (int) (yins - zins + 1) | + ((int) (xins - yins + 1) << 1) | + ((int) (xins - zins + 1) << 2) | + ((int) inSum << 3) | + ((int) (inSum + zins) << 5) | + ((int) (inSum + yins) << 7) | + ((int) (inSum + xins) << 9); var c = lookup3D[hash]; @@ -324,6 +381,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities c = c.Next; } + return value * NORM_3D; } @@ -354,17 +412,17 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities var inSum = xins + yins + zins + wins; var hash = - (int)(zins - wins + 1) | - (int)(yins - zins + 1) << 1 | - (int)(yins - wins + 1) << 2 | - (int)(xins - yins + 1) << 3 | - (int)(xins - zins + 1) << 4 | - (int)(xins - wins + 1) << 5 | - (int)inSum << 6 | - (int)(inSum + wins) << 8 | - (int)(inSum + zins) << 11 | - (int)(inSum + yins) << 14 | - (int)(inSum + xins) << 17; + (int) (zins - wins + 1) | + ((int) (yins - zins + 1) << 1) | + ((int) (yins - wins + 1) << 2) | + ((int) (xins - yins + 1) << 3) | + ((int) (xins - zins + 1) << 4) | + ((int) (xins - wins + 1) << 5) | + ((int) inSum << 6) | + ((int) (inSum + wins) << 8) | + ((int) (inSum + zins) << 11) | + ((int) (inSum + yins) << 14) | + ((int) (inSum + xins) << 17); var c = lookup4D[hash]; @@ -392,14 +450,17 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities c = c.Next; } + return value * NORM_4D; } private class Contribution2 { - public double dx, dy; - public int xsb, ysb; + public readonly double dx; + public readonly double dy; public Contribution2 Next; + public readonly int xsb; + public readonly int ysb; public Contribution2(double multiplier, int xsb, int ysb) { @@ -412,9 +473,13 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities private class Contribution3 { - public double dx, dy, dz; - public int xsb, ysb, zsb; + public readonly double dx; + public readonly double dy; + public readonly double dz; public Contribution3 Next; + public readonly int xsb; + public readonly int ysb; + public readonly int zsb; public Contribution3(double multiplier, int xsb, int ysb, int zsb) { @@ -429,9 +494,15 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities private class Contribution4 { - public double dx, dy, dz, dw; - public int xsb, ysb, zsb, wsb; + public readonly double dx; + public readonly double dy; + public readonly double dz; + public readonly double dw; public Contribution4 Next; + public readonly int xsb; + public readonly int ysb; + public readonly int zsb; + public readonly int wsb; public Contribution4(double multiplier, int xsb, int ysb, int zsb, int wsb) { @@ -446,4 +517,4 @@ namespace Artemis.Plugins.LayerBrushes.Noise.Utilities } } } -} +} \ No newline at end of file diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/app.config b/src/Artemis.Plugins.LayerBrushes.Noise/app.config index 6c8c160bb..360ea34d1 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/app.config +++ b/src/Artemis.Plugins.LayerBrushes.Noise/app.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.Plugins.LayerBrushes.Noise/packages.config b/src/Artemis.Plugins.LayerBrushes.Noise/packages.config index f09586bad..991931ace 100644 --- a/src/Artemis.Plugins.LayerBrushes.Noise/packages.config +++ b/src/Artemis.Plugins.LayerBrushes.Noise/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.Plugins.Modules.General/packages.config b/src/Artemis.Plugins.Modules.General/packages.config index 865736c9f..732a6ba59 100644 --- a/src/Artemis.Plugins.Modules.General/packages.config +++ b/src/Artemis.Plugins.Modules.General/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.UI.Shared/ColorPicker.xaml.cs b/src/Artemis.UI.Shared/ColorPicker.xaml.cs index a0e6e3a35..cfeddb01b 100644 --- a/src/Artemis.UI.Shared/ColorPicker.xaml.cs +++ b/src/Artemis.UI.Shared/ColorPicker.xaml.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; -using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; @@ -62,6 +61,8 @@ namespace Artemis.UI.Shared set => SetValue(ColorOpacityProperty, value); } + public event PropertyChangedEventHandler PropertyChanged; + private static void ColorPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var colorPicker = (ColorPicker) d; @@ -72,7 +73,7 @@ namespace Artemis.UI.Shared colorPicker.SetCurrentValue(ColorOpacityProperty, ((Color) e.NewValue).A); colorPicker.OnPropertyChanged(nameof(Color)); - + colorPicker._inCallback = false; } @@ -109,8 +110,6 @@ namespace Artemis.UI.Shared PopupOpen = !PopupOpen; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); diff --git a/src/Artemis.UI.Shared/Converters/ColorToSolidColorConverter.cs b/src/Artemis.UI.Shared/Converters/ColorToSolidColorConverter.cs index 570412502..63bd61878 100644 --- a/src/Artemis.UI.Shared/Converters/ColorToSolidColorConverter.cs +++ b/src/Artemis.UI.Shared/Converters/ColorToSolidColorConverter.cs @@ -7,7 +7,8 @@ namespace Artemis.UI.Shared.Converters { /// /// - /// Converts into a with full opacity. + /// Converts into a with full + /// opacity. /// [ValueConversion(typeof(Color), typeof(string))] internal class ColorToSolidColorConverter : IValueConverter diff --git a/src/Artemis.UI.Shared/Properties/AssemblyInfo.cs b/src/Artemis.UI.Shared/Properties/AssemblyInfo.cs index 1f6408856..030e37330 100644 --- a/src/Artemis.UI.Shared/Properties/AssemblyInfo.cs +++ b/src/Artemis.UI.Shared/Properties/AssemblyInfo.cs @@ -1,6 +1,4 @@ using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; @@ -31,13 +29,13 @@ using System.Windows; //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] -[assembly:ThemeInfo( +[assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) + //(used if a resource is not found in the page, + // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) )] @@ -52,4 +50,4 @@ using System.Windows; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Properties/Settings.settings b/src/Artemis.UI.Shared/Properties/Settings.settings index 033d7a5e9..c14891b94 100644 --- a/src/Artemis.UI.Shared/Properties/Settings.settings +++ b/src/Artemis.UI.Shared/Properties/Settings.settings @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.UI.Shared/UserControl1.xaml b/src/Artemis.UI.Shared/UserControl1.xaml index 1bb466275..9a4ccd683 100644 --- a/src/Artemis.UI.Shared/UserControl1.xaml +++ b/src/Artemis.UI.Shared/UserControl1.xaml @@ -1,12 +1,10 @@  - - - - + + \ No newline at end of file diff --git a/src/Artemis.UI.Shared/UserControl1.xaml.cs b/src/Artemis.UI.Shared/UserControl1.xaml.cs index ee4b9f7db..0e7afc80a 100644 --- a/src/Artemis.UI.Shared/UserControl1.xaml.cs +++ b/src/Artemis.UI.Shared/UserControl1.xaml.cs @@ -1,22 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace Artemis.UI.Shared { /// - /// Interaction logic for UserControl1.xaml + /// Interaction logic for UserControl1.xaml /// public partial class UserControl1 : UserControl { @@ -25,4 +12,4 @@ namespace Artemis.UI.Shared InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Artemis.UI.Shared/packages.config b/src/Artemis.UI.Shared/packages.config index 2c6820adf..255195166 100644 --- a/src/Artemis.UI.Shared/packages.config +++ b/src/Artemis.UI.Shared/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Artemis.UI/App.xaml b/src/Artemis.UI/App.xaml index ce1f31722..0d6d83550 100644 --- a/src/Artemis.UI/App.xaml +++ b/src/Artemis.UI/App.xaml @@ -63,8 +63,8 @@ diff --git a/src/Artemis.UI/Behaviors/InputBindingBehavior.cs b/src/Artemis.UI/Behaviors/InputBindingBehavior.cs index d5601670e..bd9c7f996 100644 --- a/src/Artemis.UI/Behaviors/InputBindingBehavior.cs +++ b/src/Artemis.UI/Behaviors/InputBindingBehavior.cs @@ -25,7 +25,7 @@ namespace Artemis.UI.Behaviors private static void OnLoaded(object sender, RoutedEventArgs e) { - var frameworkElement = (FrameworkElement)sender; + var frameworkElement = (FrameworkElement) sender; frameworkElement.Loaded -= OnLoaded; var window = Window.GetWindow(frameworkElement); diff --git a/src/Artemis.UI/Bootstrapper.cs b/src/Artemis.UI/Bootstrapper.cs index da7eb3b58..cffac4f69 100644 --- a/src/Artemis.UI/Bootstrapper.cs +++ b/src/Artemis.UI/Bootstrapper.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using System.Windows; -using System.Windows.Media.Animation; using System.Windows.Threading; using Artemis.Core.Ninject; using Artemis.Core.Services.Interfaces; diff --git a/src/Artemis.UI/Events/MainWindowKeyEvent.cs b/src/Artemis.UI/Events/MainWindowKeyEvent.cs index 5163f8aea..f5ac6d8e0 100644 --- a/src/Artemis.UI/Events/MainWindowKeyEvent.cs +++ b/src/Artemis.UI/Events/MainWindowKeyEvent.cs @@ -4,13 +4,13 @@ namespace Artemis.UI.Events { public class MainWindowKeyEvent { - public bool KeyDown { get; } - public KeyEventArgs EventArgs { get; } - public MainWindowKeyEvent(bool keyDown, KeyEventArgs eventArgs) { KeyDown = keyDown; EventArgs = eventArgs; } + + public bool KeyDown { get; } + public KeyEventArgs EventArgs { get; } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/GradientEditor/GradientEditorView.xaml b/src/Artemis.UI/Screens/GradientEditor/GradientEditorView.xaml index a43bd10aa..c97845ac2 100644 --- a/src/Artemis.UI/Screens/GradientEditor/GradientEditorView.xaml +++ b/src/Artemis.UI/Screens/GradientEditor/GradientEditorView.xaml @@ -1,15 +1,15 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:gradientEditor="clr-namespace:Artemis.UI.Screens.GradientEditor" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions" + mc:Ignorable="d" + Title="Gradient Editor" + Height="450" Width="800" + d:DataContext="{d:DesignInstance {x:Type gradientEditor:GradientEditorViewModel}}"> diff --git a/src/Artemis.UI/Screens/Module/ModuleRootView.xaml b/src/Artemis.UI/Screens/Module/ModuleRootView.xaml index 12b89d48e..1b3c50e18 100644 --- a/src/Artemis.UI/Screens/Module/ModuleRootView.xaml +++ b/src/Artemis.UI/Screens/Module/ModuleRootView.xaml @@ -10,15 +10,15 @@ d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance module:ModuleRootViewModel}"> - - - + + - + diff --git a/src/Artemis.UI/Screens/Module/ModuleRootViewModel.cs b/src/Artemis.UI/Screens/Module/ModuleRootViewModel.cs index 5ca770c67..929d77e89 100644 --- a/src/Artemis.UI/Screens/Module/ModuleRootViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ModuleRootViewModel.cs @@ -14,7 +14,7 @@ namespace Artemis.UI.Screens.Module { DisplayName = module?.DisplayName; Module = module; - + _profileEditorViewModelFactory = profileEditorViewModelFactory; Task.Run(AddTabsAsync); diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml index 4fd802767..a08fb3929 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml @@ -14,11 +14,11 @@ d:DataContext="{d:DesignInstance local:LayerPropertiesViewModel}" behaviors:InputBindingBehavior.PropagateInputBindingsToWindow="True"> - - + + - + diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml.cs index 44ac59450..430339120 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml.cs @@ -1,5 +1,4 @@ using System.Windows.Controls; -using System.Windows.Input; namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties { @@ -17,13 +16,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties private void TimelineScrollChanged(object sender, ScrollChangedEventArgs e) { if (sender == TimelineHeaderScrollViewer) - { TimelineRailsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset); - } else if (sender == TimelineRailsScrollViewer) - { TimelineHeaderScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset); - } } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyViewModel.cs index ea536a889..561826b72 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyViewModel.cs @@ -15,7 +15,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties private readonly IProfileEditorService _profileEditorService; private bool _keyframesEnabled; - public LayerPropertyViewModel(BaseLayerProperty layerProperty, LayerPropertyViewModel parent, ILayerPropertyViewModelFactory layerPropertyViewModelFactory, IKernel kernel, IProfileEditorService profileEditorService) + public LayerPropertyViewModel(BaseLayerProperty layerProperty, LayerPropertyViewModel parent, ILayerPropertyViewModelFactory layerPropertyViewModelFactory, IKernel kernel, + IProfileEditorService profileEditorService) { _kernel = kernel; _profileEditorService = profileEditorService; diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/FloatPropertyInputViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/FloatPropertyInputViewModel.cs index e7029aaee..36fa963fb 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/FloatPropertyInputViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/FloatPropertyInputViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Artemis.Core.Models.Profile.LayerProperties; using Artemis.UI.Services.Interfaces; namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputView.xaml index 7cffca75a..0b262da99 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputView.xaml @@ -15,7 +15,7 @@ Padding="0 -1" materialDesign:ValidationAssist.UsePopup="True" HorizontalAlignment="Left" - Text="{Binding IntInputValue}"/> + Text="{Binding IntInputValue}" /> \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputViewModel.cs index d8e74e8a4..6f1a890b3 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/IntPropertyInputViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Artemis.Core.Models.Profile.LayerProperties; using Artemis.UI.Services.Interfaces; namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/PropertyInputViewModel.cs index 223fe5f2a..3500ec06f 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/PropertyInputViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/PropertyInputViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Artemis.UI.Exceptions; using Artemis.UI.Services.Interfaces; using Stylet; diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKPointPropertyInputViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKPointPropertyInputViewModel.cs index 26924df6c..31182ef04 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKPointPropertyInputViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKPointPropertyInputViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Artemis.Core.Models.Profile.LayerProperties; using Artemis.UI.Services.Interfaces; using PropertyChanged; using SkiaSharp; @@ -26,7 +25,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P [DependsOn(nameof(InputValue))] public float Y { - get => ((SKPoint?)InputValue)?.Y ?? 0; + get => ((SKPoint?) InputValue)?.Y ?? 0; set => InputValue = new SKPoint(X, value); } diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKSizePropertyInputView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKSizePropertyInputView.xaml index 027425f2a..23321ad95 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKSizePropertyInputView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyInput/SKSizePropertyInputView.xaml @@ -16,7 +16,7 @@ materialDesign:ValidationAssist.UsePopup="True" HorizontalAlignment="Left" ToolTip="Height" - Text="{Binding Height}"/> + Text="{Binding Height}" /> , ((SKSize?)InputValue)?.Height ?? 0; + get => ((SKSize?) InputValue)?.Height ?? 0; set => InputValue = new SKSize(Width, value); } diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyTreeViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyTreeViewModel.cs index 12a200271..aed0042ad 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyTreeViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/PropertyTree/PropertyTreeViewModel.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Artemis.UI.Services.Interfaces; using Stylet; diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTimelineViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTimelineViewModel.cs index 170448f03..e532471fd 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTimelineViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTimelineViewModel.cs @@ -74,7 +74,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline } /// - /// Updates the time line's keyframes + /// Updates the time line's keyframes /// public void Update() { diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTrackEasingViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTrackEasingViewModel.cs index 6fcccd060..c1fcebd0e 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTrackEasingViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/PropertyTrackEasingViewModel.cs @@ -18,7 +18,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline EasingFunction = easingFunction; Description = easingFunction.Humanize(); - + CreateGeometry(); } diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorView.xaml index 94df93809..253004957 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorView.xaml @@ -21,8 +21,8 @@ - - + + diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs index 0fff6175f..a241e65ad 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs @@ -14,8 +14,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem public abstract class TreeItemViewModel : PropertyChangedBase { private readonly IDialogService _dialogService; - private readonly ILayerService _layerService; private readonly IFolderViewModelFactory _folderViewModelFactory; + private readonly ILayerService _layerService; private readonly ILayerViewModelFactory _layerViewModelFactory; private readonly IProfileEditorService _profileEditorService; @@ -122,7 +122,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name); var layer = new Layer(ProfileElement.Profile, ProfileElement, "New layer"); - foreach (var baseLayerProperty in layer.Properties) + foreach (var baseLayerProperty in layer.Properties) _layerService.InstantiateKeyframeEngine(baseLayerProperty); ProfileElement.AddChild(layer); UpdateProfileElements(); diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs index 20bcf559c..4e0d2c958 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using System.Windows; -using System.Windows.Input; using System.Windows.Media; using Artemis.Core.Models.Profile; using Artemis.Core.Models.Profile.LayerShapes; @@ -9,8 +8,6 @@ using Artemis.Core.Models.Surface; using Artemis.UI.Extensions; using Artemis.UI.Services.Interfaces; using RGB.NET.Core; -using SkiaSharp; -using SkiaSharp.Views.WPF; using Rectangle = Artemis.Core.Models.Profile.LayerShapes.Rectangle; namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml index 1798a391f..995a01b6a 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileView.xaml @@ -55,7 +55,7 @@ - + @@ -171,7 +171,6 @@ - diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs index 912df3104..16c62b899 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Input; diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolViewModel.cs index 04d0a5ddc..df87b7aa9 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolViewModel.cs @@ -1,23 +1,21 @@ using System; -using System.Diagnostics.Eventing.Reader; using System.Windows; using System.Windows.Input; using System.Windows.Media; using Artemis.Core.Models.Profile; using Artemis.UI.Services.Interfaces; using SkiaSharp; -using SkiaSharp.Views.WPF; namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools { public class EditToolViewModel : VisualizationToolViewModel { - private bool _isDragging; - private double _dragOffsetY; - private double _dragOffsetX; - private Point _dragStart; private bool _draggingHorizontally; private bool _draggingVertically; + private double _dragOffsetX; + private double _dragOffsetY; + private Point _dragStart; + private bool _isDragging; public EditToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService) { diff --git a/src/Artemis.UI/Screens/News/NewsViewModel.cs b/src/Artemis.UI/Screens/News/NewsViewModel.cs index 01c190f3a..70953c42a 100644 --- a/src/Artemis.UI/Screens/News/NewsViewModel.cs +++ b/src/Artemis.UI/Screens/News/NewsViewModel.cs @@ -1,5 +1,4 @@ using MaterialDesignThemes.Wpf; -using Stylet; namespace Artemis.UI.Screens.News { diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs index adfb4295b..e1b174bd5 100644 --- a/src/Artemis.UI/Screens/RootViewModel.cs +++ b/src/Artemis.UI/Screens/RootViewModel.cs @@ -1,6 +1,4 @@ -using System; -using System.ComponentModel; -using System.Threading; +using System.ComponentModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; @@ -31,6 +29,10 @@ namespace Artemis.UI.Screens SidebarViewModel.PropertyChanged += SidebarViewModelOnPropertyChanged; } + public SidebarViewModel SidebarViewModel { get; } + public bool IsSidebarVisible { get; set; } + public bool ActiveItemReady { get; set; } + private void SidebarViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(SidebarViewModel.SelectedItem)) @@ -48,10 +50,6 @@ namespace Artemis.UI.Screens } } - public SidebarViewModel SidebarViewModel { get; } - public bool IsSidebarVisible { get; set; } - public bool ActiveItemReady { get; set; } - private void ApplyWindowsTheme(ThemeWatcher.WindowsTheme windowsTheme) { var paletteHelper = new PaletteHelper(); @@ -61,9 +59,9 @@ namespace Artemis.UI.Screens var extensionsPaletteHelper = new MaterialDesignExtensions.Themes.PaletteHelper(); // That's nice, then don't use it in your own examples and provide a working alternative - #pragma warning disable 612 +#pragma warning disable 612 extensionsPaletteHelper.SetLightDark(windowsTheme == ThemeWatcher.WindowsTheme.Dark); - #pragma warning restore 612 +#pragma warning restore 612 } public void WindowDeactivated() diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.xaml b/src/Artemis.UI/Screens/Settings/SettingsView.xaml index 7412afc9f..45d1af187 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.xaml +++ b/src/Artemis.UI/Screens/Settings/SettingsView.xaml @@ -78,7 +78,7 @@ - @@ -101,7 +101,7 @@ - @@ -215,10 +215,10 @@ materialDesign:DataGridAssist.CellPadding="13 8 8 8" materialDesign:DataGridAssist.ColumnHeaderPadding="8"> - - - - + + + + ()); } - + public void ShowLogsFolder() { Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs")); diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs index 4dd7be456..f704badb4 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs @@ -31,7 +31,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices { _deviceService.IdentifyDevice(Device); } - + public void ShowDeviceDebugger() { } diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.xaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarView.xaml.cs index f76766c07..140895eff 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.xaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.xaml.cs @@ -1,22 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace Artemis.UI.Screens.Sidebar { /// - /// Interaction logic for SidebarView.xaml + /// Interaction logic for SidebarView.xaml /// public partial class SidebarView : UserControl { @@ -25,4 +12,4 @@ namespace Artemis.UI.Screens.Sidebar InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs index fe0372c42..13eee3dc0 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using Artemis.Core.Events; using Artemis.Core.Services.Interfaces; @@ -85,10 +86,10 @@ namespace Artemis.UI.Screens.Sidebar return; // Icon is provided as string to avoid having to reference MaterialDesignThemes - var parsedIcon = System.Enum.TryParse(module.DisplayIcon, true, out var iconEnum); + var parsedIcon = Enum.TryParse(module.DisplayIcon, true, out var iconEnum); if (parsedIcon == false) iconEnum = PackIconKind.QuestionMarkCircle; - var sidebarItem = new FirstLevelNavigationItem { Icon = iconEnum, Label = module.DisplayName }; + var sidebarItem = new FirstLevelNavigationItem {Icon = iconEnum, Label = module.DisplayName}; SidebarItems.Add(sidebarItem); SidebarItemObjects.Add(sidebarItem, module); } @@ -117,7 +118,7 @@ namespace Artemis.UI.Screens.Sidebar if (e.PluginInfo.Instance is Core.Plugins.Abstract.Module module) RemoveModule(module); } - + #endregion } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Splash/SplashView.xaml b/src/Artemis.UI/Screens/Splash/SplashView.xaml index 552234c83..0840bde6f 100644 --- a/src/Artemis.UI/Screens/Splash/SplashView.xaml +++ b/src/Artemis.UI/Screens/Splash/SplashView.xaml @@ -1,21 +1,21 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:splash="clr-namespace:Artemis.UI.Screens.Splash" + xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions" + xmlns:s="https://github.com/canton7/Stylet" + mc:Ignorable="d" + Title=" " + ResizeMode="NoResize" + BorderBackgroundBrush="{DynamicResource PrimaryHueMidBrush}" + Height="450" + Width="400" + WindowStartupLocation="CenterScreen" + FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" + MouseDown="{s:Action MouseDown}" + d:DataContext="{d:DesignInstance splash:SplashViewModel}"> diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs index fc014154c..3b8e52a45 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs @@ -124,9 +124,7 @@ namespace Artemis.UI.Screens.SurfaceEditor // Create VMs for missing devices var viewModel = existing.FirstOrDefault(vm => vm.Device.RgbDevice == surfaceDeviceConfiguration.RgbDevice); if (viewModel == null) - { viewModel = new SurfaceDeviceViewModel(surfaceDeviceConfiguration); - } // Update existing devices else viewModel.Device = surfaceDeviceConfiguration; @@ -199,6 +197,7 @@ namespace Artemis.UI.Screens.SurfaceEditor var deviceViewModel = Devices[i]; deviceViewModel.Device.ZIndex = i + 1; } + _surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true); } @@ -213,6 +212,7 @@ namespace Artemis.UI.Screens.SurfaceEditor var deviceViewModel = Devices[i]; deviceViewModel.Device.ZIndex = i + 1; } + _surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true); } @@ -224,6 +224,7 @@ namespace Artemis.UI.Screens.SurfaceEditor var deviceViewModel = Devices[i]; deviceViewModel.Device.ZIndex = i + 1; } + _surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true); } @@ -237,6 +238,7 @@ namespace Artemis.UI.Screens.SurfaceEditor var deviceViewModel = Devices[i]; deviceViewModel.Device.ZIndex = i + 1; } + _surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true); } diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs b/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs index 08b833e4a..2d37f0f28 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs @@ -1,6 +1,5 @@ using System.Windows.Media; using MaterialDesignThemes.Wpf; -using Stylet; namespace Artemis.UI.Screens.Workshop { @@ -15,7 +14,7 @@ namespace Artemis.UI.Screens.Workshop public Color TestColor { get; set; } public bool TestPopupOpen { get; set; } - + public void UpdateValues() { TestPopupOpen = !TestPopupOpen; diff --git a/src/Artemis.UI/Services/Interfaces/IProfileEditorService.cs b/src/Artemis.UI/Services/Interfaces/IProfileEditorService.cs index 8142c1d6d..3463c72c8 100644 --- a/src/Artemis.UI/Services/Interfaces/IProfileEditorService.cs +++ b/src/Artemis.UI/Services/Interfaces/IProfileEditorService.cs @@ -47,7 +47,5 @@ namespace Artemis.UI.Services.Interfaces /// Occurs when the profile preview has been updated /// event EventHandler ProfilePreviewUpdated; - - } } \ No newline at end of file diff --git a/src/Artemis.UI/Utilities/ThemeWatcher.cs b/src/Artemis.UI/Utilities/ThemeWatcher.cs index fbf7db504..ec9da23b7 100644 --- a/src/Artemis.UI/Utilities/ThemeWatcher.cs +++ b/src/Artemis.UI/Utilities/ThemeWatcher.cs @@ -9,11 +9,6 @@ namespace Artemis.UI.Utilities { public class ThemeWatcher { - public ThemeWatcher() - { - WatchTheme(); - } - public enum WindowsTheme { Light, @@ -24,6 +19,11 @@ namespace Artemis.UI.Utilities private const string RegistryValueName = "AppsUseLightTheme"; + public ThemeWatcher() + { + WatchTheme(); + } + public void WatchTheme() { var currentUser = WindowsIdentity.GetCurrent(); diff --git a/src/Artemis.UI/packages.config b/src/Artemis.UI/packages.config index c88fbd4f8..5c5b38878 100644 --- a/src/Artemis.UI/packages.config +++ b/src/Artemis.UI/packages.config @@ -1,4 +1,5 @@  +