From 4e565f9d767582defc7ca77146a8f60e25aa86be Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Wed, 10 Apr 2019 00:33:21 +0200 Subject: [PATCH] Opting for precompiled plugins, removed CS-Script Cleaned up Nuget packages Cleaned up references --- src/Artemis.Core/Artemis.Core.csproj | 186 +----------------- src/Artemis.Core/Ninject/CoreModule.cs | 6 +- src/Artemis.Core/Plugins/Models/PluginInfo.cs | 69 +------ src/Artemis.Core/Services/CoreService.cs | 2 +- .../Services/Interfaces/IPluginService.cs | 10 - src/Artemis.Core/Services/PluginService.cs | 53 ++--- src/Artemis.Core/Services/RgbService.cs | 1 + src/Artemis.Core/Services/StorageService.cs | 14 +- src/Artemis.Core/packages.config | 78 +------- .../Artemis.Plugins.BuiltIn.csproj | 11 -- .../Modules/General/GeneralModule.cs | 25 +-- .../Modules/General/plugin.json | 2 +- src/Artemis.Plugins.BuiltIn/packages.config | 3 - src/Artemis.Storage/Artemis.Storage.csproj | 13 +- .../Repositories/ProfileRepository.cs | 39 ++++ src/Artemis.UI/Artemis.UI.csproj | 18 +- src/Artemis.UI/packages.config | 4 +- .../packages.config.new.20190410002817 | 25 +++ 18 files changed, 133 insertions(+), 426 deletions(-) create mode 100644 src/Artemis.Storage/Repositories/ProfileRepository.cs create mode 100644 src/Artemis.UI/packages.config.new.20190410002817 diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 00277096e..882081df0 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -1,6 +1,5 @@  - Debug @@ -55,81 +54,21 @@ ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll - - ..\packages\CS-Script.bin.3.28.7\lib\net46\CSScriptLibrary.dll - - - ..\packages\HidSharp.2.0.8\lib\net35\HidSharp.dll - - - ..\packages\Microsoft.CodeAnalysis.Common.3.0.0\lib\netstandard2.0\Microsoft.CodeAnalysis.dll - - - ..\packages\Microsoft.CodeAnalysis.CSharp.3.0.0\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll - - - ..\packages\Microsoft.CodeAnalysis.CSharp.Scripting.3.0.0\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.Scripting.dll - - - ..\packages\Microsoft.CodeAnalysis.Scripting.Common.3.0.0\lib\netstandard2.0\Microsoft.CodeAnalysis.Scripting.dll - - - ..\packages\Microsoft.EntityFrameworkCore.2.2.3\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll - - - ..\packages\Microsoft.EntityFrameworkCore.Abstractions.2.2.3\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Caching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Caching.Memory.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll - - - ..\packages\Microsoft.Extensions.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll - - - ..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Configuration.Binder.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll - - - ..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll - - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Logging.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll - - - ..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll - - - ..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll - - - ..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll - - - ..\packages\CS-Script.bin.3.28.7\lib\net46\Mono.CSharp.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\Ninject.3.3.4\lib\net45\Ninject.dll + + ..\packages\Ninject.Extensions.ChildKernel.3.3.0\lib\net45\Ninject.Extensions.ChildKernel.dll + ..\packages\Ninject.Extensions.Conventions.3.3.0\lib\net45\Ninject.Extensions.Conventions.dll ..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll - - ..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll - ..\packages\RGB.NET.Brushes.0.1.22\lib\net45\RGB.NET.Brushes.dll @@ -145,126 +84,17 @@ ..\packages\RGB.NET.Groups.0.1.22\lib\net45\RGB.NET.Groups.dll - - ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll - ..\packages\Stylet.1.1.22\lib\net45\Stylet.dll - - ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll - True - - - ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll - - - ..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll - - - ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll - - - - - ..\packages\System.Console.4.3.1\lib\net46\System.Console.dll - True - True - - - ..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll - - - ..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll - True - - - ..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll - True - - - ..\packages\System.Interactive.Async.3.2.0\lib\net46\System.Interactive.Async.dll - - - ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll - True - - - ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll - True - - - ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll - True - - - ..\packages\System.Memory.4.5.2\lib\netstandard2.0\System.Memory.dll - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll - True - - - ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll - True - - - ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll - True - - - ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll - True - - - ..\packages\System.Text.Encoding.CodePages.4.5.1\lib\net461\System.Text.Encoding.CodePages.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll - True - - - ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll - - - - - - ..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll - True - - - ..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll - True - - - ..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll - True - - - ..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll - True - @@ -315,15 +145,5 @@ Artemis.Storage - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - \ No newline at end of file diff --git a/src/Artemis.Core/Ninject/CoreModule.cs b/src/Artemis.Core/Ninject/CoreModule.cs index 027fe7320..fca497a8b 100644 --- a/src/Artemis.Core/Ninject/CoreModule.cs +++ b/src/Artemis.Core/Ninject/CoreModule.cs @@ -1,5 +1,5 @@ -using Artemis.Core.Services.Interfaces; -using Artemis.Storage; +using System.Linq; +using Artemis.Core.Services.Interfaces; using Ninject.Extensions.Conventions; using Ninject.Modules; @@ -18,8 +18,6 @@ namespace Artemis.Core.Ninject .BindAllInterfaces() .Configure(c => c.InSingletonScope()); }); - - Bind().ToSelf().InSingletonScope(); } } } \ No newline at end of file diff --git a/src/Artemis.Core/Plugins/Models/PluginInfo.cs b/src/Artemis.Core/Plugins/Models/PluginInfo.cs index 3d6cac61e..c37e1e5fd 100644 --- a/src/Artemis.Core/Plugins/Models/PluginInfo.cs +++ b/src/Artemis.Core/Plugins/Models/PluginInfo.cs @@ -5,7 +5,6 @@ using System.Reflection; using System.Threading.Tasks; using Artemis.Core.Plugins.Exceptions; using Artemis.Core.Plugins.Interfaces; -using CSScriptLibrary; using Newtonsoft.Json; using Ninject; @@ -13,8 +12,8 @@ namespace Artemis.Core.Plugins.Models { public class PluginInfo { - private static Assembly _assembly; - + private static AppDomain _appDomain; + /// /// The plugin's GUID /// @@ -29,12 +28,7 @@ namespace Artemis.Core.Plugins.Models /// The version of the plugin /// public string Version { get; set; } - - /// - /// The file implementing IPlugin, loaded on startup - /// - public string Main { get; set; } - + /// /// The instantiated plugin, available after successful load /// @@ -46,60 +40,7 @@ namespace Artemis.Core.Plugins.Models /// [JsonIgnore] public string Folder { get; set; } - - /// - /// Unloads the plugin and clears the plugin info's internal data - /// - public void UnloadPlugin() - { - Plugin.Dispose(); - _assembly = null; - } - - /// - /// Load a plugin from a folder - /// - /// The Ninject kernel to use for DI - /// The folder in which plugin.json is located - /// - public static async Task FromFolder(IKernel kernel, string folder) - { - // Make sure the right engine is used - CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom; - CSScript.EvaluatorConfig.DebugBuild = true; - CSScript.GlobalSettings.SearchDirs = folder; - if (!folder.EndsWith("\\")) - folder += "\\"; - if (!File.Exists(folder + "plugin.json")) - throw new ArtemisPluginException(null, "Failed to load plugin, no plugin.json found in " + folder); - - var pluginInfo = JsonConvert.DeserializeObject(File.ReadAllText(folder + "plugin.json")); - pluginInfo.Folder = folder; - - await pluginInfo.CompilePlugin(kernel); - return pluginInfo; - } - - /// - /// Compiles the plugin's main CS file and any of it's includes and instantiates it. - /// - /// The Ninject kernel to use for DI - public async Task CompilePlugin(IKernel kernel) - { - // Load the main script and get the type - _assembly = await CSScript.Evaluator.CompileCodeAsync(File.ReadAllText(Folder + Main)); - - var pluginType = _assembly.GetTypes().Where(t => typeof(IPlugin).IsAssignableFrom(t)).ToList(); - if (!pluginType.Any()) - throw new ArtemisPluginException(this, "Failed to load plugin, no type found that implements IPlugin"); - if (pluginType.Count > 1) - throw new ArtemisPluginException(this, "Failed to load plugin, more than one type found that implements IPlugin"); - - // Instantiate the plugin with Ninject - Plugin = (IPlugin) kernel.Get(pluginType.First()); - Plugin.LoadPlugin(); - } - + /// /// Gets the view model of the module accompanying the provided plugin info /// @@ -107,7 +48,7 @@ namespace Artemis.Core.Plugins.Models /// public IModuleViewModel GetModuleViewModel(IKernel kernel) { - // Don't attempt to locave VMs for something other than a module + // Don't attempt to locate VMs for something other than a module if (Plugin == null) throw new ArtemisPluginException(this, "Cannot locate a view model for this plugin because it's not compiled."); if (!(Plugin is IModule module)) diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs index ef8cf81bf..44b921b0a 100644 --- a/src/Artemis.Core/Services/CoreService.cs +++ b/src/Artemis.Core/Services/CoreService.cs @@ -58,7 +58,7 @@ namespace Artemis.Core.Services // Render all active modules using (var g = _rgbService.GraphicsDecorator.GetGraphics()) { - g.Clear(Color.Black); + g.Clear(Color.Red); foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType()) module.Render(args.DeltaTime, _rgbService.Surface, g); diff --git a/src/Artemis.Core/Services/Interfaces/IPluginService.cs b/src/Artemis.Core/Services/Interfaces/IPluginService.cs index 112942dd3..83be0b42c 100644 --- a/src/Artemis.Core/Services/Interfaces/IPluginService.cs +++ b/src/Artemis.Core/Services/Interfaces/IPluginService.cs @@ -25,12 +25,6 @@ namespace Artemis.Core.Services.Interfaces /// Task LoadPlugins(); - /// - /// Reloads the plugin accompanying the provided plugin info - /// - /// The plugin info containing the plugin to reload - Task ReloadPlugin(PluginInfo pluginInfo); - /// /// Gets the view model of the module accompanying the provided plugin info /// @@ -42,10 +36,6 @@ namespace Artemis.Core.Services.Interfaces /// event EventHandler PluginLoaded; - /// - /// Occurs when a single plugin has reloaded - /// - event EventHandler PluginReloaded; /// /// Occurs when loading all plugins has started diff --git a/src/Artemis.Core/Services/PluginService.cs b/src/Artemis.Core/Services/PluginService.cs index 7ff2f83e7..9b9c0b6d1 100644 --- a/src/Artemis.Core/Services/PluginService.cs +++ b/src/Artemis.Core/Services/PluginService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; +using System.Reflection; using System.Threading.Tasks; using Artemis.Core.Events; using Artemis.Core.Exceptions; @@ -12,12 +13,15 @@ using Artemis.Core.Plugins.Models; using Artemis.Core.ProfileElements; using Artemis.Core.Services.Interfaces; using Ninject; +using Ninject.Extensions.ChildKernel; namespace Artemis.Core.Services { public class PluginService : IPluginService { private readonly IKernel _kernel; + private IKernel _childKernel; + private AppDomain _appDomain; private readonly List _plugins; public PluginService(IKernel kernel) @@ -40,25 +44,37 @@ namespace Artemis.Core.Services OnStartedLoadingPlugins(); - // Empty the list of plugins - foreach (var pluginInfo in _plugins) - pluginInfo.UnloadPlugin(); - _plugins.Clear(); + UnloadPlugins(); - // Iterate all plugin folders and load each plugin - foreach (var directory in Directory.GetDirectories(Constants.DataFolder + "plugins")) - _plugins.Add(await PluginInfo.FromFolder(_kernel, directory)); + // Create a child kernel and app domain that will only contain the plugins + _childKernel = new ChildKernel(_kernel); + _appDomain = AppDomain.CreateDomain("PluginAppDomain"); + + // Load the plugin assemblies into the app domain + var directory = new DirectoryInfo(Constants.DataFolder + "plugins"); + foreach (var subDirectory in directory.EnumerateDirectories()) + { +// _appDomain.Load() +// _plugins.Add(new PluginInfo(subDirectory.FullName)); + } OnFinishedLoadedPlugins(); } - /// - public async Task ReloadPlugin(PluginInfo pluginInfo) + private void UnloadPlugins() { - pluginInfo.UnloadPlugin(); - await pluginInfo.CompilePlugin(_kernel); + _plugins.Clear(); - OnPluginReloaded(new PluginEventArgs(pluginInfo)); + if (_childKernel != null) + { + _childKernel.Dispose(); + _childKernel = null; + } + if (_appDomain != null) + { + AppDomain.Unload(_appDomain); + _appDomain = null; + } } /// @@ -85,16 +101,12 @@ namespace Artemis.Core.Services public void Dispose() { - // Empty the list of plugins - foreach (var pluginInfo in _plugins) - pluginInfo.UnloadPlugin(); - _plugins.Clear(); + UnloadPlugins(); } #region Events public event EventHandler PluginLoaded; - public event EventHandler PluginReloaded; public event EventHandler StartedLoadingPlugins; public event EventHandler FinishedLoadedPlugins; @@ -102,12 +114,7 @@ namespace Artemis.Core.Services { PluginLoaded?.Invoke(this, e); } - - private void OnPluginReloaded(PluginEventArgs e) - { - PluginReloaded?.Invoke(this, e); - } - + private void OnStartedLoadingPlugins() { LoadingPlugins = true; diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs index abca2a892..402a48ca8 100644 --- a/src/Artemis.Core/Services/RgbService.cs +++ b/src/Artemis.Core/Services/RgbService.cs @@ -44,6 +44,7 @@ namespace Artemis.Core.Services await Task.Run(() => { + // TODO SpoinkyNL 8-1-18: Keep settings into account // This one doesn't work well without ASUS devices installed // Surface.LoadDevices(AsusDeviceProvider.Instance); diff --git a/src/Artemis.Core/Services/StorageService.cs b/src/Artemis.Core/Services/StorageService.cs index ae40ecfba..51beefc84 100644 --- a/src/Artemis.Core/Services/StorageService.cs +++ b/src/Artemis.Core/Services/StorageService.cs @@ -1,28 +1,26 @@ using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Artemis.Core.Plugins.Models; using Artemis.Core.ProfileElements; using Artemis.Core.Services.Interfaces; -using Artemis.Storage; -using Microsoft.EntityFrameworkCore; +using Artemis.Storage.Repositories; namespace Artemis.Core.Services { public class StorageService : IStorageService { - private readonly StorageContext _dbContext; private readonly IPluginService _pluginService; + private readonly ProfileRepository _profileRepository; - public StorageService(StorageContext dbContext, IPluginService pluginService) + public StorageService(IPluginService pluginService) { - _dbContext = dbContext; _pluginService = pluginService; + _profileRepository = new ProfileRepository(); } public async Task> GetModuleProfiles(PluginInfo pluginInfo) { - var profileEntities = await _dbContext.Profiles.Where(p => p.PluginGuid == pluginInfo.Guid).ToListAsync(); + var profileEntities = await _profileRepository.GetByPluginGuidAsync(pluginInfo.Guid); var profiles = new List(); foreach (var profileEntity in profileEntities) profiles.Add(Profile.FromProfileEntity(pluginInfo, profileEntity, _pluginService)); @@ -36,7 +34,7 @@ namespace Artemis.Core.Services // If not found, create a new one - await _dbContext.SaveChangesAsync(); + await _profileRepository.SaveAsync(); } } diff --git a/src/Artemis.Core/packages.config b/src/Artemis.Core/packages.config index e9b85ee3a..0462691bd 100644 --- a/src/Artemis.Core/packages.config +++ b/src/Artemis.Core/packages.config @@ -1,91 +1,15 @@  - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj b/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj index c84aa0a41..cb7b08d8d 100644 --- a/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj +++ b/src/Artemis.Plugins.BuiltIn/Artemis.Plugins.BuiltIn.csproj @@ -52,9 +52,6 @@ MinimumRecommendedRules.ruleset - - ..\packages\HidSharp.2.0.8\lib\net35\HidSharp.dll - @@ -69,9 +66,6 @@ ..\packages\RGB.NET.Groups.0.1.22\lib\net45\RGB.NET.Groups.dll - - ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll - ..\packages\Stylet.1.1.22\lib\net45\Stylet.dll @@ -82,11 +76,6 @@ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll - - - - - diff --git a/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs b/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs index ed7d93919..84e962bdd 100644 --- a/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs +++ b/src/Artemis.Plugins.BuiltIn/Modules/General/GeneralModule.cs @@ -1,11 +1,6 @@ -//css_inc GeneralViewModel.cs; -//css_inc GeneralDataModel.cs; - -using System; +using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; -using System.Linq; using Artemis.Core; using Artemis.Core.Plugins.Interfaces; using Artemis.Core.Services.Interfaces; @@ -48,16 +43,6 @@ namespace Artemis.Plugins.BuiltIn.Modules.General foreach (var surfaceLed in _surface.Leds) UpdateLedColor(surfaceLed, deltaTime); - - - } - - private void UpdateLedColor(Led led, double deltaTime) - { - if (_colors.ContainsKey(led)) - _colors[led] = ColorHelpers.ShiftColor(_colors[led], (int) (deltaTime * 1000)); - else - _colors[led] = ColorHelpers.GetRandomRainbowColor(); } public void Render(double deltaTime, RGBSurface surface, Graphics graphics) @@ -84,6 +69,14 @@ namespace Artemis.Plugins.BuiltIn.Modules.General PopulateColors(); } + private void UpdateLedColor(Led led, double deltaTime) + { + if (_colors.ContainsKey(led)) + _colors[led] = ColorHelpers.ShiftColor(_colors[led], (int) (deltaTime * 1000)); + else + _colors[led] = ColorHelpers.GetRandomRainbowColor(); + } + private void PopulateColors() { _colors = new Dictionary(); diff --git a/src/Artemis.Plugins.BuiltIn/Modules/General/plugin.json b/src/Artemis.Plugins.BuiltIn/Modules/General/plugin.json index 4e06582d4..d70efe1e2 100644 --- a/src/Artemis.Plugins.BuiltIn/Modules/General/plugin.json +++ b/src/Artemis.Plugins.BuiltIn/Modules/General/plugin.json @@ -1,5 +1,5 @@ { "Name": "Default", "Version": "1.0.0", - "Main": "GeneralModule.cs" + "Main": "GeneralModule.dll" } \ No newline at end of file diff --git a/src/Artemis.Plugins.BuiltIn/packages.config b/src/Artemis.Plugins.BuiltIn/packages.config index 46aba147c..a5b5bff49 100644 --- a/src/Artemis.Plugins.BuiltIn/packages.config +++ b/src/Artemis.Plugins.BuiltIn/packages.config @@ -1,12 +1,9 @@  - - - \ No newline at end of file diff --git a/src/Artemis.Storage/Artemis.Storage.csproj b/src/Artemis.Storage/Artemis.Storage.csproj index 1f2cd2c2a..74be88786 100644 --- a/src/Artemis.Storage/Artemis.Storage.csproj +++ b/src/Artemis.Storage/Artemis.Storage.csproj @@ -3,15 +3,14 @@ net461 AnyCPU;x64 - - - - - - - + + + + + + diff --git a/src/Artemis.Storage/Repositories/ProfileRepository.cs b/src/Artemis.Storage/Repositories/ProfileRepository.cs new file mode 100644 index 000000000..77bc4efd8 --- /dev/null +++ b/src/Artemis.Storage/Repositories/ProfileRepository.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Artemis.Storage.Entities; +using Microsoft.EntityFrameworkCore; + +namespace Artemis.Storage.Repositories +{ + public class ProfileRepository + { + private readonly StorageContext _dbContext; + + public ProfileRepository() + { + _dbContext = new StorageContext(); + } + + public IQueryable GetAll() + { + return _dbContext.Profiles; + } + + public async Task> GetByPluginGuidAsync(Guid pluginGuid) + { + return await _dbContext.Profiles.Where(p => p.PluginGuid == pluginGuid).ToListAsync(); + } + + public async Task GetByGuidAsync(string guid) + { + return await _dbContext.Profiles.FirstOrDefaultAsync(p => p.Guid == guid); + } + + public async Task SaveAsync() + { + await _dbContext.SaveChangesAsync(); + } + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 741b3925c..b7d92d988 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -64,9 +64,6 @@ ..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll - - ..\packages\HidSharp.2.0.8\lib\net35\HidSharp.dll - ..\packages\Humanizer.Core.2.6.2\lib\netstandard2.0\Humanizer.dll @@ -103,18 +100,17 @@ ..\packages\RGB.NET.Decorators.0.1.22\lib\net45\RGB.NET.Decorators.dll + + ..\packages\RGB.NET.Devices.Corsair.0.1.22\lib\net45\RGB.NET.Devices.Corsair.dll + ..\packages\RGB.NET.Groups.0.1.22\lib\net45\RGB.NET.Groups.dll - - ..\packages\Sanford.Multimedia.Midi.Standard.6.6.0\lib\net35\Sanford.Multimedia.Midi.dll - ..\packages\Stylet.1.1.22\lib\net45\Stylet.dll - ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll @@ -123,11 +119,7 @@ ..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll - - - - 4.0 @@ -228,10 +220,6 @@ {106f08ae-5fe8-433e-aa65-64e5219b5fc7} Artemis.Plugins.BuiltIn - - {e489e5e3-1a65-4af5-a1ea-f9805fd19a65} - Artemis.Storage - diff --git a/src/Artemis.UI/packages.config b/src/Artemis.UI/packages.config index afdf4bfcf..5346bf2d3 100644 --- a/src/Artemis.UI/packages.config +++ b/src/Artemis.UI/packages.config @@ -3,7 +3,6 @@ - @@ -16,10 +15,9 @@ + - - \ No newline at end of file diff --git a/src/Artemis.UI/packages.config.new.20190410002817 b/src/Artemis.UI/packages.config.new.20190410002817 new file mode 100644 index 000000000..92f751e98 --- /dev/null +++ b/src/Artemis.UI/packages.config.new.20190410002817 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file