Subversion Repositories spk

Rev

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

Rev 134 Rev 147
Line 2988... Line 2988...
2988
	CLinkList<C_File> fileList;
2988
	CLinkList<C_File> fileList;
2989
	int maxFiles = this->GetAllPackageFiles(&m_lEnableList, &fileList, false);
2989
	int maxFiles = this->GetAllPackageFiles(&m_lEnableList, &fileList, false);
2990
 
2990
 
2991
	int fileCount = 0;
2991
	int fileCount = 0;
2992
	// we use this list to match cat and dat files
2992
	// we use this list to match cat and dat files
2993
	CyStringList fakePatches;
2993
	Utils::CStringList fakePatches;
2994
	for ( CListNode<C_File> *node = fileList.Front(); node; node = node->next() )
2994
	for ( CListNode<C_File> *node = fileList.Front(); node; node = node->next() )
2995
	{
2995
	{
2996
		C_File *f = node->Data();
2996
		C_File *f = node->Data();
2997
		if ( f->GetGame() && m_iGame ) {
-
 
2998
			if ( f->GetGame() != m_iGame )
2997
		if (!f->isForGame(m_iGame))
2999
				continue;
2998
			continue;
3000
		}
-
 
3001
		CBaseFile *package = NULL;
2999
		CBaseFile *package = NULL;
3002
		for ( CListNode<CBaseFile> *node = m_lEnableList.Front(); node; node = node->next() )
3000
		for ( CListNode<CBaseFile> *node = m_lEnableList.Front(); node; node = node->next() )
3003
		{
3001
		{
3004
			CBaseFile *p = node->Data();
3002
			CBaseFile *p = node->Data();
3005
			if ( p->IsFileAdded(f) )
3003
			if ( p->IsFileAdded(f) )
3006
			{
3004
			{
3007
				package = p;
3005
				package = p;
3008
				break;
3006
				break;
3009
			}
3007
			}
3010
		}
3008
		}
3011
 
3009
 
3012
		if ( progress )
3010
		if ( progress )
3013
		{
3011
		{
3014
			progress->UpdateProgress(fileCount++, maxFiles);
3012
			progress->UpdateProgress(fileCount++, maxFiles);
3015
			progress->UpdateFile(f);
3013
			progress->UpdateFile(f);
3016
		}
3014
		}
3017
 
3015
 
3018
		// only move fiels that are disabled
3016
		// only move fiels that are disabled
3019
		if ( !f->IsDisabled() )
3017
		if ( !f->IsDisabled() )
3020
			continue;
3018
			continue;
3021
 
3019
 
3022
		// make the directory if it dont exist
3020
		// make the directory if it dont exist
Line 3036... Line 3034...
3036
			}
3034
			}
3037
		}
3035
		}
3038
 
3036
 
3039
		// check if theres an original file to backup
3037
		// check if theres an original file to backup
3040
		_pOriginalFiles->doBackup(f, errors);
3038
		_pOriginalFiles->doBackup(f, errors);
3041
 
3039
 
3042
		CyString newFilename = f->GetNameDirectory(package);
3040
		CyString newFilename = f->GetNameDirectory(package);
3043
 
3041
 
3044
		// fake patches need to be renamed
3042
		// fake patches need to be renamed
3045
		if ( f->IsFakePatch() )
3043
		if ( f->IsFakePatch() )
3046
		{
3044
		{
3047
			// first check if the matching file has been done already
3045
			// first check if the matching file has been done already
3048
			SStringList *foundStr = fakePatches.FindString(f->;GetBaseName());
3046
			if (fakePatches.contains(f->;baseName()))
3049
 
-
 
3050
			// already done one, simply change this to match
-
 
3051
			if ( foundStr )
-
 
3052
				newFilename = foundStr->data + "." + f->GetFileExt();
3047
				newFilename = fakePatches.findString(f->baseName()) + "." + f->fileExt();
3053
 
-
 
3054
			// we need to find the next available number instead
3048
			// we need to find the next available number instead
3055
			else
3049
			else
3056
			{
3050
			{
3057
				CyString newPos = CyString::Number(FindNextFakePatch()).PadNumber(2);
3051
				Utils::String newPos = Utils::String::PadNumber(FindNextFakePatch(), 2);
3058
				newFilename = newPos + "." + f->GetFileExt();
3052
				newFilename = newPos + "." + f->fileExt();
3059
				// and wee need to push this onto the string list so we can adjust the matchign pair
3053
				// and wee need to push this onto the string list so we can adjust the matchign pair
3060
				fakePatches.PushBack(f->GetBaseName(), newPos);
3054
				fakePatches.pushBack(f->baseName(), newPos);
3061
			}
3055
			}
3062
		}
3056
		}
3063
 
3057
 
3064
		// lets actually move the file back now
3058
		// lets actually move the file back now
3065
		// !!error checking!!
3059
		// !!error checking!!
3066
		CFileIO currentFile(f->GetFilePointer());
3060
		CFileIO currentFile(f->filePointer());
3067
		CFileIO newFile(m_sCurrentDir + "/" + newFilename);
3061
		CFileIO newFile(m_sCurrentDir + "/" + newFilename);
3068
		if ( !currentFile.exists() )
3062
		if ( !currentFile.exists() )
3069
		{
3063
		{
3070
			// missing file ??
3064
			// missing file ??
3071
			if ( !newFile.exists() )
3065
			if ( !newFile.exists() )