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);
|
||||
|
||||
//Wczytanie pliku do pamięci
|
||||
std::vector<char> buffor(size);
|
||||
f.read(buffor.data(), size);
|
||||
std::vector<char> buffer(size);
|
||||
f.read(buffer.data(), size);
|
||||
f.close();
|
||||
|
||||
//Tworzenie hashu CRC
|
||||
const uint64_t crc = XXH64(buffor.data(), buffor.size(), VERSION);
|
||||
const uint64_t crc = XXH64(buffer.data(), buffer.size(), VERSION);
|
||||
|
||||
//Kompresjia
|
||||
std::vector<char> zip;
|
||||
uint8_t method = CheckFileOnTheList(path, buffor, zip);
|
||||
std::vector<char> pakBuffer;
|
||||
uint8_t method = CheckFileOnTheList(path, buffer, pakBuffer);
|
||||
|
||||
FilesTable ft;
|
||||
ft.nameFile = path;
|
||||
ft.nameLen = path.length();
|
||||
ft.hashName = fnv64(path);
|
||||
ft.offset = offset;
|
||||
ft.size = zip.size();
|
||||
ft.isZip = method;
|
||||
ft.size = pakBuffer.size();
|
||||
ft.flag = method;
|
||||
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);
|
||||
offset += zip.size();
|
||||
offset += pakBuffer.size();
|
||||
}
|
||||
return filesTable;
|
||||
}
|
||||
|
|
|
|||
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 VERSION 100
|
||||
#define VERSION 300
|
||||
|
||||
enum StoreMethod
|
||||
{
|
||||
|
|
@ -59,7 +59,7 @@ enum StoreMethod
|
|||
struct CargoHead
|
||||
{
|
||||
std::string signature;
|
||||
uint16_t version;
|
||||
int16_t version;
|
||||
uint32_t files;
|
||||
uint64_t table;
|
||||
};
|
||||
|
|
@ -72,5 +72,5 @@ struct FilesTable
|
|||
uint64_t offset;
|
||||
uint32_t size;
|
||||
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.size), sizeof(fhTmp.size));
|
||||
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);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
|||
|
||||
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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="CompressingManager.cpp" />
|
||||
<ClCompile Include="CreateCargo.cpp" />
|
||||
<ClCompile Include="CreateCargoEX.cpp" />
|
||||
<ClCompile Include="EncryptionManager.cpp" />
|
||||
<ClCompile Include="ExtractCargo.cpp" />
|
||||
<ClCompile Include="Interface.cpp" />
|
||||
|
|
@ -143,6 +144,7 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="CompressingManager.h" />
|
||||
<ClInclude Include="CreateCargo.h" />
|
||||
<ClInclude Include="CreateCargoEX.h" />
|
||||
<ClInclude Include="DataStruct.h" />
|
||||
<ClInclude Include="EncryptionManager.h" />
|
||||
<ClInclude Include="ExtractCargo.h" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue