mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
update installer for new extractor
This commit is contained in:
parent
42864ac12b
commit
3127a00d95
@ -299,35 +299,27 @@ namespace Wabbajack
|
|||||||
private void InstallArchive(Archive archive, string absolutePath, IGrouping<string, FromArchive> grouping)
|
private void InstallArchive(Archive archive, string absolutePath, IGrouping<string, FromArchive> grouping)
|
||||||
{
|
{
|
||||||
Status($"Extracting {archive.Name}");
|
Status($"Extracting {archive.Name}");
|
||||||
var files = grouping.GroupBy(e => e.FullPath)
|
|
||||||
.ToDictionary(e => e.Key);
|
|
||||||
|
|
||||||
|
var vfiles = grouping.Select(g =>
|
||||||
var vfiles = files.Select(g =>
|
|
||||||
{
|
{
|
||||||
var first_file = g.Value.First();
|
var file = VFS.FileForArchiveHashPath(g.ArchiveHashPath);
|
||||||
var file = VFS.FileForArchiveHashPath(first_file.ArchiveHashPath);
|
g.FromFile = file;
|
||||||
file.StagedPath = first_file.To;
|
return g;
|
||||||
return file;
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
VFS.Stage(vfiles);
|
var on_finish = VFS.Stage(vfiles.Select(f => f.FromFile).Distinct());
|
||||||
|
|
||||||
vfiles.Do(f => f.StagedPath = null);
|
|
||||||
|
|
||||||
Status("Copying duplicated files for {0}", archive.Name);
|
Status("Copying files for {0}", archive.Name);
|
||||||
|
|
||||||
foreach (var dups in files.Where(e => e.Value.Count() > 1).Select(v => v.Value))
|
vfiles.DoIndexed((idx, file) =>
|
||||||
{
|
{
|
||||||
var ffrom = dups.First();
|
Status($"Installing files", idx * 100 / vfiles.Count);
|
||||||
var from_path = Path.Combine(Outputfolder, ffrom.To);
|
File.Copy(file.FromFile.StagedPath, Path.Combine(Outputfolder, file.To));
|
||||||
foreach (var to in dups.Skip(1))
|
});
|
||||||
{
|
|
||||||
var to_path = Path.Combine(Outputfolder, to.To);
|
Status("Unstaging files");
|
||||||
if (to_path.FileExists()) File.Delete(to_path);
|
on_finish();
|
||||||
File.Copy(from_path, to_path);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Now patch all the files from this archive
|
// Now patch all the files from this archive
|
||||||
foreach (var to_patch in grouping.OfType<PatchedFromArchive>())
|
foreach (var to_patch in grouping.OfType<PatchedFromArchive>())
|
||||||
|
Loading…
Reference in New Issue
Block a user