mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Make file copying parallel during compilation
This commit is contained in:
parent
e32be75816
commit
878b1759b2
@ -311,6 +311,13 @@ namespace Wabbajack.Common
|
||||
}
|
||||
}
|
||||
|
||||
public static Task PDoIndexed<T>(this IEnumerable<T> coll, WorkQueue queue, Action<int, T> f)
|
||||
{
|
||||
return coll.Zip(Enumerable.Range(0, int.MaxValue), (v, idx) => (v, idx))
|
||||
.PMap(queue, vs=> f(vs.idx, vs.v));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads INI data from the given filename and returns a dynamic type that
|
||||
|
@ -130,10 +130,10 @@ namespace Wabbajack.Lib
|
||||
.ToList();
|
||||
|
||||
Info("Installing Archives");
|
||||
await archives.PMap(Queue, UpdateTracker,a => InstallArchive(a.Archive, a.AbsolutePath, grouped[a.Archive.Hash]));
|
||||
await archives.PMap(Queue, UpdateTracker,a => InstallArchive(Queue, a.Archive, a.AbsolutePath, grouped[a.Archive.Hash]));
|
||||
}
|
||||
|
||||
private async Task InstallArchive(Archive archive, string absolutePath, IGrouping<string, FromArchive> grouping)
|
||||
private async Task InstallArchive(WorkQueue queue, Archive archive, string absolutePath, IGrouping<string, FromArchive> grouping)
|
||||
{
|
||||
Status($"Extracting {archive.Name}");
|
||||
|
||||
@ -176,8 +176,8 @@ namespace Wabbajack.Lib
|
||||
File.SetLastWriteTime(to, DateTime.Now);
|
||||
}
|
||||
|
||||
vFiles.GroupBy(f => f.FromFile)
|
||||
.DoIndexed((idx, group) =>
|
||||
await vFiles.GroupBy(f => f.FromFile)
|
||||
.PDoIndexed(queue, (idx, group) =>
|
||||
{
|
||||
Utils.Status("Installing files", idx * 100 / vFiles.Count);
|
||||
var firstDest = Path.Combine(OutputFolder, group.First().To);
|
||||
|
Loading…
Reference in New Issue
Block a user