Use .Where for filtering

This commit is contained in:
Unnoen 2020-09-18 00:08:30 +10:00
parent 4b837d83bb
commit 7b1812af87
No known key found for this signature in database
GPG Key ID: F370906A9D954C50

View File

@ -1,4 +1,5 @@
using System.Threading.Tasks; using System.Linq;
using System.Threading.Tasks;
using Wabbajack.Common.IO; using Wabbajack.Common.IO;
namespace Wabbajack.Common namespace Wabbajack.Common
@ -63,14 +64,13 @@ namespace Wabbajack.Common
var driveInfo = folder.DriveInfo().DiskSpaceInfo; var driveInfo = folder.DriveInfo().DiskSpaceInfo;
var clusterSize = driveInfo.SectorsPerCluster * driveInfo.BytesPerSector; var clusterSize = driveInfo.SectorsPerCluster * driveInfo.BytesPerSector;
await folder.EnumerateFiles(true) await folder
.EnumerateFiles(true)
.Where(f => f.Size > clusterSize)
.PMap(queue, async path => .PMap(queue, async path =>
{
if (path.Size > clusterSize)
{ {
Utils.Status($"Compacting {path.FileName}"); Utils.Status($"Compacting {path.FileName}");
await path.Compact(algorithm); await path.Compact(algorithm);
}
}); });
} }
} }