Can install Basic Fixes.exe with the new VFS backend

This commit is contained in:
Timothy Baldridge 2019-08-20 16:37:55 -06:00
parent e24d29e93d
commit b91e7348b7
2 changed files with 23 additions and 6 deletions

View File

@ -140,6 +140,7 @@ namespace VFS
{
_files.Values
.Select(f => f.ParentPath)
.Where(s => s != null)
.Where(s => !_files.ContainsKey(s))
.ToHashSet()
.Do(s =>
@ -252,7 +253,10 @@ namespace VFS
public void Stage(IEnumerable<VirtualFile> files)
{
var grouped = files.GroupBy(f => f.ParentArchive)
var grouped = files.SelectMany(f => f.FilesInPath)
.Distinct()
.Where(f => f.ParentArchive != null)
.GroupBy(f => f.ParentArchive)
.OrderBy(f => f.Key == null ? 0 : f.Key.Paths.Length)
.ToList();
@ -565,6 +569,16 @@ namespace VFS
path_copy[0] = VirtualFileSystem.VFS.Lookup(Paths[0]).Hash;
return path_copy;
}
public IEnumerable<VirtualFile> FilesInPath
{
get {
return Enumerable.Range(1, Paths.Length)
.Select(i => Paths.Take(i))
.Select(path => VirtualFileSystem.VFS.Lookup(String.Join("|", path)));
}
}
}

View File

@ -117,8 +117,8 @@ namespace Wabbajack
{
HashedArchives.Do(a => VFS.AddKnown(new VirtualFile()
{
Paths = new string[] { a.Key },
Hash = a.Value
Paths = new string[] { a.Value },
Hash = a.Key
}));
VFS.RefreshIndexes();
@ -127,7 +127,7 @@ namespace Wabbajack
.OfType<FromArchive>()
.Do(f =>
{
var updated_path = new string[f.ArchiveHashPath.Length + 1];
var updated_path = new string[f.ArchiveHashPath.Length];
f.ArchiveHashPath.CopyTo(updated_path, 0);
updated_path[0] = VFS.HashIndex[updated_path[0]].Where(e => e.IsConcrete).First().FullPath;
VFS.AddKnown(new VirtualFile() { Paths = updated_path });
@ -174,8 +174,11 @@ namespace Wabbajack
}
});
Info($"Removing temp folder {Consts.BSACreationDir}");
Directory.Delete(Path.Combine(Outputfolder, Consts.BSACreationDir), true);
if (Directory.Exists(Consts.BSACreationDir))
{
Info($"Removing temp folder {Consts.BSACreationDir}");
Directory.Delete(Path.Combine(Outputfolder, Consts.BSACreationDir), true);
}
}