edit code to split cpp, header
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ZipDefine.h"
|
||||
#include "CRC.h"
|
||||
|
||||
#define OUTPUT_FILE_NAME "MyZip.zip"
|
||||
|
||||
class MyZip
|
||||
{
|
||||
private:
|
||||
std::ofstream fileOut;
|
||||
std::string strOutputPath;
|
||||
|
||||
// Zip Format struct
|
||||
CentralDirectory CentDir{};
|
||||
EoCDRecord EOCDR{};
|
||||
|
||||
struct ArchivedEntry
|
||||
{
|
||||
CentralDirectory header;
|
||||
std::string fileName;
|
||||
};
|
||||
std::vector<ArchivedEntry> vecEntries;
|
||||
|
||||
public:
|
||||
MyZip(std::string strfilePath)
|
||||
: strOutputPath(strfilePath)
|
||||
{
|
||||
fileOut = std::ofstream(strOutputPath, std::ios::binary);
|
||||
CentDir.signature = PK_SIGNATURE_CENT_DIR;
|
||||
EOCDR.signature = PK_SIGNATURE_EO_CDR;
|
||||
|
||||
CentDir.versionMadeBy = 0; // Temp
|
||||
CentDir.versionNeededToExtract = 0; // Temp
|
||||
CentDir.generalBitFlag = 0; // Temp
|
||||
CentDir.compressionMethod = METHOD_UNCOMPRESSED;
|
||||
}
|
||||
|
||||
bool AddFileToZip(const std::string &strFilePath);
|
||||
bool FinalizeZip();
|
||||
};
|
||||
Reference in New Issue
Block a user