Subversion Repositories spk

Rev

Rev 84 | Rev 101 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
#include "CyString.h"
4
#include "File.h"
94 cycrow 5
#include "Utils/StringList.h"
1 cycrow 6
#include <map>
7
 
35 cycrow 8
class CBaseFile;
9
class CXspFile;
10
 
94 cycrow 11
namespace Utils {
12
	class CStringList;
13
}
35 cycrow 14
namespace SPK {
94 cycrow 15
	class CTextDB;
35 cycrow 16
 
1 cycrow 17
tclass CVirtualFileSystem
18
{
19
public:
84 cycrow 20
	typedef std::map<Utils::String, Utils::String> FileList;
21
	typedef std::map<Utils::String, Utils::String>::iterator FileListItr;
35 cycrow 22
 
23
private:
24
	Utils::String	m_sAddon;
25
	Utils::String	m_sDir;
26
	bool		m_bLoaded;
27
 
28
	FileList *m_pModMap;
29
	FileList *m_pMap;
30
 
31
	CTextDB	 *m_pTexts;
32
	CTextDB  *m_pModTexts;
33
 
94 cycrow 34
	Utils::CStringList	*_lShields;
35
	Utils::CStringList	*_lLasers;
36
	Utils::CStringList	*_lMissiles;
37
	Utils::CStringList	*_lCockpits;
38
	Utils::CStringList	*_lComponentSections;
39
	Utils::CStringList	*_lDummySections;
40
	Utils::CStringList	*_lBodiesSections;
41
 
35 cycrow 42
	int m_iLang;
43
 
44
public:
1 cycrow 45
	CVirtualFileSystem(void);
46
	~CVirtualFileSystem(void);
47
 
35 cycrow 48
	void SetAddon(const Utils::String &addon) { m_sAddon = addon; }
1 cycrow 49
 
35 cycrow 50
	void extractTexts(CXspFile *pPackage, int textId);
51
	C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType, const Utils::String &sTo);
52
	C_File *extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType);
58 cycrow 53
	Utils::String ExtractGameFile(const Utils::String &file, const Utils::String &to);
35 cycrow 54
	bool LoadFilesystem(const Utils::String &dir, int maxPatch = 0);
55
	bool LoadFilesystem(const Utils::String &dir, const Utils::String &mod, int maxPatch = 0);
56
	bool loadMod(const Utils::String &mod);
57
	bool addMod(const Utils::String &mod);
43 cycrow 58
	bool isFileAvailable(const Utils::String &file);
1 cycrow 59
 
35 cycrow 60
	CyStringList *GetTShipsEntries();
61
	Utils::String getTShipsEntry(const Utils::String &sId);
62
 
63
	void updateModTexts(int iPage);
64
	void updateModTexts(int iFromPage, int iToPage);
65
	void updateTexts(int iPage);
66
	void updateTexts(int iFromPage, int iToPage);
67
 
68
	Utils::String findText(int iLang, int iPage, int iID) const;
69
	bool textExists(int iLang, int iPage, int iID) const;
70
 
78 cycrow 71
	void clearMods(bool bIncludeStandard = false);
35 cycrow 72
	bool loadShipData(CyStringList *list);
73
	void setLanguage(int iLang);
74
 
94 cycrow 75
	Utils::String firstShield();
76
	Utils::String nextShield();
77
	Utils::String firstComponentSection();
78
	Utils::String nextComponentSection();
79
	Utils::String firstDummySection();
80
	Utils::String nextDummySection();
81
	Utils::String firstBodiesSection();
82
	Utils::String nextBodiesSection();
83
	std::pair<Utils::String, Utils::String> firstLaser();
84
	std::pair<Utils::String, Utils::String> nextLaser();
85
	std::pair<Utils::String, Utils::String> firstMissile();
86
	std::pair<Utils::String, Utils::String> nextMissile();
87
	Utils::String firstCockpit();
88
	Utils::String nextCockpit();
89
 
1 cycrow 90
private:
35 cycrow 91
	void _updateTexts(int iFromPage, int iToPage, FileList *pFileList, CTextDB *pTextList);
92
	Utils::String _convertExtension(const Utils::String &sFile);
93
	void _clear();
43 cycrow 94
	void _addFile(const Utils::String &sFile, const Utils::String &sDest, FileList *pList);
95
	void _addModFile(const Utils::String &sFile, const Utils::String &sMod, FileList *pList);
96
	Utils::String _findFile(const Utils::String &file);
97
	void _addDir(const Utils::String &sStart, const Utils::String &sDir);
58 cycrow 98
	Utils::String _extractFromCat(const Utils::String &sCat, const Utils::String &sFile, const Utils::String &sTo);
99
	Utils::String _extract(const Utils::String &sFile, const Utils::String &sTo);
94 cycrow 100
 
101
	Utils::CStringList *_updateList(const Utils::String &typesFile, int iTextPos);
102
	void _updateShields();
103
	void _updateLasers();
104
	void _updateMissiles();
105
	void _updateCockpits();
106
	void _updateComponentSections();
107
	void _updateDummySections();
108
	void _updateBodiesSections();
109
 
110
	Utils::String _returnText(Utils::SStringList *s);
111
	Utils::String _returnID(Utils::SStringList *s);
112
	Utils::String _returnLine(Utils::SStringList *s);
113
	std::pair<Utils::String, Utils::String> _returnPair(Utils::SStringList *s);
114
	Utils::CStringList *_updateSectionList(const Utils::String &sFile, bool singleEntry);
35 cycrow 115
};
1 cycrow 116
 
35 cycrow 117
}