| Line 3... |
Line 3... |
| 3 |
|
3 |
|
| 4 |
#include "SpkFile.h"
|
4 |
#include "SpkFile.h"
|
| 5 |
|
5 |
|
| 6 |
typedef struct SPKEXPORT SMultiSpkFile
|
6 |
typedef struct SPKEXPORT SMultiSpkFile
|
| 7 |
{
|
7 |
{
|
| 8 |
SMultiSpkFile() { 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::String 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::String sScriptName;
|
| Line 19... |
Line 19... |
| 19 |
bool bRemove;
|
19 |
bool bRemove;
|
| 20 |
} SMultiSpkFile;
|
20 |
} SMultiSpkFile;
|
| 21 |
|
21 |
|
| 22 |
typedef struct SPKEXPORT SMultiHeader
|
22 |
typedef struct SPKEXPORT SMultiHeader
|
| 23 |
{
|
23 |
{
|
| - |
|
24 |
SMultiHeader() : fVersion(0.0f), iCompression(0), lUncomprLen(0), lComprLen(0), bSelection(false) { }
|
| 24 |
float fVersion;
|
25 |
float fVersion;
|
| 25 |
int iCompression;
|
26 |
int iCompression;
|
| 26 |
long lUncomprLen;
|
27 |
long lUncomprLen;
|
| 27 |
long lComprLen;
|
28 |
long lComprLen;
|
| 28 |
bool bSelection;
|
29 |
bool bSelection;
|
| 29 |
} SMultiHeader;
|
30 |
} SMultiHeader;
|
| 30 |
|
31 |
|
| 31 |
class SPKEXPORT CMultiSpkFile
|
32 |
class SPKEXPORT CMultiSpkFile
|
| 32 |
{
|
33 |
{
|
| 33 |
public:
|
34 |
public:
|
| 34 |
CMultiSpkFile ()
|
35 |
CMultiSpkFile ()
|
| 35 |
{
|
36 |
{
|
| 36 |
m_bChanged = false;
|
37 |
m_bChanged = false;
|
| 37 |
}
|
38 |
}
|
| 38 |
~CMultiSpkFile ();
|
39 |
~CMultiSpkFile ();
|
| 39 |
|
40 |
|
| 40 |
SMultiSpkFile *AddFileEntry ( CyString filename );
|
41 |
SMultiSpkFile *addFileEntry(const Utils::String &filename);
|
| 41 |
bool AddFile ( SMultiSpkFile *file );
|
42 |
bool addFile(SMultiSpkFile *file);
|
| 42 |
bool AddFile ( CyString file, bool on = true );
|
43 |
bool addFile(const Utils::String &file, bool on = true);
|
| 43 |
bool AddFileNow ( CyString, bool = true );
|
44 |
bool addFileNow(const Utils::String &file, bool = true );
|
| 44 |
bool RemoveFile ( int id );
|
45 |
bool removeFile ( int id );
|
| 45 |
bool RemoveFile ( SMultiSpkFile *ms );
|
46 |
bool removeFile(const SMultiSpkFile *ms);
|
| 46 |
bool RemoveFile ( CyString file );
|
47 |
bool removeFile(const Utils::String &file);
|
| 47 |
bool MarkRemoveFile ( int id );
|
48 |
bool markRemoveFile ( int id );
|
| 48 |
bool MarkRemoveFile ( SMultiSpkFile *ms );
|
49 |
bool markRemoveFile ( SMultiSpkFile *ms );
|
| 49 |
bool MarkRemoveFile ( CyString file );
|
50 |
bool markRemoveFile(const Utils::String &file);
|
| 50 |
void MarkRemoveAll();
|
51 |
void markRemoveAll();
|
| 51 |
|
52 |
|
| 52 |
void ClearFiles ();
|
53 |
void ClearFiles ();
|
| 53 |
void CreatePackage(SMultiSpkFile *p);
|
54 |
void CreatePackage(SMultiSpkFile *p);
|
| 54 |
|
55 |
|
| 55 |
bool ReadFile ( CyString, bool = true );
|
56 |
bool readFile(const Utils::String &filename, bool = true );
|
| 56 |
bool ParseHeader ( CyString header );
|
- |
|
| 57 |
bool ParseValueLine ( CyString line );
|
- |
|
| 58 |
void ReadValues ( CyString values );
|
- |
|
| 59 |
|
- |
|
| 60 |
bool ReadAllFilesToMemory (CProgressInfo *progress = NULL);
|
57 |
bool ReadAllFilesToMemory (CProgressInfo *progress = NULL);
|
| 61 |
bool ReadFileToMemory ( SMultiSpkFile *ms );
|
58 |
bool ReadFileToMemory ( SMultiSpkFile *ms );
|
| 62 |
bool ReadAllPackages ( CyString filename, int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL ) { _sFilename = filename.ToString(); return ReadAllPackages(type, addToList); }
|
59 |
bool readAllPackages(const Utils::String &filename, int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL ) { _sFilename = filename; return readAllPackages(type, addToList); }
|
| 63 |
bool ReadAllPackages ( int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL );
|
60 |
bool readAllPackages(int type = SPKREAD_NODATA, CLinkList<CBaseFile> *addToList = NULL );
|
| 64 |
bool ReadSpk ( SMultiSpkFile *ms, int type = SPKREAD_NODATA );
|
61 |
bool ReadSpk ( SMultiSpkFile *ms, int type = SPKREAD_NODATA );
|
| 65 |
|
62 |
|
| 66 |
SMultiSpkFile *FindFile ( CyString name );
|
63 |
const SMultiSpkFile *findFile (const Utils::String &name) const;
|
| 67 |
|
64 |
|
| 68 |
bool ExtractAll ( CyString dir );
|
65 |
bool extractAll(const Utils::String &dir);
|
| 69 |
bool ExtractData ( SMultiSpkFile *ms );
|
66 |
bool extractData(SMultiSpkFile *ms);
|
| 70 |
bool ExtractFile ( SMultiSpkFile *ms, CyString dir );
|
67 |
bool extractFile(const SMultiSpkFile *ms, const Utils::String &dir);
|
| 71 |
bool ExtractFile ( const CyString &filename, CyString dir );
|
68 |
bool extractFile(const Utils::String &filename, const Utils::String &dir);
|
| 72 |
bool SplitMulti ( CyString filename, CyString destdir );
|
69 |
bool splitMulti(const Utils::String &filename, const Utils::String &destdir);
|
| 73 |
|
70 |
|
| 74 |
bool WriteFile ( CyString, CProgressInfo *progress = NULL );
|
71 |
bool writeFile(const Utils::String &filename, CProgressInfo *progress = NULL);
|
| 75 |
CyString CreateData ();
|
- |
|
| 76 |
|
72 |
|
| 77 |
void SetName ( CyString n ) { _sName = n.ToString(); m_bChanged = true; }
|
73 |
void setName(const Utils::String &n) { _sName = n; m_bChanged = true; }
|
| 78 |
void SetSelection ( bool on ) { m_SHeader.bSelection = on; m_bChanged = true; }
|
74 |
void setSelection ( bool on ) { m_SHeader.bSelection = on; m_bChanged = true; }
|
| 79 |
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; }
|
| - |
|
77 |
void setChanged(bool b) { m_bChanged = b; }
|
| 80 |
|
78 |
|
| 81 |
CyString GetName () { return _sName; }
|
79 |
const Utils::String name() const { return _sName; }
|
| - |
|
80 |
const Utils::String& filename() const { return _sFilename; }
|
| - |
|
81 |
bool isSelection() const { return m_SHeader.bSelection; }
|
| - |
|
82 |
bool isChanged() const { return m_bChanged; }
|
| - |
|
83 |
|
| 82 |
unsigned int GetNumFiles () { return m_lFiles.size(); }
|
84 |
size_t numFiles() const { return m_lFiles.size(); }
|
| 83 |
unsigned long GetFileSize();
|
85 |
unsigned long GetFileSize();
|
| 84 |
unsigned int GetAvailableFiles();
|
86 |
unsigned int GetAvailableFiles();
|
| 85 |
CLinkList<SMultiSpkFile> *GetFileList () { return &m_lFiles; }
|
87 |
CLinkList<SMultiSpkFile> *GetFileList () { return &m_lFiles; }
|
| 86 |
bool IsSelection () { return m_SHeader.bSelection; }
|
- |
|
| 87 |
|
- |
|
| 88 |
void SetFilename(CyString s) { _sFilename = s.ToString(); }
|
- |
|
| 89 |
CyString GetFilename() { return _sFilename; }
|
- |
|
| 90 |
|
88 |
|
| 91 |
void UpdatedPackage(CBaseFile *p);
|
89 |
void UpdatedPackage(CBaseFile *p);
|
| 92 |
SMultiSpkFile *FindPackage(CBaseFile *p);
|
90 |
SMultiSpkFile *findPackage(CBaseFile *p);
|
| 93 |
SMultiSpkFile *FindPackage(CyString name, CyString author);
|
91 |
SMultiSpkFile *findPackage(const Utils::String &name, const Utils::String &author);
|
| 94 |
void RemovePackages();
|
92 |
void RemovePackages();
|
| 95 |
|
93 |
|
| - |
|
94 |
protected:
|
| - |
|
95 |
Utils::String _createData() const;
|
| 96 |
void SetChanged(bool b) { m_bChanged = b; }
|
96 |
bool _parseHeader(const Utils::String &header);
|
| 97 |
bool IsChanged() { return m_bChanged; }
|
97 |
bool _parseValueLine(const Utils::String &line);
|
| - |
|
98 |
void _readValues(const Utils::String &values);
|
| 98 |
|
99 |
|
| 99 |
private:
|
100 |
private:
|
| 100 |
CLinkList<SMultiSpkFile> m_lFiles;
|
101 |
CLinkList<SMultiSpkFile> m_lFiles;
|
| 101 |
Utils::String _sName, _sFilename;
|
102 |
Utils::String _sName, _sFilename;
|
| 102 |
|
103 |
|