Line 8... |
Line 8... |
8 |
#if _MSC_VER > 1000
|
8 |
#if _MSC_VER > 1000
|
9 |
#pragma once
|
9 |
#pragma once
|
10 |
#endif // _MSC_VER > 1000
|
10 |
#endif // _MSC_VER > 1000
|
11 |
|
11 |
|
12 |
#include "lists.h"
|
12 |
#include "lists.h"
|
13 |
#include "StringList.h"
|
- |
|
14 |
#include "File.h"
|
13 |
#include "File.h"
|
15 |
#include "Utils/String.h"
|
14 |
#include "Utils/String.h"
|
16 |
#include "Utils/StringList.h"
|
15 |
#include "Utils/StringList.h"
|
17 |
#include "archive/zip.h"
|
16 |
#include "archive/zip.h"
|
18 |
|
17 |
|
Line 78... |
Line 77... |
78 |
} SSPKHeader2;
|
77 |
} SSPKHeader2;
|
79 |
|
78 |
|
80 |
class SPKEXPORT CBaseFile : public SPK::Package::CCorePackage
|
79 |
class SPKEXPORT CBaseFile : public SPK::Package::CCorePackage
|
81 |
{
|
80 |
{
|
82 |
public:
|
81 |
public:
|
- |
|
82 |
// static functions
|
83 |
static Utils::String ConvertGameToString(int game);
|
83 |
static Utils::String ConvertGameToString(int game);
|
84 |
static int GetGameFromString(const Utils::String &game);
|
84 |
static int GetGameFromString(const Utils::String &game);
|
85 |
static Utils::String ErrorString(int error, const Utils::String &errorStr = Utils::String::Null());
|
85 |
static Utils::String ErrorString(int error, const Utils::String &errorStr = Utils::String::Null());
|
- |
|
86 |
static Utils::String GetEndOfLine(FILE* id, int* line = NULL, bool upper = true);
|
- |
|
87 |
static int CheckFile(const Utils::String &filename, float* version = NULL);
|
- |
|
88 |
|
86 |
|
89 |
|
87 |
CBaseFile();
|
90 |
CBaseFile();
|
88 |
virtual ~CBaseFile();
|
91 |
virtual ~CBaseFile();
|
89 |
|
92 |
|
90 |
// Virtual Functions
|
93 |
// Virtual Functions
|
91 |
virtual Utils::String getFullPackageName(int language, const Utils::String &byString) const;
|
94 |
virtual Utils::String getFullPackageName(int language, const Utils::String &byString) const;
|
92 |
virtual Utils::String getFullPackageName(int language, bool includeVersion = true, const Utils::String &byString = "by") const;
|
95 |
virtual Utils::String getFullPackageName(int language, bool includeVersion = true, const Utils::String &byString = "by") const;
|
93 |
virtual Utils::String getFullPackageName(const Utils::String &format, int lang) const;
|
96 |
virtual Utils::String getFullPackageName(const Utils::String &format, int lang) const;
|
94 |
|
97 |
|
95 |
virtual Utils::String CreateValuesLine() const;
|
98 |
virtual Utils::String createValuesLine() const;
|
96 |
|
99 |
|
97 |
virtual bool LoadPackageData(const Utils::String& sFirst, const Utils::String& sRest, const Utils::String& sMainGame, Utils::CStringList& otherGames, Utils::CStringList& gameAddons, CProgressInfo* progress);
|
100 |
virtual bool LoadPackageData(const Utils::String& sFirst, const Utils::String& sRest, const Utils::String& sMainGame, Utils::CStringList& otherGames, Utils::CStringList& gameAddons, CProgressInfo* progress);
|
98 |
virtual bool GeneratePackagerScript(bool wildcard, Utils::CStringList* list, int game, const Utils::CStringList& gameAddons, bool datafile = false);
|
101 |
virtual bool GeneratePackagerScript(bool wildcard, Utils::CStringList* list, int game, const Utils::CStringList& gameAddons, bool datafile = false);
|
99 |
virtual bool GeneratePackagerScriptFile(bool wildcard, Utils::CStringList* list, int game, const Utils::CStringList& gameAddons);
|
102 |
virtual bool GeneratePackagerScriptFile(bool wildcard, Utils::CStringList* list, int game, const Utils::CStringList& gameAddons);
|
100 |
|
103 |
|
Line 121... |
Line 124... |
121 |
void SetDataCompression(int c) { m_SHeader2.iDataCompression = c; }
|
124 |
void SetDataCompression(int c) { m_SHeader2.iDataCompression = c; }
|
122 |
void SetFileCompression(int c) { m_SHeader2.iFileCompression = c; }
|
125 |
void SetFileCompression(int c) { m_SHeader2.iFileCompression = c; }
|
123 |
void SetValueCompression(int c) { m_SHeader.iValueCompression = c; }
|
126 |
void SetValueCompression(int c) { m_SHeader.iValueCompression = c; }
|
124 |
void setIcon(C_File* file, const Utils::String& ext) { if (m_pIconFile) delete m_pIconFile; _sIconExt = ext.c_str(); m_pIconFile = file; _changed(); }
|
127 |
void setIcon(C_File* file, const Utils::String& ext) { if (m_pIconFile) delete m_pIconFile; _sIconExt = ext.c_str(); m_pIconFile = file; _changed(); }
|
125 |
void setFtpAddr(const Utils::String& str) { _sFtpAddr = str; }
|
128 |
void setFtpAddr(const Utils::String& str) { _sFtpAddr = str; }
|
126 |
|
129 |
|
127 |
// Game Compatability
|
130 |
// Game Compatability
|
128 |
SGameCompat* GetGameCompatability(int game);
|
131 |
SGameCompat* GetGameCompatability(int game);
|
129 |
bool RemoveGameCompatability(int game);
|
132 |
bool RemoveGameCompatability(int game);
|
130 |
void AddGameCompatability(int game, const Utils::String &version);
|
133 |
void AddGameCompatability(int game, const Utils::String &version);
|
131 |
bool CheckGameCompatability(int game);
|
134 |
bool CheckGameCompatability(int game);
|
Line 162... |
Line 165... |
162 |
bool removeFile(size_t pos);
|
165 |
bool removeFile(size_t pos);
|
163 |
bool removeFile(C_File* files);
|
166 |
bool removeFile(C_File* files);
|
164 |
bool removeFile(const Utils::String &file, FileType type, const Utils::String &dir = Utils::String::Null(), int game = 0);
|
167 |
bool removeFile(const Utils::String &file, FileType type, const Utils::String &dir = Utils::String::Null(), int game = 0);
|
165 |
void removeAllFiles(FileType type, int game);
|
168 |
void removeAllFiles(FileType type, int game);
|
166 |
|
169 |
|
167 |
Utils::String createFilesLine(bool updateheader, CProgressInfo* = NULL);
|
170 |
Utils::String createFilesLine(SSPKHeader2 *header, CProgressInfo* = NULL) const;
|
168 |
|
171 |
|
169 |
// error handling
|
172 |
// error handling
|
170 |
void ClearError () { _sLastError = ""; _iLastError = SPKERR_NONE; }
|
173 |
void ClearError () { _sLastError = ""; _iLastError = SPKERR_NONE; }
|
171 |
int lastError() const { return _iLastError; }
|
174 |
int lastError() const { return _iLastError; }
|
172 |
const Utils::String lastErrorString() const { return _sLastError; }
|
175 |
const Utils::String lastErrorString() const { return _sLastError; }
|
173 |
|
176 |
|
174 |
virtual bool WriteHeader(CFileIO &file, int iHeader, int iLength);
|
177 |
virtual bool writeHeader(CFileIO &file, int iHeader, int iLength) const;
|
175 |
virtual bool WriteData(CFileIO &file, CProgressInfo * = NULL );
|
178 |
virtual bool writeData(CFileIO &file, CProgressInfo * = NULL) const;
|
176 |
virtual bool WriteFile ( CyString filename, CProgressInfo * = NULL );
|
179 |
virtual bool writeFile(const Utils::String &filename, CProgressInfo* = NULL) const;
|
177 |
virtual bool ReadFile(CyString filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL);
|
- |
|
178 |
virtual bool readFile(const Utils::String &filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL);
|
180 |
virtual bool readFile(const Utils::String &filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL);
|
179 |
bool readFile(CFileIO &File, int readtype, CProgressInfo *progress);
|
181 |
bool readFile(CFileIO &File, int readtype, CProgressInfo *progress);
|
180 |
|
182 |
|
181 |
virtual bool ExtractFile(C_File *file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL);
|
- |
|
182 |
virtual bool ExtractFile(int file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL);
|
- |
|
183 |
virtual bool extractFile(int file, const Utils::String &dir, bool includedir = true, CProgressInfo *progress = NULL);
|
183 |
virtual bool extractFile(int file, const Utils::String &dir, bool includedir = true, CProgressInfo *progress = NULL);
|
184 |
virtual bool extractFile(C_File *file, const Utils::String &dir, bool includedir = true, CProgressInfo *progress = NULL);
|
184 |
virtual bool extractFile(C_File *file, const Utils::String &dir, bool includedir = true, CProgressInfo *progress = NULL);
|
185 |
virtual bool extractFile(int filenum, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
185 |
virtual bool extractFile(int filenum, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
186 |
virtual bool extractFile(C_File *file, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
186 |
virtual bool extractFile(C_File *file, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
187 |
virtual bool extractAll(const Utils::String &dir, int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
187 |
virtual bool extractAll(const Utils::String &dir, int game, const Utils::CStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
|
188 |
|
188 |
|
189 |
virtual bool SaveToArchive(CyString filename, int game, const CGameExe *exes, CProgressInfo *progress = NULL);
|
- |
|
190 |
virtual bool saveToArchive(const Utils::String &filename, int game, const CGameExe *exes, CProgressInfo *progress = NULL);
|
189 |
virtual bool saveToArchive(const Utils::String &filename, int game, const CGameExe *exes, CProgressInfo *progress = NULL);
|
191 |
virtual void addGeneratedFiles(HZIP &hz) {};
|
190 |
virtual void addGeneratedFiles(HZIP &hz) {};
|
192 |
|
191 |
|
193 |
void ClearFileData();
|
192 |
void ClearFileData();
|
194 |
|
193 |
|
Line 199... |
Line 198... |
199 |
|
198 |
|
200 |
// compression
|
199 |
// compression
|
201 |
void RecompressAllFiles ( int compresstype, CProgressInfo *progress );
|
200 |
void RecompressAllFiles ( int compresstype, CProgressInfo *progress );
|
202 |
void CompressAllFiles ( int compresstype, CProgressInfo *progress = NULL, CProgressInfo *overallProgress = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
|
201 |
void CompressAllFiles ( int compresstype, CProgressInfo *progress = NULL, CProgressInfo *overallProgress = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
|
203 |
bool UncompressAllFiles ( CProgressInfo * = NULL );
|
202 |
bool UncompressAllFiles ( CProgressInfo * = NULL );
|
204 |
|
- |
|
205 |
// static functions
|
- |
|
206 |
static CyString GetEndOfLine ( FILE *id, int *line = NULL, bool upper = true );
|
- |
|
207 |
static int CheckFile ( CyString filename, float *version = NULL );
|
- |
|
208 |
|
203 |
|
209 |
bool IsFileAdded(C_File *f) { return m_lFiles.FindData(f); }
|
204 |
bool IsFileAdded(C_File *f) { return m_lFiles.FindData(f); }
|
210 |
|
205 |
|
211 |
// installing
|
206 |
// installing
|
212 |
void SwitchFilePointer(C_File *oldFile, C_File *newFile);
|
207 |
void SwitchFilePointer(C_File *oldFile, C_File *newFile);
|
213 |
bool InstallFiles ( CyString destdir, CProgressInfo *progress, CLinkList<C_File> *spklist, CyStringList *errorStr, bool enabled = true, CPackages *packages = NULL );
|
208 |
bool installFiles(const Utils::String &destdir, CProgressInfo *progress, CLinkList<C_File> *spklist, Utils::CStringList *errorStr, bool enabled = true, CPackages *packages = NULL );
|
214 |
virtual bool IsPatch () { return false; }
|
209 |
virtual bool IsPatch () { return false; }
|
215 |
|
210 |
|
216 |
// installer functions
|
211 |
// installer functions
|
217 |
bool IsProfileEnabled () { return m_bProfile; }
|
212 |
bool IsProfileEnabled () { return m_bProfile; }
|
218 |
bool IsEnabled () { return m_bEnable; }
|
213 |
bool IsEnabled () { return m_bEnable; }
|
Line 264... |
Line 259... |
264 |
bool AnyFileType ( int type );
|
259 |
bool AnyFileType ( int type );
|
265 |
CBaseFile *GetParent () { return m_pParent; }
|
260 |
CBaseFile *GetParent () { return m_pParent; }
|
266 |
void SetParent ( CBaseFile *file ) { m_pParent = file; }
|
261 |
void SetParent ( CBaseFile *file ) { m_pParent = file; }
|
267 |
int ParseLanguage(const Utils::String &lang) const;
|
262 |
int ParseLanguage(const Utils::String &lang) const;
|
268 |
|
263 |
|
- |
|
264 |
virtual bool computeSigned(bool updateFiles) const;
|
269 |
virtual bool UpdateSigned (bool updateFiles);
|
265 |
bool updateSigned (bool updateFiles);
|
270 |
int GetNum() { return m_iNum; }
|
266 |
int GetNum() { return m_iNum; }
|
271 |
void SetNum(int i) { m_iNum = i; }
|
267 |
void SetNum(int i) { m_iNum = i; }
|
272 |
|
268 |
|
273 |
bool IsFullyLoaded() { return m_bFullyLoaded; }
|
269 |
bool IsFullyLoaded() { return m_bFullyLoaded; }
|
274 |
virtual bool IsSigned () { return m_bSigned;}
|
270 |
virtual bool IsSigned () { return m_bSigned;}
|
Line 281... |
Line 277... |
281 |
protected:
|
277 |
protected:
|
282 |
virtual void Delete ();
|
278 |
virtual void Delete ();
|
283 |
virtual void SetDefaults ();
|
279 |
virtual void SetDefaults ();
|
284 |
|
280 |
|
285 |
// reading of files
|
281 |
// reading of files
|
286 |
virtual bool CheckHeader(const Utils::String header) const;
|
282 |
virtual bool _checkHeader(const Utils::String header) const;
|
287 |
virtual bool ParseHeader ( CyString header );
|
283 |
bool _parseHeader(const Utils::String &header);
|
288 |
virtual bool ParseFileHeader ( CyString header );
|
284 |
bool _parseFileHeader(const Utils::String& header);
|
289 |
virtual bool ParseFilesLine ( CyString line );
|
285 |
bool _parseFilesLine(const Utils::String& line);
|
290 |
virtual void ReadValues ( CyString values );
|
286 |
void _readValues(const Utils::String& values);
|
291 |
virtual void ReadFiles ( CyString values );
|
287 |
void _readFiles(const Utils::String& values);
|
292 |
|
288 |
|
293 |
void _install_adjustFakePatches(CPackages *pPackages);
|
289 |
void _install_adjustFakePatches(CPackages *pPackages);
|
294 |
void _install_renameText(CPackages *pPackages);
|
290 |
void _install_renameText(CPackages *pPackages);
|
295 |
bool _install_uncompress(C_File *fit, CProgressInfo *progress, CyStringList *errorStr, bool *uncomprToFile);
|
291 |
bool _install_uncompress(C_File *fit, CProgressInfo *progress, Utils::CStringList *errorStr, bool *uncomprToFile);
|
296 |
bool _install_setEnabled(bool bEnable, C_File *fit);
|
292 |
bool _install_setEnabled(bool bEnable, C_File *fit);
|
297 |
bool _install_checkVersion(C_File *pFile, const Utils::String &sDestination);
|
293 |
bool _install_checkVersion(C_File *pFile, const Utils::String &sDestination);
|
298 |
Utils::String _install_adjustFilepointer(C_File *pFile, bool bEnabled, const Utils::String &sDestination);
|
294 |
Utils::String _install_adjustFilepointer(C_File *pFile, bool bEnabled, const Utils::String &sDestination);
|
299 |
C_File *_install_checkFile(C_File *pFile, CyStringList *errorStr, bool *bDoFile, CLinkList<C_File> *pFileList);
|
295 |
C_File *_install_checkFile(C_File *pFile, Utils::CStringList *errorStr, bool *bDoFile, CLinkList<C_File> *pFileList);
|
300 |
bool _install_checkFileEnable(C_File *pCheckFile, C_File *fit, const Utils::String &sDestination, bool bEnabled, CyStringList *errorStr);
|
296 |
bool _install_checkFileEnable(C_File *pCheckFile, C_File *fit, const Utils::String &sDestination, bool bEnabled, Utils::CStringList *errorStr);
|
301 |
bool _install_createDirectory(CDirIO &Dir, const Utils::String &sTo, C_File *pFile, CyStringList *errorStr);
|
297 |
bool _install_createDirectory(CDirIO &Dir, const Utils::String &sTo, C_File *pFile, Utils::CStringList *errorStr);
|
302 |
void _install_writeFile(C_File *pFile, const Utils::String &sDestination, CyStringList *errorStr);
|
298 |
void _install_writeFile(C_File *pFile, const Utils::String &sDestination, Utils::CStringList *errorStr);
|
303 |
|
299 |
|
304 |
int _read_FileHeader(CFileIO &File, int iReadType, int iMaxProgress, int iDoneLen, CProgressInfo *pProgress);
|
300 |
int _read_FileHeader(CFileIO &File, int iReadType, int iMaxProgress, int iDoneLen, CProgressInfo *pProgress);
|
305 |
int _read_Header(CFileIO &File, int iReadType, int iMaxProgress, CProgressInfo *pProgress);
|
301 |
int _read_Header(CFileIO &File, int iReadType, int iMaxProgress, CProgressInfo *pProgress);
|
306 |
CFileIO *_startRead();
|
302 |
CFileIO *_startRead();
|
307 |
|
303 |
|