ex
This commit is contained in:
parent
6335472904
commit
66e776ee87
7 changed files with 24 additions and 16 deletions
|
|
@ -222,30 +222,30 @@ std::vector<FilesTable> CreateCargo::ComputingHeadFiles()
|
||||||
f.seekg(0, std::ios::beg);
|
f.seekg(0, std::ios::beg);
|
||||||
|
|
||||||
//Wczytanie pliku do pamięci
|
//Wczytanie pliku do pamięci
|
||||||
std::vector<char> buffor(size);
|
std::vector<char> buffer(size);
|
||||||
f.read(buffor.data(), size);
|
f.read(buffer.data(), size);
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
//Tworzenie hashu CRC
|
//Tworzenie hashu CRC
|
||||||
const uint64_t crc = XXH64(buffor.data(), buffor.size(), VERSION);
|
const uint64_t crc = XXH64(buffer.data(), buffer.size(), VERSION);
|
||||||
|
|
||||||
//Kompresjia
|
//Kompresjia
|
||||||
std::vector<char> zip;
|
std::vector<char> pakBuffer;
|
||||||
uint8_t method = CheckFileOnTheList(path, buffor, zip);
|
uint8_t method = CheckFileOnTheList(path, buffer, pakBuffer);
|
||||||
|
|
||||||
FilesTable ft;
|
FilesTable ft;
|
||||||
ft.nameFile = path;
|
ft.nameFile = path;
|
||||||
ft.nameLen = path.length();
|
ft.nameLen = path.length();
|
||||||
ft.hashName = fnv64(path);
|
ft.hashName = fnv64(path);
|
||||||
ft.offset = offset;
|
ft.offset = offset;
|
||||||
ft.size = zip.size();
|
ft.size = pakBuffer.size();
|
||||||
ft.isZip = method;
|
ft.flag = method;
|
||||||
ft.crc = crc;
|
ft.crc = crc;
|
||||||
|
|
||||||
cargo.write(reinterpret_cast<const char*>(zip.data()), zip.size());
|
cargo.write(reinterpret_cast<const char*>(pakBuffer.data()), pakBuffer.size());
|
||||||
|
|
||||||
filesTable.push_back(ft);
|
filesTable.push_back(ft);
|
||||||
offset += zip.size();
|
offset += pakBuffer.size();
|
||||||
}
|
}
|
||||||
return filesTable;
|
return filesTable;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@
|
||||||
#define KEY_ZIP "COMPRESS" // Pliki do skompresowania
|
#define KEY_ZIP "COMPRESS" // Pliki do skompresowania
|
||||||
#define KEY_RAW "RAW" // Pliki które majš pozostać w oryginalnej formie
|
#define KEY_RAW "RAW" // Pliki które majš pozostać w oryginalnej formie
|
||||||
#define KEY_IGNORE "IGNORE" // Pliki pominięte przy pakowaniu
|
#define KEY_IGNORE "IGNORE" // Pliki pominięte przy pakowaniu
|
||||||
#define KEY_ENCRYPT "ENCRYPT" // Plili które maj¹ byæ zaszyfrowane
|
#define KEY_ENCRYPT "ENCRYPT" // Plili które maj¹ byæ zaszyfrowane
|
||||||
|
|
||||||
#define ALL_FILE ".*" // Wszystkie pliki
|
#define ALL_FILE ".*" // Wszystkie pliki
|
||||||
|
|
||||||
struct PathConf
|
struct PathConf
|
||||||
{
|
{
|
||||||
|
|
|
||||||
1
CreateCargoEX.cpp
Normal file
1
CreateCargoEX.cpp
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
#include "CreateCargoEX.h"
|
||||||
5
CreateCargoEX.h
Normal file
5
CreateCargoEX.h
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
class CreateCargoEX
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#define SIGNATURE_KEY_FILE 1497713496 // XKEY
|
#define SIGNATURE_KEY_FILE 1497713496 // XKEY
|
||||||
|
|
||||||
#define VERSION 100
|
#define VERSION 300
|
||||||
|
|
||||||
enum StoreMethod
|
enum StoreMethod
|
||||||
{
|
{
|
||||||
|
|
@ -59,7 +59,7 @@ enum StoreMethod
|
||||||
struct CargoHead
|
struct CargoHead
|
||||||
{
|
{
|
||||||
std::string signature;
|
std::string signature;
|
||||||
uint16_t version;
|
int16_t version;
|
||||||
uint32_t files;
|
uint32_t files;
|
||||||
uint64_t table;
|
uint64_t table;
|
||||||
};
|
};
|
||||||
|
|
@ -72,5 +72,5 @@ struct FilesTable
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint64_t crc;
|
uint64_t crc;
|
||||||
uint8_t isZip;
|
int8_t flag;
|
||||||
};
|
};
|
||||||
|
|
@ -150,7 +150,7 @@ void ExtractCargo::LoadFilesTable()
|
||||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.offset), sizeof(fhTmp.offset));
|
cargoFile.read(reinterpret_cast<char*>(&fhTmp.offset), sizeof(fhTmp.offset));
|
||||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.size), sizeof(fhTmp.size));
|
cargoFile.read(reinterpret_cast<char*>(&fhTmp.size), sizeof(fhTmp.size));
|
||||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.crc), sizeof(fhTmp.crc));
|
cargoFile.read(reinterpret_cast<char*>(&fhTmp.crc), sizeof(fhTmp.crc));
|
||||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.isZip), sizeof(fhTmp.isZip));
|
cargoFile.read(reinterpret_cast<char*>(&fhTmp.flag), sizeof(fhTmp.flag));
|
||||||
|
|
||||||
filesHeads.push_back(fhTmp);
|
filesHeads.push_back(fhTmp);
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
||||||
|
|
||||||
cargoFile.read(buffor.data(), fh.size);
|
cargoFile.read(buffor.data(), fh.size);
|
||||||
|
|
||||||
std::vector<char> rawBuffor = fh.isZip ? cm.decompress(buffor) : eman.decrypt(buffor);
|
std::vector<char> rawBuffor = fh.flag ? cm.decompress(buffor) : eman.decrypt(buffor);
|
||||||
|
|
||||||
if (!HashValid(rawBuffor, fh.crc))
|
if (!HashValid(rawBuffor, fh.crc))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="CompressingManager.cpp" />
|
<ClCompile Include="CompressingManager.cpp" />
|
||||||
<ClCompile Include="CreateCargo.cpp" />
|
<ClCompile Include="CreateCargo.cpp" />
|
||||||
|
<ClCompile Include="CreateCargoEX.cpp" />
|
||||||
<ClCompile Include="EncryptionManager.cpp" />
|
<ClCompile Include="EncryptionManager.cpp" />
|
||||||
<ClCompile Include="ExtractCargo.cpp" />
|
<ClCompile Include="ExtractCargo.cpp" />
|
||||||
<ClCompile Include="Interface.cpp" />
|
<ClCompile Include="Interface.cpp" />
|
||||||
|
|
@ -143,6 +144,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="CompressingManager.h" />
|
<ClInclude Include="CompressingManager.h" />
|
||||||
<ClInclude Include="CreateCargo.h" />
|
<ClInclude Include="CreateCargo.h" />
|
||||||
|
<ClInclude Include="CreateCargoEX.h" />
|
||||||
<ClInclude Include="DataStruct.h" />
|
<ClInclude Include="DataStruct.h" />
|
||||||
<ClInclude Include="EncryptionManager.h" />
|
<ClInclude Include="EncryptionManager.h" />
|
||||||
<ClInclude Include="ExtractCargo.h" />
|
<ClInclude Include="ExtractCargo.h" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue