mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Moved from EF and SQLite to LiteDB
This commit is contained in:
parent
d4dd371a50
commit
66f7dc94c8
@ -61,6 +61,9 @@
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
@ -129,6 +132,7 @@
|
||||
<Reference Include="System.Reflection.Metadata, Version=1.4.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.Metadata.1.7.0-preview8.19405.3\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0-preview8.19405.3\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
@ -173,7 +177,7 @@
|
||||
<Compile Include="Plugins\Models\PluginSetting.cs" />
|
||||
<Compile Include="Plugins\Models\PluginSettings.cs" />
|
||||
<Compile Include="Models\Profile\Folder.cs" />
|
||||
<Compile Include="Models\Profile\Abstract\IProfileElement.cs" />
|
||||
<Compile Include="Models\Profile\Abstract\ProfileElement.cs" />
|
||||
<Compile Include="Models\Profile\Layer.cs" />
|
||||
<Compile Include="Models\Profile\Profile.cs" />
|
||||
<Compile Include="Ninject\CoreModule.cs" />
|
||||
|
||||
@ -5,5 +5,6 @@ namespace Artemis.Core
|
||||
public static class Constants
|
||||
{
|
||||
public static readonly string DataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Artemis\\";
|
||||
public static readonly string ConnectionString = $"FileName={DataFolder}\\database.db;Mode=Exclusive";
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.Abstract
|
||||
{
|
||||
@ -35,5 +36,29 @@ namespace Artemis.Core.Models.Profile.Abstract
|
||||
/// Applies the profile element's properties to the underlying storage entity
|
||||
/// </summary>
|
||||
internal abstract void ApplyToEntity();
|
||||
|
||||
public List<Folder> GetAllFolders()
|
||||
{
|
||||
var folders = new List<Folder>();
|
||||
foreach (var childFolder in Children.Where(c => c is Folder).Cast<Folder>())
|
||||
{
|
||||
folders.Add(childFolder);
|
||||
folders.AddRange(childFolder.GetAllFolders());
|
||||
}
|
||||
|
||||
return folders;
|
||||
}
|
||||
|
||||
public List<Layer> GetAllLayers()
|
||||
{
|
||||
var folders = new List<Layer>();
|
||||
foreach (var childLayer in Children.Where(c => c is Layer).Cast<Layer>())
|
||||
{
|
||||
folders.Add(childLayer);
|
||||
folders.AddRange(childLayer.GetAllLayers());
|
||||
}
|
||||
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
@ -11,7 +13,7 @@ namespace Artemis.Core.Models.Profile
|
||||
public Folder(Profile profile, Folder folder, string name)
|
||||
{
|
||||
FolderEntity = new FolderEntity();
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
EntityId = Guid.NewGuid();
|
||||
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
@ -22,22 +24,22 @@ namespace Artemis.Core.Models.Profile
|
||||
public Folder(Profile profile, Folder folder, FolderEntity folderEntity, IPluginService pluginService)
|
||||
{
|
||||
FolderEntity = folderEntity;
|
||||
Guid = folderEntity.Guid;
|
||||
EntityId = folderEntity.Id;
|
||||
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
Children = new List<ProfileElement>();
|
||||
|
||||
// Load child folders
|
||||
foreach (var childFolder in folderEntity.Folders)
|
||||
foreach (var childFolder in Profile.ProfileEntity.Folders.Where(f => f.ParentId == EntityId))
|
||||
folder.Children.Add(new Folder(profile, this, childFolder, pluginService));
|
||||
// Load child layers
|
||||
foreach (var childLayer in folderEntity.Layers)
|
||||
foreach (var childLayer in Profile.ProfileEntity.Layers.Where(f => f.ParentId == EntityId))
|
||||
folder.Children.Add(new Layer(profile, this, childLayer, pluginService));
|
||||
}
|
||||
|
||||
internal FolderEntity FolderEntity { get; set; }
|
||||
internal string Guid { get; set; }
|
||||
internal Guid EntityId { get; set; }
|
||||
|
||||
public Profile Profile { get; }
|
||||
public Folder ParentFolder { get; }
|
||||
@ -59,25 +61,15 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
{
|
||||
FolderEntity.Guid = Guid;
|
||||
FolderEntity.Id = EntityId;
|
||||
FolderEntity.ParentId = ParentFolder?.EntityId ?? new Guid();
|
||||
|
||||
FolderEntity.Order = Order;
|
||||
FolderEntity.Name = Name;
|
||||
|
||||
foreach (var profileElement in Children)
|
||||
{
|
||||
profileElement.ApplyToEntity();
|
||||
// Add missing children
|
||||
if (profileElement is Folder folder)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else if (profileElement is Layer layer)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
FolderEntity.ProfileId = Profile.EntityId;
|
||||
|
||||
// Remove extra childen
|
||||
}
|
||||
// TODO: conditions
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Models.Profile.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
@ -14,7 +13,7 @@ namespace Artemis.Core.Models.Profile
|
||||
internal Layer(Profile profile, Folder folder, string name)
|
||||
{
|
||||
LayerEntity = new LayerEntity();
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
EntityId = Guid.NewGuid();
|
||||
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
@ -24,15 +23,15 @@ namespace Artemis.Core.Models.Profile
|
||||
internal Layer(Profile profile, Folder folder, LayerEntity layerEntity, IPluginService pluginService)
|
||||
{
|
||||
LayerEntity = layerEntity;
|
||||
Guid = layerEntity.Guid;
|
||||
EntityId = layerEntity.Id;
|
||||
|
||||
Profile = profile;
|
||||
ParentFolder = folder;
|
||||
LayerType = pluginService.GetLayerTypeByGuid(System.Guid.Parse(layerEntity.LayerTypeGuid));
|
||||
LayerType = pluginService.GetLayerTypeByGuid(layerEntity.LayerTypeGuid);
|
||||
}
|
||||
|
||||
internal LayerEntity LayerEntity { get; set; }
|
||||
internal string Guid { get; set; }
|
||||
internal Guid EntityId { get; set; }
|
||||
|
||||
public Profile Profile { get; }
|
||||
public Folder ParentFolder { get; }
|
||||
@ -64,12 +63,16 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
{
|
||||
LayerEntity.Guid = Guid;
|
||||
LayerEntity.Id = EntityId;
|
||||
LayerEntity.ParentId = ParentFolder?.EntityId ?? new Guid();
|
||||
LayerEntity.LayerTypeGuid = LayerType?.PluginInfo.Guid ?? new Guid();
|
||||
|
||||
LayerEntity.Order = Order;
|
||||
LayerEntity.Name = Name;
|
||||
LayerEntity.LayerTypeGuid = LayerType?.PluginInfo.Guid.ToString();
|
||||
|
||||
// TODO: Settings
|
||||
LayerEntity.ProfileId = Profile.EntityId;
|
||||
|
||||
// TODO: LEDs, conditions, elements
|
||||
}
|
||||
|
||||
public void UpdateLayerType(LayerType layerType)
|
||||
|
||||
@ -6,7 +6,7 @@ using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
@ -14,8 +14,8 @@ namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
internal Profile(PluginInfo pluginInfo, string name)
|
||||
{
|
||||
ProfileEntity = new ProfileEntity {RootFolder = new FolderEntity()};
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
ProfileEntity = new ProfileEntity();
|
||||
EntityId = Guid.NewGuid();
|
||||
|
||||
PluginInfo = pluginInfo;
|
||||
Name = name;
|
||||
@ -26,20 +26,24 @@ namespace Artemis.Core.Models.Profile
|
||||
internal Profile(PluginInfo pluginInfo, ProfileEntity profileEntity, IPluginService pluginService)
|
||||
{
|
||||
ProfileEntity = profileEntity;
|
||||
Guid = profileEntity.Guid;
|
||||
EntityId = profileEntity.Id;
|
||||
|
||||
PluginInfo = pluginInfo;
|
||||
Name = profileEntity.Name;
|
||||
|
||||
// Populate the profile starting at the root, the rest is populated recursively
|
||||
Children = new List<ProfileElement> {new Folder(this, null, profileEntity.RootFolder, pluginService)};
|
||||
var rootFolder = profileEntity.Folders.FirstOrDefault(f => f.ParentId == new Guid());
|
||||
if (rootFolder == null)
|
||||
Children = new List<ProfileElement> {new Folder(this, null, "Root folder")};
|
||||
else
|
||||
Children = new List<ProfileElement> {new Folder(this, null, rootFolder, pluginService)};
|
||||
}
|
||||
|
||||
public PluginInfo PluginInfo { get; }
|
||||
public bool IsActivated { get; private set; }
|
||||
|
||||
internal ProfileEntity ProfileEntity { get; set; }
|
||||
internal string Guid { get; set; }
|
||||
public Guid EntityId { get; set; }
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
@ -67,13 +71,22 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
{
|
||||
ProfileEntity.Guid = Guid;
|
||||
ProfileEntity.Id = EntityId;
|
||||
ProfileEntity.PluginGuid = PluginInfo.Guid;
|
||||
ProfileEntity.Name = Name;
|
||||
ProfileEntity.IsActive = IsActivated;
|
||||
|
||||
var rootFolder = Children.Single();
|
||||
foreach (var profileElement in Children)
|
||||
profileElement.ApplyToEntity();
|
||||
|
||||
ProfileEntity.Folders.Clear();
|
||||
ProfileEntity.Folders.AddRange(GetAllFolders().Select(f => f.FolderEntity));
|
||||
|
||||
ProfileEntity.Layers.Clear();
|
||||
ProfileEntity.Layers.AddRange(GetAllLayers().Select(f => f.LayerEntity));
|
||||
}
|
||||
|
||||
|
||||
internal void Activate()
|
||||
{
|
||||
lock (this)
|
||||
@ -95,7 +108,7 @@ namespace Artemis.Core.Models.Profile
|
||||
OnDeactivated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(Order)}: {Order}, {nameof(Name)}: {Name}, {nameof(PluginInfo)}: {PluginInfo}";
|
||||
|
||||
@ -4,7 +4,7 @@ using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using RGB.NET.Core;
|
||||
using Rectangle = System.Drawing.Rectangle;
|
||||
|
||||
@ -17,26 +17,23 @@ namespace Artemis.Core.Models.Surface
|
||||
RgbDevice = rgbDevice;
|
||||
Plugin = plugin;
|
||||
Surface = surface;
|
||||
Configuration = new DeviceEntity();
|
||||
DeviceEntity = new DeviceEntity();
|
||||
Leds = rgbDevice.Select(l => new DeviceLed(l, this)).ToList().AsReadOnly();
|
||||
|
||||
Rotation = 0;
|
||||
ZIndex = 1;
|
||||
|
||||
ApplyToConfiguration();
|
||||
ApplyToEntity();
|
||||
CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
internal Device(IRGBDevice rgbDevice, Plugin plugin, Surface surface, DeviceEntity configuration)
|
||||
internal Device(IRGBDevice rgbDevice, Plugin plugin, Surface surface, DeviceEntity deviceEntity)
|
||||
{
|
||||
RgbDevice = rgbDevice;
|
||||
Plugin = plugin;
|
||||
Surface = surface;
|
||||
Configuration = configuration;
|
||||
DeviceEntity = deviceEntity;
|
||||
Leds = rgbDevice.Select(l => new DeviceLed(l, this)).ToList().AsReadOnly();
|
||||
|
||||
Rotation = configuration.Rotation;
|
||||
ZIndex = configuration.ZIndex;
|
||||
}
|
||||
|
||||
public Rectangle RenderRectangle { get; private set; }
|
||||
@ -45,46 +42,43 @@ namespace Artemis.Core.Models.Surface
|
||||
public IRGBDevice RgbDevice { get; private set; }
|
||||
public Plugin Plugin { get; }
|
||||
public Surface Surface { get; private set; }
|
||||
public DeviceEntity Configuration { get; private set; }
|
||||
public DeviceEntity DeviceEntity { get; private set; }
|
||||
public ReadOnlyCollection<DeviceLed> Leds { get; set; }
|
||||
|
||||
public double X
|
||||
{
|
||||
get => Configuration.X;
|
||||
set => Configuration.X = value;
|
||||
get => DeviceEntity.X;
|
||||
set => DeviceEntity.X = value;
|
||||
}
|
||||
|
||||
public double Y
|
||||
{
|
||||
get => Configuration.Y;
|
||||
set => Configuration.Y = value;
|
||||
get => DeviceEntity.Y;
|
||||
set => DeviceEntity.Y = value;
|
||||
}
|
||||
|
||||
public double Rotation
|
||||
{
|
||||
get => Configuration.Rotation;
|
||||
set => Configuration.Rotation = value;
|
||||
get => DeviceEntity.Rotation;
|
||||
set => DeviceEntity.Rotation = value;
|
||||
}
|
||||
|
||||
public int ZIndex
|
||||
{
|
||||
get => Configuration.ZIndex;
|
||||
set => Configuration.ZIndex = value;
|
||||
get => DeviceEntity.ZIndex;
|
||||
set => DeviceEntity.ZIndex = value;
|
||||
}
|
||||
|
||||
internal void ApplyToConfiguration()
|
||||
internal void ApplyToEntity()
|
||||
{
|
||||
Configuration.SurfaceId = Surface.Guid;
|
||||
Configuration.DeviceHashCode = RgbDevice.GetDeviceHashCode();
|
||||
// Other properties are mapped computed
|
||||
|
||||
// Ensure the position configuration is in the surface configuration's' collection of positions
|
||||
if (Surface.SurfaceEntity.DeviceEntities.All(p => p.Guid != Configuration.Guid))
|
||||
Surface.SurfaceEntity.DeviceEntities.Add(Configuration);
|
||||
DeviceEntity.DeviceHashCode = RgbDevice.GetDeviceHashCode();
|
||||
}
|
||||
|
||||
internal void ApplyToRgbDevice()
|
||||
{
|
||||
RgbDevice.Location = new Point(Configuration.X, Configuration.Y);
|
||||
RgbDevice.Location = new Point(DeviceEntity.X, DeviceEntity.Y);
|
||||
CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
@ -110,7 +104,7 @@ namespace Artemis.Core.Models.Surface
|
||||
|
||||
internal void Destroy()
|
||||
{
|
||||
Configuration = null;
|
||||
DeviceEntity = null;
|
||||
RgbDevice = null;
|
||||
Surface = null;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core.Models.Surface
|
||||
@ -10,12 +11,14 @@ namespace Artemis.Core.Models.Surface
|
||||
internal Surface(RGBSurface rgbSurface, string name, double scale)
|
||||
{
|
||||
SurfaceEntity = new SurfaceEntity {DeviceEntities = new List<DeviceEntity>()};
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
EntityId = Guid.NewGuid();
|
||||
|
||||
Name = name;
|
||||
Scale = scale;
|
||||
RgbSurface = rgbSurface;
|
||||
IsActive = false;
|
||||
|
||||
// Devices are not populated here but as they are detected
|
||||
Devices = new List<Device>();
|
||||
|
||||
ApplyToEntity();
|
||||
@ -24,13 +27,15 @@ namespace Artemis.Core.Models.Surface
|
||||
internal Surface(RGBSurface rgbSurface, SurfaceEntity surfaceEntity, double scale)
|
||||
{
|
||||
SurfaceEntity = surfaceEntity;
|
||||
Guid = surfaceEntity.Guid;
|
||||
EntityId = surfaceEntity.Id;
|
||||
|
||||
RgbSurface = rgbSurface;
|
||||
Scale = scale;
|
||||
Name = surfaceEntity.Name;
|
||||
IsActive = surfaceEntity.IsActive;
|
||||
Devices = new List<Device>();
|
||||
|
||||
// Devices are not populated here but as they are detected
|
||||
Devices = new List<Device>();
|
||||
}
|
||||
|
||||
public RGBSurface RgbSurface { get; }
|
||||
@ -40,13 +45,20 @@ namespace Artemis.Core.Models.Surface
|
||||
public List<Device> Devices { get; internal set; }
|
||||
|
||||
internal SurfaceEntity SurfaceEntity { get; set; }
|
||||
internal string Guid { get; set; }
|
||||
internal Guid EntityId { get; set; }
|
||||
|
||||
internal void ApplyToEntity()
|
||||
{
|
||||
SurfaceEntity.Guid = Guid;
|
||||
SurfaceEntity.Id = EntityId;
|
||||
SurfaceEntity.Name = Name;
|
||||
SurfaceEntity.IsActive = IsActive;
|
||||
|
||||
// Add missing device entities, don't remove old ones in case they come back later
|
||||
foreach (var deviceEntity in Devices.Select(d => d.DeviceEntity).ToList())
|
||||
{
|
||||
if (!SurfaceEntity.DeviceEntities.Contains(deviceEntity))
|
||||
SurfaceEntity.DeviceEntities.Add(deviceEntity);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Destroy()
|
||||
|
||||
@ -3,6 +3,7 @@ using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using LiteDB;
|
||||
using Ninject.Activation;
|
||||
using Ninject.Extensions.Conventions;
|
||||
using Ninject.Modules;
|
||||
@ -37,6 +38,8 @@ namespace Artemis.Core.Ninject
|
||||
.Configure(c => c.When(HasAccessToProtectedService).InSingletonScope());
|
||||
});
|
||||
|
||||
Kernel.Bind<LiteRepository>().ToMethod(t => new LiteRepository(Constants.ConnectionString)).InSingletonScope();
|
||||
|
||||
// Bind all repositories as singletons
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
@ -71,20 +70,7 @@ namespace Artemis.Core.Plugins.Models
|
||||
return;
|
||||
|
||||
_pluginSettingEntity.Value = JsonConvert.SerializeObject(Value);
|
||||
_pluginSettingRepository.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the setting asynchronously
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
if (!HasChanged)
|
||||
return;
|
||||
|
||||
_pluginSettingEntity.Value = JsonConvert.SerializeObject(Value);
|
||||
await _pluginSettingRepository.SaveAsync();
|
||||
_pluginSettingRepository.Save(_pluginSettingEntity);
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> SettingChanged;
|
||||
|
||||
@ -43,7 +43,6 @@ namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
settingEntity = new PluginSettingEntity {Name = name, PluginGuid = _pluginInfo.Guid, Value = JsonConvert.SerializeObject(defaultValue)};
|
||||
_pluginSettingRepository.Add(settingEntity);
|
||||
_pluginSettingRepository.Save();
|
||||
}
|
||||
|
||||
var pluginSetting = new PluginSetting<T>(_pluginInfo, _pluginSettingRepository, settingEntity);
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
var surfaceConfig = _surfaceService.ActiveSurface;
|
||||
if (surfaceConfig != null)
|
||||
_logger.Information("Initialized with active surface entity {surfaceConfig}-{guid}", surfaceConfig.Name, surfaceConfig.Guid);
|
||||
_logger.Information("Initialized with active surface entity {surfaceConfig}-{guid}", surfaceConfig.Name, surfaceConfig.EntityId);
|
||||
else
|
||||
_logger.Information("Initialized without an active surface entity");
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
@ -8,7 +7,7 @@ namespace Artemis.Core.Services.Storage.Interfaces
|
||||
{
|
||||
public interface IProfileService : IArtemisService
|
||||
{
|
||||
Task<ICollection<Profile>> GetProfiles(ProfileModule module);
|
||||
Task<Profile> GetActiveProfile(ProfileModule module);
|
||||
List<Profile> GetProfiles(ProfileModule module);
|
||||
Profile GetActiveProfile(ProfileModule module);
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.Storage.Repositories;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
|
||||
namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
@ -14,17 +16,17 @@ namespace Artemis.Core.Services.Storage
|
||||
public class ProfileService : IProfileService
|
||||
{
|
||||
private readonly IPluginService _pluginService;
|
||||
private readonly ProfileRepository _profileRepository;
|
||||
private readonly IProfileRepository _profileRepository;
|
||||
|
||||
internal ProfileService(IPluginService pluginService)
|
||||
internal ProfileService(IPluginService pluginService, IProfileRepository profileRepository)
|
||||
{
|
||||
_pluginService = pluginService;
|
||||
_profileRepository = new ProfileRepository();
|
||||
_profileRepository = profileRepository;
|
||||
}
|
||||
|
||||
public async Task<ICollection<Profile>> GetProfiles(ProfileModule module)
|
||||
public List<Profile> GetProfiles(ProfileModule module)
|
||||
{
|
||||
var profileEntities = await _profileRepository.GetByPluginGuidAsync(module.PluginInfo.Guid);
|
||||
var profileEntities = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid);
|
||||
var profiles = new List<Profile>();
|
||||
foreach (var profileEntity in profileEntities)
|
||||
profiles.Add(new Profile(module.PluginInfo, profileEntity, _pluginService));
|
||||
@ -32,23 +34,23 @@ namespace Artemis.Core.Services.Storage
|
||||
return profiles;
|
||||
}
|
||||
|
||||
public async Task<Profile> GetActiveProfile(ProfileModule module)
|
||||
public Profile GetActiveProfile(ProfileModule module)
|
||||
{
|
||||
var profileEntity = await _profileRepository.GetActiveProfileByPluginGuidAsync(module.PluginInfo.Guid);
|
||||
var profileEntity = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid).FirstOrDefault(p => p.IsActive);
|
||||
if (profileEntity == null)
|
||||
return null;
|
||||
|
||||
return new Profile(module.PluginInfo, profileEntity, _pluginService);
|
||||
}
|
||||
|
||||
public async Task<Profile> CreateProfile(ProfileModule module, string name)
|
||||
public Profile CreateProfile(ProfileModule module, string name)
|
||||
{
|
||||
var profile = new Profile(module.PluginInfo, name);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
public async Task UpdateProfile(Profile profile, bool includeChildren)
|
||||
public void UpdateProfile(Profile profile, bool includeChildren)
|
||||
{
|
||||
profile.ApplyToEntity();
|
||||
if (includeChildren)
|
||||
|
||||
@ -57,6 +57,8 @@ namespace Artemis.Core.Services.Storage
|
||||
lock (_surfaceConfigurations)
|
||||
{
|
||||
_surfaceRepository.Add(configuration.SurfaceEntity);
|
||||
_surfaceConfigurations.Add(configuration);
|
||||
|
||||
UpdateSurfaceConfiguration(configuration, true);
|
||||
return configuration;
|
||||
}
|
||||
@ -78,9 +80,9 @@ namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
configuration.IsActive = configuration == ActiveSurface;
|
||||
configuration.ApplyToEntity();
|
||||
}
|
||||
|
||||
_surfaceRepository.Save();
|
||||
_surfaceRepository.Save(configuration.SurfaceEntity);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the active surface entity to the devices
|
||||
@ -102,13 +104,13 @@ namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
foreach (var deviceConfiguration in surface.Devices)
|
||||
{
|
||||
deviceConfiguration.ApplyToConfiguration();
|
||||
deviceConfiguration.ApplyToEntity();
|
||||
if (surface.IsActive)
|
||||
deviceConfiguration.ApplyToRgbDevice();
|
||||
}
|
||||
}
|
||||
|
||||
_surfaceRepository.Save();
|
||||
_surfaceRepository.Save(surface.SurfaceEntity);
|
||||
_rgbService.UpdateGraphicsDecorator();
|
||||
OnSurfaceConfigurationUpdated(new SurfaceConfigurationEventArgs(surface));
|
||||
}
|
||||
@ -122,10 +124,9 @@ namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
var entity = surface.SurfaceEntity;
|
||||
surface.Destroy();
|
||||
_surfaceConfigurations.Remove(surface);
|
||||
|
||||
_surfaceConfigurations.Remove(surface);
|
||||
_surfaceRepository.Remove(entity);
|
||||
_surfaceRepository.Save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +177,7 @@ namespace Artemis.Core.Services.Storage
|
||||
private void AddDeviceIfMissing(IRGBDevice rgbDevice, Surface surface)
|
||||
{
|
||||
var deviceHashCode = rgbDevice.GetDeviceHashCode();
|
||||
var device = surface.Devices.FirstOrDefault(d => d.Configuration.DeviceHashCode == deviceHashCode);
|
||||
var device = surface.Devices.FirstOrDefault(d => d.DeviceEntity.DeviceHashCode == deviceHashCode);
|
||||
|
||||
if (device != null)
|
||||
return;
|
||||
|
||||
@ -28,8 +28,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 +52,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 +68,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 +84,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.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -96,8 +92,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>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="AppDomainToolkit" version="1.0.4.3" targetFramework="net461" />
|
||||
<package id="Ben.Demystifier" version="0.1.4" targetFramework="net472" />
|
||||
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
|
||||
<package id="LiteDB" version="4.1.4" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||
<package id="Ninject" version="3.3.4" targetFramework="net461" />
|
||||
<package id="Ninject.Extensions.ChildKernel" version="3.3.0" targetFramework="net461" />
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.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.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
35
src/Artemis.Plugins.Devices.Logitech/app.config
Normal file
35
src/Artemis.Plugins.Devices.Logitech/app.config
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@ -16,8 +16,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.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.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.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.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
|
||||
@ -6,12 +6,7 @@
|
||||
<LangVersion>7</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
<PackageReference Include="LiteDB" Version="4.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class DeviceEntity
|
||||
{
|
||||
public DeviceEntity()
|
||||
{
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public int DeviceHashCode { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Rotation { get; set; }
|
||||
public int ZIndex { get; set; }
|
||||
|
||||
public string SurfaceId { get; set; }
|
||||
public virtual SurfaceEntity Surface { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Folders")]
|
||||
public class FolderEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual ICollection<FolderEntity> Folders { get; set; }
|
||||
public virtual ICollection<LayerEntity> Layers { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Keypoints")]
|
||||
public class KeypointEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public int Time { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Layers")]
|
||||
public class LayerEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public virtual ICollection<LedEntity> Leds { get; set; }
|
||||
public virtual ICollection<LayerSettingEntity> Settings { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string LayerTypeGuid { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("LayerSettings")]
|
||||
public class LayerSettingEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public ICollection<KeypointEntity> Keypoints { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
[Table("Leds")]
|
||||
public class LedEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public string LedName { get; set; }
|
||||
public string LimitedToDevice { get; set; }
|
||||
|
||||
public string LayerId { get; set; }
|
||||
public virtual LayerEntity Layer { get; set; }
|
||||
}
|
||||
}
|
||||
@ -4,9 +4,10 @@ namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class PluginSettingEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PluginGuid { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
22
src/Artemis.Storage/Entities/Profile/FolderEntity.cs
Normal file
22
src/Artemis.Storage/Entities/Profile/FolderEntity.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class FolderEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<ProfileConditionEntity> Conditions { get; set; }
|
||||
|
||||
[BsonRef("ProfileEntity")]
|
||||
public ProfileEntity Profile { get; set; }
|
||||
|
||||
public Guid ProfileId { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class LayerElementEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
}
|
||||
25
src/Artemis.Storage/Entities/Profile/LayerEntity.cs
Normal file
25
src/Artemis.Storage/Entities/Profile/LayerEntity.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class LayerEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ParentId { get; set; }
|
||||
public Guid LayerTypeGuid { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<LedEntity> Leds { get; set; }
|
||||
public List<ProfileConditionEntity> Condition { get; set; }
|
||||
public List<LayerElementEntity> Elements { get; set; }
|
||||
|
||||
[BsonRef("ProfileEntity")]
|
||||
public ProfileEntity Profile { get; set; }
|
||||
|
||||
public Guid ProfileId { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/Artemis.Storage/Entities/Profile/LedEntity.cs
Normal file
12
src/Artemis.Storage/Entities/Profile/LedEntity.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class LedEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string LedName { get; set; }
|
||||
public string LimitedToDevice { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class ProfileConditionEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
}
|
||||
17
src/Artemis.Storage/Entities/Profile/ProfileEntity.cs
Normal file
17
src/Artemis.Storage/Entities/Profile/ProfileEntity.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class ProfileEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PluginGuid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public List<FolderEntity> Folders { get; set; }
|
||||
public List<LayerEntity> Layers { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class ProfileEntity
|
||||
{
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public Guid PluginGuid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public int RootFolderId { get; set; }
|
||||
public virtual FolderEntity RootFolder { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class SettingEntity
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Artemis.Storage/Entities/Surface/DeviceEntity.cs
Normal file
15
src/Artemis.Storage/Entities/Surface/DeviceEntity.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Surface
|
||||
{
|
||||
public class DeviceEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public int DeviceHashCode { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Rotation { get; set; }
|
||||
public int ZIndex { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Artemis.Storage/Entities/Surface/SurfaceEntity.cs
Normal file
15
src/Artemis.Storage/Entities/Surface/SurfaceEntity.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities.Surface
|
||||
{
|
||||
public class SurfaceEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public List<DeviceEntity> DeviceEntities { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
public class SurfaceEntity
|
||||
{
|
||||
public SurfaceEntity()
|
||||
{
|
||||
Guid = System.Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
[Key]
|
||||
public string Guid { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public virtual ICollection<DeviceEntity> DeviceEntities { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,245 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Artemis.Storage;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
[Migration("20191028171528_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceHashCode");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("DeviceEntity");
|
||||
});
|
||||
|
||||
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>("LayerId");
|
||||
|
||||
b.Property<string>("LedName");
|
||||
|
||||
b.Property<string>("LimitedToDevice");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerId");
|
||||
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.PluginSettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("PluginSettings");
|
||||
});
|
||||
|
||||
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.SurfaceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("IsActive");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.ToTable("Surfaces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("DeviceEntities")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
|
||||
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("LayerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,252 +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>(),
|
||||
Order = table.Column<int>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
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(
|
||||
"PluginSettings",
|
||||
table => new
|
||||
{
|
||||
PluginGuid = table.Column<Guid>(),
|
||||
Name = table.Column<string>(),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_PluginSettings", x => new {x.Name, x.PluginGuid}); });
|
||||
|
||||
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(
|
||||
"Surfaces",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
IsActive = table.Column<bool>()
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_Surfaces", x => x.Guid); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Layers",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
Order = table.Column<int>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
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>(),
|
||||
PluginGuid = table.Column<Guid>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
RootFolderId = table.Column<int>(),
|
||||
RootFolderGuid = table.Column<string>(nullable: true)
|
||||
},
|
||||
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(
|
||||
"DeviceEntity",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
DeviceHashCode = table.Column<int>(),
|
||||
X = table.Column<double>(),
|
||||
Y = table.Column<double>(),
|
||||
Rotation = table.Column<double>(),
|
||||
ZIndex = table.Column<int>(),
|
||||
SurfaceId = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DeviceEntity", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_DeviceEntity_Surfaces_SurfaceId",
|
||||
x => x.SurfaceId,
|
||||
"Surfaces",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"LayerSettings",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
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(
|
||||
"FK_LayerSettings_Layers_LayerEntityGuid",
|
||||
x => x.LayerEntityGuid,
|
||||
"Layers",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Leds",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
LedName = table.Column<string>(nullable: true),
|
||||
LimitedToDevice = table.Column<string>(nullable: true),
|
||||
LayerId = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Leds", x => x.Guid);
|
||||
table.ForeignKey(
|
||||
"FK_Leds_Layers_LayerId",
|
||||
x => x.LayerId,
|
||||
"Layers",
|
||||
"Guid",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Keypoints",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(),
|
||||
Time = table.Column<int>(),
|
||||
Value = table.Column<string>(nullable: true),
|
||||
LayerSettingEntityGuid = 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_DeviceEntity_SurfaceId",
|
||||
"DeviceEntity",
|
||||
"SurfaceId");
|
||||
|
||||
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_LayerId",
|
||||
"Leds",
|
||||
"LayerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Profiles_RootFolderGuid",
|
||||
"Profiles",
|
||||
"RootFolderGuid");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"DeviceEntity");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Keypoints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Leds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PluginSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Profiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Settings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Surfaces");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"LayerSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Layers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Folders");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,242 +0,0 @@
|
||||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
internal class StorageContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("DeviceHashCode");
|
||||
|
||||
b.Property<double>("Rotation");
|
||||
|
||||
b.Property<string>("SurfaceId");
|
||||
|
||||
b.Property<double>("X");
|
||||
|
||||
b.Property<double>("Y");
|
||||
|
||||
b.Property<int>("ZIndex");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("SurfaceId");
|
||||
|
||||
b.ToTable("DeviceEntity");
|
||||
});
|
||||
|
||||
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>("LayerId");
|
||||
|
||||
b.Property<string>("LedName");
|
||||
|
||||
b.Property<string>("LimitedToDevice");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerId");
|
||||
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.PluginSettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("PluginSettings");
|
||||
});
|
||||
|
||||
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.SurfaceEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("IsActive");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.ToTable("Surfaces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
|
||||
.WithMany("DeviceEntities")
|
||||
.HasForeignKey("SurfaceId");
|
||||
});
|
||||
|
||||
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("LayerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,10 +9,7 @@ namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
void Add(PluginSettingEntity pluginSettingEntity);
|
||||
List<PluginSettingEntity> GetByPluginGuid(Guid pluginGuid);
|
||||
Task<List<PluginSettingEntity>> GetByPluginGuidAsync(Guid pluginGuid);
|
||||
PluginSettingEntity GetByNameAndPluginGuid(string name, Guid pluginGuid);
|
||||
Task<PluginSettingEntity> GetByNameAndPluginGuidAsync(string name, Guid pluginGuid);
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
void Save(PluginSettingEntity pluginSettingEntity);
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
public interface IProfileRepository : IRepository
|
||||
{
|
||||
IQueryable<ProfileEntity> GetAll();
|
||||
Task<IList<ProfileEntity>> GetByPluginGuidAsync(Guid pluginGuid);
|
||||
Task<ProfileEntity> GetByGuidAsync(string guid);
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
void Add(ProfileEntity profileEntity);
|
||||
void Remove(ProfileEntity profileEntity);
|
||||
List<ProfileEntity> GetAll();
|
||||
ProfileEntity Get(Guid id);
|
||||
List<ProfileEntity> GetByPluginGuid(Guid pluginGuid);
|
||||
void Save(ProfileEntity profileEntity);
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
|
||||
namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
public interface ISettingRepository : IRepository
|
||||
{
|
||||
void Add(SettingEntity settingEntity);
|
||||
SettingEntity Get(string name);
|
||||
Task<SettingEntity> GetAsync(string name);
|
||||
List<SettingEntity> GetAll();
|
||||
Task<List<SettingEntity>> GetAllAsync();
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
|
||||
namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
@ -8,12 +8,9 @@ namespace Artemis.Storage.Repositories.Interfaces
|
||||
{
|
||||
void Add(SurfaceEntity surfaceEntity);
|
||||
void Remove(SurfaceEntity surfaceEntity);
|
||||
SurfaceEntity Get(string name);
|
||||
Task<SurfaceEntity> GetAsync(string name);
|
||||
SurfaceEntity GetByName(string name);
|
||||
List<SurfaceEntity> GetAll();
|
||||
Task<List<SurfaceEntity>> GetAllAsync();
|
||||
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
void Save(SurfaceEntity surfaceEntity);
|
||||
}
|
||||
}
|
||||
@ -1,56 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class PluginSettingRepository : IPluginSettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
private readonly LiteRepository _repository;
|
||||
|
||||
internal PluginSettingRepository()
|
||||
internal PluginSettingRepository(LiteRepository repository)
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
_repository = repository;
|
||||
_repository.Database.GetCollection<PluginSettingEntity>().EnsureIndex(s => s.Name);
|
||||
_repository.Database.GetCollection<PluginSettingEntity>().EnsureIndex(s => s.PluginGuid);
|
||||
}
|
||||
|
||||
public void Add(PluginSettingEntity pluginSettingEntity)
|
||||
{
|
||||
_dbContext.PluginSettings.Add(pluginSettingEntity);
|
||||
_repository.Insert(pluginSettingEntity);
|
||||
}
|
||||
|
||||
public List<PluginSettingEntity> GetByPluginGuid(Guid pluginGuid)
|
||||
{
|
||||
return _dbContext.PluginSettings.Where(p => p.PluginGuid == pluginGuid).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<PluginSettingEntity>> GetByPluginGuidAsync(Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.PluginSettings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
return _repository.Query<PluginSettingEntity>().Where(p => p.PluginGuid == pluginGuid).ToList();
|
||||
}
|
||||
|
||||
public PluginSettingEntity GetByNameAndPluginGuid(string name, Guid pluginGuid)
|
||||
{
|
||||
return _dbContext.PluginSettings.FirstOrDefault(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||
}
|
||||
|
||||
public async Task<PluginSettingEntity> GetByNameAndPluginGuidAsync(string name, Guid pluginGuid)
|
||||
|
||||
public void Save(PluginSettingEntity pluginSettingEntity)
|
||||
{
|
||||
return await _dbContext.PluginSettings.FirstOrDefaultAsync(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
_repository.Upsert(pluginSettingEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,51 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class ProfileRepository : IProfileRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
private readonly LiteRepository _repository;
|
||||
|
||||
public ProfileRepository()
|
||||
internal ProfileRepository(LiteRepository repository)
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
_repository = repository;
|
||||
_repository.Database.GetCollection<ProfileEntity>().EnsureIndex(s => s.Name);
|
||||
}
|
||||
|
||||
public IQueryable<ProfileEntity> GetAll()
|
||||
public void Add(ProfileEntity profileEntity)
|
||||
{
|
||||
return _dbContext.Profiles;
|
||||
_repository.Insert(profileEntity);
|
||||
}
|
||||
|
||||
public async Task<IList<ProfileEntity>> GetByPluginGuidAsync(Guid pluginGuid)
|
||||
public void Remove(ProfileEntity profileEntity)
|
||||
{
|
||||
return await _dbContext.Profiles.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
_repository.Delete<ProfileEntity>(s => s.Id == profileEntity.Id);
|
||||
}
|
||||
|
||||
public async Task<ProfileEntity> GetActiveProfileByPluginGuidAsync(Guid pluginGuid)
|
||||
public List<ProfileEntity> GetAll()
|
||||
{
|
||||
return await _dbContext.Profiles.FirstOrDefaultAsync(p => p.PluginGuid == pluginGuid && p.IsActive);
|
||||
return _repository.Query<ProfileEntity>().ToList();
|
||||
}
|
||||
|
||||
public async Task<ProfileEntity> GetByGuidAsync(string guid)
|
||||
public ProfileEntity Get(Guid id)
|
||||
{
|
||||
return await _dbContext.Profiles.FirstOrDefaultAsync(p => p.Guid == guid);
|
||||
return _repository.FirstOrDefault<ProfileEntity>(p => p.Id == id);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
public List<ProfileEntity> GetByPluginGuid(Guid pluginGuid)
|
||||
{
|
||||
_dbContext.SaveChanges();
|
||||
return _repository.Query<ProfileEntity>()
|
||||
.Include(p => p.Folders)
|
||||
.Include(p => p.Layers)
|
||||
.Where(s => s.PluginGuid == pluginGuid)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
public void Save(ProfileEntity profileEntity)
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
_repository.Upsert(profileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SettingRepository : ISettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
|
||||
internal SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public void Add(SettingEntity settingEntity)
|
||||
{
|
||||
_dbContext.Settings.Add(settingEntity);
|
||||
}
|
||||
|
||||
public SettingEntity Get(string name)
|
||||
{
|
||||
return _dbContext.Settings.FirstOrDefault(p => p.Name == name);
|
||||
}
|
||||
|
||||
public async Task<SettingEntity> GetAsync(string name)
|
||||
{
|
||||
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name);
|
||||
}
|
||||
|
||||
public List<SettingEntity> GetAll()
|
||||
{
|
||||
return _dbContext.Settings.ToList();
|
||||
}
|
||||
|
||||
public async Task<List<SettingEntity>> GetAllAsync()
|
||||
{
|
||||
return await _dbContext.Settings.ToListAsync();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,60 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SurfaceRepository : ISurfaceRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
private readonly LiteRepository _repository;
|
||||
|
||||
internal SurfaceRepository()
|
||||
internal SurfaceRepository(LiteRepository repository)
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
_repository = repository;
|
||||
_repository.Database.GetCollection<SurfaceEntity>().EnsureIndex(s => s.Name);
|
||||
}
|
||||
|
||||
public void Add(SurfaceEntity surfaceEntity)
|
||||
{
|
||||
_dbContext.Surfaces.Add(surfaceEntity);
|
||||
_repository.Insert(surfaceEntity);
|
||||
}
|
||||
|
||||
public void Remove(SurfaceEntity surfaceEntity)
|
||||
{
|
||||
_dbContext.Surfaces.Remove(surfaceEntity);
|
||||
_repository.Delete<SurfaceEntity>(s => s.Id == surfaceEntity.Id);
|
||||
}
|
||||
|
||||
public SurfaceEntity Get(string name)
|
||||
public SurfaceEntity GetByName(string name)
|
||||
{
|
||||
return _dbContext.Surfaces.Include(s => s.DeviceEntities).FirstOrDefault(p => p.Name == name);
|
||||
}
|
||||
|
||||
public async Task<SurfaceEntity> GetAsync(string name)
|
||||
{
|
||||
return await _dbContext.Surfaces.Include(s => s.DeviceEntities).FirstOrDefaultAsync(p => p.Name == name);
|
||||
return _repository.FirstOrDefault<SurfaceEntity>(s => s.Name == name);
|
||||
}
|
||||
|
||||
public List<SurfaceEntity> GetAll()
|
||||
{
|
||||
return _dbContext.Surfaces.Include(s => s.DeviceEntities).ToList();
|
||||
return _repository.Query<SurfaceEntity>().Include(s => s.DeviceEntities).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<SurfaceEntity>> GetAllAsync()
|
||||
public void Save(SurfaceEntity surfaceEntity)
|
||||
{
|
||||
return await _dbContext.Surfaces.Include(s => s.DeviceEntities).ToListAsync();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
_repository.Upsert(surfaceEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Artemis.Storage.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SQLitePCL;
|
||||
|
||||
namespace Artemis.Storage
|
||||
{
|
||||
public class StorageContext : DbContext
|
||||
{
|
||||
public DbSet<ProfileEntity> Profiles { get; set; }
|
||||
public DbSet<SettingEntity> Settings { get; set; }
|
||||
public DbSet<SurfaceEntity> Surfaces { get; set; }
|
||||
public DbSet<PluginSettingEntity> PluginSettings { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
// ReSharper disable once RedundantAssignment - Used if not debugging
|
||||
var dbLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Artemis\\Storage.db");
|
||||
#if DEBUG
|
||||
dbLocation = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\Artemis.Storage\Storage.db"));
|
||||
#endif
|
||||
|
||||
optionsBuilder.UseSqlite("Data Source=" + dbLocation);
|
||||
|
||||
// Requires Microsoft.Data.Sqlite in the startup project
|
||||
Batteries.Init();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<SettingEntity>().HasKey(s => s.Name);
|
||||
modelBuilder.Entity<PluginSettingEntity>().HasKey(s => new {s.Name, s.PluginGuid});
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,8 +31,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 +55,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 +71,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 +87,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.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@ -99,8 +95,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>
|
||||
|
||||
@ -91,9 +91,6 @@
|
||||
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
@ -117,18 +114,6 @@
|
||||
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.2.8.0\lib\net46\Serilog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.12.351, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.batteries_v2, Version=1.1.12.351, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.1.12.351, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
||||
</Reference>
|
||||
@ -372,14 +357,8 @@
|
||||
<PropertyGroup>
|
||||
<ErrorText>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}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\PropertyChanged.Fody.3.0.1\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged.Fody.3.0.1\build\PropertyChanged.Fody.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.5.0.6\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.5.0.6\build\Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
|
||||
<Import Project="..\packages\Fody.5.0.6\build\Fody.targets" Condition="Exists('..\packages\Fody.5.0.6\build\Fody.targets')" />
|
||||
</Project>
|
||||
@ -62,13 +62,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
Task.Run(LoadProfilesAsync);
|
||||
Task.Run(() => LoadProfiles());
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
private async Task LoadProfilesAsync()
|
||||
private void LoadProfiles()
|
||||
{
|
||||
var profiles = await _profileService.GetProfiles((ProfileModule) Module);
|
||||
var profiles = _profileService.GetProfiles((ProfileModule) Module);
|
||||
Profiles.Clear();
|
||||
Profiles.AddRange(profiles);
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?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="net472" />
|
||||
@ -11,19 +10,11 @@
|
||||
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
||||
<package id="MaterialDesignThemes" version="2.6.0" targetFramework="net472" />
|
||||
<package id="MaterialDesignThemes.MahApps" version="0.1.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Data.Sqlite" version="2.2.4" targetFramework="net472" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="2.2.4" targetFramework="net472" />
|
||||
<package id="Ninject" version="3.3.4" targetFramework="net461" />
|
||||
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net461" />
|
||||
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net461" />
|
||||
<package id="PropertyChanged.Fody" version="3.0.1" targetFramework="net472" />
|
||||
<package id="Serilog" version="2.8.0" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.bundle_green" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.core" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.12" targetFramework="net472" />
|
||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
||||
<package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user