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

Project cleanup

This commit is contained in:
SpoinkyNL 2018-03-04 22:29:04 +01:00
parent 2f72cdb1d9
commit 31affd01b3
30 changed files with 254 additions and 268 deletions

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Artemis.Core.Attributes
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Artemis.Core.Models
namespace Artemis.Core.Models
{
public class DataModelDescription
{

View File

@ -1,9 +1,4 @@
using System.Linq;
using System.Reflection;
using Artemis.Core.Services.Interfaces;
using Artemis.Plugins.Interfaces;
using Artemis.Plugins.Models;
using Newtonsoft.Json;
using Artemis.Core.Services.Interfaces;
using Ninject.Extensions.Conventions;
using Ninject.Modules;

View File

@ -10,8 +10,8 @@ namespace Artemis.Core.Services
{
public class CoreService : ICoreService
{
private readonly IRgbService _rgbService;
private readonly IPluginService _pluginService;
private readonly IRgbService _rgbService;
public CoreService(IPluginService pluginService, IRgbService rgbService)
{

View File

@ -1,19 +1,14 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
using RGB.NET.Brushes;
using RGB.NET.Core;
using RGB.NET.Devices.Asus;
using RGB.NET.Devices.CoolerMaster;
using RGB.NET.Devices.Corsair;
using RGB.NET.Devices.DMX;
using RGB.NET.Devices.Logitech;
using RGB.NET.Devices.Msi;
using RGB.NET.Devices.Novation;
using RGB.NET.Devices.Razer;
using RGB.NET.Groups;
namespace Artemis.Core.Services
{

View File

@ -28,7 +28,8 @@
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
@ -52,7 +53,8 @@
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net46" />
<package id="HidSharp" version="1.5" targetFramework="net46" />

View File

@ -1,5 +1,4 @@
using System;
using Artemis.Core.Attributes;
using Artemis.Core.Attributes;
using Artemis.Plugins.Interfaces;
namespace Artemis.Plugins.BuiltIn.Modules.General

View File

@ -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

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -15,7 +16,8 @@
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
@ -59,7 +61,8 @@
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Stylet" version="1.1.21" targetFramework="net461" />
</packages>

View File

@ -1,5 +1,4 @@
using System;
using Ninject;
namespace Artemis.Plugins.Interfaces
{

View File

@ -2,6 +2,5 @@
{
public interface IModuleDataModel
{
}
}

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -19,7 +20,8 @@
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
@ -43,7 +45,8 @@
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CS-Script.bin" version="3.28.0.1" targetFramework="net46" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net46" />

View File

@ -1,6 +1,4 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Artemis.Storage.Migrations
{
@ -9,8 +7,8 @@ namespace Artemis.Storage.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Folders",
columns: table => new
"Folders",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -22,28 +20,25 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Folders", x => x.Id);
table.ForeignKey(
name: "FK_Folders_Folders_FolderEntityId",
column: x => x.FolderEntityId,
principalTable: "Folders",
principalColumn: "Id",
"FK_Folders_Folders_FolderEntityId",
x => x.FolderEntityId,
"Folders",
"Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Settings",
columns: table => new
"Settings",
table => new
{
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Name);
});
constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); });
migrationBuilder.CreateTable(
name: "Layers",
columns: table => new
"Layers",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -56,16 +51,16 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Layers", x => x.Id);
table.ForeignKey(
name: "FK_Layers_Folders_FolderEntityId",
column: x => x.FolderEntityId,
principalTable: "Folders",
principalColumn: "Id",
"FK_Layers_Folders_FolderEntityId",
x => x.FolderEntityId,
"Folders",
"Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Profiles",
columns: table => new
"Profiles",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -77,16 +72,16 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Profiles", x => x.Id);
table.ForeignKey(
name: "FK_Profiles_Folders_RootFolderId",
column: x => x.RootFolderId,
principalTable: "Folders",
principalColumn: "Id",
"FK_Profiles_Folders_RootFolderId",
x => x.RootFolderId,
"Folders",
"Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LayerSettings",
columns: table => new
"LayerSettings",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -98,16 +93,16 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_LayerSettings", x => x.Id);
table.ForeignKey(
name: "FK_LayerSettings_Layers_LayerEntityId",
column: x => x.LayerEntityId,
principalTable: "Layers",
principalColumn: "Id",
"FK_LayerSettings_Layers_LayerEntityId",
x => x.LayerEntityId,
"Layers",
"Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Leds",
columns: table => new
"Leds",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -119,16 +114,16 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Leds", x => x.Id);
table.ForeignKey(
name: "FK_Leds_Layers_LayerId",
column: x => x.LayerId,
principalTable: "Layers",
principalColumn: "Id",
"FK_Leds_Layers_LayerId",
x => x.LayerId,
"Layers",
"Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Keypoints",
columns: table => new
"Keypoints",
table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
@ -140,66 +135,66 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Keypoints", x => x.Id);
table.ForeignKey(
name: "FK_Keypoints_LayerSettings_LayerSettingEntityId",
column: x => x.LayerSettingEntityId,
principalTable: "LayerSettings",
principalColumn: "Id",
"FK_Keypoints_LayerSettings_LayerSettingEntityId",
x => x.LayerSettingEntityId,
"LayerSettings",
"Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Folders_FolderEntityId",
table: "Folders",
column: "FolderEntityId");
"IX_Folders_FolderEntityId",
"Folders",
"FolderEntityId");
migrationBuilder.CreateIndex(
name: "IX_Keypoints_LayerSettingEntityId",
table: "Keypoints",
column: "LayerSettingEntityId");
"IX_Keypoints_LayerSettingEntityId",
"Keypoints",
"LayerSettingEntityId");
migrationBuilder.CreateIndex(
name: "IX_Layers_FolderEntityId",
table: "Layers",
column: "FolderEntityId");
"IX_Layers_FolderEntityId",
"Layers",
"FolderEntityId");
migrationBuilder.CreateIndex(
name: "IX_LayerSettings_LayerEntityId",
table: "LayerSettings",
column: "LayerEntityId");
"IX_LayerSettings_LayerEntityId",
"LayerSettings",
"LayerEntityId");
migrationBuilder.CreateIndex(
name: "IX_Leds_LayerId",
table: "Leds",
column: "LayerId");
"IX_Leds_LayerId",
"Leds",
"LayerId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_RootFolderId",
table: "Profiles",
column: "RootFolderId");
"IX_Profiles_RootFolderId",
"Profiles",
"RootFolderId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Keypoints");
"Keypoints");
migrationBuilder.DropTable(
name: "Leds");
"Leds");
migrationBuilder.DropTable(
name: "Profiles");
"Profiles");
migrationBuilder.DropTable(
name: "Settings");
"Settings");
migrationBuilder.DropTable(
name: "LayerSettings");
"LayerSettings");
migrationBuilder.DropTable(
name: "Layers");
"Layers");
migrationBuilder.DropTable(
name: "Folders");
"Folders");
}
}
}

