Poprawione flagowanie metody pakowania
This commit is contained in:
parent
66e776ee87
commit
31f08e52d0
10 changed files with 287 additions and 200 deletions
|
|
@ -45,6 +45,8 @@ bool ExtractCargo::Extract(const std::string& cFile)
|
|||
{
|
||||
cargoFileName = cFile;
|
||||
|
||||
std::cout << "START EXTRACT " << cFile << std::endl;
|
||||
|
||||
//SprawdŸ czy plik istnieje
|
||||
if (!std::filesystem::exists(cargoFileName))
|
||||
{
|
||||
|
|
@ -136,7 +138,7 @@ bool ExtractCargo::HashValid(const std::vector<char>& data, const uint64_t& crc)
|
|||
void ExtractCargo::LoadFilesTable()
|
||||
{
|
||||
cargoFile.seekg(tablePosition);
|
||||
|
||||
std::cout << "TU TABLICA" << std::endl;
|
||||
for (uint32_t i = 0; i < filesLen; ++i)
|
||||
{
|
||||
FilesTable fhTmp;
|
||||
|
|
@ -146,6 +148,8 @@ void ExtractCargo::LoadFilesTable()
|
|||
cargoFile.read(nameBuffor.data(), fhTmp.nameLen);
|
||||
fhTmp.nameFile = std::string(nameBuffor.begin(), nameBuffor.end());
|
||||
|
||||
std::cout << fhTmp.nameFile << std::endl;
|
||||
|
||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.hashName), sizeof(fhTmp.hashName));
|
||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.offset), sizeof(fhTmp.offset));
|
||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.size), sizeof(fhTmp.size));
|
||||
|
|
@ -167,6 +171,8 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
|||
{
|
||||
std::filesystem::path dir = cargoFileName.stem() / fh.nameFile;
|
||||
CreateDirections(dir);
|
||||
std::cout << "TU EXTRAT" << std::endl;
|
||||
std::cout << dir << std::endl;
|
||||
std::ofstream file(dir, std::ios::binary);
|
||||
|
||||
cargoFile.seekg(fh.offset);
|
||||
|
|
@ -174,7 +180,7 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
|||
|
||||
cargoFile.read(buffor.data(), fh.size);
|
||||
|
||||
std::vector<char> rawBuffor = fh.flag ? cm.decompress(buffor) : eman.decrypt(buffor);
|
||||
std::vector<char> rawBuffor = fh.flag ? cm.decompress(buffor) : buffor;
|
||||
|
||||
if (!HashValid(rawBuffor, fh.crc))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue