Subversion Repositories spk

Rev

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

Rev 174 Rev 178
Line 212... Line 212...
212
	void clearUsed () { _iUsed = 0; }
212
	void clearUsed () { _iUsed = 0; }
213
	void incUsed () { ++_iUsed; }
213
	void incUsed () { ++_iUsed; }
214
	void DeleteData ();
214
	void DeleteData ();
215
	// varible setting functions
215
	// varible setting functions
216
	void setFileType(FileType t) { m_iFileType = t; }
216
	void setFileType(FileType t) { m_iFileType = t; }
217
	void SetFilename(CyString filename);
-
 
218
	void setFilename(const Utils::String &filename);
217
	void setFilename(const Utils::String &filename);
219
	void SetName(CyString name) { _sName = name.ToString(); }
-
 
220
	void setName(const Utils::String &name) { _sName = name; }
218
	void setName(const Utils::String &name) { _sName = name; }
221
	void SetDir(CyString dir) { _sDir = dir.ToString(); }
-
 
222
	void setDir(const Utils::String &dir) { _sDir = dir; }
219
	void setDir(const Utils::String &dir) { _sDir = dir; }
223
	void SetCreationTime ( time_t time ) { m_tTime = time; }
220
	void SetCreationTime ( time_t time ) { m_tTime = time; }
224
	void SetFileSize ( long size ) { m_lSize = size; }
221
	void SetFileSize ( long size ) { m_lSize = size; }
225
	void SetDataSize ( long size ) { m_lDataSize = size; }
222
	void SetDataSize ( long size ) { m_lDataSize = size; }
226
	void SetUncompressedDataSize ( long size ) { m_lUncomprDataSize = size; }
223
	void SetUncompressedDataSize ( long size ) { m_lUncomprDataSize = size; }
227
	void SetDataCompression ( int c ) { m_iDataCompression = c; }
224
	void SetDataCompression ( int c ) { m_iDataCompression = c; }
228
	void SetShared ( bool b ) { m_bShared = b; }
225
	void SetShared ( bool b ) { m_bShared = b; }
229
	void SetSigned ( bool b ) { m_bSigned = b; }
226
	void SetSigned ( bool b ) { m_bSigned = b; }
230
	void SetFullDir(CyString dir) { _sFullDir = dir.ToString(); }
-
 
231
	void setFullDir(const Utils::String &dir) { _sFullDir = dir; }
227
	void setFullDir(const Utils::String &dir) { _sFullDir = dir; }
232
	void setInMod (const Utils::String &s) { _sInMod = s; }
228
	void setInMod (const Utils::String &s) { _sInMod = s; }
233
	void SetCompressedToFile ( bool b ) { m_bCompressedToFile = b; }
229
	void SetCompressedToFile ( bool b ) { m_bCompressedToFile = b; }
234
	void SetData(const unsigned char *data, size_t size) { m_sData = (unsigned char *)data, m_lDataSize = (long)size; }
230
	void SetData(const unsigned char *data, size_t size) { m_sData = (unsigned char *)data, m_lDataSize = (long)size; }
235
	void copyData(const unsigned char *data, size_t size);
231
	void copyData(const unsigned char *data, size_t size);
Line 237... Line 233...
237
	// get functions
233
	// get functions
238
	int getUsed () { return _iUsed; }
234
	int getUsed () { return _iUsed; }
239
	int GetLastError () { return m_iLastError; }
235
	int GetLastError () { return m_iLastError; }
240
	int GetFileType() { return m_iFileType; }
236
	int GetFileType() { return m_iFileType; }
241
	FileType fileType() { return m_iFileType; }
237
	FileType fileType() { return m_iFileType; }
242
	//CyString GetFilename() { return _sName; }
-
 
243
	const Utils::String &filename() const { return _sName; }
238
	const Utils::String &filename() const { return _sName; }
244
	CyString GetFullFilename() { return CyString(_sFullDir.toString()) + "/" + CyString(_sName.toString()); }
-
 
245
	Utils::String fullFilename() { return _sFullDir + "/" + _sName; }
239
	Utils::String fullFilename() { return _sFullDir + "/" + _sName; }
246
	long GetSize () { return m_lSize; }
240
	long GetSize () { return m_lSize; }
247
	time_t GetCreationTime () { return m_tTime; }
241
	time_t GetCreationTime () { return m_tTime; }
248
	CyString GetName() { return _sName.toString(); }
-
 
249
	const Utils::String &name() { return _sName; }
242
	const Utils::String &name() { return _sName; }
250
	CyString GetDir() { return _sDir.toString(); }
-
 
251
	const Utils::String &dir() { return _sDir; }