View File

@ -1,16 +1,12 @@
// <auto-generated />
using Artemis.Storage;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using System;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
partial class StorageContextModelSnapshot : ModelSnapshot
internal class StorageContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{

View File

@ -31,7 +31,8 @@
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
@ -55,7 +56,8 @@
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>

View File

@ -31,9 +31,9 @@
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />
<!-- Artemis -->
<ResourceDictionary Source="Styles/Visualizers/RGBSurfaceVisualizer.xaml"></ResourceDictionary>
<ResourceDictionary Source="Styles/Visualizers/RGBDeviceVisualizer.xaml"></ResourceDictionary>
<ResourceDictionary Source="Styles/Visualizers/LedVisualizer.xaml"></ResourceDictionary>
<ResourceDictionary Source="Styles/Visualizers/RGBSurfaceVisualizer.xaml" />
<ResourceDictionary Source="Styles/Visualizers/RGBDeviceVisualizer.xaml" />
<ResourceDictionary Source="Styles/Visualizers/LedVisualizer.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- MahApps Brushes -->

View File

@ -11,6 +11,16 @@ namespace Artemis.UI.Controls.Visualizers
/// </summary>
public class LedVisualizer : Control
{
public void Select()
{
BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
}
public void Deselect()
{
BorderBrush = new SolidColorBrush(Colors.Black);
}
#region DependencyProperties
// ReSharper disable InconsistentNaming
@ -33,15 +43,5 @@ namespace Artemis.UI.Controls.Visualizers
// ReSharper restore InconsistentNaming
#endregion
public void Select()
{
BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
}
public void Deselect()
{
BorderBrush = new SolidColorBrush(Colors.Black);
}
}
}

View File

@ -69,7 +69,7 @@ namespace Artemis.UI.Controls.Visualizers
if (Device == null) return;
foreach (Led led in Device)
foreach (var led in Device)
Canvas.Children.Add(new LedVisualizer {Led = led});
}

View File

