| 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 "File.h"
 | 
        
           | 8 | cycrow | 14 | #include "Utils/String.h"
 | 
        
           | 109 | cycrow | 15 | #include "archive/zip.h"
 | 
        
           | 6 | cycrow | 16 |   | 
        
           | 46 | cycrow | 17 | #include "Package/CorePackage.h"
 | 
        
           |  |  | 18 |   | 
        
           | 6 | cycrow | 19 | #define GAME_ALL			0
 | 
        
           |  |  | 20 | #define GAME_X2				1
 | 
        
           |  |  | 21 | #define GAME_X3				2
 | 
        
           |  |  | 22 | #define GAME_X3TC			3
 | 
        
           |  |  | 23 | #define GAME_X3AP			4
 | 
        
           | 126 | cycrow | 24 | #define GAME_X3FL			5
 | 
        
           | 127 | cycrow | 25 | #define GAME_MAX			(GAME_X3FL)
 | 
        
           |  |  | 26 | #define GAME_ALLNEW			(1 << 31)
 | 
        
           | 6 | cycrow | 27 |   | 
        
           | 209 | cycrow | 28 | #define FILEVERSION 4.40f
 | 
        
           | 20 | cycrow | 29 |   | 
        
           | 6 | cycrow | 30 | #define WRITECHUNK		50000
 | 
        
           |  |  | 31 |   | 
        
           |  |  | 32 | class CPackages;
 | 
        
           | 126 | cycrow | 33 | class CGameExe;
 | 
        
           | 6 | cycrow | 34 |   | 
        
           | 88 | cycrow | 35 | namespace SPK {
 | 
        
           |  |  | 36 | 	class CTextDB;
 | 
        
           |  |  | 37 | }
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | using namespace SPK;
 | 
        
           |  |  | 40 |   | 
        
           | 6 | cycrow | 41 | enum {
 | 
        
           |  |  | 42 | 	READFLAG_NONE = 0,
 | 
        
           |  |  | 43 | 	READFLAG_NOUNCOMPRESS = 1
 | 
        
           |  |  | 44 | };
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 | enum {SPKFILE_INVALID, SPKFILE_SINGLE, SPKFILE_MULTI, SPKFILE_SINGLESHIP, SPKFILE_OLD, SPKFILE_BASE};
 | 
        
           |  |  | 47 | enum {SPKREAD_ALL, SPKREAD_NODATA, SPKREAD_VALUES, SPKREAD_HEADER};
 | 
        
           |  |  | 48 | enum {DELETESTATE_NONE, DELETESTATE_WAITING, DELETESTATE_DONE};
 | 
        
           |  |  | 49 | enum {SPKINSTALL_CREATEDIRECTORY, SPKINSTALL_CREATEDIRECTORY_FAIL, SPKINSTALL_WRITEFILE, SPKINSTALL_WRITEFILE_FAIL, SPKINSTALL_DELETEFILE, SPKINSTALL_DELETEFILE_FAIL,
 | 
        
           |  |  | 50 | 		SPKINSTALL_SKIPFILE, SPKINSTALL_REMOVEDIR, SPKINSTALL_ENABLEFILE, SPKINSTALL_DISABLEFILE, SPKINSTALL_ENABLEFILE_FAIL, SPKINSTALL_DISABLEFILE_FAIL,
 | 
        
           |  |  | 51 | 		SPKINSTALL_UNINSTALL_MOVE, SPKINSTALL_UNINSTALL_COPY, SPKINSTALL_UNINSTALL_MOVE_FAIL, SPKINSTALL_UNINSTALL_COPY_FAIL, SPKINSTALL_UNINSTALL_REMOVE, SPKINSTALL_UNINSTALL_REMOVE_FAIL,
 | 
        
           |  |  | 52 | 		SPKINSTALL_ORIGINAL_BACKUP, SPKINSTALL_ORIGINAL_RESTORE, SPKINSTALL_ORIGINAL_BACKUP_FAIL, SPKINSTALL_ORIGINAL_RESTORE_FAIL, SPKINSTALL_FAKEPATCH, SPKINSTALL_FAKEPATCH_FAIL, 
 | 
        
           |  |  | 53 | 		SPKINSTALL_MISSINGFILE, SPKINSTALL_SHARED, SPKINSTALL_SHARED_FAIL, SPKINSTALL_ORPHANED, SPKINSTALL_ORPHANED_FAIL, SPKINSTALL_UNCOMPRESS_FAIL, SPKINSTALL_AUTOTEXT, SPKINSTALL_AUTOTEXT_FAIL
 | 
        
           |  |  | 54 | };
 | 
        
           |  |  | 55 |   | 
        
           |  |  | 56 | enum {PACKAGETYPE_NORMAL, PACKAGETYPE_LIBRARY, PACKAGETYPE_CUSTOMSTART, PACKAGETYPE_PATCH, PACKAGETYPE_UPDATE, PACKAGETYPE_MOD, PACKAGETYPE_SHIP, PACKAGETYPE_FAKEPATCH};
 | 
        
           |  |  | 57 |   | 
        
           | 170 | cycrow | 58 | enum BaseFileType {TYPE_BASE, TYPE_SPK, TYPE_XSP, TYPE_ARCHIVE};
 | 
        
           | 6 | cycrow | 59 |   | 
        
           |  |  | 60 | // spk header struct
 | 
        
           |  |  | 61 | tstruct SSPKHeader {
 | 
        
           |  |  | 62 | 	SSPKHeader () { fVersion = 0; iValueCompression = lValueCompressSize = 0; }
 | 
        
           |  |  | 63 | 	float fVersion;
 | 
        
           |  |  | 64 | 	int iValueCompression;
 | 
        
           |  |  | 65 | 	unsigned long lValueCompressSize;
 | 
        
           |  |  | 66 | } SSPKHeader;
 | 
        
           |  |  | 67 |   | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 | tstruct SSPKHeader2 {
 | 
        
           | 170 | cycrow | 70 | 	SSPKHeader2 () : iFileCompression(0), iDataCompression(0), iNumFiles(0), lSize(0), lFullSize(0) { }
 | 
        
           | 6 | cycrow | 71 | 	int iNumFiles;
 | 
        
           |  |  | 72 | 	long lSize;
 | 
        
           |  |  | 73 | 	long lFullSize;
 | 
        
           |  |  | 74 | 	int iFileCompression;
 | 
        
           |  |  | 75 | 	int iDataCompression;
 | 
        
           |  |  | 76 | } SSPKHeader2;
 | 
        
           |  |  | 77 |   | 
        
           | 46 | cycrow | 78 | class SPKEXPORT CBaseFile : public SPK::Package::CCorePackage
 | 
        
           | 6 | cycrow | 79 | {
 | 
        
           |  |  | 80 | public:
 | 
        
           | 175 | cycrow | 81 | 	// static functions
 | 
        
           | 197 | cycrow | 82 | 	static Utils::WString ConvertGameToString(int game);
 | 
        
           | 210 | cycrow | 83 | 	static int GetGameFromString(const Utils::WString &game);
 | 
        
           | 197 | cycrow | 84 | 	static Utils::WString ErrorString(int error, const Utils::WString &errorStr = Utils::WString::Null());
 | 
        
           | 175 | cycrow | 85 | 	static Utils::String GetEndOfLine(FILE* id, int* line = NULL, bool upper = true);
 | 
        
           | 197 | cycrow | 86 | 	static int CheckFile(const Utils::WString &filename, float* version = NULL);
 | 
        
           | 6 | cycrow | 87 |   | 
        
           | 175 | cycrow | 88 |   | 
        
           | 6 | cycrow | 89 | 	CBaseFile();
 | 
        
           |  |  | 90 | 	virtual ~CBaseFile();
 | 
        
           |  |  | 91 |   | 
        
           | 170 | cycrow | 92 | 	// Virtual Functions
 | 
        
           | 203 | cycrow | 93 | 	virtual Utils::WString getFullPackageName(int language, const Utils::WString &byString) const;
 | 
        
           |  |  | 94 | 	virtual Utils::WString getFullPackageName(int language, bool includeVersion = true, const Utils::WString &byString = L"by") const;
 | 
        
           |  |  | 95 | 	virtual Utils::WString getFullPackageName(const Utils::WString &format, int lang) const;
 | 
        
           | 170 | cycrow | 96 |   | 
        
           | 207 | cycrow | 97 | 	virtual Utils::WString createValuesLine() const;
 | 
        
           | 170 | cycrow | 98 |   | 
        
           | 197 | cycrow | 99 | 	virtual bool loadPackageData(const Utils::WString& sFirst, const Utils::WString& sRest, const Utils::WString& sMainGame, Utils::WStringList& otherGames, Utils::WStringList& gameAddons, CProgressInfo* progress);
 | 
        
           | 210 | cycrow | 100 | 	virtual bool GeneratePackagerScript(bool wildcard, Utils::WStringList* list, int game, const Utils::WStringList& gameAddons, bool datafile = false);
 | 
        
           |  |  | 101 | 	virtual bool GeneratePackagerScriptFile(bool wildcard, Utils::WStringList* list, int game, const Utils::WStringList& gameAddons);
 | 
        
           | 170 | cycrow | 102 |   | 
        
           |  |  | 103 | 	// Getters
 | 
        
           | 197 | cycrow | 104 | 	Utils::WString getNameValidFile() const;
 | 
        
           | 170 | cycrow | 105 | 	const CLinkList<C_File> &fileList() const;
 | 
        
           |  |  | 106 | 	CLinkList<C_File>& fileList(FileType type, CLinkList<C_File> &list) const;
 | 
        
           |  |  | 107 | 	CLinkList<C_File>& fileList(FileType type);
 | 
        
           | 6 | cycrow | 108 | 	CLinkList<C_File> *GetFileList() { return &m_lFiles; }
 | 
        
           | 170 | cycrow | 109 | 	C_File *icon() const { return m_pIconFile; }
 | 
        
           | 197 | cycrow | 110 | 	const Utils::WString &iconExt() const { return _sIconExt; }
 | 
        
           | 170 | cycrow | 111 | 	int dataCompression () const { return m_SHeader2.iDataCompression; }
 | 
        
           |  |  | 112 | 	float fileVersion () const { return m_SHeader.fVersion; }
 | 
        
           |  |  | 113 | 	size_t fileSize() const;
 | 
        
           | 203 | cycrow | 114 | 	Utils::WString getAutosaveName() const;
 | 
        
           | 170 | cycrow | 115 | 	bool IsMod();
 | 
        
           |  |  | 116 | 	bool IsFakePatch() const;
 | 
        
           |  |  | 117 |   | 
        
           |  |  | 118 | 	// Setters
 | 
        
           | 203 | cycrow | 119 | 	void setAutosaveName() { this->setFilename(getAutosaveName()); }
 | 
        
           | 170 | cycrow | 120 | 	void SetDataCompression(int c) { m_SHeader2.iDataCompression = c; }
 | 
        
           |  |  | 121 | 	void SetFileCompression(int c) { m_SHeader2.iFileCompression = c; }
 | 
        
           |  |  | 122 | 	void SetValueCompression(int c) { m_SHeader.iValueCompression = c; }
 | 
        
           | 210 | cycrow | 123 | 	void setIcon(C_File* file, const Utils::WString& ext) { if (m_pIconFile) delete m_pIconFile; _sIconExt = ext.c_str(); m_pIconFile = file; _changed(); }
 | 
        
           |  |  | 124 | 	void setFtpAddr(const Utils::WString& str) { _sFtpAddr = str; }
 | 
        
           | 170 | cycrow | 125 |   | 
        
           |  |  | 126 | 	// Game Compatability
 | 
        
           |  |  | 127 | 	SGameCompat* GetGameCompatability(int game);
 | 
        
           | 6 | cycrow | 128 | 	bool RemoveGameCompatability(int game);
 | 
        
           | 210 | cycrow | 129 | 	void AddGameCompatability(int game, const Utils::WString &version);
 | 
        
           | 6 | cycrow | 130 | 	bool CheckGameCompatability(int game);
 | 
        
           | 197 | cycrow | 131 | 	bool checkGameVersionCompatability(int game, const Utils::WString &sVersion, int iVersion) const;
 | 
        
           | 6 | cycrow | 132 | 	bool AnyGameCompatability() { return !m_lGames.empty(); }
 | 
        
           |  |  | 133 |   | 
        
           | 170 | cycrow | 134 | 	// Files
 | 
        
           | 13 | cycrow | 135 | 	C_File *GetFirstFile(int type) const;
 | 
        
           |  |  | 136 | 	C_File *GetNextFile(C_File *prev) const;
 | 
        
           |  |  | 137 | 	C_File *GetPrevFile(C_File *next) const;
 | 
        
           | 170 | cycrow | 138 | 	C_File* findMatchingMod(C_File* f) const;
 | 
        
           | 6 | cycrow | 139 |   | 
        
           | 210 | cycrow | 140 | 	void convertNormalMod(C_File *f, const Utils::WString &to) const;
 | 
        
           | 170 | cycrow | 141 | 	void convertFakePatch(C_File *f) const;
 | 
        
           |  |  | 142 | 	void convertAutoText(C_File *f) const;
 | 
        
           | 210 | cycrow | 143 | 	void renameFile(C_File *f, const Utils::WString &baseName) const;
 | 
        
           | 6 | cycrow | 144 |   | 
        
           | 170 | cycrow | 145 | 	size_t countFiles(FileType filetype) const;
 | 
        
           |  |  | 146 | 	C_File* findFileAt(FileType filetype, size_t pos) const;
 | 
        
           | 197 | cycrow | 147 | 	C_File* findFile(const Utils::WString& file, FileType type, const Utils::WString& dir = Utils::WString::Null(), int game = 0) const;
 | 
        
           | 6 | cycrow | 148 |   | 
        
           | 197 | cycrow | 149 | 	void addFileScript(FileType filetype, bool shared, bool packed, const Utils::WString &rest, const Utils::WString &sMainGame, Utils::WStringList &otherGames, Utils::WStringList &gameAddons, CProgressInfo *progress = NULL);
 | 
        
           | 170 | cycrow | 150 | 	void AddFile(C_File* file);
 | 
        
           | 197 | cycrow | 151 | 	C_File* addFile(const Utils::WString& file, const Utils::WString& dir, FileType type, int game = 0, bool packed = false);
 | 
        
           |  |  | 152 | 	C_File* appendFile(const Utils::WString& file, int type, int game, bool packed, const Utils::WString& dir = Utils::WString::Null(), CProgressInfo* progress = NULL);
 | 
        
           | 210 | cycrow | 153 | 	bool addFileNow(const Utils::WString&, const Utils::WString&, FileType type, CProgressInfo* progress = NULL);
 | 
        
           | 172 | cycrow | 154 | 	bool removeFile(size_t pos);
 | 
        
           |  |  | 155 | 	bool removeFile(C_File* files);
 | 
        
           | 210 | cycrow | 156 | 	bool removeFile(const Utils::WString &file, FileType type, const Utils::WString &dir = Utils::WString::Null(), int game = 0);
 | 
        
           | 170 | cycrow | 157 | 	void removeAllFiles(FileType type, int game);
 | 
        
           | 6 | cycrow | 158 |   | 
        
           | 211 | cycrow | 159 | 	Utils::WString createFilesLine(SSPKHeader2 *header, CProgressInfo* = NULL) const;
 | 
        
           | 6 | cycrow | 160 |   | 
        
           |  |  | 161 | 	// error handling
 | 
        
           | 134 | cycrow | 162 | 	void ClearError () { _sLastError = ""; _iLastError = SPKERR_NONE; }
 | 
        
           |  |  | 163 | 	int lastError() const { return _iLastError; }
 | 
        
           | 197 | cycrow | 164 | 	const Utils::WString lastErrorString() const { return _sLastError; }
 | 
        
           | 6 | cycrow | 165 |   | 
        
           | 175 | cycrow | 166 | 	virtual bool writeHeader(CFileIO &file, int iHeader, int iLength) const;
 | 
        
           |  |  | 167 | 	virtual bool writeData(CFileIO &file, CProgressInfo * = NULL) const;
 | 
        
           | 210 | cycrow | 168 | 	virtual bool writeFile(const Utils::WString &filename, CProgressInfo* = NULL) const;
 | 
        
           |  |  | 169 | 	virtual bool readFile(const Utils::WString &filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL);
 | 
        
           | 58 | cycrow | 170 | 	bool readFile(CFileIO &File, int readtype, CProgressInfo *progress);
 | 
        
           | 6 | cycrow | 171 |   | 
        
           | 210 | cycrow | 172 | 	virtual bool extractFile(int file, const Utils::WString &dir, bool includedir = true, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 173 | 	virtual bool extractFile(C_File *file, const Utils::WString &dir, bool includedir = true, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 174 | 	virtual bool extractFile(int filenum, const Utils::WString &dir, unsigned int game, const Utils::WStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 175 | 	virtual bool extractFile(C_File *file, const Utils::WString &dir, unsigned int game, const Utils::WStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
 | 
        
           |  |  | 176 | 	virtual bool extractAll(const Utils::WString &dir, int game, const Utils::WStringList &gameAddons, bool includedir = true, CProgressInfo *progress = NULL);
 | 
        
           | 6 | cycrow | 177 |   | 
        
           | 210 | cycrow | 178 | 	virtual bool saveToArchive(const Utils::WString &filename, int game, const CGameExe *exes, CProgressInfo *progress = NULL);
 | 
        
           | 109 | cycrow | 179 | 	virtual void addGeneratedFiles(HZIP &hz) {};
 | 
        
           |  |  | 180 |   | 
        
           | 6 | cycrow | 181 | 	void ClearFileData();
 | 
        
           |  |  | 182 |   | 
        
           |  |  | 183 | 	// reading files
 | 
        
           |  |  | 184 | 	void ReadAllFilesToMemory ();
 | 
        
           |  |  | 185 | 	void ReadIconFileToMemory ();
 | 
        
           |  |  | 186 | 	bool ReadFileToMemory(C_File *f);
 | 
        
           |  |  | 187 |   | 
        
           |  |  | 188 | 	// compression
 | 
        
           |  |  | 189 | 	void RecompressAllFiles ( int compresstype, CProgressInfo *progress );
 | 
        
           | 47 | cycrow | 190 | 	void CompressAllFiles ( int compresstype, CProgressInfo *progress = NULL, CProgressInfo *overallProgress = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
 | 
        
           | 6 | cycrow | 191 | 	bool UncompressAllFiles ( CProgressInfo * = NULL );
 | 
        
           |  |  | 192 |   | 
        
           |  |  | 193 | 	bool IsFileAdded(C_File *f) { return m_lFiles.FindData(f); }
 | 
        
           |  |  | 194 |   | 
        
           |  |  | 195 | 	// installing
 | 
        
           |  |  | 196 | 	void SwitchFilePointer(C_File *oldFile, C_File *newFile);
 | 
        
           | 197 | cycrow | 197 | 	bool installFiles(const Utils::WString &destdir, CProgressInfo *progress, CLinkList<C_File> *spklist, Utils::WStringList *errorStr, bool enabled = true, CPackages *packages = NULL );
 | 
        
           | 6 | cycrow | 198 | 	virtual bool IsPatch () { return false; }
 | 
        
           |  |  | 199 |   | 
        
           |  |  | 200 | 	// installer functions
 | 
        
           |  |  | 201 | 	bool IsProfileEnabled () { return m_bProfile; }
 | 
        
           |  |  | 202 | 	bool IsEnabled () { return m_bEnable; }
 | 
        
           |  |  | 203 | 	bool IsModifiedEnabled () { return m_bModifiedEnabled; }
 | 
        
           |  |  | 204 | 	bool IsGlobalEnabled () { return m_bGlobal; }
 | 
        
           |  |  | 205 |   | 
        
           |  |  | 206 | 	void SetProfileEnabled ( bool en ) { m_bProfile = en; }
 | 
        
           |  |  | 207 | 	void SetEnabled ( bool en ) { m_bEnable = en; }
 | 
        
           |  |  | 208 | 	void SetModifiedEnabled ( bool en ) { m_bModifiedEnabled = en; }
 | 
        
           |  |  | 209 | 	void SetGlobalEnabled ( bool en ) { m_bGlobal = en; }
 | 
        
           |  |  | 210 |   | 
        
           |  |  | 211 | 	int  GetLoadError() { return m_iLoadError; }
 | 
        
           |  |  | 212 | 	void SetLoadError(int i) { m_iLoadError = i; }
 | 
        
           | 196 | cycrow | 213 | 	Utils::WString createUpdateFile(const Utils::WString &dir) const;
 | 
        
           | 6 | cycrow | 214 |   | 
        
           | 207 | cycrow | 215 | 	virtual bool parseValueLine(const Utils::WString &line);
 | 
        
           | 6 | cycrow | 216 |   | 
        
           |  |  | 217 | 	CLinkList<SGameCompat>  *GetGameCompatabilityList() { return &m_lGames; }
 | 
        
           |  |  | 218 |   | 
        
           | 197 | cycrow | 219 | 	Utils::WString fileSizeString() const;
 | 
        
           | 6 | cycrow | 220 |   | 
        
           |  |  | 221 | 	CLinkList<SNeededLibrary> *GetNeededLibraries() { return &m_lNeededLibrarys; }
 | 
        
           | 204 | cycrow | 222 | 	void addNeededLibrary(const Utils::WString &scriptName, const Utils::WString &author, const Utils::WString &minVersion);
 | 
        
           | 203 | cycrow | 223 | 	bool isPackageNeeded(const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           |  |  | 224 | 	SNeededLibrary *findPackageNeeded(const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           |  |  | 225 | 	void removePackageNeeded(const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           | 6 | cycrow | 226 | 	void ClearNeededPackages();
 | 
        
           |  |  | 227 | 	bool AnyDependacies() { return (m_lNeededLibrarys.size()) ? true: false; }
 | 
        
           |  |  | 228 | 	bool AutoGenerateUpdateFile() { return m_bAutoGenerateUpdateFile; }
 | 
        
           | 207 | cycrow | 229 | 	void removeFakePatchOrder(bool after, const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           |  |  | 230 | 	void removeFakePatchOrder(const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           |  |  | 231 | 	void addFakePatchOrder(bool after, const Utils::WString &scriptName, const Utils::WString &author);
 | 
        
           | 160 | cycrow | 232 | 	bool anyFakePatchOrder() const { if ( !_lFakePatchBefore.empty() || !_lFakePatchAfter.empty() ) return true; return false; }
 | 
        
           | 207 | cycrow | 233 | 	const Utils::WStringList &getFakePatchBeforeOrder() const { return _lFakePatchBefore; }
 | 
        
           |  |  | 234 | 	const Utils::WStringList &getFakePatchAfterOrder() const { return _lFakePatchAfter; }
 | 
        
           | 88 | cycrow | 235 | 	void updateTextDB() { this->_resetTextDB(); }
 | 
        
           | 6 | cycrow | 236 |   | 
        
           | 197 | cycrow | 237 | 	virtual bool readWares(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &empWares);
 | 
        
           | 89 | cycrow | 238 | 	virtual bool readCommands(int iLang, CLinkList<SCommandSlot> &list);
 | 
        
           |  |  | 239 | 	virtual bool readWingCommands(int iLang, CLinkList<SCommandSlot> &list);
 | 
        
           | 88 | cycrow | 240 |   | 
        
           | 6 | cycrow | 241 | 	int  FindFirstGameInPackage();
 | 
        
           |  |  | 242 | 	bool IsAnyGameInPackage();
 | 
        
           |  |  | 243 | 	bool IsMultipleGamesInPackage();
 | 
        
           |  |  | 244 | 	bool IsGameInPackage(int game);
 | 
        
           |  |  | 245 |   | 
        
           | 170 | cycrow | 246 | 	virtual BaseFileType type () const { return BaseFileType::TYPE_BASE; }
 | 
        
           |  |  | 247 | 	virtual int GetType() { return type(); }
 | 
        
           | 6 | cycrow | 248 | 	bool AnyFileType ( int type );
 | 
        
           |  |  | 249 | 	CBaseFile *GetParent () { return m_pParent; }
 | 
        
           |  |  | 250 | 	void SetParent ( CBaseFile *file ) { m_pParent = file; }
 | 
        
           | 207 | cycrow | 251 | 	int parseLanguage(const Utils::WString &lang) const;
 | 
        
           | 6 | cycrow | 252 |   | 
        
           | 175 | cycrow | 253 | 	virtual bool computeSigned(bool updateFiles) const;
 | 
        
           |  |  | 254 | 	bool updateSigned (bool updateFiles);
 | 
        
           | 6 | cycrow | 255 | 	int GetNum() { return m_iNum; }
 | 
        
           |  |  | 256 | 	void SetNum(int i) { m_iNum = i; }
 | 
        
           |  |  | 257 |   | 
        
           |  |  | 258 | 	bool	IsFullyLoaded() { return m_bFullyLoaded; }
 | 
        
           |  |  | 259 | 	virtual bool   IsSigned ()		{ return m_bSigned;}
 | 
        
           |  |  | 260 | 	void SetOverrideFiles(bool b) { m_bOverrideFiles = b; }
 | 
        
           |  |  | 261 | 	bool IsUpdateChecked () { return m_bUpdate; }
 | 
        
           |  |  | 262 | 	void SetUpdateChecked ( bool en ) { m_bUpdate = en; }
 | 
        
           |  |  | 263 |   | 
        
           | 197 | cycrow | 264 | 	unsigned char *createData(size_t *size, CProgressInfo *progress = NULL);
 | 
        
           | 6 | cycrow | 265 |   | 
        
           |  |  | 266 | protected:
 | 
        
           |  |  | 267 | 	virtual void Delete ();
 | 
        
           |  |  | 268 | 	virtual void SetDefaults ();
 | 
        
           |  |  | 269 |   | 
        
           |  |  | 270 | 	// reading of files
 | 
        
           | 210 | cycrow | 271 | 	virtual bool _checkHeader(const Utils::WString &header) const;
 | 
        
           |  |  | 272 | 	bool _parseHeader(const Utils::WString &header);
 | 
        
           |  |  | 273 | 	bool _parseFileHeader(const Utils::WString& header);
 | 
        
           |  |  | 274 | 	bool _parseFilesLine(const Utils::WString& line);
 | 
        
           | 207 | cycrow | 275 | 	void _readValues(const Utils::WString& values);
 | 
        
           | 211 | cycrow | 276 | 	void _readFiles(const Utils::WString& values);
 | 
        
           | 6 | cycrow | 277 |   | 
        
           | 14 | cycrow | 278 | 	void _install_adjustFakePatches(CPackages *pPackages);
 | 
        
           | 43 | cycrow | 279 | 	void _install_renameText(CPackages *pPackages);
 | 
        
           | 197 | cycrow | 280 | 	bool _install_uncompress(C_File *fit, CProgressInfo *progress, Utils::WStringList *errorStr, bool *uncomprToFile);
 | 
        
           | 50 | cycrow | 281 | 	bool _install_setEnabled(bool bEnable, C_File *fit);
 | 
        
           | 197 | cycrow | 282 | 	bool _install_checkVersion(C_File *pFile, const Utils::WString &sDestination);
 | 
        
           | 210 | cycrow | 283 | 	Utils::WString _install_adjustFilepointer(C_File *pFile, bool bEnabled, const Utils::WString &sDestination);
 | 
        
           | 197 | cycrow | 284 | 	C_File *_install_checkFile(C_File *pFile, Utils::WStringList *errorStr, bool *bDoFile, CLinkList<C_File> *pFileList);
 | 
        
           |  |  | 285 | 	bool _install_checkFileEnable(C_File *pCheckFile, C_File *fit, const Utils::WString &sDestination, bool bEnabled, Utils::WStringList *errorStr);
 | 
        
           |  |  | 286 | 	bool _install_createDirectory(CDirIO &Dir, const Utils::WString &sTo, C_File *pFile, Utils::WStringList *errorStr);
 | 
        
           |  |  | 287 | 	void _install_writeFile(C_File *pFile, const Utils::WString &sDestination, Utils::WStringList *errorStr);
 | 
        
           | 14 | cycrow | 288 |   | 
        
           | 109 | cycrow | 289 | 	int _read_FileHeader(CFileIO &File, int iReadType, int iMaxProgress, int iDoneLen, CProgressInfo *pProgress);
 | 
        
           |  |  | 290 | 	int _read_Header(CFileIO &File, int iReadType, int iMaxProgress, CProgressInfo *pProgress);
 | 
        
           | 58 | cycrow | 291 | 	CFileIO *_startRead();
 | 
        
           | 51 | cycrow | 292 |   | 
        
           | 88 | cycrow | 293 | 	void _addFile(C_File *file, bool dontChange = false);
 | 
        
           |  |  | 294 | 	void _updateTextDB(C_File *file);
 | 
        
           |  |  | 295 | 	void _resetTextDB();
 | 
        
           | 197 | cycrow | 296 | 	void _addWaresToList(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &wares, enum WareTypes eType);
 | 
        
           | 89 | cycrow | 297 | 	bool _readCommands(int iLang, int iStartID, CLinkList<SCommandSlot> &list);
 | 
        
           | 196 | cycrow | 298 | 	Utils::WString _replaceFilename(const Utils::WString &fname);
 | 
        
           | 88 | cycrow | 299 |   | 
        
           |  |  | 300 | protected:
 | 
        
           | 6 | cycrow | 301 | 	SSPKHeader m_SHeader;
 | 
        
           |  |  | 302 | 	SSPKHeader2 m_SHeader2;
 | 
        
           |  |  | 303 |   | 
        
           |  |  | 304 | 	C_File *m_pIconFile;
 | 
        
           | 197 | cycrow | 305 | 	Utils::WString _sIconExt;
 | 
        
           |  |  | 306 | 	Utils::WString _sLastError;
 | 
        
           | 134 | cycrow | 307 | 	int _iLastError;
 | 
        
           | 6 | cycrow | 308 |   | 
        
           |  |  | 309 | 	CLinkList<C_File>  m_lFiles;
 | 
        
           | 170 | cycrow | 310 | 	CLinkList<C_File>  m_lTempFiles;
 | 
        
           | 207 | cycrow | 311 | 	Utils::WStringList _lFakePatchBefore;
 | 
        
           |  |  | 312 | 	Utils::WStringList _lFakePatchAfter;
 | 
        
           | 6 | cycrow | 313 |   | 
        
           | 88 | cycrow | 314 | 	CTextDB	*_pTextDB;
 | 
        
           |  |  | 315 |   | 
        
           | 6 | cycrow | 316 | 	CLinkList<SGameCompat> m_lGames;
 | 
        
           |  |  | 317 |   | 
        
           |  |  | 318 | 	bool m_bSigned;
 | 
        
           |  |  | 319 | 	bool m_bFullyLoaded;
 | 
        
           |  |  | 320 |   | 
        
           |  |  | 321 | 	//installer varibles
 | 
        
           |  |  | 322 | 	bool m_bEnable;
 | 
        
           |  |  | 323 | 	bool m_bModifiedEnabled;
 | 
        
           |  |  | 324 | 	bool m_bGlobal;
 | 
        
           |  |  | 325 | 	bool m_bProfile;
 | 
        
           |  |  | 326 | 	int m_iLoadError;
 | 
        
           |  |  | 327 |   | 
        
           |  |  | 328 | 	CBaseFile *m_pParent;
 | 
        
           |  |  | 329 |   | 
        
           |  |  | 330 | 	int m_iNum;
 | 
        
           |  |  | 331 |   | 
        
           |  |  | 332 | 	CLinkList<SNeededLibrary> m_lNeededLibrarys;
 | 
        
           |  |  | 333 |   | 
        
           | 130 | cycrow | 334 | 	bool	_bCombineFiles;
 | 
        
           | 6 | cycrow | 335 | 	bool	m_bOverrideFiles;
 | 
        
           | 210 | cycrow | 336 | 	Utils::WString	_sFtpAddr;
 | 
        
           | 170 | cycrow | 337 | 	bool			m_bAutoGenerateUpdateFile;
 | 
        
           |  |  | 338 | 	bool			m_bUpdate;
 | 
        
           | 6 | cycrow | 339 | };
 | 
        
           |  |  | 340 |   | 
        
           |  |  | 341 |   | 
        
           |  |  | 342 | class SPKEXPORT CArchiveFile : public CBaseFile
 | 
        
           |  |  | 343 | {
 | 
        
           |  |  | 344 | public:
 | 
        
           |  |  | 345 | 	CArchiveFile();
 | 
        
           |  |  | 346 | 	virtual ~CArchiveFile();
 | 
        
           | 203 | cycrow | 347 | 	virtual Utils::WString getFullPackageName(const Utils::WString& format, int lang) const override { return L"Archive(" + name() + L")"; }
 | 
        
           |  |  | 348 | 	virtual Utils::WString getFullPackageName(int language, const Utils::WString& byString) const override { return L"Archive(" + name() + L")"; }
 | 
        
           |  |  | 349 | 	virtual Utils::WString getFullPackageName(int language, bool includeVersion = true, const Utils::WString& byString = L"by") const override { return L"Archive(" + name() + L")"; }
 | 
        
           | 170 | cycrow | 350 |   | 
        
           |  |  | 351 | 	virtual BaseFileType type() const override { return BaseFileType::TYPE_ARCHIVE; }
 | 
        
           | 6 | cycrow | 352 | };
 | 
        
           |  |  | 353 |   | 
        
           |  |  | 354 | #endif //__BASEFILE_H__
 | 
        
           |  |  | 355 |   |