243
	const Utils::String &dir() { return _sDir; }
252
	Utils::String dataSizeString() const;
244
	Utils::String dataSizeString() const;
253
	CyString GetUncompressedSizeString ();
245
	Utils::String uncompressedSizeString() const;
254
	CyString GetDirectory(CBaseFile *spkfile);
-
 
255
	Utils::String getDirectory(CBaseFile *spkfile) const;
246
	Utils::String getDirectory(CBaseFile *spkfile) const;
256
	int GetVersion () { return m_iVersion; }
247
	int GetVersion () { return m_iVersion; }
257
	time_t GetLastModified() { return m_tTime; }
248
	time_t GetLastModified() { return m_tTime; }
258
	Utils::String fileTypeString() const { return ::GetFileTypeString(m_iFileType); }
249
	Utils::String fileTypeString() const { return ::GetFileTypeString(m_iFileType); }
259
	CyString GetFileTypeString() { return ::GetFileTypeString(m_iFileType); }
-
 
260
	CyString GetCreationTimeString ();
250
	Utils::String creationTimeString() const;
261
	const Utils::String &getTempFile () const { return _sTmpFile; }
251
	const Utils::String &getTempFile () const { return _sTmpFile; }
262
	CyString GetFullDir() { return _sFullDir; }
-
 
263
	const Utils::String fullDir() const { return _sFullDir; }
252
	const Utils::String fullDir() const { return _sFullDir; }
264
	CyString GetBaseName();
-
 
265
	Utils::String baseName() const;
253
	Utils::String baseName() const;
266
	CyString GetOriginalName() { return CyString(_sOriginalName); }
-
 
267
	const Utils::String &originalName() const { return _sOriginalName; }
254
	const Utils::String &originalName() const { return _sOriginalName; }
268
	const Utils::String &getInMod() const { return _sInMod; }
255
	const Utils::String &getInMod() const { return _sInMod; }
269
	const Utils::String &getSignature() { if ( !m_bUpdatedSignature ) updateSignature(); return _sSignature; }
256
	const Utils::String &getSignature() { if ( !m_bUpdatedSignature ) updateSignature(); return _sSignature; }
270
	void updateSignature();
257
	void updateSignature();
271
	void ChangeBaseName(CyString b) { _sName = CyString(b + "." + this->GetFileExt()).ToString(); }
-
 
272
	void changeBaseName(const Utils::String &b) { _sName = b + "." + this->fileExt(); }
258
	void changeBaseName(const Utils::String &b) { _sName = b + "." + this->fileExt(); }
273
	bool RenameScript(CyString baseName);
259
	bool renameScript(const Utils::String &baseName);
274
	bool isInMod() { return !_sInMod.empty(); }
260
	bool isInMod() { return !_sInMod.empty(); }
275
 
261
 
276
	void FixOriginalName() { _sOriginalName = _sName; }
262
	void FixOriginalName() { _sOriginalName = _sName; }
277
	void SetOriginalName(const Utils::String &name) { _sOriginalName = name; }
263
	void SetOriginalName(const Utils::String &name) { _sOriginalName = name; }
278
 
264
 
279
	bool isFileInAddon() const;
265
	bool isFileInAddon() const;
280
	bool IsFakePatch () const;
266
	bool IsFakePatch () const;
281
	bool isAutoTextFile();
267
	bool isAutoTextFile();
282
	int  GetTextFileID(CyString name = NullString);
268
	int  textFileID(const Utils::String &name = Utils::String::Null()) const;
283
	bool IsCompressedToFile () { return m_bCompressedToFile; }
269
	bool IsCompressedToFile () { return m_bCompressedToFile; }
284
	bool CompareNew ( C_File *file );
270
	bool CompareNew ( C_File *file );
285
	CyString GetFileExt() { return _sName.token(".", -1); }
-
 
286
	Utils::String fileExt() const;
271
	Utils::String fileExt() const;
287
	bool CheckFileExt ( const CyString &ext ) { 
272
	bool checkFileExt(const Utils::String& ext);
288
		if ( GetFileExt().Compare(ext) ) return true; return false; 
-
 
289
	}
-
 
290
	CyString ChangeFileExt(CyString ext);
-
 
291
	const Utils::String &changeFileExt(const Utils::String &ext);
273
	const Utils::String &changeFileExt(const Utils::String &ext);
292
	bool CheckPackedExtension();
274
	bool CheckPackedExtension();
293
	bool shouldCheckBaseName() const;
275
	bool shouldCheckBaseName() const;
294
 
276
 
295
	int GetCompressionType () { return m_iDataCompression; }
277
	int GetCompressionType () { return m_iDataCompression; }
