62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
#pragma once
|
|
#include "FileProcessor.h"
|
|
#include "JobMetaData.h"
|
|
#include "JobContent.h"
|
|
#include "BPBinary.h"
|
|
|
|
#include "../external/minizip/unzip.h"
|
|
#include "../external/minizip/iowin32.h"
|
|
|
|
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
|
|
#define FTELLO_FUNC(stream) ftello64(stream)
|
|
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
|
|
|
#define CASESENSITIVITY (0)
|
|
#define WRITEBUFFERSIZE (8192)
|
|
#define MAXFILENAME (256)
|
|
|
|
#define BP_SUCCESS 0
|
|
#define BP_ERR_OPEN_FILE_FAILED -0x8000
|
|
#define BP_ERR_UNZIP_FAILED -0x8001
|
|
#define BP_ERR_LOAD_CONTENT_FILE_FAILED -0x8002
|
|
#define BP_ERR_GET_METAFILE_NAME_FAILED -0x8003
|
|
#define BP_ERR_LOAD_METAFILE_FAILED -0x8004
|
|
#define BP_ERR_NO_BINARY_FILE -0x8005
|
|
#define BP_ERR_LOAD_BINARY_FILE_FAILED -0x8006
|
|
#define BP_ERR_NOT_SUPPORT_DATA -0x8007
|
|
|
|
class JobFileProcessor : public FileProcessor
|
|
{
|
|
public:
|
|
JobFileProcessor();
|
|
~JobFileProcessor();
|
|
int Process(string jobfile);
|
|
|
|
string GetJobTitle();
|
|
string GetMaterialName();
|
|
double GetLayerThickness();
|
|
unsigned int GetLayerCount();
|
|
int GetComponentCount();
|
|
MetaData::Layer* GetLayer(unsigned int index);
|
|
int GetLayerIndex(MetaData::Layer* layer);
|
|
string GetJobUid();
|
|
int GetCurrentLayerIndex(void) { return GetLayerIndex(m_job_meta_data.GetCurrentLayer()); }
|
|
int GetPreviewLayerIndex(void) { return GetLayerIndex(m_job_meta_data.GetPreviewLayer()); }
|
|
MetaData* GetMetaData() { return &m_job_meta_data; }
|
|
FileType GetFileType() { return FT_BP; }
|
|
|
|
private:
|
|
int UnZipJobFile(string jobfile, string& extpath);
|
|
int ExtractOneFile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password);
|
|
int Extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password);
|
|
int ExtractCurrentFile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password);
|
|
int Makedir(const char* newdir);
|
|
void ChangeFileDate(const char* filename, uLong dosdate);
|
|
void SetStartIndex(unsigned int index);
|
|
|
|
private:
|
|
JobMetaData m_job_meta_data;
|
|
JobContent m_job_content;
|
|
MachineCfg* m_MachineCfg;
|
|
};
|