1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 17:53:32 +00:00

Compare commits

..

No commits in common. "8d7af6bb85ed92b4d45155a985148d941d41aff9" and "91d1d16f2476c80442afa9fa9d222c2239df6e78" have entirely different histories.

9 changed files with 34 additions and 27 deletions

View File

@ -363,7 +363,9 @@ public sealed class Folder : RenderProfileElement
FolderEntity.Name = Name;
FolderEntity.IsExpanded = IsExpanded;
FolderEntity.Suspended = Suspended;
FolderEntity.ProfileId = Profile.EntityId;
SaveRenderElement();
}

View File

@ -321,6 +321,7 @@ public sealed class Layer : RenderProfileElement
LayerEntity.Order = Order;
LayerEntity.Suspended = Suspended;
LayerEntity.Name = Name;
LayerEntity.ProfileId = Profile.EntityId;
General.ApplyToEntity();
Transform.ApplyToEntity();

View File

@ -41,9 +41,6 @@ public class ProfileConfiguration : BreakableModel, IStorageModel, IDisposable,
Icon = new ProfileConfigurationIcon(Entity);
Icon.SetIconByName(icon);
ActivationCondition = new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", this);
Entity.Profile.Id = Guid.NewGuid();
Entity.ProfileConfiguration.ProfileId = Entity.Profile.Id;
}
internal ProfileConfiguration(ProfileCategory category, ProfileContainerEntity entity)
@ -191,7 +188,7 @@ public class ProfileConfiguration : BreakableModel, IStorageModel, IDisposable,
/// alongside any activation requirements of the <see cref="Module" />, if set
/// </summary>
public NodeScript<bool> ActivationCondition { get; }
/// <summary>
/// Gets the entity used by this profile config
/// </summary>

View File

@ -0,0 +1,9 @@
using System.Text.Json.Nodes;
namespace Artemis.Storage.Legacy.Migrations;
public interface IProfileMigration
{
int Version { get; }
void Migrate(JsonObject configurationJson, JsonObject profileJson);
}

View File

@ -1,4 +1,5 @@
using Artemis.Storage.Entities.Profile.Abstract;
using System;
using Artemis.Storage.Entities.Profile.Abstract;
namespace Artemis.Storage.Entities.Profile;
@ -8,4 +9,6 @@ public class FolderEntity : RenderElementEntity
public string? Name { get; set; }
public bool IsExpanded { get; set; }
public bool Suspended { get; set; }
public Guid ProfileId { get; set; }
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.AdaptionHints;
@ -22,4 +23,6 @@ public class LayerEntity : RenderElementEntity
public PropertyGroupEntity? GeneralPropertyGroup { get; set; }
public PropertyGroupEntity? TransformPropertyGroup { get; set; }
public LayerBrushEntity? LayerBrush { get; set; }
public Guid ProfileId { get; set; }
}

View File

