Subversion Repositories spk

Rev

Rev 83 | Rev 101 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83 Rev 85
Line 36... Line 36...
36
	static CyString PckChangeExtension ( CyString f );
36
	static CyString PckChangeExtension ( CyString f );
37
	static CyString RenameFileExtension(SInCatFile *f);
37
	static CyString RenameFileExtension(SInCatFile *f);
38
	static bool IsAddonDir(CyString dir);
38
	static bool IsAddonDir(CyString dir);
39
	static bool CheckPackedExtension(const Utils::String &sFilename);
39
	static bool CheckPackedExtension(const Utils::String &sFilename);
40
 
40
 
-
 
41
public:
41
	CCatFile ();
42
	CCatFile ();
42
	~CCatFile ();
43
	~CCatFile ();
43
 
44
 
44
	int  Open ( CyString catfile, CyString addon, int readtype = CATREAD_CATDECRYPT, bool = true );
45
	int  Open ( CyString catfile, CyString addon, int readtype = CATREAD_CATDECRYPT, bool = true );
45
	bool DecryptData ();
46
	bool DecryptData ();
46
	bool DecryptData ( unsigned char *data, size_t size );
47
	bool DecryptData ( unsigned char *data, size_t size );
47
	void DecryptDAT(unsigned char *buffer, size_t size);
48
	void DecryptDAT(unsigned char *buffer, size_t size);
48
	void DecryptDAT(SInCatFile *pFile);
49
	void DecryptDAT(SInCatFile *pFile);
49
	bool ReadFiles ();
50
	bool readFiles ();
50
	void LoadDatFile ();
51
	void LoadDatFile ();
51
	const Utils::String &catFilename() { return m_fCatFile.fullFilename(); }
-
 
52
 
52
 
53
	bool CheckExtensionPck ( CyString filename );
53
	bool CheckExtensionPck ( CyString filename );
54
	CyStringList *GetTShipsEntries();
54
	CyStringList *GetTShipsEntries();
55
	CyString GetTShipsEntry(CyString id);
55
	CyString GetTShipsEntry(CyString id);
56
 
56
 
Line 60... Line 60...
60
	bool ReadFileToData ( CyString filename );
60
	bool ReadFileToData ( CyString filename );
61
	bool ReadFileToData ( SInCatFile *c );
61
	bool ReadFileToData ( SInCatFile *c );
62
 
62
 
63
	bool MarkRemoveFile ( SInCatFile *f );
63
	bool MarkRemoveFile ( SInCatFile *f );
64
	bool MarkRemoveFile ( CyString filename );
64
	bool MarkRemoveFile ( CyString filename );
65
 
65
 
66
	int GetEndOffset();
66
	int GetEndOffset();
67
	int GetNumFiles () { return m_lFiles.size(); }
67
	int GetNumFiles () { return m_lFiles.size(); }
68
	SInCatFile *GetFile ( int num ) { return m_lFiles.Get(num); }
68
	SInCatFile *GetFile ( int num ) { return m_lFiles.Get(num); }
69
 
69
 
70
	unsigned char *UnpackFile ( SInCatFile *c, size_t *size);
70
	unsigned char *UnpackFile ( SInCatFile *c, size_t *size);
Line 86... Line 86...
86
 
86
 
87
	void ClearError () { m_iError = CATERR_NONE; m_sError = ""; }
87
	void ClearError () { m_iError = CATERR_NONE; m_sError = ""; }
88
	int Error () { return m_iError; }
88
	int Error () { return m_iError; }
89
	CyString ErrorString() { return m_sError; }
89
	CyString ErrorString() { return m_sError; }
90
	CyString GetErrorString ();
90
	CyString GetErrorString ();
-
 
91
 
-
 
92
	const Utils::String &internalDatFilename() const;
-
 
93
	const Utils::String &catFilename() { return m_fCatFile.fullFilename(); }
-
 
94
	const Utils::String &datFilename() { return m_fDatFile.fullFilename(); }
91
	
95
 
92
	bool WriteFromCat ( CyString catfile, CyString file );
96
	bool WriteFromCat ( CyString catfile, CyString file );
93
	bool WriteFromCat ( CCatFile *fcat, CyString file );
97
	bool WriteFromCat ( CCatFile *fcat, CyString file );
94
 
98
 
95
	void FindFiles(CyStringList *list, CyString filemask);
99
	void FindFiles(CyStringList *list, CyString filemask);
96
 
100
 
97
 
101
 
98
private:
102
private:
-
 
103
	void _clearFiles();
99
	int _checkFiletype(const unsigned char *pBuffer, int iSize);
104
	int _checkFiletype(const unsigned char *pBuffer, int iSize);
100
	void RemoveData ();
105
	void RemoveData ();
101
 
106
 
102
	CFileIO m_fCatFile;
107
	CFileIO m_fCatFile;
103
	CFileIO m_fDatFile;
108
	CFileIO m_fDatFile;
Line 108... Line 113...
108
 
113
 
109
	CLinkList<SInCatFile> m_lFiles;
114
	CLinkList<SInCatFile> m_lFiles;
110
	CyString m_sError;
115
	CyString m_sError;
111
	CyString m_sAddonDir;
116
	CyString m_sAddonDir;
112
 
117
 
-
 
118
	Utils::String _sReadFilename;
113
	int m_iError;
119
	int m_iError;
114
 
120
 
115
	bool m_bCreate;
121
	bool m_bCreate;
116
	bool m_bCatChanged;
122
	bool m_bCatChanged;
117
};
123
};