296
	long GetDataSize () { return m_lDataSize; }
278
	long GetDataSize () { return m_lDataSize; }
297
	// returns the Uncompressed Data size, based on how the file is loaded, ie view data, view pointer, etc
279
	// returns the Uncompressed Data size, based on how the file is loaded, ie view data, view pointer, etc
298
	long GetUncompressedDataSize ()
280
	long uncompressedDataSize() const;
299
	{
-
 
300
		if ( m_lUncomprDataSize )
-
 
301
			return m_lUncomprDataSize;
-
 
302
		if ( m_lSize )
-
 
303
			return m_lSize;
-
 
304
		return m_lDataSize;
-
 
305
	}
-
 
306
	CyString GetNameDirectory(CBaseFile *spkfile);
-
 
307
	Utils::String getNameDirectory(CBaseFile *spkfile) const;
281
	Utils::String getNameDirectory(CBaseFile *spkfile) const;
308
 
282
 
309
	unsigned int game() const;
283
	unsigned int game() const;
310
	bool isForGame(int game) const;
284
	bool isForGame(int game) const;
311
	int getForSingleGame() const;
285
	int getForSingleGame() const;
Line 321... Line 295...
321
 
295
 
322
	// file reading functions
296
	// file reading functions
323
	long ReadFileSize ();
297
	long ReadFileSize ();
324
	time_t ReadLastModified ();
298
	time_t ReadLastModified ();
325
	bool readFromFile(const Utils::String filename);
299
	bool readFromFile(const Utils::String filename);
326
	bool ReadFromFile (CyString filename);
-
 
327
	bool ReadFromFile ();
300
	bool ReadFromFile ();
328
	bool readFromFile(CFileIO &File);
301
	bool readFromFile(CFileIO &File);
329
	bool readFromFile(CFileIO &File, int lSize, bool bDoSize = true);
302
	bool readFromFile(CFileIO &File, int lSize, bool bDoSize = true);
330
	//bool readFromFile(std::fstream &stream, long lSize, bool bDoSize = true );
-
 
331
	bool ReadFromData ( char *data, long size );
303
	bool ReadFromData ( char *data, long size );
332
	int ReadScriptVersion ();
304
	int ReadScriptVersion ();
333
	CyString GetFilePointer();
-
 
334
	Utils::String filePointer() const;
305
	Utils::String filePointer() const;
335
	bool isExternalFile() const;
306
	bool isExternalFile() const;
336
 
307
 
337
	// file writing functions
308
	// file writing functions
338
	bool writeToDir(const Utils::String &dir, CBaseFile *, bool = true, const Utils::String &appendDir = Utils::String::Null(), unsigned char * = NULL, long = 0);
309
	bool writeToDir(const Utils::String &dir, CBaseFile *, bool = true, const Utils::String &appendDir = Utils::String::Null(), unsigned char * = NULL, long = 0);
339
	bool writeToFile(const Utils::String &filename, unsigned char * = NULL, long = 0);
310
	bool writeToFile(const Utils::String &filename, unsigned char * = NULL, long = 0);
340
	bool writeFilePointer(unsigned char *cData = NULL, long len = 0);
311
	bool writeFilePointer(unsigned char *cData = NULL, long len = 0);
341
 
312
 
342
	// file compression functions
313
	// file compression functions
343
	unsigned char *CompressToData(int compressionType, unsigned long *outSize, CProgressInfo *progress = NULL, int level = DEFAULT_COMPRESSION_LEVEL);
314
	unsigned char *CompressToData(int compressionType, unsigned long *outSize, CProgressInfo *progress = NULL, int level = DEFAULT_COMPRESSION_LEVEL);
344
	bool UncompressToFile ( CyString, CBaseFile *, bool = true, CProgressInfo * = NULL );
315
	bool uncompressToFile(const Utils::String &toFile, CBaseFile *spkFile, bool includeDir = true, CProgressInfo *progress = NULL);
345
	bool ChangeCompression(int compresstyp, CProgressInfo *progress);
316
	bool ChangeCompression(int compresstyp, CProgressInfo *progress);
346
	bool CompressData ( int compressionType, CProgressInfo * = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
317
	bool CompressData ( int compressionType, CProgressInfo * = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
347
	bool CompressFile ( CProgressInfo * = NULL );
318
	bool CompressFile ( CProgressInfo * = NULL );
348
	bool UncompressData ( CProgressInfo * = NULL );
319
	bool UncompressData ( CProgressInfo * = NULL );
349
	unsigned char *UncompressData ( long *size, CProgressInfo * = NULL );
320
	unsigned char *UncompressData ( long *size, CProgressInfo * = NULL );