MCPcopy Create free account
hub / github.com/Soreepeong/XivAlexander / LoadFileParts

Function LoadFileParts

ScratchProject/Test_Sqpatch.cpp:414–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412};
413
414std::pair<std::vector<std::string>, std::map<std::string, std::vector<FilePart>>> LoadFileParts(const std::filesystem::path& patchFileIndexPath) {
415 std::ifstream in2(patchFileIndexPath, std::ios::binary);
416
417 std::vector<std::string> sourceFiles;
418 do {
419 sourceFiles.emplace_back(MAX_PATH, '\0');
420 in2.read(sourceFiles.back().data(), MAX_PATH);
421 sourceFiles.back().resize(strlen(sourceFiles.back().c_str()));
422 } while (!sourceFiles.back().empty());
423 sourceFiles.pop_back();
424
425 std::map<std::string, std::vector<FilePart>> fileParts;
426 while (true) {
427 uint32_t nameLength = 0;
428 in2.read(reinterpret_cast<char*>(&nameLength), sizeof nameLength);
429
430 uint32_t partCount = 0;
431 in2.read(reinterpret_cast<char*>(&partCount), sizeof partCount);
432
433 if (nameLength == 0)
434 break;
435
436 char name[MAX_PATH]{};
437 in2.read(name, nameLength);
438 auto& parts = fileParts[name];
439
440 parts.resize(partCount);
441 in2.read(reinterpret_cast<char*>(&parts[0]), std::span(parts).size_bytes());
442 }
443
444 return std::make_pair(std::move(sourceFiles), std::move(fileParts));
445}
446
447void Update(const std::filesystem::path& sourcePath, const std::filesystem::path& targetPath, const std::filesystem::path& versionPath) {
448 std::vector<std::filesystem::path> patchFiles;

Callers 2

UpdateFunction · 0.85
VerifyFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected