Subversion Repositories spk

Rev

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

Rev 203 Rev 204
Line 75... Line 75...
75
{
75
{
76
	Utils::WString p = this->name(language);
76
	Utils::WString p = this->name(language);
77
	if (includeVersion)
77
	if (includeVersion)
78
	{
78
	{
79
		p += L" V";
79
		p += L" V";
80
		p += this->version().toWString();
80
		p += this->version();
81
	}
81
	}
82
	p += L" ";
82
	p += L" ";
83
	p += byString + L" " + this->author();
83
	p += byString + L" " + this->author();
84
	return p;
84
	return p;
85
}
85
}
Line 87... Line 87...
87
Utils::WString CBaseFile::getFullPackageName(const Utils::WString &format, int lang) const
87
Utils::WString CBaseFile::getFullPackageName(const Utils::WString &format, int lang) const
88
{
88
{
89
	if (format.empty())
89
	if (format.empty())
90
		return getFullPackageName(lang);
90
		return getFullPackageName(lang);
91
 
91
 
92
	Utils::WString args[3] = { this->name(lang), this->version().toWString(), this->author() };
92
	Utils::WString args[3] = { this->name(lang), this->version(), this->author() };
93
	return format.args(args, 3);
93
	return format.args(args, 3);
94
}
94
}
95
 
95
 
96
void CBaseFile::Delete ()
96
void CBaseFile::Delete ()
97
{
97
{
Line 1877... Line 1877...
1877
Utils::String CBaseFile::createValuesLine () const
1877
Utils::String CBaseFile::createValuesLine () const
1878
{
1878
{
1879
	Utils::WString values(L"Name: ");
1879
	Utils::WString values(L"Name: ");
1880
	values += this->name() + L"\n";
1880
	values += this->name() + L"\n";
1881
	values += L"Author: " + this->author() + L"\n";
1881
	values += L"Author: " + this->author() + L"\n";
1882
	values += L"Version: " + this->version().toWString() + L"\n";
1882
	values += L"Version: " + this->version() + L"\n";
1883
	if ( !this->creationDate().empty() )values += L"Date: "			+ this->creationDate().toWString()	+ L"\n";
1883
	if ( !this->creationDate().empty() )values += L"Date: "			+ this->creationDate()				+ L"\n";
1884
	if ( !this->webAddress().empty() )	values += L"WebAddress: "	+ this->webAddress().toWString()	+ L"\n";
1884
	if ( !this->webAddress().empty() )	values += L"WebAddress: "	+ this->webAddress().toWString()	+ L"\n";
1885
	if ( !this->webSite().empty() )		values += L"WebSite: "		+ this->webSite().toWString()		+ L"\n";
1885
	if ( !this->webSite().empty() )		values += L"WebSite: "		+ this->webSite().toWString()		+ L"\n";
1886
	if ( !this->email().empty() )		values += L"Email: "		+ this->email().toWString()			+ L"\n";
1886
	if ( !this->email().empty() )		values += L"Email: "		+ this->email().toWString()			+ L"\n";
1887
	if ( !this->forumLink().empty() )	values += L"ForumLink: "	+ this->forumLink().toWString()		+ L"\n";
1887
	if ( !this->forumLink().empty() )	values += L"ForumLink: "	+ this->forumLink().toWString()		+ L"\n";
1888
 
1888
 
Line 1923... Line 1923...
1923
	values += Utils::WString(L"GameChanging: ") + (long)gameChanging() + L"\n";
1923
	values += Utils::WString(L"GameChanging: ") + (long)gameChanging() + L"\n";
1924
	values += Utils::WString(L"EaseOfUse: ") + (long)easeOfUse() + L"\n";
1924
	values += Utils::WString(L"EaseOfUse: ") + (long)easeOfUse() + L"\n";
1925
	values += Utils::WString(L"Recommended: ") + (long)recommended() + L"\n";
1925
	values += Utils::WString(L"Recommended: ") + (long)recommended() + L"\n";
1926
 
1926
 
1927
	for(auto itr = namesList()->begin(); itr != namesList()->end(); itr++)
1927
	for(auto itr = namesList()->begin(); itr != namesList()->end(); itr++)
1928
		values += Utils::WString(L"ScriptName: ") + (long)(*itr)->iLanguage + L":" + (*itr)->sName.toWString() + L"\n";
1928
		values += Utils::WString(L"ScriptName: ") + (long)(*itr)->iLanguage + L":" + (*itr)->sName + L"\n";
1929
 
1929
 
1930
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() ) {
1930
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() ) {
1931
		SNeededLibrary *l = libNode->Data();
1931
		SNeededLibrary *l = libNode->Data();
1932
		values += L"NeededLibrary: " + l->sName + L"||" + l->sAuthor + L"||" + l->sMinVersion.toWString() + L"\n";
1932
		values += L"NeededLibrary: " + l->sName + L"||" + l->sAuthor + L"||" + l->sMinVersion + L"\n";
1933
	}
1933
	}
1934
 
1934
 
1935
	for (auto itr = _lFakePatchBefore.begin(); itr != _lFakePatchBefore.end(); itr++)
1935
	for (auto itr = _lFakePatchBefore.begin(); itr != _lFakePatchBefore.end(); itr++)
1936
		values += L"FakePatchBefore: " + (*itr)->str.toWString() + L"||" + (*itr)->data.toWString() + L"\n";
1936
		values += L"FakePatchBefore: " + (*itr)->str.toWString() + L"||" + (*itr)->data.toWString() + L"\n";
1937
	for (auto itr = _lFakePatchAfter.begin(); itr != _lFakePatchAfter.end(); itr++)
1937
	for (auto itr = _lFakePatchAfter.begin(); itr != _lFakePatchAfter.end(); itr++)
Line 2348... Line 2348...
2348
		removeFakePatchOrder(!after, scriptName, author);
2348
		removeFakePatchOrder(!after, scriptName, author);
2349
 
2349
 
2350
		list->pushBack(scriptName, author);
2350
		list->pushBack(scriptName, author);
2351
	}
2351
	}
2352
}
2352
}
2353
void CBaseFile::addNeededLibrary(const Utils::WString &scriptName, const Utils::WString &author, const Utils::String &minVersion)
2353
void CBaseFile::addNeededLibrary(const Utils::WString &scriptName, const Utils::WString &author, const Utils::WString &minVersion)
2354
{
2354
{
2355
	SNeededLibrary *l = this->findPackageNeeded(scriptName, author);
2355
	SNeededLibrary *l = this->findPackageNeeded(scriptName, author);
2356
	if ( !l )
2356
	if ( !l )
2357
	{
2357
	{
2358
		l = new SNeededLibrary;
2358
		l = new SNeededLibrary;
Line 2374... Line 2374...
2374
}
2374
}
2375
 
2375
 
2376
void CBaseFile::ClearNeededPackages()
2376
void CBaseFile::ClearNeededPackages()
2377
{
2377
{
2378
	SNeededLibrary *ns = this->findPackageNeeded(L"<package>", L"<author>");
2378
	SNeededLibrary *ns = this->findPackageNeeded(L"<package>", L"<author>");
2379
	Utils::String version;
2379
	Utils::WString version;
2380
	if ( ns ) version = ns->sMinVersion;
2380
	if ( ns ) version = ns->sMinVersion;
2381
 
2381
 
2382
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2382
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2383
		node->DeleteData();
2383
		node->DeleteData();
2384
	m_lNeededLibrarys.clear();
2384
	m_lNeededLibrarys.clear();
Line 2407... Line 2407...
2407
	list->pushBack("# The author of the script, ie, you");
2407
	list->pushBack("# The author of the script, ie, you");
2408
	list->pushBack("Author: " + this->author().toString());
2408
	list->pushBack("Author: " + this->author().toString());
2409
	list->pushBack("");
2409
	list->pushBack("");
2410
	list->pushBack("# The creation data, when it was created");
2410
	list->pushBack("# The creation data, when it was created");
2411
	if ( datafile )
2411
	if ( datafile )
2412
		list->pushBack("Date: " + this->creationDate());
2412
		list->pushBack("Date: " + this->creationDate().toString());
2413
	else {
2413
	else {
2414
		list->pushBack("# $DATE variable is used to get the current date");
2414
		list->pushBack("# $DATE variable is used to get the current date");
2415
		list->pushBack("Date: $DATE");
2415
		list->pushBack("Date: $DATE");
2416
	}
2416
	}
2417
	list->pushBack("");
2417
	list->pushBack("");
2418
	list->pushBack("# The version of script");
2418
	list->pushBack("# The version of script");
2419
	if ( datafile )
2419
	if ( datafile )
2420
		list->pushBack("Version: " + this->version());
2420
		list->pushBack("Version: " + this->version().toString());
2421
	else
2421
	else
2422
	{
2422
	{
2423
		list->pushBack("# $ASK variable is used to get an input when creating");
2423
		list->pushBack("# $ASK variable is used to get an input when creating");
2424
		list->pushBack("Version: $ASK");
2424
		list->pushBack("Version: $ASK");
2425
	}
2425
	}
Line 2496... Line 2496...
2496
 
2496
 
2497
	if ( m_lNeededLibrarys.size() )
2497
	if ( m_lNeededLibrarys.size() )
2498
	{
2498
	{
2499
		list->pushBack("# Needed Library dependacies, require these to be installed");
2499
		list->pushBack("# Needed Library dependacies, require these to be installed");
2500
		for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2500
		for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2501
			list->pushBack("Depend: " + node->Data()->sName.toString() + "|" + node->Data()-&gt;sMinVersion + "|" + node->;Data()->sAuthor.toString());
2501
			list->pushBack((L"Depend: " + node->Data()->sName + L"|" + node->Data()-&gt;sMinVersion + L"|" + node->;Data()->sAuthor).toString());
2502
 
2502
 
2503
		list->pushBack("");
2503
		list->pushBack("");
2504
	}
2504
	}
2505
 
2505
 
2506
	if ( !_noRatings() )
2506
	if ( !_noRatings() )
Line 2512... Line 2512...
2512
 
2512
 
2513
	if (namesList()->size())
2513
	if (namesList()->size())
2514
	{
2514
	{
2515
		list->pushBack("# Package names, uses different names for different languages");
2515
		list->pushBack("# Package names, uses different names for different languages");
2516
		for(auto itr = namesList()->begin(); itr != namesList()->end(); itr++)
2516
		for(auto itr = namesList()->begin(); itr != namesList()->end(); itr++)
2517
			list->pushBack(Utils::String("ScriptName: ") + (long)(*itr)->iLanguage + "; "; + (*itr)->sName);
2517
			list->pushBack((Utils::WString("ScriptName: ") + (long)(*itr)->iLanguage + L"; "; + (*itr)->sName).toString());
2518
		list->pushBack("");
2518
		list->pushBack("");
2519
	}
2519
	}
2520
 
2520
 
2521
	for ( int j = 0; j < 2; j++ ) {
2521
	for ( int j = 0; j < 2; j++ ) {
2522
		Utils::String installText = (j == 0) ? "Install" : "Uninstall";
2522
		Utils::String installText = (j == 0) ? "Install" : "Uninstall";
Line 2663... Line 2663...
2663
	return true;
2663
	return true;
2664
}
2664
}
2665
 
2665
 
2666
Utils::WString CBaseFile::getAutosaveName() const
2666
Utils::WString CBaseFile::getAutosaveName() const
2667
{
2667
{
2668
	return this->name() + L"-V" + this->version().toWString() + L"-" + this->creationDate().findReplace(";/", ".").toWString();
2668
	return this->name() + L"-V" + this->version() + L"-" + this->creationDate().findReplace(";/", ".");
2669
}
2669
}
2670
 
2670
 
2671
bool CBaseFile::CheckGameCompatability(int game)
2671
bool CBaseFile::CheckGameCompatability(int game)
2672
{
2672
{
2673
	if ( m_lGames.empty() )
2673
	if ( m_lGames.empty() )
Line 3198... Line 3198...
3198
	file.removeChar(' ');
3198
	file.removeChar(' ');
3199
 
3199
 
3200
	Utils::WStringList write;
3200
	Utils::WStringList write;
3201
	write.pushBack(L"Package: " + this->name());
3201
	write.pushBack(L"Package: " + this->name());
3202
	write.pushBack(L"Author: " + this->author());
3202
	write.pushBack(L"Author: " + this->author());
3203
	write.pushBack(L"Version: " + this->version().toWString());
3203
	write.pushBack(L"Version: " + this->version());
3204
	write.pushBack(L"File: " + CFileIO(this->filename()).filename());
3204
	write.pushBack(L"File: " + CFileIO(this->filename()).filename());
3205
 
3205
 
3206
	CFileIO File(dir + L"/" + file);
3206
	CFileIO File(dir + L"/" + file);
3207
	if (File.writeFile(&write))
3207
	if (File.writeFile(&write))
3208
		return File.fullFilename();
3208
		return File.fullFilename();