| 6 | cycrow | 1 | // BaseFile.h: interface for the CBaseFile class.
 | 
        
           |  |  | 2 | //
 | 
        
           |  |  | 3 | //////////////////////////////////////////////////////////////////////
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 | #ifndef __BASEFILE_H__
 | 
        
           |  |  | 6 | #define __BASEFILE_H__
 | 
        
           |  |  | 7 |   | 
        
           |  |  | 8 | #if _MSC_VER > 1000
 | 
        
           |  |  | 9 | #pragma once
 | 
        
           |  |  | 10 | #endif // _MSC_VER > 1000
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | #include "lists.h"
 | 
        
           |  |  | 13 | #include "StringList.h"
 | 
        
           |  |  | 14 | #include "File.h"
 | 
        
           | 8 | cycrow | 15 | #include "Utils/String.h"
 | 
        
           | 6 | cycrow | 16 |   | 
        
           |  |  | 17 | #define GAME_ALL			0
 | 
        
           |  |  | 18 | #define GAME_X2				1
 | 
        
           |  |  | 19 | #define GAME_X3				2
 | 
        
           |  |  | 20 | #define GAME_X3TC			3
 | 
        
           |  |  | 21 | #define GAME_X3AP			4
 | 
        
           |  |  | 22 | #define GAME_XREBIRTH		5
 | 
        
           |  |  | 23 | #define GAME_MAX			(GAME_XREBIRTH)
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 | #define FILEVERSION 4.20f
 | 
        
           | 20 | cycrow | 26 |   | 
        
           | 6 | cycrow | 27 | #define WRITECHUNK		50000
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | class CPackages;
 | 
        
           |  |  | 30 |   | 
        
           |  |  | 31 | enum {
 | 
        
           |  |  | 32 | 	READFLAG_NONE = 0,
 | 
        
           |  |  | 33 | 	READFLAG_NOUNCOMPRESS = 1
 | 
        
           |  |  | 34 | };
 | 
        
           |  |  | 35 |   | 
        
           |  |  | 36 | enum {SPKFILE_INVALID, SPKFILE_SINGLE, SPKFILE_MULTI, SPKFILE_SINGLESHIP, SPKFILE_OLD, SPKFILE_BASE};
 | 
        
           |  |  | 37 | enum {SPKREAD_ALL, SPKREAD_NODATA, SPKREAD_VALUES, SPKREAD_HEADER};
 | 
        
           |  |  | 38 | enum {DELETESTATE_NONE, DELETESTATE_WAITING, DELETESTATE_DONE};
 | 
        
           |  |  | 39 | enum {SPKINSTALL_CREATEDIRECTORY, SPKINSTALL_CREATEDIRECTORY_FAIL, SPKINSTALL_WRITEFILE, SPKINSTALL_WRITEFILE_FAIL, SPKINSTALL_DELETEFILE, SPKINSTALL_DELETEFILE_FAIL,
 | 
        
           |  |  | 40 | 		SPKINSTALL_SKIPFILE, SPKINSTALL_REMOVEDIR, SPKINSTALL_ENABLEFILE, SPKINSTALL_DISABLEFILE, SPKINSTALL_ENABLEFILE_FAIL, SPKINSTALL_DISABLEFILE_FAIL,
 | 
        
           |  |  | 41 | 		SPKINSTALL_UNINSTALL_MOVE, SPKINSTALL_UNINSTALL_COPY, SPKINSTALL_UNINSTALL_MOVE_FAIL, SPKINSTALL_UNINSTALL_COPY_FAIL, SPKINSTALL_UNINSTALL_REMOVE, SPKINSTALL_UNINSTALL_REMOVE_FAIL,
 | 
        
           |  |  | 42 | 		SPKINSTALL_ORIGINAL_BACKUP, SPKINSTALL_ORIGINAL_RESTORE, SPKINSTALL_ORIGINAL_BACKUP_FAIL, SPKINSTALL_ORIGINAL_RESTORE_FAIL, SPKINSTALL_FAKEPATCH, SPKINSTALL_FAKEPATCH_FAIL, 
 | 
        
           |  |  | 43 | 		SPKINSTALL_MISSINGFILE, SPKINSTALL_SHARED, SPKINSTALL_SHARED_FAIL, SPKINSTALL_ORPHANED, SPKINSTALL_ORPHANED_FAIL, SPKINSTALL_UNCOMPRESS_FAIL, SPKINSTALL_AUTOTEXT, SPKINSTALL_AUTOTEXT_FAIL
 | 
        
           |  |  | 44 | };
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 | enum {PACKAGETYPE_NORMAL, PACKAGETYPE_LIBRARY, PACKAGETYPE_CUSTOMSTART, PACKAGETYPE_PATCH, PACKAGETYPE_UPDATE, PACKAGETYPE_MOD, PACKAGETYPE_SHIP, PACKAGETYPE_FAKEPATCH};
 | 
        
           |  |  | 47 | enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
 | 
        
           |  |  | 48 |   | 
        
           |  |  | 49 | enum {TYPE_BASE, TYPE_SPK, TYPE_XSP, TYPE_ARCHIVE};
 | 
        
           |  |  | 50 |   | 
        
           |  |  | 51 | // text pages
 | 
        
           |  |  | 52 | #define TEXTPAGE_RACE		1266
 | 
        
           |  |  | 53 | #define TEXTPAGE_OBJECTS	17
 | 
        
           |  |  | 54 | #define TEXTPAGE_CLASS		2006
 | 
        
           |  |  | 55 | #define TEXTPAGE_CARGOCLASS	1999
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 |   | 
        
           |  |  | 58 | // spk header struct
 | 
        
           |  |  | 59 | tstruct SSPKHeader {
 | 
        
           |  |  | 60 | 	SSPKHeader () { fVersion = 0; iValueCompression = lValueCompressSize = 0; }
 | 
        
           |  |  | 61 | 	float fVersion;
 | 
        
           |  |  | 62 | 	int iValueCompression;
 | 
        
           |  |  | 63 | 	unsigned long lValueCompressSize;
 | 
        
           |  |  | 64 | } SSPKHeader;
 | 
        
           |  |  | 65 |   | 
        
           |  |  | 66 | tstruct SNeededLibrary {
 | 
        
           |  |  | 67 | 	CyString	sName;
 | 
        
           |  |  | 68 | 	CyString	sAuthor;
 | 
        
           |  |  | 69 | 	CyString	sMinVersion;
 | 
        
           |  |  | 70 | } SNeededLibrary;
 | 
        
           |  |  | 71 |   | 
        
           |  |  | 72 | tstruct SGameCompat {
 | 
        
           |  |  | 73 | 	int			iGame;
 | 
        
           |  |  | 74 | 	CyString	sVersion;
 | 
        
           |  |  | 75 | 	int			iVersion;
 | 
        
           |  |  | 76 | } SGameCompat;
 | 
        
           |  |  | 77 |   | 
        
           |  |  | 78 | tstruct SSPKHeader2 {
 | 
        
           |  |  | 79 | 	SSPKHeader2 () { iNumFiles = 0; lSize = 0; lFullSize = 0; }
 | 
        
           |  |  | 80 | 	int iNumFiles;
 | 
        
           |  |  | 81 | 	long lSize;
 | 
        
           |  |  | 82 | 	long lFullSize;
 | 
        
           |  |  | 83 | 	int iFileCompression;
 | 
        
           |  |  | 84 | 	int iDataCompression;
 | 
        
           |  |  | 85 | } SSPKHeader2;
 | 
        
           |  |  | 86 |   | 
        
           |  |  | 87 | tstruct SInstallText {
 | 
        
           |  |  | 88 | 	int		iLanguage;
 | 
        
           |  |  | 89 | 	CyString	sBefore;
 | 
        
           |  |  | 90 | 	CyString	sAfter;
 | 
        
           |  |  | 91 | } SInstallText;
 | 
        
           |  |  | 92 |   | 
        
           |  |  | 93 | typedef struct SNames {
 | 
        
           |  |  | 94 | 	int iLanguage;
 | 
        
           |  |  | 95 | 	CyString sName;
 | 
        
           |  |  | 96 | } SNames;
 | 
        
           |  |  | 97 |   | 
        
           |  |  | 98 |   | 
        
           |  |  | 99 | class SPKEXPORT CBaseFile 
 | 
        
           |  |  | 100 | {
 | 
        
           |  |  | 101 | public:
 | 
        
           | 13 | cycrow | 102 | 	static Utils::String ConvertGameToString(int game);
 | 
        
           |  |  | 103 | 	static int GetGameFromString(const Utils::String &game);
 | 
        
           | 6 | cycrow | 104 | 	static CyString ErrorString(int error, CyString errorStr = NullString);
 | 
        
           |  |  | 105 |   | 
        
           |  |  | 106 | 	CBaseFile();
 | 
        
           |  |  | 107 | 	virtual ~CBaseFile();
 | 
        
           |  |  | 108 |   | 
        
           |  |  | 109 | 	// Get basic Settings
 | 
        
           |  |  | 110 | 	CyString GetName ()			{ return m_sName; }
 | 
        
           |  |  | 111 | 	CyString GetVersion ()		{ return m_sVersion; }
 | 
        
           |  |  | 112 | 	CyString GetAuthor ()		{ return m_sAuthor; }
 | 
        
           |  |  | 113 | 	CyString GetWebSite ()		{ return m_sWebSite; }
 | 
        
           |  |  | 114 | 	CyString GetWebAddress ()	{ return m_sWebAddress; }
 | 
        
           |  |  | 115 | 	CyString GetEmail ()		{ return m_sEmail; }
 | 
        
           |  |  | 116 | 	CyString GetCreationDate ()	{ return m_sCreationDate; }
 | 
        
           |  |  | 117 | 	CyString GetDescription ()	{ return m_sDescription; }
 | 
        
           |  |  | 118 | 	CyString GetForumLink ()	{ return m_sForumLink; }
 | 
        
           |  |  | 119 | 	virtual CyString GetFullPackageName(int language, CyString byString) { return GetFullPackageName(language, true, byString); }
 | 
        
           |  |  | 120 | 	virtual CyString GetFullPackageName(int language, bool includeVersion = true, CyString byString = "by") 
 | 
        
           |  |  | 121 | 	{ 
 | 
        
           |  |  | 122 | 		CyString p;
 | 
        
           |  |  | 123 | 		if ( language == -1 )
 | 
        
           |  |  | 124 | 			p = m_sName;
 | 
        
           |  |  | 125 | 		else
 | 
        
           |  |  | 126 | 			p = GetLanguageName(language);
 | 
        
           |  |  | 127 | 		if ( includeVersion )
 | 
        
           |  |  | 128 | 		{
 | 
        
           |  |  | 129 | 			p += " V";
 | 
        
           |  |  | 130 | 			p += m_sVersion;
 | 
        
           |  |  | 131 | 		}
 | 
        
           |  |  | 132 | 		p += " ";
 | 
        
           |  |  | 133 | 		p += byString + " " + m_sAuthor;
 | 
        
           |  |  | 134 | 		return p;
 | 
        
           |  |  | 135 | 	}
 | 
        
           |  |  | 136 | 	CLinkList<C_File> *GetFileList() { return &m_lFiles; }
 | 
        
           |  |  | 137 | 	C_File *GetIcon () { return m_pIconFile; }
 | 
        
           |  |  | 138 | 	CyString GetIconExt () { return m_sIconExt; }
 | 
        
           |  |  | 139 | 	CyString GetNameValidFile ();
 | 
        
           |  |  | 140 | 	int GetDataCompression () { return m_SHeader2.iDataCompression; }
 | 
        
           |  |  | 141 | 	float GetFileVersion () { return m_SHeader.fVersion; }
 | 
        
           |  |  | 142 | 	long GetFullFileSize ();
 | 
        
           |  |  | 143 | 	CyString GetLanguageName ( int lang );
 | 
        
           |  |  | 144 | 	virtual CyString GetFullPackageName(CyString format, int lang);
 | 
        
           |  |  | 145 | 	CyString GetAutosaveName();
 | 
        
           |  |  | 146 | 	void SetAutosaveName() { m_sFilename = GetAutosaveName(); }
 | 
        
           |  |  | 147 | 	SGameCompat *GetGameCompatability(int game);
 | 
        
           |  |  | 148 | 	bool RemoveGameCompatability(int game);
 | 
        
           |  |  | 149 | 	void AddGameCompatability(int game, CyString version);
 | 
        
           |  |  | 150 | 	bool CheckGameCompatability(int game);
 | 
        
           |  |  | 151 | 	bool CheckGameVersionCompatability(int game, CyString sVersion, int iVersion);
 | 
        
           |  |  | 152 | 	bool AnyGameCompatability() { return !m_lGames.empty(); }
 | 
        
           |  |  | 153 |   | 
        
           |  |  | 154 | 	bool AnyWebMirrors() { return !m_lMirrors.Empty(); }
 | 
        
           |  |  | 155 | 	CyStringList *GetWebMirrors() { return &m_lMirrors; }
 | 
        
           |  |  | 156 | 	int GetMaxWebMirrors() { return m_lMirrors.Count(); }
 | 
        
           |  |  | 157 | 	CyString GetWebMirror(int i) { if ( i >= 0 && i < m_lMirrors.Count() ) return m_lMirrors.StringAt(i); return NullString; }
 | 
        
           |  |  | 158 | 	void ClearWebMirrors() { m_lMirrors.Clear(); }
 | 
        
           |  |  | 159 |   | 
        
           |  |  | 160 | 	CLinkList<C_File> *GetFileList(int type);
 | 
        
           | 13 | cycrow | 161 | 	C_File *GetFirstFile(int type) const;
 | 
        
           |  |  | 162 | 	C_File *GetNextFile(C_File *prev) const;
 | 
        
           |  |  | 163 | 	C_File *GetPrevFile(C_File *next) const;
 | 
        
           | 6 | cycrow | 164 |   | 
        
           |  |  | 165 | 	int GetRecommended() { return m_iRecommended; }
 | 
        
           |  |  | 166 | 	int GetEaseOfUse() { return m_iEaseOfUse; }
 | 
        
           |  |  | 167 | 	int GetGameChanging() { return m_iGameChanging; }
 | 
        
           |  |  | 168 |   | 
        
           | 14 | cycrow | 169 | 	virtual Utils::String CreateValuesLine () const;
 | 
        
           | 6 | cycrow | 170 |   | 
        
           | 14 | cycrow | 171 | 	virtual bool LoadPackageData(const Utils::String &sFfirst, const Utils::String &sRest);
 | 
        
           | 6 | cycrow | 172 | 	virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
 | 
        
           |  |  | 173 | 	virtual bool GeneratePackagerScriptFile(bool wildcard, CyStringList *list);
 | 
        
           |  |  | 174 |   | 
        
           |  |  | 175 | 	void ConvertNormalMod(C_File *f, CyString to);
 | 
        
           |  |  | 176 | 	void ConvertFakePatch(C_File *f);
 | 
        
           |  |  | 177 | 	void ConvertAutoText(C_File *f);
 | 
        
           |  |  | 178 | 	C_File *FindMatchingMod(C_File *f);
 | 
        
           |  |  | 179 | 	void RenameFile(C_File *f, CyString baseName);
 | 
        
           |  |  | 180 |   | 
        
           |  |  | 181 | 	// set basic settings
 | 
        
           |  |  | 182 | 	void SetName			( CyString str ) { m_sName = str.Remove ( '|' ); m_bChanged = true; }
 | 
        
           |  |  | 183 | 	void SetVersion			( CyString str ) { m_sVersion = str; m_bChanged = true; }
 | 
        
           |  |  | 184 | 	void SetAuthor			( CyString str ) { m_sAuthor = str.Remove ( '|' ); m_bChanged = true; }
 | 
        
           |  |  | 185 | 	void SetWebAddress		( CyString str ) { m_sWebAddress = str; m_bChanged = true; }
 | 
        
           |  |  | 186 | 	void SetWebSite			( CyString str ) { m_sWebSite = str; m_bChanged = true; }
 | 
        
           |  |  | 187 | 	void SetEmail			( CyString str ) { m_sEmail = str; m_bChanged = true; }
 | 
        
           |  |  | 188 | 	void SetCreationDate	( CyString str ) { m_sCreationDate = str; m_bChanged = true; }
 | 
        
           |  |  | 189 | 	void AddWebMirror		( CyString str ) { m_lMirrors.PushBack(str, "", true); m_bChanged = true; }
 | 
        
           |  |  | 190 | 	void RemoveWebMirror	( CyString str ) { m_lMirrors.Remove(str, true); m_bChanged = true; }
 | 
        
           |  |  | 191 | 	void SetDescription		( CyString str ) { m_sDescription = str; m_bChanged = true; }
 | 
        
           |  |  | 192 | 	void SetDataCompression ( int c )       { m_SHeader2.iDataCompression = c; }
 | 
        
           |  |  | 193 | 	void SetFileCompression ( int c )       { m_SHeader2.iFileCompression = c; }
 | 
        
           |  |  | 194 | 	void SetValueCompression( int c )       { m_SHeader.iValueCompression = c; }
 | 
        
           |  |  | 195 | 	void SetForumLink		( CyString str ) { m_sForumLink = str; m_bChanged = true; }
 | 
        
           |  |  | 196 | 	void SetIcon ( C_File *file, CyString ext ) { if ( m_pIconFile ) delete m_pIconFile; m_sIconExt = ext; m_pIconFile = file; m_bChanged = true; }
 | 
        
           |  |  | 197 | 	void SetFtpAddr			( CyString str ) { m_sFtpAddr = str; }
 | 
        
           |  |  | 198 |   | 
        
           |  |  | 199 | 	void AddFileScript(int filetype, bool shared, CyString rest);
 | 
        
           |  |  | 200 | 	void SetFilename ( CyString str ) { m_sFilename = str; }
 | 
        
           |  |  | 201 | 	CyString GetFilename() { return m_sFilename; }
 | 
        
           |  |  | 202 | 	CyString GetExportFilename() { return m_sExportFilename; }
 | 
        
           |  |  | 203 |   | 
        
           |  |  | 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();
 | 
        
           | 13 | cycrow | 209 | 	bool IsFakePatch() const;
 | 
        
           | 6 | cycrow | 210 |   | 
        
           |  |  | 211 | 	// error handling
 | 
        
           |  |  | 212 | 	void ClearError () { m_sLastError = ""; m_iLastError = SPKERR_NONE; }
 | 
        
           |  |  | 213 | 	int GetLastError () { return m_iLastError; }
 | 
        
           |  |  | 214 | 	CyString GetLastErrorString() { return m_sLastError; }
 | 
        
           |  |  | 215 |   | 
        
           |  |  | 216 | 	// file handling
 | 
        
           |  |  | 217 | 	void AddFile ( C_File *file );
 | 
        
           |  |  | 218 | 	C_File *AddFile ( CyString, CyString, int type, int game = 0 );
 | 
        
           |  |  | 219 | 	C_File *AppendFile ( CyString file, int type, int game, CyString dir = NullString, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 220 | 	C_File *FindFile ( CyString, int, CyString = NullString, int game = 0 );
 | 
        
           |  |  | 221 | 	bool AddFileNow ( CyString, CyString, int type, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 222 | 	int CountFiles ( int filetype );
 | 
        
           |  |  | 223 | 	C_File *FindFileAt ( int filetype, int pos );
 | 
        
           |  |  | 224 | 	virtual bool RemoveFile ( int pos );
 | 
        
           |  |  | 225 | 	virtual bool RemoveFile ( C_File *files );
 | 
        
           |  |  | 226 | 	virtual bool RemoveFile ( CyString file, int type, CyString dir = NullString, int game = 0 );
 | 
        
           |  |  | 227 | 	void RemoveAllFiles ( int type, int game );
 | 
        
           |  |  | 228 | 	CyString CreateFilesLine ( bool updateheader, CProgressInfo * = NULL );
 | 
        
           |  |  | 229 |   | 
        
           |  |  | 230 | 	virtual bool WriteHeader ( FILE *id, int, int );
 | 
        
           |  |  | 231 | 	virtual bool WriteData ( FILE *id, CProgressInfo * = NULL );
 | 
        
           |  |  | 232 | 	virtual bool WriteFile ( CyString filename, CProgressInfo * = NULL );
 | 
        
           |  |  | 233 | 	virtual bool ReadFile ( CyString filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 234 | 	virtual bool ReadFile ( FILE *id, int readtype, CProgressInfo *progress );
 | 
        
           |  |  | 235 |   | 
        
           |  |  | 236 | 	virtual bool ExtractFile ( C_File *file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 237 | 	virtual bool ExtractFile ( int file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 238 | 	virtual bool ExtractAll ( CyString dir, int game, bool includedir = true, CProgressInfo *progress = NULL );
 | 
        
           |  |  | 239 |   | 
        
           |  |  | 240 | 	virtual bool SaveToArchive(CyString filename, int game, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 241 | 	void ClearFileData();
 | 
        
           |  |  | 242 |   | 
        
           |  |  | 243 | 	CLinkList<SNames> *GetNamesList() { return &m_lNames; }
 | 
        
           |  |  | 244 |   | 
        
           |  |  | 245 | 	// reading files
 | 
        
           |  |  | 246 | 	void ReadAllFilesToMemory ();
 | 
        
           |  |  | 247 | 	void ReadIconFileToMemory ();
 | 
        
           |  |  | 248 | 	bool ReadFileToMemory(C_File *f);
 | 
        
           |  |  | 249 |   | 
        
           |  |  | 250 | 	// compression
 | 
        
           |  |  | 251 | 	void RecompressAllFiles ( int compresstype, CProgressInfo *progress );
 | 
        
           |  |  | 252 | 	void CompressAllFiles ( int compresstype, CProgressInfo *progress = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
 | 
        
           |  |  | 253 | 	bool UncompressAllFiles ( CProgressInfo * = NULL );
 | 
        
           |  |  | 254 |   | 
        
           |  |  | 255 | 	// static functions
 | 
        
           |  |  | 256 | 	static CyString GetEndOfLine ( FILE *id, int *line = NULL, bool upper = true );
 | 
        
           |  |  | 257 | 	static int CheckFile ( CyString filename, float *version = NULL );
 | 
        
           |  |  | 258 |   | 
        
           |  |  | 259 | 	bool IsFileAdded(C_File *f) { return m_lFiles.FindData(f); }
 | 
        
           |  |  | 260 |   | 
        
           |  |  | 261 | 	// installing
 | 
        
           |  |  | 262 | 	void SwitchFilePointer(C_File *oldFile, C_File *newFile);
 | 
        
           |  |  | 263 | 	bool InstallFiles ( CyString destdir, CProgressInfo *progress, CLinkList<C_File> *spklist, CyStringList *errorStr, bool enabled = true, CPackages *packages = NULL );
 | 
        
           |  |  | 264 | 	virtual bool IsPatch () { return false; }
 | 
        
           |  |  | 265 |   | 
        
           |  |  | 266 | 	// installer functions
 | 
        
           |  |  | 267 | 	bool IsProfileEnabled () { return m_bProfile; }
 | 
        
           |  |  | 268 | 	bool IsEnabled () { return m_bEnable; }
 | 
        
           |  |  | 269 | 	bool IsModifiedEnabled () { return m_bModifiedEnabled; }
 | 
        
           |  |  | 270 | 	bool IsGlobalEnabled () { return m_bGlobal; }
 | 
        
           |  |  | 271 |   | 
        
           |  |  | 272 | 	void SetProfileEnabled ( bool en ) { m_bProfile = en; }
 | 
        
           |  |  | 273 | 	void SetEnabled ( bool en ) { m_bEnable = en; }
 | 
        
           |  |  | 274 | 	void SetModifiedEnabled ( bool en ) { m_bModifiedEnabled = en; }
 | 
        
           |  |  | 275 | 	void SetGlobalEnabled ( bool en ) { m_bGlobal = en; }
 | 
        
           |  |  | 276 |   | 
        
           |  |  | 277 | 	int  GetLoadError() { return m_iLoadError; }
 | 
        
           |  |  | 278 | 	void SetLoadError(int i) { m_iLoadError = i; }
 | 
        
           |  |  | 279 | 	CyString CreateUpdateFile(CyString dir);
 | 
        
           |  |  | 280 |   | 
        
           |  |  | 281 | 	// language functions
 | 
        
           |  |  | 282 | 	void RemoveLanguageName ( int lang );
 | 
        
           |  |  | 283 | 	void AddLanguageName ( int lang, CyString name );
 | 
        
           |  |  | 284 | 	void ClearNames ();
 | 
        
           |  |  | 285 |   | 
        
           | 14 | cycrow | 286 | 	virtual bool ParseValueLine(const Utils::String &line);
 | 
        
           | 6 | cycrow | 287 | 	int	ParseInstallText(CyString lang);
 | 
        
           |  |  | 288 |   | 
        
           |  |  | 289 | 	CLinkList<SInstallText> *GetInstallTextList() { return &m_lInstallText; }
 | 
        
           |  |  | 290 | 	CLinkList<SInstallText> *GetUninstallTextList() { return &m_lUninstallText; }
 | 
        
           |  |  | 291 | 	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 |   | 
        
           |  |  | 310 | 	CyString GetFullFileSizeString();
 | 
        
           |  |  | 311 |   | 
        
           |  |  | 312 | 	CLinkList<SNeededLibrary> *GetNeededLibraries() { return &m_lNeededLibrarys; }
 | 
        
           |  |  | 313 | 	void AddNeededLibrary(CyString scriptName, CyString author, CyString minVersion);
 | 
        
           |  |  | 314 | 	bool IsPackageNeeded(CyString scriptName, CyString author);
 | 
        
           |  |  | 315 | 	SNeededLibrary *FindPackageNeeded(CyString scriptName, CyString author);
 | 
        
           |  |  | 316 | 	void RemovePackageNeeded(CyString scriptName, CyString author);
 | 
        
           |  |  | 317 | 	void ClearNeededPackages();
 | 
        
           |  |  | 318 | 	bool AnyDependacies() { return (m_lNeededLibrarys.size()) ? true: false; }
 | 
        
           |  |  | 319 | 	bool AutoGenerateUpdateFile() { return m_bAutoGenerateUpdateFile; }
 | 
        
           |  |  | 320 | 	void RemoveFakePatchOrder(bool after, CyString scriptName, CyString author);
 | 
        
           |  |  | 321 | 	void RemoveFakePatchOrder(CyString scriptName, CyString author);
 | 
        
           |  |  | 322 | 	void AddFakePatchOrder(bool after, CyString scriptName, CyString author);
 | 
        
           |  |  | 323 | 	bool AnyFakePatchOrder() { if ( !m_lFakePatchBefore.Empty() || !m_lFakePatchAfter.Empty() ) return true; return false; }
 | 
        
           |  |  | 324 | 	CyStringList &GetFakePatchBeforeOrder() { return m_lFakePatchBefore; }
 | 
        
           |  |  | 325 | 	CyStringList &GetFakePatchAfterOrder() { return m_lFakePatchAfter; }
 | 
        
           |  |  | 326 | 	int		GetPluginType() { return m_iPluginType; }
 | 
        
           |  |  | 327 | 	void	SetPluginType(int i) { m_iPluginType = i; m_bChanged = true; }
 | 
        
           |  |  | 328 |   | 
        
           |  |  | 329 | 	bool IsChanged() { return m_bChanged; }
 | 
        
           |  |  | 330 | 	void SetChanged(bool b) { m_bChanged = b; }
 | 
        
           |  |  | 331 |   | 
        
           |  |  | 332 | 	int  FindFirstGameInPackage();
 | 
        
           |  |  | 333 | 	bool IsAnyGameInPackage();
 | 
        
           |  |  | 334 | 	bool IsMultipleGamesInPackage();
 | 
        
           |  |  | 335 | 	bool IsGameInPackage(int game);
 | 
        
           |  |  | 336 |   | 
        
           |  |  | 337 | 	virtual int GetType () { return TYPE_BASE; }
 | 
        
           |  |  | 338 | 	bool AnyFileType ( int type );
 | 
        
           |  |  | 339 | 	CBaseFile *GetParent () { return m_pParent; }
 | 
        
           |  |  | 340 | 	void SetParent ( CBaseFile *file ) { m_pParent = file; }
 | 
        
           |  |  | 341 | 	int ParseLanguage(CyString lang);
 | 
        
           |  |  | 342 |   | 
        
           |  |  | 343 | 	virtual bool UpdateSigned (bool updateFiles);
 | 
        
           |  |  | 344 | 	int GetNum() { return m_iNum; }
 | 
        
           |  |  | 345 | 	void SetNum(int i) { m_iNum = i; }
 | 
        
           |  |  | 346 |   | 
        
           |  |  | 347 | 	bool	IsFullyLoaded() { return m_bFullyLoaded; }
 | 
        
           |  |  | 348 | 	virtual bool   IsSigned ()		{ return m_bSigned;}
 | 
        
           |  |  | 349 | 	void SetOverrideFiles(bool b) { m_bOverrideFiles = b; }
 | 
        
           |  |  | 350 | 	bool IsUpdateChecked () { return m_bUpdate; }
 | 
        
           |  |  | 351 | 	void SetUpdateChecked ( bool en ) { m_bUpdate = en; }
 | 
        
           |  |  | 352 |   | 
        
           |  |  | 353 | 	unsigned char *CreateData(size_t *size, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 354 |   | 
        
           |  |  | 355 | protected:
 | 
        
           |  |  | 356 | 	virtual void Delete ();
 | 
        
           |  |  | 357 | 	virtual void SetDefaults ();
 | 
        
           |  |  | 358 |   | 
        
           |  |  | 359 | 	// reading of files
 | 
        
           | 14 | cycrow | 360 | 	virtual bool CheckHeader(const Utils::String header) const;
 | 
        
           | 6 | cycrow | 361 | 	virtual bool ParseHeader ( CyString header );
 | 
        
           |  |  | 362 | 	virtual bool ParseFileHeader ( CyString header );
 | 
        
           |  |  | 363 | 	virtual bool ParseFilesLine ( CyString line );
 | 
        
           |  |  | 364 | 	virtual void ReadValues ( CyString values );
 | 
        
           |  |  | 365 | 	virtual void ReadFiles ( CyString values );
 | 
        
           |  |  | 366 |   | 
        
           |  |  | 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 |   | 
        
           | 14 | cycrow | 375 | 	void _install_adjustFakePatches(CPackages *pPackages);
 | 
        
           |  |  | 376 |   | 
        
           | 6 | cycrow | 377 | 	int m_iType;
 | 
        
           |  |  | 378 | 	SSPKHeader m_SHeader;
 | 
        
           |  |  | 379 | 	SSPKHeader2 m_SHeader2;
 | 
        
           |  |  | 380 |   | 
        
           |  |  | 381 | 	CyString m_sName;
 | 
        
           |  |  | 382 | 	CyString m_sVersion;
 | 
        
           |  |  | 383 | 	CyString m_sAuthor;
 | 
        
           |  |  | 384 | 	CyString m_sWebSite;
 | 
        
           |  |  | 385 | 	CyString m_sWebAddress;
 | 
        
           |  |  | 386 | 	CyString m_sEmail;
 | 
        
           |  |  | 387 | 	CyString m_sDescription;
 | 
        
           |  |  | 388 | 	CyString m_sCreationDate;
 | 
        
           |  |  | 389 | 	CyString m_sForumLink;
 | 
        
           |  |  | 390 |   | 
        
           |  |  | 391 | 	C_File *m_pIconFile;
 | 
        
           |  |  | 392 | 	CyString m_sIconExt;
 | 
        
           |  |  | 393 | 	CyString m_sLastError;
 | 
        
           |  |  | 394 | 	int m_iLastError;
 | 
        
           |  |  | 395 |   | 
        
           |  |  | 396 | 	CyString m_sFilename;
 | 
        
           |  |  | 397 | 	CyString m_sExportFilename;
 | 
        
           |  |  | 398 |   | 
        
           |  |  | 399 | 	CLinkList<C_File>  m_lFiles;
 | 
        
           |  |  | 400 | 	CLinkList<SNames> m_lNames;
 | 
        
           |  |  | 401 | 	CLinkList<SInstallText> m_lInstallText;
 | 
        
           |  |  | 402 | 	CLinkList<SInstallText> m_lUninstallText;
 | 
        
           |  |  | 403 | 	CyStringList m_lMirrors;
 | 
        
           |  |  | 404 | 	CyStringList m_lFakePatchBefore;
 | 
        
           |  |  | 405 | 	CyStringList m_lFakePatchAfter;
 | 
        
           |  |  | 406 |   | 
        
           |  |  | 407 | 	int m_iPluginType;
 | 
        
           |  |  | 408 | 	CLinkList<SGameCompat> m_lGames;
 | 
        
           |  |  | 409 |   | 
        
           |  |  | 410 | 	// package stats
 | 
        
           |  |  | 411 | 	int m_iRecommended;
 | 
        
           |  |  | 412 | 	int m_iEaseOfUse;
 | 
        
           |  |  | 413 | 	int m_iGameChanging;
 | 
        
           |  |  | 414 |   | 
        
           |  |  | 415 | 	bool m_bSigned;
 | 
        
           |  |  | 416 | 	bool m_bFullyLoaded;
 | 
        
           |  |  | 417 |   | 
        
           |  |  | 418 | 	//installer varibles
 | 
        
           |  |  | 419 | 	bool m_bEnable;
 | 
        
           |  |  | 420 | 	bool m_bModifiedEnabled;
 | 
        
           |  |  | 421 | 	bool m_bGlobal;
 | 
        
           |  |  | 422 | 	bool m_bProfile;
 | 
        
           |  |  | 423 | 	int m_iLoadError;
 | 
        
           |  |  | 424 |   | 
        
           |  |  | 425 | 	CBaseFile *m_pParent;
 | 
        
           |  |  | 426 |   | 
        
           |  |  | 427 | 	int m_iNum;
 | 
        
           |  |  | 428 | 	bool	m_bChanged;
 | 
        
           |  |  | 429 |   | 
        
           |  |  | 430 | 	CLinkList<SNeededLibrary> m_lNeededLibrarys;
 | 
        
           |  |  | 431 |   | 
        
           |  |  | 432 | 	bool	m_bOverrideFiles;
 | 
        
           |  |  | 433 | 	CyString	m_sFtpAddr;
 | 
        
           |  |  | 434 | 	bool	m_bAutoGenerateUpdateFile;
 | 
        
           |  |  | 435 | 	bool m_bUpdate;
 | 
        
           |  |  | 436 | };
 | 
        
           |  |  | 437 |   | 
        
           |  |  | 438 |   | 
        
           |  |  | 439 | class SPKEXPORT CArchiveFile : public CBaseFile
 | 
        
           |  |  | 440 | {
 | 
        
           |  |  | 441 | public:
 | 
        
           |  |  | 442 | 	CArchiveFile();
 | 
        
           |  |  | 443 | 	virtual ~CArchiveFile();
 | 
        
           |  |  | 444 | 	virtual CyString GetFullPackageName(CyString format, int lang) { return CyString("Archive(") + m_sName + ")"; }
 | 
        
           |  |  | 445 | 	virtual CyString GetFullPackageName(int language, CyString byString) { return CyString("Archive(") + m_sName + ")"; }
 | 
        
           |  |  | 446 | 	virtual CyString GetFullPackageName(int language, bool includeVersion = true, CyString byString = "by") { return CyString("Archive(") + m_sName + ")"; }
 | 
        
           |  |  | 447 | 	virtual int GetType () { return TYPE_ARCHIVE; }
 | 
        
           |  |  | 448 | };
 | 
        
           |  |  | 449 |   | 
        
           |  |  | 450 | #endif //__BASEFILE_H__
 | 
        
           |  |  | 451 |   |