Line 4... |
Line 4... |
4 |
#include "SpkFile.h"
|
4 |
#include "SpkFile.h"
|
5 |
|
5 |
|
6 |
typedef struct SPKEXPORT SMultiSpkFile
|
6 |
typedef struct SPKEXPORT SMultiSpkFile
|
7 |
{
|
7 |
{
|
8 |
SMultiSpkFile() : bOn(false), iPos(0), pFile(nullptr) { iType = 0; bRemove = false; sData = 0; lSize = 0; }
|
8 |
SMultiSpkFile() : bOn(false), iPos(0), pFile(nullptr) { iType = 0; bRemove = false; sData = 0; lSize = 0; }
|
9 |
Utils::String sName;
|
9 |
Utils::WString sName;
|
10 |
char *sData;
|
10 |
char *sData;
|
11 |
long lSize;
|
11 |
long lSize;
|
12 |
bool bOn;
|
12 |
bool bOn;
|
13 |
Utils::String sScriptName;
|
13 |
Utils::WString sScriptName;
|
14 |
Utils::String sScriptVersion;
|
14 |
Utils::WString sScriptVersion;
|
15 |
Utils::String sScriptAuthor;
|
15 |
Utils::WString sScriptAuthor;
|
16 |
CBaseFile *pFile;
|
16 |
CBaseFile *pFile;
|
17 |
int iType;
|
17 |
int iType;
|
18 |
int iPos;
|
18 |
int iPos;
|
19 |
bool bRemove;
|
19 |
bool bRemove;
|
20 |
} SMultiSpkFile;
|
20 |
} SMultiSpkFile;
|
Line 36... |
Line 36... |
36 |
{
|
36 |
{
|
37 |
m_bChanged = false;
|
37 |
m_bChanged = false;
|
38 |
}
|
38 |
}
|
39 |
~CMultiSpkFile ();
|
39 |
~CMultiSpkFile ();
|
40 |
|
40 |
|
41 |
SMultiSpkFile *addFileEntry(const Utils::String &filename);
|
41 |
SMultiSpkFile *addFileEntry(const Utils::WString &filename);
|
42 |
bool addFile(SMultiSpkFile *file);
|
42 |
bool addFile(SMultiSpkFile *file);
|
43 |
bool addFile(const Utils::String &file, bool on = true);
|
43 |
bool addFile(const Utils::WString &file, bool on = true);
|
44 |
bool addFileNow(const Utils::String &file, bool = true );
|
44 |
bool addFileNow(const Utils::WString &file, bool = true );
|
45 |
bool removeFile ( int id );
|
45 |
bool removeFile ( int id );
|
46 |
bool removeFile(const SMultiSpkFile *ms);
|
46 |
bool removeFile(const SMultiSpkFile *ms);
|
47 |
bool removeFile(const Utils::String &file);
|
47 |
bool removeFile(const Utils::WString &file);
|
48 |
bool markRemoveFile ( int id );
|
48 |
bool markRemoveFile ( int id );
|
49 |
bool markRemoveFile ( SMultiSpkFile *ms );
|
49 |
bool markRemoveFile ( SMultiSpkFile *ms );
|
50 |
bool markRemoveFile(const Utils::String &file);
|
50 |
bool markRemoveFile(const Utils::WString &file);
|
51 |
void markRemoveAll();
|
51 |
void markRemoveAll();
|
52 |
|
52 |
|
53 |
void ClearFiles ();
|
53 |
void ClearFiles ();
|
54 |
void CreatePackage(SMultiSpkFile *p);
|
54 |
void CreatePackage(SMultiSpkFile *p);
|
55 |
|
55 |
|
56 |
bool readFile(const Utils::WString &filename, bool = true );
|
56 |
bool readFile(const Utils::WString &filename, bool = true );
|
57 |
bool ReadAllFilesToMemory (CProgressInfo *progress = NULL);
|
57 |
bool ReadAllFilesToMemory (CProgressInfo *progress = NULL);
|
58 |
bool ReadFileToMemory ( SMultiSpkFile *ms );
|
58 |
bool ReadFileToMemory ( SMultiSpkFile *ms );
|
59 |
bool readAllPackages(const Utils::String &filename, int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL ) { _sFilename = filename; return readAllPackages(type, addToList); }
|
59 |
bool readAllPackages(const Utils::WString &filename, int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL ) { _sFilename = filename; return readAllPackages(type, addToList); }
|
60 |
bool readAllPackages(int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL );
|
60 |
bool readAllPackages(int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL );
|
61 |
bool ReadSpk ( SMultiSpkFile *ms, int type = SPKREAD_NODATA );
|
61 |
bool ReadSpk ( SMultiSpkFile *ms, int type = SPKREAD_NODATA );
|
62 |
|
62 |
|
63 |
const SMultiSpkFile *findFile (const Utils::String &name) const;
|
63 |
const SMultiSpkFile *findFile (const Utils::WString &name) const;
|
64 |
|
64 |
|
65 |
bool extractAll(const Utils::String &dir);
|
65 |
bool extractAll(const Utils::WString &dir);
|
66 |
bool extractData(SMultiSpkFile *ms);
|
66 |
bool extractData(SMultiSpkFile *ms);
|
67 |
bool extractFile(const SMultiSpkFile *ms, const Utils::String &dir);
|
67 |
bool extractFile(const SMultiSpkFile *ms, const Utils::WString &dir);
|
68 |
bool extractFile(const Utils::String &filename, const Utils::String &dir);
|
68 |
bool extractFile(const Utils::WString &filename, const Utils::WString &dir);
|
69 |
bool splitMulti(const Utils::String &filename, const Utils::String &destdir);
|
69 |
bool splitMulti(const Utils::WString &filename, const Utils::WString &destdir);
|
70 |
|
70 |
|
71 |
bool writeFile(const Utils::String &filename, CProgressInfo *progress = NULL);
|
71 |
bool writeFile(const Utils::WString &filename, CProgressInfo *progress = NULL);
|
72 |
|
72 |
|
73 |
void setName(const Utils::String &n) { _sName = n; m_bChanged = true; }
|
73 |
void setName(const Utils::WString &n) { _sName = n; m_bChanged = true; }
|
74 |
void setSelection ( bool on ) { m_SHeader.bSelection = on; m_bChanged = true; }
|
74 |
void setSelection ( bool on ) { m_SHeader.bSelection = on; m_bChanged = true; }
|
75 |
void setCompression ( int c ) { m_SHeader.iCompression = c; m_bChanged = true; }
|
75 |
void setCompression ( int c ) { m_SHeader.iCompression = c; m_bChanged = true; }
|
76 |
void setFilename(const Utils::String &s) { _sFilename = s; }
|
76 |
void setFilename(const Utils::WString &s) { _sFilename = s; }
|
77 |
void setChanged(bool b) { m_bChanged = b; }
|
77 |
void setChanged(bool b) { m_bChanged = b; }
|
78 |
|
78 |
|
79 |
const Utils::String name() const { return _sName; }
|
79 |
const Utils::WString name() const { return _sName; }
|
80 |
const Utils::String& filename() const { return _sFilename; }
|
80 |
const Utils::WString& filename() const { return _sFilename; }
|
81 |
bool isSelection() const { return m_SHeader.bSelection; }
|
81 |
bool isSelection() const { return m_SHeader.bSelection; }
|
82 |
bool isChanged() const { return m_bChanged; }
|
82 |
bool isChanged() const { return m_bChanged; }
|
83 |
|
83 |
|
84 |
size_t numFiles() const { return m_lFiles.size(); }
|
84 |
size_t numFiles() const { return m_lFiles.size(); }
|
85 |
unsigned long GetFileSize();
|
85 |
unsigned long GetFileSize();
|
86 |
unsigned int GetAvailableFiles();
|
86 |
unsigned int GetAvailableFiles();
|
87 |
CLinkList<SMultiSpkFile> *GetFileList () { return &m_lFiles; }
|
87 |
CLinkList<SMultiSpkFile> *GetFileList () { return &m_lFiles; }
|
88 |
|
88 |
|
89 |
void UpdatedPackage(CBaseFile *p);
|
89 |
void UpdatedPackage(CBaseFile *p);
|
90 |
SMultiSpkFile *findPackage(CBaseFile *p);
|
90 |
SMultiSpkFile *findPackage(CBaseFile *p);
|
91 |
SMultiSpkFile *findPackage(const Utils::String &name, const Utils::String &author);
|
91 |
SMultiSpkFile *findPackage(const Utils::WString &name, const Utils::WString &author);
|
92 |
void RemovePackages();
|
92 |
void RemovePackages();
|
93 |
|
93 |
|
94 |
protected:
|
94 |
protected:
|
95 |
Utils::String _createData() const;
|
95 |
Utils::WString _createData() const;
|
96 |
bool _parseHeader(const Utils::String &header);
|
96 |
bool _parseHeader(const Utils::WString &header);
|
97 |
bool _parseValueLine(const Utils::String &line);
|
97 |
bool _parseValueLine(const Utils::WString &line);
|
98 |
void _readValues(const Utils::String &values);
|
98 |
void _readValues(const Utils::WString &values);
|
99 |
|
99 |
|
100 |
private:
|
100 |
private:
|
101 |
CLinkList<SMultiSpkFile> m_lFiles;
|
101 |
CLinkList<SMultiSpkFile> m_lFiles;
|
102 |
Utils::String _sName, _sFilename;
|
102 |
Utils::WString _sName, _sFilename;
|
103 |
|
103 |
|
104 |
SMultiHeader m_SHeader;
|
104 |
SMultiHeader m_SHeader;
|
105 |
bool m_bChanged;
|
105 |
bool m_bChanged;
|
106 |
};
|
106 |
};
|
107 |
|
107 |
|