80 lines
1.9 KiB
C++
80 lines
1.9 KiB
C++
/*
|
|
* This file is part of VoidArchiveTool.
|
|
*
|
|
* Copyright (C) 2025 Yanczi
|
|
*
|
|
* Void Archive Toolis free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <fstream>
|
|
#include <filesystem>
|
|
#include <algorithm>
|
|
#include <stdexcept>
|
|
#include <sstream>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <xxhash.h>
|
|
|
|
#include "DataStruct.h"
|
|
#include "ChunkManager.h"
|
|
#include "EncryptionManager.h"
|
|
|
|
class ExtractCargo {
|
|
public:
|
|
ExtractCargo();
|
|
virtual ~ExtractCargo();
|
|
|
|
// Punkt wejœcia
|
|
bool Extract(const std::string&);
|
|
|
|
private:
|
|
std::filesystem::path cargoFileName;
|
|
|
|
uint32_t filesLen;
|
|
uint64_t tablePosition;
|
|
|
|
const int8_t version;
|
|
const std::string signature;
|
|
|
|
std::vector<FilesTable> filesHeads;
|
|
|
|
|
|
std::ifstream cargoFile;
|
|
|
|
EncryptionManager eman;
|
|
|
|
|
|
// Sprawdzenie poprawnoœci archiwum
|
|
bool CheckCargoFile();
|
|
|
|
// Wypakowywanie plików
|
|
void ExtractingFilesFromCargo();
|
|
|
|
// Pobieranie nag³ówków plików
|
|
void LoadFilesTable();
|
|
|
|
// Sprawdzanie sumy kontrolnej
|
|
bool HashValid(const std::vector<char>&, const uint64_t&);
|
|
|
|
// Utwórz katalog
|
|
void CreateDirections(std::filesystem::path);
|
|
|
|
// Magiczna funkcja do dekompresji i deszyfracji danych
|
|
void computingBytes(const std::vector<char>&, std::vector<char>&, const uint8_t&);
|
|
|
|
};
|