Subversion Repositories spk

Rev

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

Rev 181 Rev 196
Line 59... Line 59...
59
	case FILETYPE_MOD:
59
	case FILETYPE_MOD:
60
		return "Mods";
60
		return "Mods";
61
	case FILETYPE_UNINSTALL:
61
	case FILETYPE_UNINSTALL:
62
		return "PluginManager/Uninstall";
62
		return "PluginManager/Uninstall";
63
	case FILETYPE_SOUND:
63
	case FILETYPE_SOUND:
64
		if (!filename.empty() && !CFileIO(filename).isFileExtension("wav"))
64
		if (!filename.empty() && !CFileIO(filename).isFileExtension(L"wav"))
65
			return "Soundtrack";
65
			return "Soundtrack";
66
		return "s";
66
		return "s";
67
	case FILETYPE_SOUNDTRACK:
67
	case FILETYPE_SOUNDTRACK:
68
		return "Soundtrack";
68
		return "Soundtrack";
69
	case FILETYPE_EXTRA:
69
	case FILETYPE_EXTRA:
Line 613... Line 613...
613
	if ( (m_iFileType != FILETYPE_SCRIPT) && (m_iFileType != FILETYPE_UNINSTALL) )
613
	if ( (m_iFileType != FILETYPE_SCRIPT) && (m_iFileType != FILETYPE_UNINSTALL) )
614
		return false;
614
		return false;
615
 
615
 
616
	// check file pointer
616
	// check file pointer
617
	Utils::String file = filePointer();
617
	Utils::String file = filePointer();
618
	Utils::String ext = CFileIO(file).extension();
618
	Utils::WString ext = CFileIO(file).extension();
619
	if ( !ext.Compare("xml") && !ext.Compare("pck") )
619
	if ( !ext.Compare(L"xml") && !ext.Compare(L"pck") )
620
		return false;
620
		return false;
621
 
621
 
622
	if ( m_iDataCompression != SPKCOMPRESS_NONE )
622
	if ( m_iDataCompression != SPKCOMPRESS_NONE )
623
		return m_bSigned;
623
		return m_bSigned;
624
 
624
 
625
	// check file extenstion
625
	// check file extenstion
626
	if ( (ext.Compare("pck")) || (CheckPCK()) )
626
	if ( (ext.Compare(L"pck")) || (CheckPCK()) )
627
	{
627
	{
628
		size_t size = 0;
628
		size_t size = 0;
629
		unsigned char *data = UnPCKFile ( &size );
629
		unsigned char *data = UnPCKFile ( &size );
630
		if ( (data) && (size) ) {
630
		if ( (data) && (size) ) {
631
			bool ret = ::ReadSignedFromData ( data, (long)size );
631
			bool ret = ::ReadSignedFromData ( data, (long)size );
Line 684... Line 684...
684
	if ( file->name() != _sName )
684
	if ( file->name() != _sName )
685
	{
685
	{
686
		// check if the base name matches, but only for certain file extensions
686
		// check if the base name matches, but only for certain file extensions
687
		if (file->shouldCheckBaseName())
687
		if (file->shouldCheckBaseName())
688
		{
688
		{
689
			Utils::String baseName = CFileIO(file->name()).dir() + "/" + CFileIO(file->name()).baseName();
689
			Utils::WString baseName = CFileIO(file->name()).dir() + L"/" + CFileIO(file->name()).baseName();
690
			Utils::String compareBaseName = CFileIO(_sName).dir() + "/" + CFileIO(_sName).baseName();
690
			Utils::WString compareBaseName = CFileIO(_sName).dir() + L"/" + CFileIO(_sName).baseName();
691
			if (baseName.Compare(compareBaseName))
691
			if (baseName.Compare(compareBaseName))
692
				return true;
692
				return true;
693
		}
693
		}
694
		return false;
694
		return false;
695
	}
695
	}
Line 1774... Line 1774...
1774
	if (fileExt().Compare(ext)) return true; return false;
1774
	if (fileExt().Compare(ext)) return true; return false;
1775
}
1775
}
1776
 
1776
 
1777
const Utils::String &C_File::changeFileExt(const Utils::String &ext)
1777
const Utils::String &C_File::changeFileExt(const Utils::String &ext)
1778
{
1778
{
1779
	_sName = CFileIO(_sName).changeFileExtension(ext);
1779
	_sName = CFileIO(_sName).changeFileExtension(ext).toString();
1780
	return _sName;
1780
	return _sName;
1781
}
1781
}
1782
 
1782
 
1783
bool C_File::CheckPackedExtension()
1783
bool C_File::CheckPackedExtension()
1784
{
1784
{
Line 1793... Line 1793...
1793
	return false;
1793
	return false;
1794
}
1794
}
1795
 
1795
 
1796
bool C_File::shouldCheckBaseName() const
1796
bool C_File::shouldCheckBaseName() const
1797
{
1797
{
1798
	Utils::String ext = CFileIO(_sName).extension();
1798
	Utils::WString ext = CFileIO(_sName).extension();
1799
	if (ext == "xml" || ext == "txt" || ext == "pck")
1799
	if (ext == L"xml" || ext == L"txt" || ext == L"pck")
1800
		return true;
1800
		return true;
1801
	if (ext == "bod" || ext == "bob" || ext == "pbb" || ext == "pbd")
1801
	if (ext == L"bod" || ext == L"bob" || ext == L"pbb" || ext == L"pbd")
1802
		return true;
1802
		return true;
1803
	return false;
1803
	return false;
1804
}
1804
}
1805
 
1805
 
1806
unsigned int C_File::game() const 
1806
unsigned int C_File::game() const