Subversion Repositories spk

Rev

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

Rev 125 Rev 126
Line 487... Line 487...
487
		}
487
		}
488
	}
488
	}
489
 
489
 
490
	return dir;
490
	return dir;
491
}
491
}
-
 
492
 
-
 
493
int CGameExe::findAddonType(const Utils::String &addon) const
-
 
494
{
-
 
495
	int i = 0;
-
 
496
	for (CListNode<SGameExe> *node = m_lExe.Front(); node; node = node->next())
-
 
497
	{
-
 
498
		SGameExe *exe = node->Data();
-
 
499
		if (exe->iFlags & EXEFLAG_ADDON)
-
 
500
		{
-
 
501
			if (exe->sAddon.Compare(addon))
-
 
502
				return i;
-
 
503
		}
-
 
504
		++i;
-
 
505
	}
-
 
506
 
-
 
507
	return -1;
-
 
508
}
-
 
509
 
492
int CGameExe::GetGameType(const Utils::String &gameExe) const
510
int CGameExe::GetGameType(const Utils::String &gameExe) const
493
{
511
{
494
	CDirIO Dir (gameExe);
512
	CDirIO Dir (gameExe);
495
	int count = 0;
513
	int count = 0;
496
 
514
 
Line 556... Line 574...
556
		CDirIO Dir(sGameDir);
574
		CDirIO Dir(sGameDir);
557
		CFileIO File(Dir.File(textFileName));
575
		CFileIO File(Dir.File(textFileName));
558
		size_t fileSize;
576
		size_t fileSize;
559
		unsigned char *fileData = File.readAll(&fileSize);
577
		unsigned char *fileData = File.readAll(&fileSize);
560
		if ( fileData && fileSize) 
578
		if ( fileData && fileSize) 
561
		{
579
		{
562
			if (CFileIO(textFileName).isFileExtension("pck"))
580
			if (CFileIO(textFileName).isFileExtension("pck"))
563
			{
581
			{
564
				size_t newFileSize;
582
				size_t newFileSize;
565
				unsigned char *pckData = UnPCKData((unsigned char *)fileData, fileSize, &newFileSize);
583
				unsigned char *pckData = UnPCKData((unsigned char *)fileData, fileSize, &newFileSize);
566
				delete fileData;
584
				delete fileData;
Line 572... Line 590...
572
			else if (CFileIO(textFileName).isFileExtension("xml"))
590
			else if (CFileIO(textFileName).isFileExtension("xml"))
573
			{
591
			{
574
				Utils::String Data((char *)fileData);
592
				Utils::String Data((char *)fileData);
575
				delete fileData;
593
				delete fileData;
576
				return Data;
594
				return Data;
577
			}
595
			}
578
		}
596
		}
579
	}
597
	}
580
 
598
 
581
	return "";
599
	return "";
582
}
600
}
583
 
601
 
584
Utils::String CGameExe::_extractTextData(const Utils::String &sData, long iPage, long iID, int iGameID) const
602
Utils::String CGameExe::_extractTextData(const Utils::String &sData, long iPage, long iID, int iGameID) const
585
{
603
{
586
	Utils::String sID = Utils::String("<t id=\"") + iID + "\">";
604
	Utils::String sID = Utils::String("<t id=\"") + iID + "\">";
587
 
605
 
588
	if (iGameID > 0)
606
	if (iGameID > 0)
589
	{
607
	{
590
		Utils::String sPage = Utils::String("<page id=\"") + Utils::String::Number(iGameID) + iPage + "\"";
608
		Utils::String sPage = Utils::String("<page id=\"") + Utils::String::Number(iGameID) + iPage + "\"";
591
 
609
 
592
		int startpage = sData.findPos(sPage);
610
		int startpage = sData.findPos(sPage);
593
		if (startpage >= 0) {
611
		if (startpage >= 0) {
594
			int start = sData.findPos(sID, startpage);
612
			int start = sData.findPos(sID, startpage);
595
			if (start >= 0) {
613
			if (start >= 0) {
596
				start += sID.length();
614
				start += sID.length();
597
				int end = sData.findPos("</t>", start);
615
				int end = sData.findPos("</t>", start);
598
				return sData.mid(start, end);
616
				return sData.mid(start, end);
599
			}
617
			}
600
		}
618
		}
601
	}
619
	}
602
 
620
 
603
	{
621
	{
604
		Utils::String sPage = Utils::String("<page id=\"") + iPage + "\"";
622
		Utils::String sPage = Utils::String("<page id=\"") + iPage + "\"";
605
 
623
 
606
		int startpage = sData.findPos(sPage);
624
		int startpage = sData.findPos(sPage);
607
		if (startpage >= 0) {
625
		if (startpage >= 0) {
608
			int start = sData.findPos(sID, startpage);
626
			int start = sData.findPos(sID, startpage);
609
			if (start >= 0) {
627
			if (start >= 0) {
Line 656... Line 674...
656
				if ( (float)node->Data()->fVersion == fVersion )
674
				if ( (float)node->Data()->fVersion == fVersion )
657
				{
675
				{
658
					(*versionName) = node->Data()->sName;
676
					(*versionName) = node->Data()->sName;
659
					return true;
677
					return true;
660
				}
678
				}
661
				++count;
679
				++count;
662
			}
680
			}
663
 
681
 
664
			version = lower;
682
			version = lower;
665
		}				
683
		}				
666
	}
684
	}
667
 
685
 
668
	return true;
686
	return true;
669
}
687
}
670
 
688
 
671
int CGameExe::GetGameVersion(const Utils::String &sGameExe, Utils::String *a_fVersion) const
689
int CGameExe::GetGameVersion(const Utils::String &sGameExe, Utils::String *a_fVersion) const
Line 767... Line 785...
767
	}
785
	}
768
 
786
 
769
	// not found ?? just set to all versions
787
	// not found ?? just set to all versions
770
	*version = 0;
788
	*version = 0;
771
	return 0;
789
	return 0;
-
 
790
}
-
 
791
 
-
 
792
SGameExe *CGameExe::GetGame(int game) const
-
 
793
{ 
-
 
794
	if (game >= 0 && game < m_lExe.size()) 
-
 
795
		return m_lExe.Get(game); 
-
 
796
	return NULL; 
772
}
797
}