1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Robert cd8656cb0d Profile editor - Added effect renaming
Core - Fixed effect loading
Core - Fixed some effects not applying on per-LED brushes
2022-04-23 21:12:06 +02:00

44 lines
1.1 KiB
C#

using System;
using Artemis.Core;
using Artemis.Core.LayerEffects;
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
/// <summary>
/// Represents a profile editor command that can be used to rename a layer effect
/// </summary>
public class RenameLayerEffect : IProfileEditorCommand
{
private readonly BaseLayerEffect _layerEffect;
private readonly string _name;
private readonly string _oldName;
private readonly bool _wasRenamed;
/// <summary>
/// Creates a new instance of the <see cref="RenameLayerEffect"/> class.
/// </summary>
public RenameLayerEffect(BaseLayerEffect layerEffect, string name)
{
_layerEffect = layerEffect;
_name = name;
_oldName = layerEffect.Name;
_wasRenamed = layerEffect.HasBeenRenamed;
}
/// <inheritdoc />
public string DisplayName => "Rename layer effect";
/// <inheritdoc />
public void Execute()
{
_layerEffect.Name = _name;
_layerEffect.HasBeenRenamed = true;
}
/// <inheritdoc />
public void Undo()
{
_layerEffect.Name = _oldName;
_layerEffect.HasBeenRenamed = _wasRenamed;
}
}