@ -38,7 +38,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("Version")
.IsUnique();
b.ToTable("Releases", (string)null);
b.ToTable("Releases");
});
modelBuilder.Entity("Artemis.Storage.Entities.Plugins.PluginEntity", b =>
@ -58,7 +58,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("PluginGuid")
.IsUnique();
b.ToTable("Plugins", (string)null);
b.ToTable("Plugins");
});
modelBuilder.Entity("Artemis.Storage.Entities.Plugins.PluginFeatureEntity", b =>
@ -81,7 +81,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("PluginEntityId");
b.ToTable("PluginFeatures", (string)null);
b.ToTable("PluginFeatures");
});
modelBuilder.Entity("Artemis.Storage.Entities.Plugins.PluginSettingEntity", b =>
@ -109,7 +109,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("Name", "PluginGuid")
.IsUnique();
b.ToTable("PluginSettings", (string)null);
b.ToTable("PluginSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.Profile.ProfileCategoryEntity", b =>
@ -137,7 +137,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("Name")
.IsUnique();
b.ToTable("ProfileCategories", (string)null);
b.ToTable("ProfileCategories");
});
modelBuilder.Entity("Artemis.Storage.Entities.Profile.ProfileContainerEntity", b =>
@ -165,7 +165,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("ProfileCategoryId");
b.ToTable("ProfileContainers", (string)null);
b.ToTable("ProfileContainers");
});
modelBuilder.Entity("Artemis.Storage.Entities.Surface.DeviceEntity", b =>
@ -227,7 +227,7 @@ namespace Artemis.Storage.Migrations
b.HasKey("Id");
b.ToTable("Devices", (string)null);
b.ToTable("Devices");
});
modelBuilder.Entity("Artemis.Storage.Entities.Workshop.EntryEntity", b =>
@ -268,7 +268,7 @@ namespace Artemis.Storage.Migrations
b.HasIndex("EntryId")
.IsUnique();
b.ToTable("Entries", (string)null);
b.ToTable("Entries");
});
modelBuilder.Entity("Artemis.Storage.Entities.Plugins.PluginFeatureEntity", b =>
@ -291,7 +291,7 @@ namespace Artemis.Storage.Migrations
modelBuilder.Entity("Artemis.Storage.Entities.Surface.DeviceEntity", b =>
{
b.OwnsOne("Artemis.Storage.Entities.Surface.DeviceEntity.InputIdentifiers#System.Collections.Generic.List<Artemis.Storage.Entities.Surface.DeviceInputIdentifierEntity>", "InputIdentifiers", b1 =>
b.OwnsOne("System.Collections.Generic.List<Artemis.Storage.Entities.Surface.DeviceInputIdentifierEntity>", "InputIdentifiers", b1 =>
{
b1.Property<string>("DeviceEntityId")
.HasColumnType("TEXT");
@ -301,7 +301,7 @@ namespace Artemis.Storage.Migrations
b1.HasKey("DeviceEntityId");
b1.ToTable("Devices", (string)null);
b1.ToTable("Devices");
b1.ToJson("InputIdentifiers");
@ -309,7 +309,7 @@ namespace Artemis.Storage.Migrations
.HasForeignKey("DeviceEntityId");
});
b.OwnsOne("Artemis.Storage.Entities.Surface.DeviceEntity.InputMappings#System.Collections.Generic.List<Artemis.Storage.Entities.Surface.InputMappingEntity>", "InputMappings", b1 =>
b.OwnsOne("System.Collections.Generic.List<Artemis.Storage.Entities.Surface.InputMappingEntity>", "InputMappings", b1 =>
{
b1.Property<string>("DeviceEntityId")
.HasColumnType("TEXT");
@ -319,7 +319,7 @@ namespace Artemis.Storage.Migrations
b1.HasKey("DeviceEntityId");
b1.ToTable("Devices", (string)null);
b1.ToTable("Devices");
b1.ToJson("InputMappings");

View File

@ -30,8 +30,6 @@ public class ProfileRepository(ILogger logger, Func<ArtemisDbContext> getContext
public void Save(ProfileContainerEntity profileContainerEntity)
{
profileContainerEntity.ProfileConfiguration.Version = profileMigrators.Max(m => m.Version);
using ArtemisDbContext dbContext = getContext();
dbContext.Update(profileContainerEntity);
dbContext.SaveChanges();
@ -39,9 +37,6 @@ public class ProfileRepository(ILogger logger, Func<ArtemisDbContext> getContext
public void SaveRange(List<ProfileContainerEntity> profileContainerEntities)
{
foreach (ProfileContainerEntity profileContainerEntity in profileContainerEntities)
profileContainerEntity.ProfileConfiguration.Version = profileMigrators.Max(m => m.Version);
using ArtemisDbContext dbContext = getContext();
dbContext.UpdateRange(profileContainerEntities);
dbContext.SaveChanges();

View File

@ -105,9 +105,6 @@ public partial class SidebarCategoryViewModel : ActivatableViewModelBase
public void AddProfileConfiguration(ProfileConfiguration profileConfiguration, ProfileConfiguration? target)
{
if (profileConfiguration == target)
return;
ProfileCategory oldCategory = profileConfiguration.Category;
ProfileCategory.AddProfileConfiguration(profileConfiguration, target);