mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Fixed layer copy with databindings
Shows how thoroughly tested it was :)
This commit is contained in:
1 parent
f80a7d658c
commit
c0d0e421c7
2 files changed
+9
-4
No files matched your search
@@ -128,13 +128,17 @@ namespace Artemis.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a deep copy of the layer
|
/// Creates a deep copy of the folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The newly created copy</returns>
|
/// <returns>The newly created copy</returns>
|
||||||
public Folder CreateCopy()
|
public Folder CreateCopy()
|
||||||
{
|
{
|
||||||
FolderEntity entityCopy = JsonConvert.DeserializeObject<FolderEntity>(JsonConvert.SerializeObject(FolderEntity));
|
JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
|
||||||
|
FolderEntity entityCopy = JsonConvert.DeserializeObject<FolderEntity>(JsonConvert.SerializeObject(FolderEntity, settings), settings)!;
|
||||||
entityCopy.Id = Guid.NewGuid();
|
entityCopy.Id = Guid.NewGuid();
|
||||||
|
entityCopy.Name += " - Copy";
|
||||||
|
|
||||||
|
// TODO Children
|
||||||
|
|
||||||
return new Folder(Profile, Parent, entityCopy);
|
return new Folder(Profile, Parent, entityCopy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,9 +122,10 @@ namespace Artemis.Core
|
|||||||
/// <returns>The newly created copy</returns>
|
/// <returns>The newly created copy</returns>
|
||||||
public Layer CreateCopy()
|
public Layer CreateCopy()
|
||||||
{
|
{
|
||||||
LayerEntity entityCopy = JsonConvert.DeserializeObject<LayerEntity>(JsonConvert.SerializeObject(LayerEntity));
|
JsonSerializerSettings settings = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
|
||||||
|
LayerEntity entityCopy = JsonConvert.DeserializeObject<LayerEntity>(JsonConvert.SerializeObject(LayerEntity, settings), settings)!;
|
||||||
entityCopy.Id = Guid.NewGuid();
|
entityCopy.Id = Guid.NewGuid();
|
||||||
entityCopy.Name = entityCopy.Name + " - Copy";
|
entityCopy.Name += " - Copy";
|
||||||
|
|
||||||
Layer copy = new Layer(Profile, Parent, entityCopy);
|
Layer copy = new Layer(Profile, Parent, entityCopy);
|
||||||
copy.ChangeLayerBrush(LayerBrush.Descriptor);
|
copy.ChangeLayerBrush(LayerBrush.Descriptor);
|
||||||
|
|||||||
Reference in new issue
Block a user