Dodaj pliki projektów.

This commit is contained in:
yanczi 2025-09-23 01:31:59 +02:00
parent 4912ed6774
commit f6150b0d17
18 changed files with 9210 additions and 0 deletions

77
ExtractCargo.h Normal file
View file

@ -0,0 +1,77 @@
/*
* 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 <lz4.h>
#include <filesystem>
#include <algorithm>
#include <stdexcept>
#include <sstream>
#include "DataStruct.h"
#include "xxhash.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;
uint8_t filesHeadsOffset;
const uint8_t version;
const std::string signature;
std::vector<FilesTable> filesHeads;
std::ifstream cargoFile;
// Sprawdzenie poprawnoœci archiwum
bool CheckCargoFile();
// Wypakowywanie plików
void ExtractingFilesFromCargo();
// Pobieranie nag³ówków plików
void LoadFilesTable();
// Dekomprezja danych
std::vector<char> DecompressingData(const std::vector<char>&, const uint32_t&);
// Sprawdzanie sumy kontrolnej
bool HashValid(const std::vector<char>&, const uint64_t&);
// Utwórz katalog
void CreateDirections(std::filesystem::path);
};