private void BackupAndRecycle(string outputDirectory) {
var original = new [] {
"body", "tyre_0", "tyre_1", "tyre_2", "tyre_3"
}.Select(x => Path.Combine(outputDirectory, x + "_shadow.png")).Select(x => new {
Original = x,
Backup = x.ApartFromLast(".png") + "~bak.png"
}).ToList();
try {
foreach (var p in original) {
File.Move(p.Original, p.Backup);
}
} catch (Exception e) {
throw new Exception("Cannot remove original files", e);
}
Task.Run(() => {
foreach (var p in original) {
FileUtils.Recycle(p.Backup);
}
});
}