| 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:
 | 
        
           | 35 | cycrow | 17 | 	typedef std::map<std::string, std::string> FileList;
 | 
        
           |  |  | 18 | 	typedef std::map<std::string, std::string>::iterator FileListItr;
 | 
        
           |  |  | 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);
 | 
        
           |  |  | 42 | 	bool ExtractGameFile(const Utils::String &file, const Utils::String &to);
 | 
        
           |  |  | 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);
 | 
        
           |  |  | 47 | 	Utils::String findFile(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 |   | 
        
           |  |  | 60 | 	void clearMods();
 | 
        
           |  |  | 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();
 | 
        
           |  |  | 68 | };
 | 
        
           | 1 | cycrow | 69 |   | 
        
           | 35 | cycrow | 70 | }
 |