Subversion Repositories spk

Rev

Rev 43 | Rev 47 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 43 Rev 46
Line 12... Line 12...
12
#include "lists.h"
12
#include "lists.h"
13
#include "StringList.h"
13
#include "StringList.h"
14
#include "File.h"
14
#include "File.h"
15
#include "Utils/String.h"
15
#include "Utils/String.h"
16
 
16
 
-
 
17
#include "Package/CorePackage.h"
-
 
18
 
17
#define GAME_ALL			0
19
#define GAME_ALL			0
18
#define GAME_X2				1
20
#define GAME_X2				1
19
#define GAME_X3				2
21
#define GAME_X3				2
20
#define GAME_X3TC			3
22
#define GAME_X3TC			3
21
#define GAME_X3AP			4
23
#define GAME_X3AP			4
Line 62... Line 64...
62
	int iValueCompression;
64
	int iValueCompression;
63
	unsigned long lValueCompressSize;
65
	unsigned long lValueCompressSize;
64
} SSPKHeader;
66
} SSPKHeader;
65
 
67
 
66
tstruct SNeededLibrary {
68
tstruct SNeededLibrary {
67
	CyString	sName;
69
	Utils::String	sName;
68
	CyString	sAuthor;
70
	Utils::String	sAuthor;
69
	CyString	sMinVersion;
71
	Utils::String	sMinVersion;
70
} SNeededLibrary;
72
} SNeededLibrary;
71
 
73
 
72
tstruct SGameCompat {
74
tstruct SGameCompat {
73
	int			iGame;
75
	int			iGame;
74
	CyString	sVersion;
76
	Utils::String	sVersion;
75
	int			iVersion;
77
	int			iVersion;
76
} SGameCompat;
78
} SGameCompat;
77
 
79
 
78
tstruct SSPKHeader2 {
80
tstruct SSPKHeader2 {
79
	SSPKHeader2 () { iNumFiles = 0; lSize = 0; lFullSize = 0; }
81
	SSPKHeader2 () { iNumFiles = 0; lSize = 0; lFullSize = 0; }
Line 82... Line 84...
82
	long lFullSize;
84
	long lFullSize;
83
	int iFileCompression;
85
	int iFileCompression;
84
	int iDataCompression;
86
	int iDataCompression;
85
} SSPKHeader2;
87
} SSPKHeader2;
86
 
88
 
87
tstruct SInstallText {
-
 
88
	int		iLanguage;
-
 
89
	CyString	sBefore;
-
 
90
	CyString	sAfter;
-
 
91
} SInstallText;
-
 
92
 
-
 
93
typedef struct SNames {
89
typedef struct SNames {
94
	int iLanguage;
90
	int iLanguage;
95
	CyString sName;
91
	Utils::String sName;
96
} SNames;
92
} SNames;
97
 
93
 
98
 
94
 
