Compare commits
12 commits
f9ea960cf0
...
9593f98ae6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9593f98ae6 | |||
| 93296a1f6e | |||
| 0ffd302de6 | |||
| b98ded7ca3 | |||
| 6a07236b2c | |||
| c63417571a | |||
| 1fccdeca2b | |||
| 043c136738 | |||
| e2dc70acc0 | |||
| 3bf98ba472 | |||
| 690e5278c5 | |||
|
|
07f25198da |
3 changed files with 31 additions and 93 deletions
|
|
@ -1,26 +1,6 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
#include "CompressingManager.h"
|
||||
|
||||
#include "ChunkManager.h"
|
||||
|
||||
ChunkManager::ChunkManager(EncryptionManager& em)
|
||||
:eman(em)
|
||||
CompressingManager::CompressingManager()
|
||||
{ }
|
||||
|
||||
ChunkManager::~ChunkManager()
|
||||
|
|
@ -56,17 +36,14 @@ std::vector<char> ChunkManager::chunked(const std::vector<char>& raw, const bool
|
|||
|
||||
std::vector<char> outChunk;
|
||||
|
||||
// Przetwórz chunki i przetwórz
|
||||
if (compress)
|
||||
{
|
||||
// Zaszyfruj i skompresuj lub tylko skompresuj
|
||||
outChunk = encrypt ? eman.encrypt(cman.compress(chunk)) : cman.compress(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Zaszyfruj lub skopiuj
|
||||
outChunk = encrypt ? eman.encrypt(chunk) : std::move(chunk);
|
||||
}
|
||||
// Buffor wyjœciowy nadpisany skompresowanymi danymi
|
||||
std::vector<char> zipChunk(maxZipChunkSize);
|
||||
|
||||
// Kompresja
|
||||
int zipSize = LZ4_compress_default(chunk.data(), zipChunk.data(), chunkSize, maxZipChunkSize);
|
||||
|
||||
// Zmiana rozmiaru do faktycznego rozmiaru po kompresji
|
||||
zipChunk.resize(zipSize);
|
||||
|
||||
uint32_t chs = static_cast<uint32_t>(chunk.size());
|
||||
uint32_t zch = static_cast<uint32_t>(outChunk.size());
|
||||
|
|
@ -123,11 +100,19 @@ std::vector<char> ChunkManager::dechunked(const std::vector<char>& zip, const bo
|
|||
std::memcpy(inChunk.data(), zip.data() + offset, chunkZipSize);
|
||||
offset += chunkZipSize;
|
||||
|
||||
// Jeœli flaga encrypt jest aktywna najpierw zdeszyfruj blok
|
||||
std::vector<char> zipChunk = encrypt ? eman.decrypt(inChunk) : std::move(inChunk);
|
||||
|
||||
// Zdeklarój pusty chunk
|
||||
std::vector<char> chunk = compress ? cman.decompress(zipChunk, chunkSize) : std::move(zipChunk);
|
||||
std::vector<char> chunk(chunkSize);
|
||||
|
||||
// Dekompresja chunka
|
||||
int sizeData = LZ4_decompress_safe(zipChunk.data(), chunk.data(), static_cast<int>(chunkZipSize), static_cast<int>(chunkSize));
|
||||
|
||||
if (sizeData < 0)
|
||||
{
|
||||
throw std::runtime_error("LZ4 Decompressing Error");
|
||||
}
|
||||
|
||||
// Dostosowanie rozmiaru vectora po skompresowaniu
|
||||
chunk.resize(sizeData);
|
||||
|
||||
// Scal chunki
|
||||
chunksString.insert(chunksString.end(), chunk.begin(), chunk.end());
|
||||
|
|
|
|||
|
|
@ -1,22 +1,3 @@
|
|||
/*
|
||||
* 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 <vector>
|
||||
|
|
|
|||
46
README.md
46
README.md
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
**Visual Studio 2022**
|
||||
|
||||
**CMAKE**
|
||||
--soon--
|
||||
|
||||
|
||||
**=========================================================================================**
|
||||
|
|
@ -34,7 +36,13 @@
|
|||
|
||||
\*\*-c - Packing catalog width compressing all files\*\*
|
||||
|
||||
\*\*-p - Packing catalog width out compressing\*\*
|
||||
\*\*-r - Raw files\*\*
|
||||
|
||||
\*\*-c - Compressing\*\*
|
||||
|
||||
\*\*-e - Encrypted\*\*
|
||||
|
||||
\*\*-s - Compressing and encrypted\*\*
|
||||
|
||||
\*\*-f - Packing catalog width unique config for individual files (look on under section)\*\*
|
||||
|
||||
|
|
@ -47,42 +55,6 @@
|
|||
|
||||
|
||||
|
||||
**-f Parameters instruction**
|
||||
|
||||
|
||||
|
||||
**Create regular txt file in same directory on catalog width same name.**
|
||||
|
||||
|
||||
|
||||
**This is a config file width parameters**
|
||||
|
||||
|
||||
|
||||
**{COMPRESS} - key for compress files list**
|
||||
|
||||
|
||||
|
||||
**{COMPRESS}**
|
||||
|
||||
**textures/texture.png**
|
||||
|
||||
**\*.png**
|
||||
|
||||
|
||||
|
||||
**{IGNORE} - key for ignoring files list**
|
||||
|
||||
|
||||
|
||||
**{IGNORE}**
|
||||
|
||||
**testfile.odt**
|
||||
|
||||
**\*.odt**
|
||||
|
||||
|
||||
|
||||
**=========================================================================================**
|
||||
|
||||
### **Components:**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue