Subversion Repositories spk

Rev

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

Rev 49 Rev 50
Line 192... Line 192...
192
	wt->iLang = sData.token(" ", 1);
192
	wt->iLang = sData.token(" ", 1);
193
	wt->sName = sData.tokens(" ", 2).token("|", 1);
193
	wt->sName = sData.tokens(" ", 2).token("|", 1);
194
	wt->sDesc = sData.tokens(" ", 2).tokens("|", 2);
194
	wt->sDesc = sData.tokens(" ", 2).tokens("|", 2);
195
	m_pLastWare->lText.push_back ( wt );
195
	m_pLastWare->lText.push_back ( wt );
196
 
196
 
197
	m_bChanged = true;
197
	_changed();
198
}
198
}
199
 
199
 
200
void CSpkFile::AddWare(const Utils::String &sData)
200
void CSpkFile::AddWare(const Utils::String &sData)
201
{
201
{
202
	SWares *ware = new SWares;
202
	SWares *ware = new SWares;
Line 215... Line 215...
215
		ware->iTextPage = r.token(",", 2);
215
		ware->iTextPage = r.token(",", 2);
216
	}
216
	}
217
	m_lWares.push_back ( ware );
217
	m_lWares.push_back ( ware );
218
	m_pLastWare = ware;
218
	m_pLastWare = ware;
219
 
219
 
220
	m_bChanged = true;
220
	_changed();
221
}
221
}
222
 
222
 
223
 
223
 
224
 
224
 
225
bool CSpkFile::ReadFileToMemory ( C_File *file )
225
bool CSpkFile::ReadFileToMemory ( C_File *file )
Line 230... Line 230...
230
	// check if data is already extracted
230
	// check if data is already extracted
231
	if ( (file->GetDataSize ()) && (file->GetData()) )
231
	if ( (file->GetDataSize ()) && (file->GetData()) )
232
		return true;
232
		return true;
233
 
233
 
234
	// no file to read from
234
	// no file to read from
235
	if ( m_sFilename.Empty() )
235
	if ( this->filename().empty() )
236
		return false;
236
		return false;
237
 
237
 
238
	// now open the file
238
	// now open the file
239
	FILE *id = fopen ( m_sFilename.c_str(), "rb" );
239
	FILE *id = fopen ( this->filename().c_str(), "rb" );
240
	if ( !id )
240
	if ( !id )
241
		return false;
241
		return false;
242
 
242
 
243
	// read the header
243
	// read the header
244
	GetEndOfLine ( id, NULL, false );
244
	GetEndOfLine ( id, NULL, false );
Line 303... Line 303...
303
{
303
{
304
	for ( CListNode<SWares> *node = m_lWares.Front(); node; node = node->next() ) {
304
	for ( CListNode<SWares> *node = m_lWares.Front(); node; node = node->next() ) {
305
		node->Data()->lText.clear(true);
305
		node->Data()->lText.clear(true);
306
		node->DeleteData();
306
		node->DeleteData();
307
	}
307
	}
308
	m_bChanged = true;
308
	_changed();
309
	m_lWares.clear(true);
309
	m_lWares.clear(true);
310
}
310
}
311
 
311
 
312
SWares *CSpkFile::FindWare(const Utils::String &id) const
312
SWares *CSpkFile::FindWare(const Utils::String &id) const
313
{
313
{
Line 325... Line 325...
325
	for ( CListNode<SWares> *node = m_lWares.Front(); node; node = node->next() ) {
325
	for ( CListNode<SWares> *node = m_lWares.Front(); node; node = node->next() ) {
326
		SWares *w = node->Data();
326
		SWares *w = node->Data();
327
		if ( w->sID.Compare(id) ) {
327
		if ( w->sID.Compare(id) ) {
328
			m_lWares.RemoveCurrent ();
328
			m_lWares.RemoveCurrent ();
329
			delete w;
329
			delete w;
330
			m_bChanged = true;
330
			_changed();
331
			return;
331
			return;
332
		}
332
		}
333
	}
333
	}
334
}
334
}
335
 
335
 
Line 341... Line 341...
341
	if ( newware ) {
341
	if ( newware ) {
342
		m_lWares.remove(newware);
342
		m_lWares.remove(newware);
343
	}
343
	}
344
 
344
 
345
	m_lWares.push_back(ware);
345
	m_lWares.push_back(ware);
346
	m_bChanged = true;
346
	_changed();
347
}
347
}
348
 
348
 
349
void CSpkFile::AddWareText(SWares *pWare, int iLang, const Utils::String &sName, const Utils::String &sDesc)
349
void CSpkFile::AddWareText(SWares *pWare, int iLang, const Utils::String &sName, const Utils::String &sDesc)
350
{
350
{
351
	SWaresText *wt;
351
	SWaresText *wt;
Line 362... Line 362...
362
	wt->iLang = iLang;
362
	wt->iLang = iLang;
363
	wt->sName = sName;
363
	wt->sName = sName;
364
	wt->sDesc = sDesc;
364
	wt->sDesc = sDesc;
365
 
365
 
366
	pWare->lText.push_back(wt);
366
	pWare->lText.push_back(wt);
367
	m_bChanged = true;
367
	_changed();
368
}
368
}
369
 
369
 
370
 
370
 
371
void CSpkFile::ClearWareText(const Utils::String &id)
371
void CSpkFile::ClearWareText(const Utils::String &id)
372
{
372
{
Line 377... Line 377...
377
void CSpkFile::ClearWareText(SWares *w)
377
void CSpkFile::ClearWareText(SWares *w)
378
{
378
{
379
	if ( !w ) return;
379
	if ( !w ) return;
380
 
380
 
381
	w->lText.clear(true);
381
	w->lText.clear(true);
382
	m_bChanged = true;
382
	_changed();
383
}
383
}
384
 
384
 
385
void CSpkFile::RemoveWareText(const Utils::String &wid, int lang)
385
void CSpkFile::RemoveWareText(const Utils::String &wid, int lang)
386
{
386
{
387
	SWares *w = FindWare(wid);
387
	SWares *w = FindWare(wid);
Line 389... Line 389...
389
	{
389
	{
390
		for ( CListNode<SWaresText> *node = w->lText.Front(); node; node = node->next() ) {
390
		for ( CListNode<SWaresText> *node = w->lText.Front(); node; node = node->next() ) {
391
			SWaresText *wt = node->Data();
391
			SWaresText *wt = node->Data();
392
			if ( wt->iLang == lang ) {
392
			if ( wt->iLang == lang ) {
393
				w->lText.RemoveCurrent();
393
				w->lText.RemoveCurrent();
394
				m_bChanged = true;
394
				_changed();
395
				delete wt;
395
				delete wt;
396
				break;
396
				break;
397
			}
397
			}
398
		}
398
		}
399
	}
399
	}
Line 459... Line 459...
459
 
459
 
460
	t->sKey = sKey;
460
	t->sKey = sKey;
461
	t->iType = type;
461
	t->iType = type;
462
 
462
 
463
	m_lSettings.push_back ( t );
463
	m_lSettings.push_back ( t );
464
	m_bChanged = true;
464
	_changed();
465
 
465
 
466
	return t;
466
	return t;
467
}
467
}
468
 
468
 
469
void CSpkFile::ConvertSetting ( SSettingType *t, const Utils::String &set ) const
469
void CSpkFile::ConvertSetting ( SSettingType *t, const Utils::String &set ) const
Line 492... Line 492...
492
	switch ( t->iType )
492
	switch ( t->iType )
493
	{
493
	{
494
		case SETTING_STRING:
494
		case SETTING_STRING:
495
			return ((SSettingString *)t)->sValue;
495
			return ((SSettingString *)t)->sValue;
496
		case SETTING_INTEGER:
496
		case SETTING_INTEGER:
497
			return Utils::String::number(((SSettingInteger *)t)->iValue);
497
			return Utils::String::Number(((SSettingInteger *)t)->iValue);
498
		case SETTING_CHECK:
498
		case SETTING_CHECK:
499
			return (((SSettingInteger *)t)->iValue) ? "1" : "0";
499
			return (((SSettingInteger *)t)->iValue) ? "1" : "0";
500
	}
500
	}
501
 
501
 
502
	return "";
502
	return "";
503
}
503
}
504
 
504
 
505
void CSpkFile::ClearSettings ()
505
void CSpkFile::ClearSettings ()
506
{
506
{
507
	m_lSettings.clear(true);
507
	m_lSettings.clear(true);
508
	m_bChanged = true;
508
	_changed();
509
}
509
}
510
 
510
 
511
 
511
 
512
bool CSpkFile::IsMatchingMod(const Utils::String &mod) const
512
bool CSpkFile::IsMatchingMod(const Utils::String &mod) const
513
{
513
{
Line 838... Line 838...
838
	return file->GetFilename().GetToken(".", 2, 2).ToString();
838
	return file->GetFilename().GetToken(".", 2, 2).ToString();
839
}
839
}
840
 
840
 
841
void CSpkFile::MergePackage(CBaseFile *base)
841
void CSpkFile::MergePackage(CBaseFile *base)
842
{
842
{
843
	// update version information
-
 
844
	m_sVersion = base->GetVersion();
-
 
845
	m_sCreationDate = base->GetCreationDate();
-
 
846
 
-
 
847
	// update possible changes
843
	// update possible changes
848
	if ( base->GetType() == TYPE_SPK )
844
	if ( base->GetType() == TYPE_SPK )
849
	{
845
	{
850
		CSpkFile *spk = (CSpkFile *)base;
846
		CSpkFile *spk = (CSpkFile *)base;
851
		m_bForceProfile = spk->IsForceProfile();
847
		m_bForceProfile = spk->IsForceProfile();
Line 918... Line 914...
918
unsigned char *CSpkFile::_convert_uncompressFile(const Utils::String &sOldFilename, int *pLen)
914
unsigned char *CSpkFile::_convert_uncompressFile(const Utils::String &sOldFilename, int *pLen)
919
{
915
{
920
	// firstcheck if the file exists
916
	// firstcheck if the file exists
921
	FILE *id = fopen(sOldFilename.c_str(), "rb" );
917
	FILE *id = fopen(sOldFilename.c_str(), "rb" );
922
	if ( !id ) {
918
	if ( !id ) {
923
		CLog::logf(CLog::Log_IO, "Unable to open file: %s", sOldFilename.c_str());
919
		CLog::logf(CLog::Log_IO, 1, "Unable to open file: %s", sOldFilename.c_str());
924
		return false;
920
		return false;
925
	}
921
	}
926
 
922
 
927
	// read the first 3 charaters to check if its using the original "HiP" compression
923
	// read the first 3 charaters to check if its using the original "HiP" compression
928
	Utils::String check((char)fgetc(id));
924
	Utils::String check((char)fgetc(id));
Line 944... Line 940...
944
			if ( id )
940
			if ( id )
945
				opened = true;
941
				opened = true;
946
		}
942
		}
947
 
943
 
948
		if ( !opened ) {
944
		if ( !opened ) {
949
			CLog::log(CLog::Log_IO, "Unable to uncompress file, exiting...");
945
			CLog::log(CLog::Log_IO, 1, "Unable to uncompress file, exiting...");
950
			return false;
946
			return false;
951
		}
947
		}
952
 
948
 
953
		CLog::log(CLog::Log_IO, "* Reading file into memory...");
949
		CLog::log(CLog::Log_IO, 1, "* Reading file into memory...");
954
		// get file length
950
		// get file length
955
		fseek ( id, 0, SEEK_END );
951
		fseek ( id, 0, SEEK_END );
956
		len = ftell ( id );
952
		len = ftell ( id );
957
		
953
		
958
		// move back to beginning
954
		// move back to beginning
Line 964... Line 960...
964
 
960
 
965
		newlen = len;
961
		newlen = len;
966
	}
962
	}
967
	else
963
	else
968
	{
964
	{
969
		CLog::log(CLog::Log_IO, "* Reading file into memory...");
965
		CLog::log(CLog::Log_IO, 1, "* Reading file into memory...");
970
		// get file length
966
		// get file length
971
		fseek ( id, 0, SEEK_END );
967
		fseek ( id, 0, SEEK_END );
972
		len = ftell ( id );
968
		len = ftell ( id );
973
		
969
		
974
		// move back to beginning
970
		// move back to beginning
Line 977... Line 973...
977
		// read the data from file into memory
973
		// read the data from file into memory
978
		data = new unsigned char[len + 1];
974
		data = new unsigned char[len + 1];
979
		fread ( data, sizeof(unsigned char), len, id );
975
		fread ( data, sizeof(unsigned char), len, id );
980
 
976
 
981
		// uncompress the file (currently only 7zip compression)
977
		// uncompress the file (currently only 7zip compression)
982
		CLog::log(CLog::Log_IO, "* Uncompressing file...");
978
		CLog::log(CLog::Log_IO, 1, "* Uncompressing file...");
983
		newlen = len;
979
		newlen = len;
984
	#ifdef _INCLUDE7ZIP
980
	#ifdef _INCLUDE7ZIP
985
		uncomprData = LZMADecodeData ( data, len, newlen, progress );
981
		uncomprData = LZMADecodeData ( data, len, newlen, progress );
986
	#else
982
	#else
987
		uncomprData = LZMADecode_C ( (unsigned char *)data, len, (size_t*)&newlen, NULL );
983
		uncomprData = LZMADecode_C ( (unsigned char *)data, len, (size_t*)&newlen, NULL );
Line 1036... Line 1032...
1036
 
1032
 
1037
void CSpkFile::_convert_parse(const Utils::String &sCmd, const Utils::String &sRest)
1033
void CSpkFile::_convert_parse(const Utils::String &sCmd, const Utils::String &sRest)
1038
{
1034
{
1039
	if ( sCmd == "Name:" )
1035
	if ( sCmd == "Name:" )
1040
	{
1036
	{
1041
		this->SetName ( sRest );
1037
		this->setName ( sRest );
1042
		CLog::logf(CLog::Log_EditPackage, "\tScript Name: %s", sRest.c_str() );
1038
		CLog::logf(CLog::Log_EditPackage, 3, "\tScript Name: %s", sRest.c_str() );
1043
	}
1039
	}
1044
	else if ( sCmd == "Author:" )
1040
	else if ( sCmd == "Author:" )
1045
	{
1041
	{
1046
		this->SetAuthor ( sRest );
1042
		this->setAuthor(sRest);
1047
		CLog::logf(CLog::Log_EditPackage, "\tScript Author: %s", sRest.c_str() );
1043
		CLog::logf(CLog::Log_EditPackage, 3, "\tScript Author: %s", sRest.c_str() );
1048
	}
1044
	}
1049
	else if ( sCmd == "CustomStart" )
1045
	else if ( sCmd == "CustomStart" )
1050
	{
1046
	{
1051
		this->SetCustomStart();
1047
		this->SetCustomStart();
1052
		CLog::logf(CLog::Log_EditPackage, "\tPackage is a custom start!!" );
1048
		CLog::logf(CLog::Log_EditPackage, 3, "\tPackage is a custom start!!" );
1053
	}
1049
	}
1054
	else if ( sCmd == "AnotherMod:" )
1050
	else if ( sCmd == "AnotherMod:" )
1055
	{
1051
	{
1056
		this->SetAnotherMod(sRest.token("|", 1), sRest.tokens("|", 2));
1052
		this->SetAnotherMod(sRest.token("|", 1), sRest.tokens("|", 2));
1057
		CLog::logf(CLog::Log_EditPackage, "\tFor another Mod, Name: %s, Author: %s", this->GetOtherName().c_str(), this->GetOtherAuthor().c_str() );
1053
		CLog::logf(CLog::Log_EditPackage, 3, "\tFor another Mod, Name: %s, Author: %s", this->GetOtherName().c_str(), this->GetOtherAuthor().c_str() );
1058
	}
1054
	}
1059
	else if ( sCmd == "PATCH" )
1055
	else if ( sCmd == "PATCH" )
1060
	{
1056
	{
1061
		this->SetPatch();
1057
		this->SetPatch();
1062
		CLog::logf(CLog::Log_EditPackage, "\tPackage is a Patch Mod!!" );
1058
		CLog::logf(CLog::Log_EditPackage, 3, "\tPackage is a Patch Mod!!" );
1063
	}
1059
	}
1064
	else if ( sCmd == "Version:" )
1060
	else if ( sCmd == "Version:" )
1065
	{
1061
	{
1066
		this->SetVersion ( sRest );
1062
		this->setVersion(sRest);
1067
		CLog::logf(CLog::Log_EditPackage, "\tScript Version: %s", sRest.c_str() );
1063
		CLog::logf(CLog::Log_EditPackage, 3,"\tScript Version: %s", sRest.c_str() );
1068
	}
1064
	}
1069
	else if ( sCmd == "Date:" )
1065
	else if ( sCmd == "Date:" )
1070
	{
1066
	{
1071
		this->SetCreationDate ( sRest );
1067
		this->setCreationDate ( sRest );
1072
		CLog::logf(CLog::Log_EditPackage, "\tScript Creation Date: %s", sRest.c_str() );
1068
		CLog::logf(CLog::Log_EditPackage, 3,"\tScript Creation Date: %s", sRest.c_str() );
1073
	}
1069
	}
1074
	else if ( sCmd == "Desc:" ) {
1070
	else if ( sCmd == "Desc:" ) {
1075
		this->setDescription(sRest.findReplace("<br>", "\n") );
1071
		this->setDescription(sRest.findReplace("<br>", "\n") );
1076
		CLog::logf(CLog::Log_EditPackage, "\tScript Description: %s", this->description().c_str() );
1072
		CLog::logf(CLog::Log_EditPackage, 3,"\tScript Description: %s", this->description().c_str() );
1077
	}
1073
	}
1078
	else if ( sCmd == "WebAddress:" ) {
1074
	else if ( sCmd == "WebAddress:" ) {
1079
		this->setWebAddress(sRest);
1075
		this->setWebAddress(sRest);
1080
		CLog::logf(CLog::Log_EditPackage, "\tWeb Address: %s", sRest.c_str() );
1076
		CLog::logf(CLog::Log_EditPackage, 3, "\tWeb Address: %s", sRest.c_str() );
1081
	}
1077
	}
1082
	else if ( sCmd == "WebMirror1:" )
1078
	else if ( sCmd == "WebMirror1:" )
1083
	{
1079
	{
1084
		this->AddWebMirror(sRest);
1080
		this->AddWebMirror(sRest);
1085
		CLog::logf(CLog::Log_EditPackage, "\tWeb Mirror Address: %s", sRest.c_str() );
1081
		CLog::logf(CLog::Log_EditPackage, 3, "\tWeb Mirror Address: %s", sRest.c_str() );
1086
	}
1082
	}
1087
	else if ( sCmd == "WebMirror2:" )
1083
	else if ( sCmd == "WebMirror2:" )
1088
	{
1084
	{
1089
		this->AddWebMirror(sRest);
1085
		this->AddWebMirror(sRest);
1090
		CLog::logf(CLog::Log_EditPackage, "\tWeb Mirror Address: %s", sRest.c_str() );
1086
		CLog::logf(CLog::Log_EditPackage, 3, "\tWeb Mirror Address: %s", sRest.c_str() );
1091
	}
1087
	}
1092
	
1088
	
1093
	else if ( sCmd == "ScriptType:" )
1089
	else if ( sCmd == "ScriptType:" )
1094
		this->SetScriptType (sRest);
1090
		this->SetScriptType (sRest);
1095
	else if ( sCmd == "WebSite:" ) {
1091
	else if ( sCmd == "WebSite:" ) {
1096
		this->setWebSite ( sRest );
1092
		this->setWebSite ( sRest );
1097
		CLog::logf(CLog::Log_EditPackage, "\tWeb Site: %s", sRest.c_str() );
1093
		CLog::logf(CLog::Log_EditPackage, 3, "\tWeb Site: %s", sRest.c_str() );
1098
	}
1094
	}
1099
	else if ( sCmd == "Email:" ) {
1095
	else if ( sCmd == "Email:" ) {
1100
		this->setEmail(sRest);
1096
		this->setEmail(sRest);
1101
		CLog::logf(CLog::Log_EditPackage, "\tAuthor Email Address: %s", sRest.c_str() );
1097
		CLog::logf(CLog::Log_EditPackage, 3, "\tAuthor Email Address: %s", sRest.c_str() );
1102
	}
1098
	}
1103
	else if ( sCmd == "GameVersion:" )
1099
	else if ( sCmd == "GameVersion:" )
1104
	{
1100
	{
1105
		//TODO: fix this for new game version
1101
		//TODO: fix this for new game version
1106
		/*
1102
		/*
Line 1116... Line 1112...
1116
	}
1112
	}
1117
	
1113
	
1118
	else if ( sCmd == "Ware:" )
1114
	else if ( sCmd == "Ware:" )
1119
	{
1115
	{
1120
		this->AddWare ( sRest );
1116
		this->AddWare ( sRest );
1121
		CLog::logf(CLog::Log_EditPackage, "\tAdding Custom Ware" );
1117
		CLog::logf(CLog::Log_EditPackage, 3, "\tAdding Custom Ware" );
1122
	}
1118
	}
1123
	else if ( sCmd == "WareText:" )
1119
	else if ( sCmd == "WareText:" )
1124
		this->AddWareText ( sRest );
1120
		this->AddWareText ( sRest );
1125
	else if ( sCmd == "UninstallAfter:" )	this->addUninstallText(sRest.token(" ", 1).toLong(), false, sRest.tokens(" ", 2));
1121
	else if ( sCmd == "UninstallAfter:" )	this->addUninstallText(sRest.token(" ", 1).toLong(), false, sRest.tokens(" ", 2));
1126
	else if ( sCmd == "UninstallBefore:" )	this->addUninstallText(sRest.token(" ", 1).toLong(), true, sRest.tokens(" ", 2));
1122
	else if ( sCmd == "UninstallBefore:" )	this->addUninstallText(sRest.token(" ", 1).toLong(), true, sRest.tokens(" ", 2));
Line 1129... Line 1125...
1129
	else if ( sCmd == "ScriptName:" )
1125
	else if ( sCmd == "ScriptName:" )
1130
	{
1126
	{
1131
		Utils::String lang = sRest.token(":", 1);
1127
		Utils::String lang = sRest.token(":", 1);
1132
		Utils::String name = sRest.tokens(":", 2);
1128
		Utils::String name = sRest.tokens(":", 2);
1133
		this->AddLanguageName(lang.toLong(), name);
1129
		this->AddLanguageName(lang.toLong(), name);
1134
		CLog::logf(CLog::Log_EditPackage, "\tScript Name Language (%s) %s", lang.c_str(), name.c_str() );
1130
		CLog::logf(CLog::Log_EditPackage, 3, "\tScript Name Language (%s) %s", lang.c_str(), name.c_str() );
1135
	}
1131
	}
1136
}
1132
}
1137
 
1133
 
1138
Utils::String CSpkFile::_convert_parseFilename(const Utils::String &sRest, float fVersion, Utils::String *pDir)
1134
Utils::String CSpkFile::_convert_parseFilename(const Utils::String &sRest, float fVersion, Utils::String *pDir)
1139
{
1135
{
Line 1177... Line 1173...
1177
	bool binaryRead = (CFileIO(filename).CheckFileExtension("PCK")) ? true : false;
1173
	bool binaryRead = (CFileIO(filename).CheckFileExtension("PCK")) ? true : false;
1178
	if ( sEnd.empty() ) binaryRead = true;
1174
	if ( sEnd.empty() ) binaryRead = true;
1179
	
1175
	
1180
	C_File *file = new C_File ();
1176
	C_File *file = new C_File ();
1181
 
1177
 
1182
	if ( bShared )	CLog::logf(CLog::Log_File, "\tFound %s File (Shared): %s, Reading...", sFile.c_str(), filename.c_str() );
1178
	if ( bShared )	CLog::logf(CLog::Log_File, 2, "\tFound %s File (Shared): %s, Reading...", sFile.c_str(), filename.c_str() );
1183
	else			CLog::logf(CLog::Log_File, "\tFound %s File: %s, Reading...", sFile.c_str(), filename.c_str() );
1179
	else			CLog::logf(CLog::Log_File, 2, "\tFound %s File: %s, Reading...", sFile.c_str(), filename.c_str() );
1184
 
1180
 
1185
	// read the data
1181
	// read the data
1186
	if ( binaryRead )
1182
	if ( binaryRead )
1187
	{
1183
	{
1188
		file->ReadFromData ( (char *)d, size );
1184
		file->ReadFromData ( (char *)d, size );
Line 1203... Line 1199...
1203
	if ( !dir.empty() )
1199
	if ( !dir.empty() )
1204
		file->SetDir ( dir );
1200
		file->SetDir ( dir );
1205
	
1201
	
1206
	this->AddFile ( file );
1202
	this->AddFile ( file );
1207
 
1203
 
1208
	CLog::logf(CLog::Log_File, "Size: %s", file->GetDataSizeString().c_str() );
1204
	CLog::logf(CLog::Log_File, 3, "Size: %s", file->GetDataSizeString().c_str() );
1209
 
1205
 
1210
	return d;
1206
	return d;
1211
}
1207
}
1212
 
1208
 
1213
CSpkFile *CSpkFile::convertFromOld(const Utils::String &sOldFilename)
1209
CSpkFile *CSpkFile::convertFromOld(const Utils::String &sOldFilename)
Line 1239... Line 1235...
1239
	int len;
1235
	int len;
1240
	unsigned char *uncomprData = this->_convert_uncompressFile(sOldFilename, &len);
1236
	unsigned char *uncomprData = this->_convert_uncompressFile(sOldFilename, &len);
1241
 
1237
 
1242
	// uncomressed failed
1238
	// uncomressed failed
1243
	if ( !uncomprData ) {
1239
	if ( !uncomprData ) {
1244
		CLog::log(CLog::Log_IO, "Error: Unable to uncompress the file");
1240
		CLog::log(CLog::Log_IO, 1, "Error: Unable to uncompress the file");
1245
		return false;
1241
		return false;
1246
	}
1242
	}
1247
 
1243
 
1248
	// now we can read the data
1244
	// now we can read the data
1249
	unsigned char *d = uncomprData;
1245
	unsigned char *d = uncomprData;
Line 1253... Line 1249...
1253
	//SMultiSpkFile *cur_mspk = NULL;
1249
	//SMultiSpkFile *cur_mspk = NULL;
1254
 
1250
 
1255
	int numscripts = 0, curscript = 0;
1251
	int numscripts = 0, curscript = 0;
1256
	float fVersion = 1;
1252
	float fVersion = 1;
1257
 
1253
 
1258
	CLog::log(CLog::Log_IO, "* Reading spk data...");
1254
	CLog::log(CLog::Log_IO, 1, "* Reading spk data...");
1259
	while ( d )
1255
	while ( d )
1260
	{
1256
	{
1261
		// read the next line
1257
		// read the next line
1262
		d = str.readToEndOfLine(d);
1258
		d = str.readToEndOfLine(d);
1263
		if ( !d || d[0] == 0 ) {
1259
		if ( !d || d[0] == 0 ) {
Line 1295... Line 1291...
1295
		}
1291
		}
1296
		*/
1292
		*/
1297
		Utils::String sRest = str.tokens(" ", 2);
1293
		Utils::String sRest = str.tokens(" ", 2);
1298
		if ( sCmd == "Packager:" ) {
1294
		if ( sCmd == "Packager:" ) {
1299
			fVersion = sRest;
1295
			fVersion = sRest;
1300
			CLog::logf(CLog::Log_Read, "\tPackager Version: %.2f", fVersion );
1296
			CLog::logf(CLog::Log_Read, 3, "\tPackager Version: %.2f", fVersion );
1301
		}
1297
		}
1302
		else if ( sCmd == "Icon:" )
1298
		else if ( sCmd == "Icon:" )
1303
		{
1299
		{
1304
			long size = sRest.token(" ", 1);
1300
			long size = sRest.token(" ", 1);
1305
			Utils::String ext = sRest.token(" ", 2);
1301
			Utils::String ext = sRest.token(" ", 2);
Line 1309... Line 1305...
1309
 
1305
 
1310
			d += size;
1306
			d += size;
1311
 
1307
 
1312
			this->SetIcon(file, ext);
1308
			this->SetIcon(file, ext);
1313
 
1309
 
1314
			CLog::logf(CLog::Log_File, "\tIcon (%s) Size: %s", ext.c_str(), file->GetDataSizeString ().c_str() );
1310
			CLog::logf(CLog::Log_File, 3, "\tIcon (%s) Size: %s", ext.c_str(), file->GetDataSizeString ().c_str() );
1315
		}
1311
		}
1316
		else if ( sCmd.left(3) == "$$$" )
1312
		else if ( sCmd.left(3) == "$$$" )
1317
			d = _convert_parseFile(sCmd, sRest, fVersion, d);
1313
			d = _convert_parseFile(sCmd, sRest, fVersion, d);
1318
		else {
1314
		else {
1319
			this->_convert_parse(sCmd, sRest);
1315
			this->_convert_parse(sCmd, sRest);
1320
		}
1316
		}
1321
	}
1317
	}
1322
 
1318
 
1323
	CLog::logf(CLog::Log_IO, "* Reading spk data..." );
1319
	CLog::logf(CLog::Log_IO, 1, "* Reading spk data..." );
1324
 
1320
 
1325
	return true;
1321
	return true;
1326
}
1322
}