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