using System; using System.Linq; using System.Collections.Generic; using BFR.Helpers; namespace BFR.Operations { public class NumberOperationMode : OperationMode { public bool IsPrefix => Index == NumberMode.Prefix; public bool IsSuffix => Index == NumberMode.Suffix; 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(Prefix), "Inserts the numbering before the file name.")] Prefix, [OperationMode(nameof(Suffix), "Inserts the numbering after the file name.")] Suffix, [OperationMode(nameof(Insert), "Inserts the numbering at the specified index.")] Insert, [OperationMode(nameof(Replace), "Replaces the given pattern with the numbering.")] Replace, } }