mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added most of the settings code, doesn't work because SQLite is weird
This commit is contained in:
parent
40c3222ae9
commit
8f4bb37fa4
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Artemis.Core</RootNamespace>
|
||||
<AssemblyName>Artemis.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
@ -93,6 +93,9 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -105,6 +108,7 @@
|
||||
<Compile Include="Events\DeviceEventArgs.cs" />
|
||||
<Compile Include="Exceptions\ArtemisCoreException.cs" />
|
||||
<Compile Include="Models\DataModelDescription.cs" />
|
||||
<Compile Include="Ninject\PluginSettingsProvider.cs" />
|
||||
<Compile Include="Plugins\Abstract\ModuleDataModel.cs" />
|
||||
<Compile Include="Plugins\Abstract\ModuleViewModel.cs" />
|
||||
<Compile Include="Plugins\Abstract\ProfileModule.cs" />
|
||||
@ -117,7 +121,7 @@
|
||||
<Compile Include="Plugins\Abstract\Plugin.cs" />
|
||||
<Compile Include="Plugins\Models\PluginInfo.cs" />
|
||||
<Compile Include="Plugins\Models\PluginSetting.cs" />
|
||||
<Compile Include="Plugins\Models\PluginSettingsContainer.cs" />
|
||||
<Compile Include="Plugins\Models\PluginSettings.cs" />
|
||||
<Compile Include="ProfileElements\Folder.cs" />
|
||||
<Compile Include="ProfileElements\Interfaces\IProfileElement.cs" />
|
||||
<Compile Include="ProfileElements\Layer.cs" />
|
||||
@ -136,7 +140,6 @@
|
||||
<Compile Include="Services\Interfaces\IPluginService.cs" />
|
||||
<Compile Include="Events\PluginEventArgs.cs" />
|
||||
<Compile Include="Services\PluginService.cs" />
|
||||
<Compile Include="Services\SettingsService.cs" />
|
||||
<Compile Include="Services\StorageService.cs" />
|
||||
<Compile Include="UtilitiesRemoveMe.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Repositories;
|
||||
using Ninject.Extensions.Conventions;
|
||||
using Ninject.Modules;
|
||||
|
||||
@ -17,6 +19,18 @@ namespace Artemis.Core.Ninject
|
||||
.BindAllInterfaces()
|
||||
.Configure(c => c.InSingletonScope());
|
||||
});
|
||||
|
||||
// Bind all repositories as singletons
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromAssemblyContaining<IRepository>()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<IRepository>()
|
||||
.BindAllInterfaces()
|
||||
.Configure(c => c.InSingletonScope());
|
||||
});
|
||||
|
||||
Kernel.Bind<PluginSettings>().ToProvider<PluginSettingsProvider>();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/Artemis.Core/Ninject/PluginSettingsProvider.cs
Normal file
27
src/Artemis.Core/Ninject/PluginSettingsProvider.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Storage.Repositories;
|
||||
using Ninject.Activation;
|
||||
|
||||
namespace Artemis.Core.Ninject
|
||||
{
|
||||
public class PluginSettingsProvider : Provider<PluginSettings>
|
||||
{
|
||||
private readonly ISettingRepository _settingRepository;
|
||||
|
||||
public PluginSettingsProvider(ISettingRepository settingRepository)
|
||||
{
|
||||
_settingRepository = settingRepository;
|
||||
}
|
||||
|
||||
protected override PluginSettings CreateInstance(IContext context)
|
||||
{
|
||||
var pluginInfo = context.Request.ParentRequest?.Parameters.FirstOrDefault(p => p.Name == "PluginInfo")?.GetValue(context, null) as PluginInfo;
|
||||
if (pluginInfo == null)
|
||||
throw new ArtemisCoreException("A plugin needs to be initialized with PluginInfo as a parameter");
|
||||
|
||||
return new PluginSettings(pluginInfo, _settingRepository);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,21 +15,25 @@ namespace Artemis.Core.Plugins.Models
|
||||
/// <summary>
|
||||
/// The plugins GUID
|
||||
/// </summary>
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public Guid Guid { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the plugin
|
||||
/// </summary>
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string Name { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of the plugin
|
||||
/// </summary>
|
||||
public string Version { get; internal set; }
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public Version Version { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The main entry DLL, should contain a class implementing Plugin
|
||||
/// </summary>
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string Main { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -9,9 +9,9 @@ namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
private readonly PluginInfo _pluginInfo;
|
||||
private readonly SettingEntity _settingEntity;
|
||||
private readonly SettingRepository _settingRepository;
|
||||
private readonly ISettingRepository _settingRepository;
|
||||
|
||||
internal PluginSetting(PluginInfo pluginInfo, SettingRepository settingRepository, SettingEntity settingEntity)
|
||||
internal PluginSetting(PluginInfo pluginInfo, ISettingRepository settingRepository, SettingEntity settingEntity)
|
||||
{
|
||||
_pluginInfo = pluginInfo;
|
||||
_settingRepository = settingRepository;
|
||||
|
||||
35
src/Artemis.Core/Plugins/Models/PluginSettings.cs
Normal file
35
src/Artemis.Core/Plugins/Models/PluginSettings.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Repositories;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
public class PluginSettings
|
||||
{
|
||||
private readonly PluginInfo _pluginInfo;
|
||||
private readonly ISettingRepository _settingRepository;
|
||||
private readonly Dictionary<string, SettingEntity> _settingEntities;
|
||||
|
||||
public PluginSettings(PluginInfo pluginInfo, ISettingRepository settingRepository)
|
||||
{
|
||||
_pluginInfo = pluginInfo;
|
||||
_settingRepository = settingRepository;
|
||||
_settingEntities = settingRepository.GetByPluginGuid(_pluginInfo.Guid).ToDictionary(se => se.Name);
|
||||
}
|
||||
|
||||
public PluginSetting<T> GetSetting<T>(string name, T defaultValue = default)
|
||||
{
|
||||
if (_settingEntities.ContainsKey(name))
|
||||
return new PluginSetting<T>(_pluginInfo, _settingRepository, _settingEntities[name]);
|
||||
|
||||
var settingEntity = new SettingEntity {Name = name, PluginGuid = _pluginInfo.Guid, Value = JsonConvert.SerializeObject(defaultValue)};
|
||||
_settingRepository.Add(settingEntity);
|
||||
_settingRepository.Save();
|
||||
|
||||
_settingEntities.Add(name, settingEntity);
|
||||
return GetSetting(name, defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Repositories;
|
||||
|
||||
namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
public class PluginSettingsContainer
|
||||
{
|
||||
private readonly PluginInfo _pluginInfo;
|
||||
private readonly SettingRepository _settingRepository;
|
||||
private Task<List<SettingEntity>> _settings;
|
||||
|
||||
internal PluginSettingsContainer(PluginInfo pluginInfo, SettingRepository settingRepository)
|
||||
{
|
||||
_pluginInfo = pluginInfo;
|
||||
_settingRepository = settingRepository;
|
||||
}
|
||||
|
||||
public bool HasSettingChanged(string settingName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAnySettingChanged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@ namespace Artemis.Core.Services
|
||||
private readonly IPluginService _pluginService;
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public CoreService(IPluginService pluginService, IRgbService rgbService)
|
||||
internal CoreService(IPluginService pluginService, IRgbService rgbService)
|
||||
{
|
||||
_pluginService = pluginService;
|
||||
_rgbService = rgbService;
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
private readonly List<DataModelExpansion> _dataModelExpansions;
|
||||
|
||||
public MainDataModelService()
|
||||
internal MainDataModelService()
|
||||
{
|
||||
_dataModelExpansions = new List<DataModelExpansion>();
|
||||
}
|
||||
|
||||
@ -146,8 +146,12 @@ namespace Artemis.Core.Services
|
||||
var pluginType = pluginTypes.Single();
|
||||
try
|
||||
{
|
||||
var constructorArguments = new ConstructorArgument("pluginInfo", pluginInfo);
|
||||
pluginInfo.Instance = (Plugin) _childKernel.Get(pluginType, constraint: null, parameters: constructorArguments);
|
||||
var parameters = new IParameter[]
|
||||
{
|
||||
new ConstructorArgument("pluginInfo", pluginInfo),
|
||||
new Parameter("PluginInfo", pluginInfo, false)
|
||||
};
|
||||
pluginInfo.Instance = (Plugin) _childKernel.Get(pluginType, constraint: null, parameters: parameters);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@ -16,7 +16,7 @@ namespace Artemis.Core.Services
|
||||
private readonly List<IRGBDevice> _loadedDevices;
|
||||
private readonly TimerUpdateTrigger _updateTrigger;
|
||||
|
||||
public RgbService()
|
||||
internal RgbService()
|
||||
{
|
||||
Surface = RGBSurface.Instance;
|
||||
LoadingDevices = false;
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Repositories;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
// TODO: Rethink this :')
|
||||
public class SettingsService : ISettingsService
|
||||
{
|
||||
private SettingRepository _settingRepository;
|
||||
|
||||
public SettingsService()
|
||||
{
|
||||
_settingRepository = new SettingRepository();
|
||||
}
|
||||
|
||||
public PluginSettingsContainer GetPluginSettings(PluginInfo pluginInfo)
|
||||
{
|
||||
return new PluginSettingsContainer(pluginInfo, _settingRepository);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ISettingsService : IArtemisService
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@ namespace Artemis.Core.Services
|
||||
private readonly IPluginService _pluginService;
|
||||
private readonly ProfileRepository _profileRepository;
|
||||
|
||||
public StorageService(IPluginService pluginService)
|
||||
internal StorageService(IPluginService pluginService)
|
||||
{
|
||||
_pluginService = pluginService;
|
||||
_profileRepository = new ProfileRepository();
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
@ -28,8 +27,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.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.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -53,8 +51,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.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-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -70,8 +67,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -87,8 +83,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -96,8 +91,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -111,6 +105,6 @@
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="AppDomainToolkit" version="1.0.4.3" targetFramework="net461" />
|
||||
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
|
||||
@ -14,4 +13,5 @@
|
||||
<package id="RGB.NET.Devices.Corsair" version="0.1.22" targetFramework="net461" />
|
||||
<package id="RGB.NET.Groups" version="0.1.22" targetFramework="net461" />
|
||||
<package id="Stylet" version="1.1.22" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -9,9 +9,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Artemis.Plugins.LayerTypes.Brush</RootNamespace>
|
||||
<AssemblyName>Artemis.Plugins.LayerTypes.Brush</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -48,8 +49,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
@ -9,4 +8,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="QRCoder" version="1.2.5" targetFramework="net461" />
|
||||
<package id="RGB.NET.Core" version="0.1.22" targetFramework="net461" />
|
||||
<package id="Stylet" version="1.1.22" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -1,5 +1,10 @@
|
||||
{
|
||||
"Guid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Name": "Brush layer",
|
||||
"Version": "1.0.0",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"Main": "Artemis.Plugins.LayerTypes.Brush.dll"
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,9 +9,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Artemis.Plugins.Modules.General</RootNamespace>
|
||||
<AssemblyName>Artemis.Plugins.Modules.General</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -52,8 +53,7 @@
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
@ -15,11 +16,13 @@ namespace Artemis.Plugins.Modules.General
|
||||
{
|
||||
public class GeneralModule : Module
|
||||
{
|
||||
private readonly PluginSettings _settings;
|
||||
private readonly RGBSurface _surface;
|
||||
private Dictionary<Led, Color> _colors;
|
||||
|
||||
public GeneralModule(PluginInfo pluginInfo, IRgbService rgbService) : base(pluginInfo)
|
||||
public GeneralModule(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo)
|
||||
{
|
||||
_settings = settings;
|
||||
DisplayName = "General";
|
||||
ExpandsMainDataModel = true;
|
||||
|
||||
@ -27,6 +30,8 @@ namespace Artemis.Plugins.Modules.General
|
||||
_colors = new Dictionary<Led, Color>();
|
||||
|
||||
rgbService.FinishedLoadedDevices += (sender, args) => PopulateColors();
|
||||
|
||||
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
|
||||
}
|
||||
|
||||
public override void EnablePlugin()
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
@ -9,4 +8,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="QRCoder" version="1.3.5" targetFramework="net461" />
|
||||
<package id="RGB.NET.Core" version="0.1.22" targetFramework="net461" />
|
||||
<package id="Stylet" version="1.1.17" targetFramework="net461" />
|
||||
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -1,5 +1,10 @@
|
||||
{
|
||||
"Guid": "0de2991a-d7b8-4f61-ae4e-6623849215b5",
|
||||
"Name": "General module",
|
||||
"Version": "1.0.0",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"Main": "Artemis.Plugins.Modules.General.dll"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
|
||||
|
||||
@ -5,11 +5,9 @@ namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class SettingEntity
|
||||
{
|
||||
[Key]
|
||||
public string Name { get; set; }
|
||||
|
||||
public Guid PluginGuid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,191 +0,0 @@
|
||||
// <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 Microsoft.EntityFrameworkCore.Storage.Internal;
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
[Migration("20180406175247_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Folders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerSettingEntityGuid");
|
||||
|
||||
b.Property<int>("Time");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerSettingEntityGuid");
|
||||
|
||||
b.ToTable("Keypoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Layers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerEntityGuid");
|
||||
|
||||
b.ToTable("LayerSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerGuid");
|
||||
|
||||
b.Property<int>("LayerId");
|
||||
|
||||
b.Property<string>("LedName");
|
||||
|
||||
b.Property<string>("LimitedToDevice");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerGuid");
|
||||
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("RootFolderGuid");
|
||||
|
||||
b.Property<int>("RootFolderId");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("RootFolderGuid");
|
||||
|
||||
b.ToTable("Profiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Folders")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
|
||||
.WithMany("Keypoints")
|
||||
.HasForeignKey("LayerSettingEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Layers")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity")
|
||||
.WithMany("Settings")
|
||||
.HasForeignKey("LayerEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
|
||||
.WithMany("Leds")
|
||||
.HasForeignKey("LayerGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,196 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
"Folders",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Order = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Folders", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Folders_Folders_FolderEntityGuid",
|
||||
x => x.FolderEntityGuid,
|
||||
"Folders",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Settings",
|
||||
table => new
|
||||
{
|
||||
Name = table.Column<string>(),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Layers",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Order = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Layers", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Layers_Folders_FolderEntityGuid",
|
||||
x => x.FolderEntityGuid,
|
||||
"Folders",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Profiles",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
PluginGuid = table.Column<Guid>(),
|
||||
RootFolderGuid = table.Column<string>(nullable: true),
|
||||
RootFolderId = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Profiles", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Profiles_Folders_RootFolderGuid",
|
||||
x => x.RootFolderGuid,
|
||||
"Folders",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"LayerSettings",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
LayerEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LayerSettings", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_LayerSettings_Layers_LayerEntityGuid",
|
||||
x => x.LayerEntityGuid,
|
||||
"Layers",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Leds",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
LayerGuid = table.Column<string>(nullable: true),
|
||||
LayerId = table.Column<int>(),
|
||||
LedName = table.Column<string>(nullable: true),
|
||||
LimitedToDevice = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leds", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Leds_Layers_LayerGuid",
|
||||
x => x.LayerGuid,
|
||||
"Layers",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Keypoints",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
LayerSettingEntityGuid = table.Column<string>(nullable: true),
|
||||
Time = table.Column<int>(),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Keypoints", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Keypoints_LayerSettings_LayerSettingEntityGuid",
|
||||
x => x.LayerSettingEntityGuid,
|
||||
"LayerSettings",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Folders_FolderEntityGuid",
|
||||
"Folders",
|
||||
"FolderEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Keypoints_LayerSettingEntityGuid",
|
||||
"Keypoints",
|
||||
"LayerSettingEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Layers_FolderEntityGuid",
|
||||
"Layers",
|
||||
"FolderEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_LayerSettings_LayerEntityGuid",
|
||||
"LayerSettings",
|
||||
"LayerEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Leds_LayerGuid",
|
||||
"Leds",
|
||||
"LayerGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Profiles_RootFolderGuid",
|
||||
"Profiles",
|
||||
"RootFolderGuid");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"Keypoints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Leds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Profiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Settings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"LayerSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Layers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Folders");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public partial class SettingsPluginGuid : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PluginGuid",
|
||||
table: "Settings",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Settings_Name_PluginGuid",
|
||||
table: "Settings",
|
||||
columns: new[] { "Name", "PluginGuid" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Settings_Name_PluginGuid",
|
||||
table: "Settings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PluginGuid",
|
||||
table: "Settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
[Migration("20190415185618_SettingsPluginGuid")]
|
||||
partial class SettingsPluginGuid
|
||||
[Migration("20190417180145_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -132,16 +132,13 @@ namespace Artemis.Storage.Migrations
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.HasIndex("Name", "PluginGuid");
|
||||
b.HasKey("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
200
src/Artemis.Storage/Migrations/20190417180145_InitialCreate.cs
Normal file
200
src/Artemis.Storage/Migrations/20190417180145_InitialCreate.cs
Normal file
@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Folders",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Order = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Folders", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_Folders_Folders_FolderEntityGuid",
|
||||
column: x => x.FolderEntityGuid,
|
||||
principalTable: "Folders",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Settings",
|
||||
columns: table => new
|
||||
{
|
||||
PluginGuid = table.Column<Guid>(nullable: false),
|
||||
Name = table.Column<string>(nullable: false),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Settings", x => new { x.Name, x.PluginGuid });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Layers",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Order = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Layers", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_Layers_Folders_FolderEntityGuid",
|
||||
column: x => x.FolderEntityGuid,
|
||||
principalTable: "Folders",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Profiles",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
PluginGuid = table.Column<Guid>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
RootFolderId = table.Column<int>(nullable: false),
|
||||
RootFolderGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Profiles", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_Profiles_Folders_RootFolderGuid",
|
||||
column: x => x.RootFolderGuid,
|
||||
principalTable: "Folders",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LayerSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Value = table.Column<string>(nullable: true),
|
||||
LayerEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LayerSettings", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_LayerSettings_Layers_LayerEntityGuid",
|
||||
column: x => x.LayerEntityGuid,
|
||||
principalTable: "Layers",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Leds",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
LedName = table.Column<string>(nullable: true),
|
||||
LimitedToDevice = table.Column<string>(nullable: true),
|
||||
LayerId = table.Column<int>(nullable: false),
|
||||
LayerGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leds", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_Leds_Layers_LayerGuid",
|
||||
column: x => x.LayerGuid,
|
||||
principalTable: "Layers",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Keypoints",
|
||||
columns: table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Time = table.Column<int>(nullable: false),
|
||||
Value = table.Column<string>(nullable: true),
|
||||
LayerSettingEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Keypoints", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
name: "FK_Keypoints_LayerSettings_LayerSettingEntityGuid",
|
||||
column: x => x.LayerSettingEntityGuid,
|
||||
principalTable: "LayerSettings",
|
||||
principalColumn: "Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Folders_FolderEntityGuid",
|
||||
table: "Folders",
|
||||
column: "FolderEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Keypoints_LayerSettingEntityGuid",
|
||||
table: "Keypoints",
|
||||
column: "LayerSettingEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Layers_FolderEntityGuid",
|
||||
table: "Layers",
|
||||
column: "FolderEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LayerSettings_LayerEntityGuid",
|
||||
table: "LayerSettings",
|
||||
column: "LayerEntityGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Leds_LayerGuid",
|
||||
table: "Leds",
|
||||
column: "LayerGuid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Profiles_RootFolderGuid",
|
||||
table: "Profiles",
|
||||
column: "RootFolderGuid");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Keypoints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Leds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Profiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Settings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LayerSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Layers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Folders");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,16 +130,13 @@ namespace Artemis.Storage.Migrations
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.HasIndex("Name", "PluginGuid");
|
||||
b.HasKey("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
|
||||
6
src/Artemis.Storage/Repositories/IRepository.cs
Normal file
6
src/Artemis.Storage/Repositories/IRepository.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
}
|
||||
}
|
||||
20
src/Artemis.Storage/Repositories/ISettingRepository.cs
Normal file
20
src/Artemis.Storage/Repositories/ISettingRepository.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public interface ISettingRepository : IRepository
|
||||
{
|
||||
IQueryable<SettingEntity> GetAll();
|
||||
List<SettingEntity> GetByPluginGuid(Guid pluginGuid);
|
||||
void Add(SettingEntity settingEntity);
|
||||
Task<List<SettingEntity>> GetByPluginGuidAsync(Guid pluginGuid);
|
||||
Task<SettingEntity> GetByNameAndPluginGuid(string name, Guid pluginGuid);
|
||||
Task<SettingEntity> GetByName(string name);
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
}
|
||||
}
|
||||
@ -7,11 +7,11 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SettingRepository
|
||||
public class SettingRepository : ISettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
|
||||
public SettingRepository()
|
||||
internal SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
}
|
||||
@ -26,6 +26,11 @@ namespace Artemis.Storage.Repositories
|
||||
return _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToList();
|
||||
}
|
||||
|
||||
public void Add(SettingEntity settingEntity)
|
||||
{
|
||||
_dbContext.Settings.Add(settingEntity);
|
||||
}
|
||||
|
||||
public async Task<List<SettingEntity>> GetByPluginGuidAsync(Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
|
||||
Binary file not shown.
@ -11,11 +11,12 @@ namespace Artemis.Storage
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=Storage.db");
|
||||
SQLitePCL.Batteries.Init();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<SettingEntity>().HasIndex(s => new {s.Name, s.PluginGuid});
|
||||
modelBuilder.Entity<SettingEntity>().HasKey(s => new {s.Name, s.PluginGuid});
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
@ -31,8 +30,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.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.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -56,8 +54,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.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-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -73,8 +70,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -90,8 +86,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -99,8 +94,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51"
|
||||
culture="neutral" />
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -113,4 +107,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
||||
@ -9,13 +9,14 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Artemis.UI</RootNamespace>
|
||||
<AssemblyName>Artemis.UI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -62,13 +63,13 @@
|
||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net462\ControlzEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Humanizer, Version=2.6.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Humanizer.Core.2.6.2\lib\netstandard2.0\Humanizer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll</HintPath>
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net47\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MaterialDesignColors, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll</HintPath>
|
||||
@ -113,10 +114,10 @@
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net462\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
2
src/Artemis.UI/Properties/Resources.Designer.cs
generated
2
src/Artemis.UI/Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace Artemis.UI.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
22
src/Artemis.UI/Properties/Settings.Designer.cs
generated
22
src/Artemis.UI/Properties/Settings.Designer.cs
generated
@ -8,21 +8,17 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.UI.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace Artemis.UI.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
|
||||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" />
|
||||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net472" />
|
||||
<package id="Fody" version="4.2.1" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Humanizer.Core" version="2.6.2" targetFramework="net461" />
|
||||
<package id="MahApps.Metro" version="1.6.5" targetFramework="net461" />
|
||||
<package id="MahApps.Metro" version="1.6.5" targetFramework="net472" />
|
||||
<package id="MaterialDesignColors" version="1.1.3" targetFramework="net461" />
|
||||
<package id="MaterialDesignThemes" version="2.5.1" targetFramework="net461" />
|
||||
<package id="MaterialDesignThemes.MahApps" version="0.0.12" targetFramework="net461" />
|
||||
@ -20,5 +19,5 @@
|
||||
<package id="RGB.NET.Groups" version="0.1.22" targetFramework="net461" />
|
||||
<package id="RGB.NET.Resources.Corsair" version="0.3.0.234" targetFramework="net461" />
|
||||
<package id="Stylet" version="1.1.22" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user