2019-11-21 18:46:33 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
using BFR.Helpers;
|
|
|
|
|
|
|
|
|
|
namespace BFR.Operations
|
|
|
|
|
{
|
|
|
|
|
public class NumberOperationMode : OperationMode<NumberMode>
|
|
|
|
|
{
|
2019-11-22 18:12:28 +00:00
|
|
|
|
public bool IsPrepend => Index == NumberMode.Prepend;
|
|
|
|
|
public bool IsAppend => Index == NumberMode.Append;
|
2019-11-21 18:46:33 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
2019-11-22 18:12:28 +00:00
|
|
|
|
[OperationMode(nameof(Prepend), "Inserts the numbering before the file name.")]
|
|
|
|
|
Prepend,
|
|
|
|
|
[OperationMode(nameof(Append), "Inserts the numbering after the file name.")]
|
|
|
|
|
Append,
|
2019-11-21 18:46:33 +00:00
|
|
|
|
[OperationMode(nameof(Insert), "Inserts the numbering at the specified index.")]
|
|
|
|
|
Insert,
|
|
|
|
|
[OperationMode(nameof(Replace), "Replaces the given pattern with the numbering.")]
|
|
|
|
|
Replace,
|
|
|
|
|
}
|
|
|
|
|
}
|