mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Rework indexed files to support cases where multiple archives reference the same file, but in different locations
This commit is contained in:
@ -17,10 +17,15 @@ namespace Wabbajack.CacheServer.DTOs
|
|||||||
public string SHA1 { get; set; }
|
public string SHA1 { get; set; }
|
||||||
public string MD5 { get; set; }
|
public string MD5 { get; set; }
|
||||||
public string CRC { get; set; }
|
public string CRC { get; set; }
|
||||||
public string Name { get; set; }
|
|
||||||
public string Extension { get; set; }
|
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public bool IsArchive { get; set; }
|
public bool IsArchive { get; set; }
|
||||||
public List<string> Children { get; set; } = new List<string>();
|
public List<ChildFile> Children { get; set; } = new List<ChildFile>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChildFile
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public string Extension;
|
||||||
|
public string Hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,23 +77,30 @@ namespace Wabbajack.CacheServer.Jobs
|
|||||||
var name = isTop ? Path.GetFileName(file.Name) : file.Name;
|
var name = isTop ? Path.GetFileName(file.Name) : file.Name;
|
||||||
var ifile = new IndexedFile
|
var ifile = new IndexedFile
|
||||||
{
|
{
|
||||||
Name = name,
|
|
||||||
Extension = Path.GetExtension(name),
|
|
||||||
Hash = file.Hash,
|
Hash = file.Hash,
|
||||||
SHA256 = file.ExtendedHashes.SHA256,
|
SHA256 = file.ExtendedHashes.SHA256,
|
||||||
SHA1 = file.ExtendedHashes.SHA1,
|
SHA1 = file.ExtendedHashes.SHA1,
|
||||||
MD5 = file.ExtendedHashes.MD5,
|
MD5 = file.ExtendedHashes.MD5,
|
||||||
CRC = file.ExtendedHashes.CRC,
|
CRC = file.ExtendedHashes.CRC,
|
||||||
Size = file.Size,
|
Size = file.Size,
|
||||||
Children = file.Children != null ? file.Children.Select(f =>
|
Children = file.Children != null ? file.Children.Select(
|
||||||
{
|
f =>
|
||||||
ConvertArchive(files, f, false);
|
{
|
||||||
return f.Hash;
|
ConvertArchive(files, f, false);
|
||||||
}).ToList() : new List<string>()
|
|
||||||
|
return new ChildFile
|
||||||
|
{
|
||||||
|
Hash = f.Hash,
|
||||||
|
Name = f.Name.ToLowerInvariant(),
|
||||||
|
Extension = Path.GetExtension(f.Name.ToLowerInvariant())
|
||||||
|
};
|
||||||
|
}).ToList() : new List<ChildFile>()
|
||||||
};
|
};
|
||||||
ifile.IsArchive = ifile.Children.Count > 0;
|
ifile.IsArchive = ifile.Children.Count > 0;
|
||||||
files.Add(ifile);
|
files.Add(ifile);
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace Wabbajack.CacheServer
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<object> HandleFileID(dynamic arg)
|
private async Task<Response> HandleFileID(dynamic arg)
|
||||||
{
|
{
|
||||||
Utils.Log($"{DateTime.Now} - File Info - {arg.GameName}/{arg.ModID}/{arg.FileID}");
|
Utils.Log($"{DateTime.Now} - File Info - {arg.GameName}/{arg.ModID}/{arg.FileID}");
|
||||||
string gameName = arg.GameName;
|
string gameName = arg.GameName;
|
||||||
@ -183,7 +183,7 @@ namespace Wabbajack.CacheServer
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<object> HandleGetFiles(dynamic arg)
|
private async Task<Response> HandleGetFiles(dynamic arg)
|
||||||
{
|
{
|
||||||
Utils.Log($"{DateTime.Now} - Mod Files - {arg.GameName} {arg.ModID}");
|
Utils.Log($"{DateTime.Now} - Mod Files - {arg.GameName} {arg.ModID}");
|
||||||
string gameName = arg.GameName;
|
string gameName = arg.GameName;
|
||||||
|
Reference in New Issue
Block a user