41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
|
|
using BFR.Helpers;
|
|
|
|
namespace BFR.Operations
|
|
{
|
|
public class NumberOperationMode : OperationMode<NumberMode>
|
|
{
|
|
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<NumberMode>)Enum.GetValues(typeof(NumberMode))).Select(x =>
|
|
new NumberOperationMode(
|
|
x,
|
|
x.GetAttribute<OperationModeAttribute>().DisplayName,
|
|
x.GetAttribute<OperationModeAttribute>().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,
|
|
}
|
|
}
|