| 46 | cycrow | 1 | #pragma once
 | 
        
           |  |  | 2 |   | 
        
           | 170 | cycrow | 3 | #include "spkdefines.h"
 | 
        
           | 46 | cycrow | 4 | #include "../Utils/String.h"
 | 
        
           | 170 | cycrow | 5 | #include "../Utils/List.h"
 | 
        
           | 131 | cycrow | 6 | #include <map>
 | 
        
           | 46 | cycrow | 7 |   | 
        
           | 48 | cycrow | 8 | enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
 | 
        
           | 46 | cycrow | 9 |   | 
        
           |  |  | 10 | namespace SPK {
 | 
        
           |  |  | 11 | namespace Package {
 | 
        
           |  |  | 12 |   | 
        
           | 48 | cycrow | 13 |   | 
        
           | 46 | cycrow | 14 | class CInstallText;
 | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 | class SPKEXPORT CCorePackage
 | 
        
           |  |  | 17 | {
 | 
        
           |  |  | 18 | private:
 | 
        
           | 203 | cycrow | 19 | 	Utils::WString _sName;
 | 
        
           | 46 | cycrow | 20 | 	Utils::String _sVersion;
 | 
        
           | 203 | cycrow | 21 | 	Utils::WString _sAuthor;
 | 
        
           | 46 | cycrow | 22 | 	Utils::String _sWebSite;
 | 
        
           |  |  | 23 | 	Utils::String _sWebAddress;
 | 
        
           |  |  | 24 | 	Utils::String _sEmail;
 | 
        
           |  |  | 25 | 	Utils::String _sDescription;
 | 
        
           |  |  | 26 | 	Utils::String _sCreationDate;
 | 
        
           |  |  | 27 | 	Utils::String _sForumLink;
 | 
        
           |  |  | 28 |   | 
        
           | 197 | cycrow | 29 | 	Utils::WString _sFilename;
 | 
        
           | 46 | cycrow | 30 | 	Utils::String _sExportFilename;
 | 
        
           |  |  | 31 |   | 
        
           | 131 | cycrow | 32 | 	std::map<unsigned int, Utils::String> *_pAutoExtract;
 | 
        
           |  |  | 33 | 	std::map<unsigned int, Utils::String> *_pAutoExport;
 | 
        
           | 170 | cycrow | 34 | 	Utils::CList<SNames> *_lNames;
 | 
        
           | 131 | cycrow | 35 |   | 
        
           | 46 | cycrow | 36 | 	CInstallText *_pInstallText;
 | 
        
           |  |  | 37 | 	CInstallText *_pUninstallText;
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | 	int _iPluginType;
 | 
        
           |  |  | 40 |   | 
        
           |  |  | 41 | 	// package stats
 | 
        
           |  |  | 42 | 	int _iRecommended;
 | 
        
           |  |  | 43 | 	int _iEaseOfUse;
 | 
        
           |  |  | 44 | 	int _iGameChanging;
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 | 	bool _bChanged;
 | 
        
           |  |  | 47 |   | 
        
           |  |  | 48 | public:
 | 
        
           |  |  | 49 | 	CCorePackage(void);
 | 
        
           |  |  | 50 | 	virtual ~CCorePackage(void);
 | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 | 	//getters
 | 
        
           | 203 | cycrow | 53 | 	const Utils::WString &name			() const { return _sName; }
 | 
        
           | 46 | cycrow | 54 | 	const Utils::String	&version	 	() const { return _sVersion; }
 | 
        
           | 203 | cycrow | 55 | 	const Utils::WString &author		() const { return _sAuthor; }
 | 
        
           | 46 | cycrow | 56 | 	const Utils::String	&webSite		() const { return _sWebSite; }
 | 
        
           |  |  | 57 | 	const Utils::String	&webAddress		() const { return _sWebAddress; }
 | 
        
           |  |  | 58 | 	const Utils::String	&email			() const { return _sEmail; }
 | 
        
           |  |  | 59 | 	const Utils::String	&creationDate	() const { return _sCreationDate; }
 | 
        
           | 48 | cycrow | 60 | 	const Utils::String	&description	() const { return _sDescription; }
 | 
        
           | 46 | cycrow | 61 | 	const Utils::String	&forumLink		() const { return _sForumLink; }
 | 
        
           |  |  | 62 | 	int					 recommended	() const { return _iRecommended; }
 | 
        
           |  |  | 63 | 	int					 easeOfUse		() const { return _iEaseOfUse; }
 | 
        
           |  |  | 64 | 	int					 gameChanging	() const { return _iGameChanging; }
 | 
        
           | 197 | cycrow | 65 | 	const Utils::WString &filename		() const { return _sFilename; }
 | 
        
           | 46 | cycrow | 66 | 	const Utils::String &exportFilename	() const { return _sExportFilename; }
 | 
        
           |  |  | 67 | 	const CInstallText  *installText	() const { return _pInstallText; }
 | 
        
           |  |  | 68 | 	const CInstallText  *uninstallText	() const { return _pUninstallText; }
 | 
        
           | 48 | cycrow | 69 | 	int					 pluginType		() const { return _iPluginType; }
 | 
        
           | 50 | cycrow | 70 | 	bool				 hasChanged		() const { return _bChanged; }
 | 
        
           | 203 | cycrow | 71 | 	const Utils::WString	&name			(int lang) const;
 | 
        
           | 131 | cycrow | 72 | 	const std::map<unsigned int, Utils::String> *autoExtraction() const { return _pAutoExtract; }
 | 
        
           |  |  | 73 | 	const std::map<unsigned int, Utils::String> *autoExporter() const { return _pAutoExport; }
 | 
        
           | 170 | cycrow | 74 | 	const Utils::CList<SNames> *namesList() const { return _lNames; }
 | 
        
           | 46 | cycrow | 75 |   | 
        
           |  |  | 76 | 	//setters
 | 
        
           | 203 | cycrow | 77 | 	void setName			( const Utils::WString &str ) { _changed(); _sName = str.remove(L'|'); }
 | 
        
           | 46 | cycrow | 78 | 	void setVersion			( const Utils::String &str ) { _changed(); _sVersion = str; }
 | 
        
           | 203 | cycrow | 79 | 	void setAuthor			( const Utils::WString &str ) { _changed(); _sAuthor = str.remove(L'|'); }
 | 
        
           | 46 | cycrow | 80 | 	void setWebAddress		( const Utils::String &str ) { _changed(); _sWebAddress = str; }
 | 
        
           |  |  | 81 | 	void setWebSite			( const Utils::String &str ) { _changed(); _sWebSite = str; }
 | 
        
           |  |  | 82 | 	void setEmail			( const Utils::String &str ) { _changed(); _sEmail = str; }
 | 
        
           |  |  | 83 | 	void setCreationDate	( const Utils::String &str ) { _changed(); _sCreationDate = str; }
 | 
        
           | 48 | cycrow | 84 | 	void setDescription		( const Utils::String &str ) { _changed(); _parseDescription(str); }
 | 
        
           | 197 | cycrow | 85 | 	void setFilename		( const Utils::WString &str ) { _sFilename = str; }
 | 
        
           | 50 | cycrow | 86 | 	void setExportFilename	( const Utils::String &str ) { _sExportFilename = str; }
 | 
        
           | 46 | cycrow | 87 | 	void setForumLink		( const Utils::String &str ) { _changed(); _sForumLink = str; }
 | 
        
           |  |  | 88 | 	void setRecommended		( int i )					 { _changed(); _iRecommended = i; }
 | 
        
           |  |  | 89 | 	void setGameChanging	( int i )					 { _changed(); _iGameChanging = i; }
 | 
        
           |  |  | 90 | 	void setEaseOfUse		( int i )					 { _changed(); _iEaseOfUse = i; }
 | 
        
           | 48 | cycrow | 91 | 	void setPluginType		( int i )					 { _changed(); _iPluginType = i; }
 | 
        
           | 50 | cycrow | 92 | 	void adjustChanged		( bool bChanged )			 { _bChanged = bChanged; }
 | 
        
           | 46 | cycrow | 93 |   | 
        
           | 131 | cycrow | 94 | 	void addAutoExtract(unsigned int game, const Utils::String &dir);
 | 
        
           |  |  | 95 | 	void addAutoExport(unsigned int game, const Utils::String &file);
 | 
        
           |  |  | 96 | 	void clearAutoExtract();
 | 
        
           |  |  | 97 | 	void clearAutoExport();
 | 
        
           |  |  | 98 |   | 
        
           | 170 | cycrow | 99 | 	void addName(int iLang, const Utils::String& name);
 | 
        
           |  |  | 100 | 	void removeName(int iLang);
 | 
        
           |  |  | 101 | 	void clearNames();
 | 
        
           |  |  | 102 |   | 
        
           | 46 | cycrow | 103 | 	// install texts
 | 
        
           |  |  | 104 | 	Utils::String installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
 | 
        
           |  |  | 105 | 	Utils::String uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
 | 
        
           |  |  | 106 | 	void addInstallText(int iLang, bool bBefore, const Utils::String &sText);
 | 
        
           |  |  | 107 | 	void addUninstallText(int iLang, bool bBefore, const Utils::String &sText);
 | 
        
           |  |  | 108 | 	void removeInstallText(int iLang, bool bInstall);
 | 
        
           |  |  | 109 |   | 
        
           |  |  | 110 | protected:
 | 
        
           |  |  | 111 | 	virtual void _changed() { _bChanged = true; }
 | 
        
           |  |  | 112 | 	virtual void _setDefaults();
 | 
        
           |  |  | 113 | 	void _setRatings(int iEase, int iChanging, int iRec);
 | 
        
           | 48 | cycrow | 114 | 	void _parseDescription(const Utils::String &sDesc);
 | 
        
           | 46 | cycrow | 115 |   | 
        
           |  |  | 116 | 	bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }
 | 
        
           |  |  | 117 | 	void _merge(CCorePackage *pPackage);
 | 
        
           |  |  | 118 |   | 
        
           |  |  | 119 | 	Utils::String _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;
 | 
        
           |  |  | 120 | 	void _addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText);
 | 
        
           |  |  | 121 | };
 | 
        
           |  |  | 122 |   | 
        
           |  |  | 123 |   | 
        
           |  |  | 124 | }}//NAMESPACE
 |