mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layer properties - Disable keyframes when resetting to default Device dialogs - Only dim unselected LEDs if a LED is selected Migrations - Renamed to stay in order Migrations - Added migration for color gradients
44 lines
1.9 KiB
C#
44 lines
1.9 KiB
C#
using Artemis.Storage.Entities.Profile;
|
|
using Artemis.Storage.Migrations.Interfaces;
|
|
using LiteDB;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Artemis.Storage.Migrations
|
|
{
|
|
public class M0004ProfileSegmentsMigration : IStorageMigration
|
|
{
|
|
public int UserVersion => 4;
|
|
|
|
public void Apply(LiteRepository repository)
|
|
{
|
|
// Lesson for next time: Use BsonDocuments in migrations
|
|
// List<ProfileEntity> profiles = repository.Query<ProfileEntity>().ToList();
|
|
// foreach (ProfileEntity profileEntity in profiles)
|
|
// {
|
|
// foreach (FolderEntity 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);
|
|
//
|
|
// folder.PlayMode = 0;
|
|
// }
|
|
//
|
|
// foreach (LayerEntity 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);
|
|
//
|
|
// layer.PlayMode = 0;
|
|
// }
|
|
//
|
|
// repository.Update(profileEntity);
|
|
// }
|
|
}
|
|
}
|
|
} |