[DATFromDir] Add async delete

This commit is contained in:
Matt Nadareski
2016-09-22 09:42:45 -07:00
parent 57f6d361f7
commit 656ac774ab
2 changed files with 26 additions and 28 deletions

View File

@@ -190,18 +190,7 @@ namespace SabreTools
new ParallelOptions { MaxDegreeOfParallelism = _maxDegreeOfParallelism },
file =>
{
int i = 0;
while (File.Exists(file) && i < 50)
{
try
{
Directory.Delete(Path.GetDirectoryName(file), true);
}
catch
{
i++;
}
}
FileTools.DeleteFile(file);
});
}
@@ -320,22 +309,7 @@ namespace SabreTools
// Cue to delete the file if it's a copy
if (_copyFiles)
{
int i = 0;
while (File.Exists(newItem) && i < 50)
{
try
{
Directory.Delete(Path.GetDirectoryName(newItem), true);
}
catch
{
i++;
}
}
if (File.Exists(newItem))
{
_clean.Add(newItem);
}
FileTools.DeleteFile(newItem);
}
// Delete the sub temp directory