using System; using System.Linq; using System.Collections.Generic; using BFR.Helpers; namespace BFR.Operations { public class AddOperationMode : OperationMode { public bool IsPrepend => Index == AddMode.Prepend; public bool IsAppend => Index == AddMode.Append; public bool IsInsert => Index == AddMode.Insert; public readonly static AddOperationMode[] Modes = All(); public AddOperationMode(AddMode index, string name, string description) : base(index, name, description) { } protected static AddOperationMode[] All() => ((IEnumerable)Enum.GetValues(typeof(AddMode))).Select(x => new AddOperationMode( x, x.GetAttribute().DisplayName, x.GetAttribute().Description )).ToArray(); } public enum AddMode { [OperationMode(nameof(Prepend), "Inserts before the file name.")] Prepend, [OperationMode(nameof(Append), "Inserts after the file name.")] Append, [OperationMode(nameof(Insert), "Inserts at the specified index.")] Insert } }