@ -45,8 +45,8 @@ namespace Artemis.UI.Controls.Visualizers
/// </summary>
public RGBSurfaceVisualizer()
{
this.Loaded += OnLoaded;
this.Unloaded += OnUnloaded;
Loaded += OnLoaded;
Unloaded += OnUnloaded;
}
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
@ -54,7 +54,7 @@ namespace Artemis.UI.Controls.Visualizers
_surface = RGBSurface.Instance;
_surface.SurfaceLayoutChanged += RGBSurfaceOnSurfaceLayoutChanged;
foreach (IRGBDevice device in _surface.Devices)
foreach (var device in _surface.Devices)
_newDevices.Add(device);
UpdateSurface();
@ -70,7 +70,7 @@ namespace Artemis.UI.Controls.Visualizers
private void RGBSurfaceOnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs args)
{
if (args.DeviceAdded)
foreach (IRGBDevice device in args.Devices)
foreach (var device in args.Devices)
_newDevices.Add(device);
UpdateSurface();
@ -89,6 +89,7 @@ namespace Artemis.UI.Controls.Visualizers
_canvas.MouseLeftButtonDown -= ScrollViewerOnMouseLeftButtonDown;
_canvas.MouseLeftButtonUp -= ScrollViewerOnMouseLeftButtonUp;
}
_canvas?.Children.Clear();
_canvas = (Canvas) GetTemplateChild(PART_CANVAS);
@ -151,11 +152,11 @@ namespace Artemis.UI.Controls.Visualizers
private void UpdateSurface()
{
if ((_canvas == null) || (_surface == null)) return;
if (_canvas == null || _surface == null) return;
if (_newDevices.Count > 0)
{
foreach (IRGBDevice device in _newDevices)
foreach (var device in _newDevices)
_canvas.Children.Add(new RGBDeviceVisualizer {Device = device});
_newDevices.Clear();
}

View File

@ -2,6 +2,7 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using Color = RGB.NET.Core.Color;
namespace Artemis.UI.Converters
{
@ -9,23 +10,23 @@ namespace Artemis.UI.Converters
/// <summary>
/// Converts <see cref="T:RGB.NET.Core.Color" /> into <see cref="T:System.Windows.Media.SolidColorBrush" />.
/// </summary>
[ValueConversion(typeof(RGB.NET.Core.Color), typeof(SolidColorBrush))]
[ValueConversion(typeof(Color), typeof(SolidColorBrush))]
public class ColorToSolidColorBrushConverter : IValueConverter
{
/// <inheritdoc />
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return new SolidColorBrush(!(value is RGB.NET.Core.Color color)
? Color.FromArgb(0, 0, 0, 0)
: Color.FromArgb(color.A, color.R, color.G, color.B));
return new SolidColorBrush(!(value is Color color)
? System.Windows.Media.Color.FromArgb(0, 0, 0, 0)
: System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B));
}
/// <inheritdoc />
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(value is SolidColorBrush brush)
? RGB.NET.Core.Color.Transparent
: new RGB.NET.Core.Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
? Color.Transparent
: new Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
}
}
}

View File

@ -3,6 +3,5 @@
// ReSharper disable once InconsistentNaming
public interface IArtemisUIService
{
}
}

View File

@ -67,11 +67,14 @@
<Style x:Key="StyleLedVisualizer" TargetType="{x:Type controls:LedVisualizer}">
<Setter Property="Width" Value="{Binding Led.LedRectangle.Size.Width, RelativeSource={RelativeSource Self}}" />
<Setter Property="Height" Value="{Binding Led.LedRectangle.Size.Height, RelativeSource={RelativeSource Self}}" />
<Setter Property="Canvas.Left" Value="{Binding Led.LedRectangle.Location.X, RelativeSource={RelativeSource Self}}" />
<Setter Property="Canvas.Top" Value="{Binding Led.LedRectangle.Location.Y, RelativeSource={RelativeSource Self}}" />
<Setter Property="Canvas.Left"
Value="{Binding Led.LedRectangle.Location.X, RelativeSource={RelativeSource Self}}" />
<Setter Property="Canvas.Top"
Value="{Binding Led.LedRectangle.Location.Y, RelativeSource={RelativeSource Self}}" />
<Setter Property="BorderBrush" Value="#000000" />
<Setter Property="Background" Value="{Binding Led.Color, RelativeSource={RelativeSource Self},
<Setter Property="Background"
Value="{Binding Led.Color, RelativeSource={RelativeSource Self},
Converter={StaticResource ConverterColorToSolidColorBrush}}" />
<Setter Property="Template" Value="{StaticResource ControlTemplateLedRectangle}" />

View File

@ -8,7 +8,8 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" />