2019-11-16 01:00:17 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
using BFR.DataModels;
|
|
|
|
|
|
|
|
|
|
namespace BFR.Operations
|
|
|
|
|
{
|
|
|
|
|
public class Overwrite : Operation
|
|
|
|
|
{
|
|
|
|
|
// Operation Info
|
|
|
|
|
public override string Name => nameof(Overwrite);
|
|
|
|
|
public override string Description => "Overwrites all file names. To produce a valid result this has to be combined with numbering.";
|
|
|
|
|
|
|
|
|
|
// Operation Parameters
|
|
|
|
|
public string Replacement { get; set; } = "";
|
|
|
|
|
public bool FullName { get; set; } = false;
|
|
|
|
|
|
2019-11-16 01:47:07 +00:00
|
|
|
|
protected override void ApplyToInternal(IList<FileModel> files)
|
2019-11-16 01:00:17 +00:00
|
|
|
|
{
|
|
|
|
|
// Fail conditions: No fail conditions
|
|
|
|
|
// Apply Operation
|
|
|
|
|
foreach (var file in files)
|
|
|
|
|
if (FullName) file.FullName = Replacement;
|
|
|
|
|
else file.Name = Replacement;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|