mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Migrations - Added migration to segments
Layout - Fixed rotation not always applying (workaround) Conditions - Added string operators
This commit is contained in:
1 parent
dab11cb3e7
commit
385a30bec7
17 files changed
+317
-22
No files matched your search
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public class M4ProfileSegmentsMigration : IStorageMigration
|
||||
{
|
||||
public int UserVersion => 4;
|
||||
|
||||
public void Apply(LiteRepository repository)
|
||||
{
|
||||
var profiles = repository.Query<ProfileEntity>().ToList();
|
||||
foreach (var profileEntity in profiles)
|
||||
{
|
||||
foreach (var folder in profileEntity.Folders.Where(f => f.MainSegmentLength == TimeSpan.Zero))
|
||||
{
|
||||
if (folder.PropertyEntities.Any(p => p.KeyframeEntities.Any()))
|
||||
folder.MainSegmentLength = folder.PropertyEntities.Where(p => p.KeyframeEntities.Any()).Max(p => p.KeyframeEntities.Max(k => k.Position));
|
||||
if (folder.MainSegmentLength == TimeSpan.Zero)
|
||||
folder.MainSegmentLength = TimeSpan.FromSeconds(5);
|
||||
}
|
||||
|
||||
foreach (var layer in profileEntity.Layers.Where(l => l.MainSegmentLength == TimeSpan.Zero))
|
||||
{
|
||||
if (layer.PropertyEntities.Any(p => p.KeyframeEntities.Any()))
|
||||
layer.MainSegmentLength = layer.PropertyEntities.Where(p => p.KeyframeEntities.Any()).Max(p => p.KeyframeEntities.Max(k => k.Position));
|
||||
if (layer.MainSegmentLength == TimeSpan.Zero)
|
||||
layer.MainSegmentLength = TimeSpan.FromSeconds(5);
|
||||
}
|
||||
|
||||
repository.Update(profileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Artemis.Storage.Repositories
|
||||
internal PluginRepository(LiteRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
|
||||
|
||||
_repository.Database.GetCollection<PluginSettingEntity>().EnsureIndex(s => new {s.Name, s.PluginGuid}, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user