mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
fixes #15 - allow non-archive files to be downloaded and installed directly
This commit is contained in:
parent
41daec2c3b
commit
5d822bc63a
@ -462,6 +462,9 @@ namespace VFS
|
||||
/// <returns></returns>
|
||||
public VirtualFile FileForArchiveHashPath(string[] archiveHashPath)
|
||||
{
|
||||
if (archiveHashPath.Length == 1)
|
||||
return HashIndex[archiveHashPath[0]].First();
|
||||
|
||||
var archive = HashIndex[archiveHashPath[0]].Where(a => a.IsArchive).OrderByDescending(a => a.LastModified).First();
|
||||
string fullPath = archive.FullPath + "|" + String.Join("|", archiveHashPath.Skip(1));
|
||||
return Lookup(fullPath);
|
||||
|
@ -165,7 +165,6 @@ namespace Wabbajack
|
||||
|
||||
Info($"Indexing Archives");
|
||||
IndexedArchives = Directory.EnumerateFiles(MO2DownloadsFolder)
|
||||
.Where(f => Consts.SupportedArchives.Contains(Path.GetExtension(f)))
|
||||
.Where(f => File.Exists(f + ".meta"))
|
||||
.Select(f => new IndexedArchive()
|
||||
{
|
||||
@ -179,7 +178,9 @@ namespace Wabbajack
|
||||
Info($"Indexing Files");
|
||||
IndexedFiles = IndexedArchives.PMap(f => { Status($"Finding files in {Path.GetFileName(f.File.FullPath)}");
|
||||
return VFS.FilesInArchive(f.File); })
|
||||
|
||||
.SelectMany(fs => fs)
|
||||
.Concat(IndexedArchives.Select(f => f.File))
|
||||
.OrderByDescending(f => f.TopLevelArchive.LastModified)
|
||||
.GroupBy(f => f.Hash)
|
||||
.ToDictionary(f => f.Key, f => f.AsEnumerable());
|
||||
|
@ -593,7 +593,7 @@ namespace Wabbajack
|
||||
private void HashArchives()
|
||||
{
|
||||
HashedArchives = Directory.EnumerateFiles(DownloadFolder)
|
||||
.Where(e => Consts.SupportedArchives.Contains(Path.GetExtension(e)))
|
||||
.Where(e => !e.EndsWith(".sha"))
|
||||
.PMap(e => (HashArchive(e), e))
|
||||
.OrderByDescending(e => File.GetLastWriteTime(e.Item2))
|
||||
.GroupBy(e => e.Item1)
|
||||
|
Loading…
Reference in New Issue
Block a user