99
class SPKEXPORT CBaseFile 
95
class SPKEXPORT CBaseFile : public SPK::Package::CCorePackage
100
{
96
{
101
public:
97
public:
102
	static Utils::String ConvertGameToString(int game);
98
	static Utils::String ConvertGameToString(int game);
103
	static int GetGameFromString(const Utils::String &game);
99
	static int GetGameFromString(const Utils::String &game);
104
	static CyString ErrorString(int error, CyString errorStr = NullString);
100
	static CyString ErrorString(int error, CyString errorStr = NullString);
Line 144... Line 140...
144
	virtual CyString GetFullPackageName(CyString format, int lang);
140
	virtual CyString GetFullPackageName(CyString format, int lang);
145
	CyString GetAutosaveName();
141
	CyString GetAutosaveName();
146
	void SetAutosaveName() { m_sFilename = GetAutosaveName(); }
142
	void SetAutosaveName() { m_sFilename = GetAutosaveName(); }
147
	SGameCompat *GetGameCompatability(int game);
143
	SGameCompat *GetGameCompatability(int game);
148
	bool RemoveGameCompatability(int game);
144
	bool RemoveGameCompatability(int game);
149
	void AddGameCompatability(int game, CyString version);
145
	void AddGameCompatability(int game, const Utils::String &version);
150
	bool CheckGameCompatability(int game);
146
	bool CheckGameCompatability(int game);
151
	bool CheckGameVersionCompatability(int game, CyString sVersion, int iVersion);
147
	bool CheckGameVersionCompatability(int game, CyString sVersion, int iVersion);
152
	bool AnyGameCompatability() { return !m_lGames.empty(); }
148
	bool AnyGameCompatability() { return !m_lGames.empty(); }
153
 
149
 
154
	bool AnyWebMirrors() { return !m_lMirrors.Empty(); }
150
	bool AnyWebMirrors() { return !m_lMirrors.Empty(); }
Line 160... Line 156...
160
	CLinkList<C_File> *GetFileList(int type);
156
	CLinkList<C_File> *GetFileList(int type);
161
	C_File *GetFirstFile(int type) const;
157
	C_File *GetFirstFile(int type) const;
162
	C_File *GetNextFile(C_File *prev) const;
158
	C_File *GetNextFile(C_File *prev) const;
163
	C_File *GetPrevFile(C_File *next) const;
159
	C_File *GetPrevFile(C_File *next) const;
164
 
160
 
165
	int GetRecommended() { return m_iRecommended; }
-
 
166
	int GetEaseOfUse() { return m_iEaseOfUse; }
-
 
167
	int GetGameChanging() { return m_iGameChanging; }
-
 
168
 
-
 
169
	virtual Utils::String CreateValuesLine () const;
161
	virtual Utils::String CreateValuesLine () const;
170
 
162
 
171
	virtual bool LoadPackageData(const Utils::String &sFfirst, const Utils::String &sRest);
163
	virtual bool LoadPackageData(const Utils::String &sFfirst, const Utils::String &sRest);
172
	virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
164
	virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
173
	virtual bool GeneratePackagerScriptFile(bool wildcard, CyStringList *list);
165
	virtual bool GeneratePackagerScriptFile(bool wildcard, CyStringList *list);
Line 199... Line 191...
199
	void AddFileScript(int filetype, bool shared, CyString rest);
191
	void AddFileScript(int filetype, bool shared, CyString rest);
200
	void SetFilename ( CyString str ) { m_sFilename = str; }
192
	void SetFilename ( CyString str ) { m_sFilename = str; }
201
	CyString GetFilename() { return m_sFilename; }
193
	CyString GetFilename() { return m_sFilename; }
202
	CyString GetExportFilename() { return m_sExportFilename; }
194
	CyString GetExportFilename() { return m_sExportFilename; }
203
 
195
 
204
	void SetRecommended ( int i ) { m_iRecommended = i; m_bChanged = true; }
-
 
205
	void SetGameChanging ( int i ) { m_iGameChanging = i; m_bChanged = true; }
-
 
206
	void SetEaseOfUse ( int i ) { m_iEaseOfUse = i; m_bChanged = true; }
-
 
207
 
-
 
208
	bool IsMod();
196
	bool IsMod();
209
	bool IsFakePatch() const;
197
	bool IsFakePatch() const;
210
 
198
 
211
	// error handling
199
	// error handling
212
	void ClearError () { m_sLastError = ""; m_iLastError = SPKERR_NONE; }
200
	void ClearError () { m_sLastError = ""; m_iLastError = SPKERR_NONE; }
Line 278... Line 266...
278
	void SetLoadError(int i) { m_iLoadError = i; }
266
	void SetLoadError(int i) { m_iLoadError = i; }
279
	CyString CreateUpdateFile(CyString dir);
267
	CyString CreateUpdateFile(CyString dir);
280
 
268
 
281
	// language functions
269
	// language functions
282
	void RemoveLanguageName ( int lang );
270
	void RemoveLanguageName ( int lang );
283
	void AddLanguageName ( int lang, CyString name );
271
	void AddLanguageName ( int lang, const Utils::String &name );
284
	void ClearNames ();
272
	void ClearNames ();
285
 
273
 
286
	virtual bool ParseValueLine(const Utils::String &line);
274
	virtual bool ParseValueLine(const Utils::String &line);
287
	int	ParseInstallText(CyString lang);
275
	int	ParseInstallText(const Utils::String &lang);
288
 
276
 
289
	CLinkList<SInstallText> *GetInstallTextList() { return &m_lInstallText; }
-
 
290
	CLinkList<SInstallText> *GetUninstallTextList() { return &m_lUninstallText; }
-
 
291
	CLinkList<SGameCompat>  *GetGameCompatabilityList() { return &m_lGames; }
277
	CLinkList<SGameCompat>  *GetGameCompatabilityList() { return &m_lGames; }
292
	CyString GetInstallAfterText ( int lang, bool noDefault = false ) { return GetAfterText ( &m_lInstallText, lang, noDefault ); }
-
 
293
	CyString GetInstallBeforeText ( int lang, bool noDefault = false ) { return GetBeforeText ( &m_lInstallText, lang, noDefault ); }
-
 
294
	CyString GetUninstallAfterText ( int lang, bool noDefault = false ) { return GetAfterText ( &m_lUninstallText, lang, noDefault ); }
-
 
295
	CyString GetUninstallBeforeText ( int lang, bool noDefault = false ) { return GetBeforeText ( &m_lUninstallText, lang, noDefault ); }
-
 
296
 
-
 
297
	SInstallText *AddInstallBeforeText ( int lang, CyString data ) { return AddInstallText ( true, true, lang, data ); }
-
 
298
	SInstallText *AddInstallAfterText ( int lang, CyString data ) { return AddInstallText ( false, true, lang, data ); }
-
 
299
	SInstallText *AddUninstallBeforeText ( int lang, CyString data ) { return AddInstallText ( true, false, lang, data ); }
-
 
300
	SInstallText *AddUninstallAfterText ( int lang, CyString data ) { return AddInstallText ( false, false, lang, data ); }
-
 
301
	SInstallText *FindInstallText ( int lang ) { return FindInstallText ( true, lang ); }
-
 
302
	SInstallText *FindUninstallText ( int lang ) { return FindInstallText ( false, lang ); }
-
 
303
	void AddInstallText ( SInstallText * );
-
 
304
	void AddUninstallText ( SInstallText * );
-
 
305
	void RemoveInstallText ( int lang ) { RemoveInstallText ( true, lang ); }
-
 
306
	void RemoveUninstallText ( int lang  ) { RemoveInstallText ( false, lang ); }
-
 
307
	bool IsThereInstallText () { return IsThereInstallText ( true ); }
-
 
308
	bool IsThereUninstallText () { return IsThereInstallText ( false ); }
-
 
309
 
278
 
310
	CyString GetFullFileSizeString();
279
	CyString GetFullFileSizeString();
311
 
280
 
312
	CLinkList<SNeededLibrary> *GetNeededLibraries() { return &m_lNeededLibrarys; }
281
	CLinkList<SNeededLibrary> *GetNeededLibraries() { return &m_lNeededLibrarys; }
313
	void AddNeededLibrary(CyString scriptName, CyString author, CyString minVersion);
282
	void AddNeededLibrary(const Utils::String &scriptName, const Utils::String &author, const Utils::String &minVersion);
314
	bool IsPackageNeeded(CyString scriptName, CyString author);
283
	bool IsPackageNeeded(const Utils::String &scriptName, const Utils::String &author);
315
	SNeededLibrary *FindPackageNeeded(CyString scriptName, CyString author);
284
	SNeededLibrary *FindPackageNeeded(const Utils::String &scriptName, const Utils::String &author);
316
	void RemovePackageNeeded(CyString scriptName, CyString author);
285
	void RemovePackageNeeded(const Utils::String &scriptName, const Utils::String &author);
317
	void ClearNeededPackages();
286
	void ClearNeededPackages();
318
	bool AnyDependacies() { return (m_lNeededLibrarys.size()) ? true: false; }
287
	bool AnyDependacies() { return (m_lNeededLibrarys.size()) ? true: false; }
319
	bool AutoGenerateUpdateFile() { return m_bAutoGenerateUpdateFile; }
288
	bool AutoGenerateUpdateFile() { return m_bAutoGenerateUpdateFile; }
320
	void RemoveFakePatchOrder(bool after, CyString scriptName, CyString author);
289
	void RemoveFakePatchOrder(bool after, CyString scriptName, CyString author);
321
	void RemoveFakePatchOrder(CyString scriptName, CyString author);
290
	void RemoveFakePatchOrder(CyString scriptName, CyString author);
Line 362... Line 331...
362
	virtual bool ParseFileHeader ( CyString header );
331
	virtual bool ParseFileHeader ( CyString header );
363
	virtual bool ParseFilesLine ( CyString line );
332
	virtual bool ParseFilesLine ( CyString line );
364
	virtual void ReadValues ( CyString values );
333
	virtual void ReadValues ( CyString values );
365
	virtual void ReadFiles ( CyString values );
334
	virtual void ReadFiles ( CyString values );
366
 
335
 
367
	SInstallText *AddInstallText ( bool before, bool install, int lang, CyString data );
-
 
368
	SInstallText *FindInstallText ( bool install, int lang );
-
 
369
	void RemoveInstallText ( bool install, int lang );
-
 
370
	bool IsThereInstallText ( bool );
-
 
371
 
-
 
372
	CyString GetAfterText ( CLinkList<SInstallText> *list, int lang, bool noDefault = false );
-
 
373
	CyString GetBeforeText ( CLinkList<SInstallText> *list, int lang, bool noDefault = false );
-
 
374
 
-
 
375
	void _install_adjustFakePatches(CPackages *pPackages);
336
	void _install_adjustFakePatches(CPackages *pPackages);
376
	void _install_renameText(CPackages *pPackages);
337
	void _install_renameText(CPackages *pPackages);
377
 
338
 
378
	int m_iType;
339
	int m_iType;
379
	SSPKHeader m_SHeader;
340
	SSPKHeader m_SHeader;
Line 397... Line 358...
397
	CyString m_sFilename;
358
	CyString m_sFilename;
398
	CyString m_sExportFilename;
359
	CyString m_sExportFilename;
399
 
360
 
400
	CLinkList<C_File>  m_lFiles;
361
	CLinkList<C_File>  m_lFiles;
401
	CLinkList<SNames> m_lNames;
362
	CLinkList<SNames> m_lNames;
402
	CLinkList<SInstallText> m_lInstallText;
-
 
403
	CLinkList<SInstallText> m_lUninstallText;
-
 
404
	CyStringList m_lMirrors;
363
	CyStringList m_lMirrors;
405
	CyStringList m_lFakePatchBefore;
364
	CyStringList m_lFakePatchBefore;
406
	CyStringList m_lFakePatchAfter;
365
	CyStringList m_lFakePatchAfter;
407
 
366
 
408
	int m_iPluginType;
367
	int m_iPluginType;
409
	CLinkList<SGameCompat> m_lGames;
368
	CLinkList<SGameCompat> m_lGames;
410
 
369
 
411
	// package stats
-
 
412
	int m_iRecommended;
-
 
413
	int m_iEaseOfUse;
-
 
414
	int m_iGameChanging;
-
 
415
 
-
 
416
	bool m_bSigned;
370
	bool m_bSigned;
417
	bool m_bFullyLoaded;
371
	bool m_bFullyLoaded;
418
 
372
 
419
	//installer varibles
373
	//installer varibles
420
	bool m_bEnable;
374
	bool m_bEnable;