Subversion Repositories spk

Rev

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

Rev 254 Rev 269
Line 892... Line 892...
892
void CBaseFile::_install_adjustFakePatches(CPackages *pPackages)
892
void CBaseFile::_install_adjustFakePatches(CPackages *pPackages)
893
{
893
{
894
	Utils::WStringList lPatches;
894
	Utils::WStringList lPatches;
895
	int startfake = pPackages->findNextFakePatch();
895
	int startfake = pPackages->findNextFakePatch();
896
 
896
 
-
 
897
	std::vector<C_File*> fakepatches;
-
 
898
	for (CListNode<C_File>* node = m_lFiles.Front(); node; node = node->next())
-
 
899
	{
-
 
900
		C_File* fit = node->Data();
-
 
901
		// only do fake patchs
-
 
902
		if (!fit->IsFakePatch())
-
 
903
			continue;
-
 
904
 
-
 
905
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
-
 
906
		if (!fit->checkFileExt(L"cat"))
-
 
907
			continue;
-
 
908
 
-
 
909
		if (fakepatches.empty())
-
 
910
			fakepatches.push_back(fit);
-
 
911
		else
-
 
912
		{
-
 
913
			bool added = false;
-
 
914
			int num = fit->baseName().toInt();
-
 
915
			for (auto itr = fakepatches.begin(); itr != fakepatches.end(); itr++)
-
 
916
			{
-
 
917
				int checkNum = (*itr)->baseName().toInt();
-
 
918
				if (num < checkNum) 
-
 
919
				{
-
 
920
					fakepatches.insert(itr, fit);
-
 
921
					added = true;
-
 
922
					break;
-
 
923
				}
-
 
924
			}
-
 
925
			if(!added)
-
 
926
				fakepatches.push_back(fit);
-
 
927
		}
-
 
928
	}
-
 
929
 
-
 
930
	// rename all the cat files
-
 
931
	for (auto itr = fakepatches.begin(); itr != fakepatches.end(); itr++)
-
 
932
	{
-
 
933
		Utils::WString newname = Utils::WString::PadNumber((long)startfake, 2);
-
 
934
		lPatches.pushBack((*itr)->baseName(), newname);
-
 
935
 
-
 
936
		// rename the file
-
 
937
		(*itr)->FixOriginalName();
-
 
938
		CLog::logf(CLog::Log_Install, 2, L"Adjusting fake patch number, %s => %s", (*itr)->getNameDirectory(this).c_str(), (newname + L"." + (*itr)->fileExt()).c_str());
-
 
939
		(*itr)->setName(newname + L"." + (*itr)->fileExt());
-
 
940
 
-
 
941
		// find the next gap
-
 
942
		startfake = pPackages->findNextFakePatch(startfake);
-
 
943
	}
-
 
944
 
-
 
945
	// now rename all the matching dat files
897
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
946
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
898
	{
947
	{
899
		C_File *fit = node->Data();
948
		C_File *fit = node->Data();
900
		// only do fake patchs
949
		// only do fake patchs
901
		if ( !fit->IsFakePatch() )
950
		if ( !fit->IsFakePatch() )
902
			continue;
951
			continue;
903
 
952
 
904
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
953
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
905
		if ( !fit->checkFileExt (L"cat") && !fit->checkFileExt(L"dat") )
954
		if ( !fit->checkFileExt(L"dat") )
906
			continue;
955
			continue;
907
 
956
 
908
		// search for the name on the list
957
		// search for the name on the list
909
		Utils::WString newname;
-
 
910
		bool isOpposite = false;
-
 
911
		if (lPatches.contains(fit->baseName()))
958
		if (lPatches.contains(fit->baseName()))
912
		{
959
		{
913
			newname = lPatches.findString(fit->baseName());
960
			Utils::WString newname = lPatches.findString(fit->baseName());
914
			isOpposite = true;
-
 
915
		}
-
 
916
		else
-
 
917
		{
-
 
918
			newname = Utils::WString::PadNumber((long)startfake, 2);
-
 
919
			lPatches.pushBack(fit->baseName(), newname);
-
 
920
		}
-
 
921
 
961
 
922
		// rename the file
962
			// rename the file
923
		fit->FixOriginalName();
963
			fit->FixOriginalName();
924
		CLog::logf(CLog::Log_Install, 2, L"Adjusting fake patch number, %s => %s", fit->getNameDirectory(this).c_str(), (newname + L"." + fit->fileExt()).c_str());
964
			CLog::logf(CLog::Log_Install, 2, L"Adjusting fake patch number, %s => %s", fit->getNameDirectory(this).c_str(), (newname + L"." + fit->fileExt()).c_str());
925
		fit->setName(newname + L"." + fit->fileExt());
965
			fit->setName(newname + L"." + fit->fileExt());
926
 
-
 
927
		// find the next gap
-
 
928
		if ( !isOpposite ) {
-
 
929
			startfake = pPackages->findNextFakePatch(startfake + 1);
-
 
930
		}
966
		}
931
	}
967
	}
932
}
968
}
933
 
969
 
934
void CBaseFile::_install_renameText(CPackages *pPackages)
970
void CBaseFile::_install_renameText(CPackages *pPackages)