mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: sort hd and non-hd
This commit is contained in:
1 parent
3a2aa135a1
commit
b16601704f
1 file changed
+61
-16
@@ -44,30 +44,75 @@ namespace CLI.Functions
|
|||||||
|
|
||||||
Console.WriteLine($"Exploring DLC \"{contentBuildId}\" within group \"{CONTENT_GROUP}\"");
|
Console.WriteLine($"Exploring DLC \"{contentBuildId}\" within group \"{CONTENT_GROUP}\"");
|
||||||
|
|
||||||
using HttpClient httpClient = new();
|
|
||||||
DlcManifest manifest = await FetchManifest(CONTENT_GROUP, contentBuildId);
|
DlcManifest manifest = await FetchManifest(CONTENT_GROUP, contentBuildId);
|
||||||
|
|
||||||
|
List<PakFile> nonHdPaks = [];
|
||||||
|
List<PakFile> hdPaks = [];
|
||||||
|
|
||||||
|
Console.WriteLine("Filtering HD and non-HD containers");
|
||||||
|
|
||||||
foreach (var pakFile in manifest.PakFiles)
|
foreach (var pakFile in manifest.PakFiles)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Exergizing DLC container \"{pakFile.FileName}\"");
|
long chunkId = pakFile.ChunkId;
|
||||||
|
manifest.ChunkTags.TryGetValue(chunkId.ToString(), out var tags);
|
||||||
|
|
||||||
string url = $"{WG_DLC_DOMAIN}/dlc/{CONTENT_GROUP}/dlc/{pakFile.RelativeUrl}";
|
if (tags == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"Failed to find tags for chunk {chunkId}");
|
||||||
|
}
|
||||||
|
|
||||||
// load to stream
|
bool isHd = tags.GameplayTags.Any(tag => tag.TagName == "Dlc.HdTextures");
|
||||||
Stream httpStream = await httpClient.GetStreamAsync(url);
|
|
||||||
MemoryStream memoryStream = new();
|
|
||||||
|
|
||||||
await httpStream.CopyToAsync(memoryStream);
|
if (isHd)
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
{
|
||||||
|
hdPaks.Add(pakFile);
|
||||||
FStreamArchive archive = new(url, memoryStream);
|
}
|
||||||
PakFileReader reader = new(archive);
|
else
|
||||||
|
{
|
||||||
Exergize(reader);
|
nonHdPaks.Add(pakFile);
|
||||||
|
}
|
||||||
memoryStream.Dispose();
|
|
||||||
httpStream.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Found {nonHdPaks.Count} non-HD containers and {hdPaks.Count} HD containers"
|
||||||
|
);
|
||||||
|
|
||||||
|
Console.WriteLine($"Exergizing non-HD containers");
|
||||||
|
|
||||||
|
foreach (var pak in nonHdPaks)
|
||||||
|
{
|
||||||
|
await ExergizeManifestPakFile(pak);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"Exergizing HD containers");
|
||||||
|
|
||||||
|
foreach (var pak in hdPaks)
|
||||||
|
{
|
||||||
|
await ExergizeManifestPakFile(pak);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task ExergizeManifestPakFile(PakFile pak)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Exergizing DLC container \"{pak.FileName}\"");
|
||||||
|
|
||||||
|
string url = $"{WG_DLC_DOMAIN}/dlc/{CONTENT_GROUP}/dlc/{pak.RelativeUrl}";
|
||||||
|
|
||||||
|
using HttpClient httpClient = new();
|
||||||
|
Stream httpStream = await httpClient.GetStreamAsync(url);
|
||||||
|
MemoryStream memoryStream = new();
|
||||||
|
|
||||||
|
await httpStream.CopyToAsync(memoryStream);
|
||||||
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
FStreamArchive archive = new(url, memoryStream);
|
||||||
|
PakFileReader reader = new(archive);
|
||||||
|
|
||||||
|
Exergize(reader);
|
||||||
|
|
||||||
|
memoryStream.Dispose();
|
||||||
|
httpStream.Dispose();
|
||||||
|
archive.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<DlcManifest> FetchManifest(string group, string build)
|
public static async Task<DlcManifest> FetchManifest(string group, string build)
|
||||||
|
|||||||
Reference in new issue
Block a user