| 1 | cycrow | 1 | #pragma once
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | #include "CyString.h"
 | 
        
           |  |  | 4 | #include "File.h"
 | 
        
           | 35 | cycrow | 5 | #include "TextDB.h"
 | 
        
           | 1 | cycrow | 6 |   | 
        
           |  |  | 7 | #include <map>
 | 
        
           |  |  | 8 |   | 
        
           | 35 | cycrow | 9 | class CBaseFile;
 | 
        
           |  |  | 10 | class CXspFile;
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | namespace SPK {
 | 
        
           |  |  | 13 |   | 
        
           | 1 | cycrow | 14 | tclass CVirtualFileSystem
 | 
        
           |  |  | 15 | {
 | 
        
           |  |  | 16 | public:
 | 
        
           | 84 | cycrow | 17 | 	typedef std::map<Utils::String, Utils::String> FileList;
 | 
        
           |  |  | 18 | 	typedef std::map<Utils::String, Utils::String>::iterator FileListItr;
 | 
        
           | 35 | cycrow | 19 |   | 
        
           |  |  | 20 | private:
 | 
        
           |  |  | 21 | 	Utils::String	m_sAddon;
 | 
        
           |  |  | 22 | 	Utils::String	m_sDir;
 | 
        
           |  |  | 23 | 	bool		m_bLoaded;
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 | 	FileList *m_pModMap;
 | 
        
           |  |  | 26 | 	FileList *m_pMap;
 | 
        
           |  |  | 27 |   | 
        
           |  |  | 28 | 	CTextDB	 *m_pTexts;
 | 
        
           |  |  | 29 | 	CTextDB  *m_pModTexts;
 | 
        
           |  |  | 30 |   | 
        
           |  |  | 31 | 	int m_iLang;
 | 
        
           |  |  | 32 |   | 
        
           |  |  | 33 | public:
 | 
        
           | 1 | cycrow | 34 | 	CVirtualFileSystem(void);
 | 
        
           |  |  | 35 | 	~CVirtualFileSystem(void);
 | 
        
           |  |  | 36 |   | 
        
           | 35 | cycrow | 37 | 	void SetAddon(const Utils::String &addon) { m_sAddon = addon; }
 | 
        
           | 1 | cycrow | 38 |   | 
        
           | 35 | cycrow | 39 | 	void extractTexts(CXspFile *pPackage, int textId);
 | 
        
           |  |  | 40 | 	C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType, const Utils::String &sTo);
 | 
        
           |  |  | 41 | 	C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType);
 | 
        
           | 58 | cycrow | 42 | 	Utils::String ExtractGameFile(const Utils::String &file, const Utils::String &to);
 | 
        
           | 35 | cycrow | 43 | 	bool LoadFilesystem(const Utils::String &dir, int maxPatch = 0);
 | 
        
           |  |  | 44 | 	bool LoadFilesystem(const Utils::String &dir, const Utils::String &mod, int maxPatch = 0);
 | 
        
           |  |  | 45 | 	bool loadMod(const Utils::String &mod);
 | 
        
           |  |  | 46 | 	bool addMod(const Utils::String &mod);
 | 
        
           | 43 | cycrow | 47 | 	bool isFileAvailable(const Utils::String &file);
 | 
        
           | 1 | cycrow | 48 |   | 
        
           | 35 | cycrow | 49 | 	CyStringList *GetTShipsEntries();
 | 
        
           |  |  | 50 | 	Utils::String getTShipsEntry(const Utils::String &sId);
 | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 | 	void updateModTexts(int iPage);
 | 
        
           |  |  | 53 | 	void updateModTexts(int iFromPage, int iToPage);
 | 
        
           |  |  | 54 | 	void updateTexts(int iPage);
 | 
        
           |  |  | 55 | 	void updateTexts(int iFromPage, int iToPage);
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 | 	Utils::String findText(int iLang, int iPage, int iID) const;
 | 
        
           |  |  | 58 | 	bool textExists(int iLang, int iPage, int iID) const;
 | 
        
           |  |  | 59 |   | 
        
           | 78 | cycrow | 60 | 	void clearMods(bool bIncludeStandard = false);
 | 
        
           | 35 | cycrow | 61 | 	bool loadShipData(CyStringList *list);
 | 
        
           |  |  | 62 | 	void setLanguage(int iLang);
 | 
        
           |  |  | 63 |   | 
        
           | 1 | cycrow | 64 | private:
 | 
        
           | 35 | cycrow | 65 | 	void _updateTexts(int iFromPage, int iToPage, FileList *pFileList, CTextDB *pTextList);
 | 
        
           |  |  | 66 | 	Utils::String _convertExtension(const Utils::String &sFile);
 | 
        
           |  |  | 67 | 	void _clear();
 | 
        
           | 43 | cycrow | 68 | 	void _addFile(const Utils::String &sFile, const Utils::String &sDest, FileList *pList);
 | 
        
           |  |  | 69 | 	void _addModFile(const Utils::String &sFile, const Utils::String &sMod, FileList *pList);
 | 
        
           |  |  | 70 | 	Utils::String _findFile(const Utils::String &file);
 | 
        
           |  |  | 71 | 	void _addDir(const Utils::String &sStart, const Utils::String &sDir);
 | 
        
           | 58 | cycrow | 72 | 	Utils::String _extractFromCat(const Utils::String &sCat, const Utils::String &sFile, const Utils::String &sTo);
 | 
        
           |  |  | 73 | 	Utils::String _extract(const Utils::String &sFile, const Utils::String &sTo);
 | 
        
           | 35 | cycrow | 74 | };
 | 
        
           | 1 | cycrow | 75 |   | 
        
           | 35 | cycrow | 76 | }
 |