Subversion Repositories spk

Rev

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

Rev 98 Rev 100
Line 8377... Line 8377...
8377
	ret.AddToken("::", package->sDesc);
8377
	ret.AddToken("::", package->sDesc);
8378
 
8378
 
8379
	return ret;
8379
	return ret;
8380
}
8380
}
8381
 
8381
 
8382
void CPackages::ParseAvailablePackage(CyString str, CyString webaddress)
8382
void CPackages::ParseAvailablePackage(CyString sStr, CyString webaddress)
8383
{
8383
{
8384
	// first check game
8384
	// first check game
8385
	int game = str.GetToken("::", 2, 2).ToInt();
8385
	Utils::String str = sStr.ToString();
8386
	if ( game && m_iGame && m_iGame != game )
-
 
8387
		return;
-
 
8388
 
8386
 
8389
	int num = 0;
8387
	int num = 0;
8390
	CyString *tok = str.SplitToken("::", &num);
8388
	Utils::String *tok = str.tokenise("::", &num);
8391
	if ( !num || !tok ) return;
8389
	if ( !num || !tok ) return;
-
 
8390
	// invalid number of entries?
8392
	if ( num < 7 ) { CLEANSPLIT(tok, num); return; }
8391
	if ( num < 7 ) { CLEANSPLIT(tok, num); return; }
8393
 
8392
 
8394
	SAvailablePackage *p = new SAvailablePackage;
8393
	SAvailablePackage *p = new SAvailablePackage;
8395
	p->iType = tok[0].ToInt();
8394
	p->iType = tok[0].toLong();
8396
	p->bSigned = false;
8395
	p->bSigned = false;
8397
 
8396
 
8398
	CyString gameCompat = tok[1];
8397
	// theres multiple games, so we need to split it
8399
	if ( gameCompat.IsIn("!") ) {
8398
	if ( m_iGame ) {
8400
		int maxSplit = 0;
8399
		Utils::String sGame = tok[1];
8401
		CyString *games = gameCompat.SplitToken("!", &maxSplit);
-
 
8402
		if ( games && maxSplit ) {
8400
		if ( sGame.isin("!") ) {
8403
			for ( int i = 0; i < maxSplit; i++ ) {
8401
			for(int i = 1; i <= sGame.countToken("!"); i++) {
8404
				SGameCompat *gc = new SGameCompat;
8402
				SGameCompat *gc = new SGameCompat;
8405
				gc->iVersion = 0;
8403
				gc->iVersion = 0;
8406
				gc->iGame = games[i].ToInt();
8404
				gc->iGame = sGame.token("!", i).toLong();
8407
				p->lGames.push_back(gc);
8405
				p->lGames.push_back(gc);
8408
			}
8406
			}
8409
		}
8407
		}
8410
		CLEANSPLIT(games, maxSplit);
-
 
8411
	}
-
 
8412
	else {
8408
		else {
8413
		SGameCompat *gc = new SGameCompat;
8409
			SGameCompat *gc = new SGameCompat;
8414
		gc->iVersion = 0;
8410
			gc->iVersion = 0;
8415
		gc->iGame = gameCompat.ToInt();
8411
			gc->iGame = sGame.toLong();
8416
		p->lGames.push_back(gc);
8412
			p->lGames.push_back(gc);
-
 
8413
		}
8417
	}
8414
	}
-
 
8415
 
8418
	p->sName = tok[2];
8416
	p->sName = tok[2];
8419
	p->sAuthor = tok[3];
8417
	p->sAuthor = tok[3];
8420
	p->sVersion = tok[4];
8418
	p->sVersion = tok[4];
8421
	p->sUpdated = tok[5];
8419
	p->sUpdated = tok[5];
8422
	p->sFilename = tok[6];
8420
	p->sFilename = tok[6];
Line 8424... Line 8422...
8424
	if ( !webaddress.Empty() )
8422
	if ( !webaddress.Empty() )
8425
		p->sFilename = webaddress + "/" + p->sFilename;
8423
		p->sFilename = webaddress + "/" + p->sFilename;
8426
 
8424
 
8427
	p->iChanging = p->iEase = p->iPluginType = p->iRec = p->iScriptType = -1;
8425
	p->iChanging = p->iEase = p->iPluginType = p->iRec = p->iScriptType = -1;
8428
 
8426
 
-
 
8427
	// check if we have the extra values
8429
	if ( num >= 12 )
8428
	if ( num >= 12 )
8430
	{
8429
	{
8431
		p->iEase = tok[7].ToInt();
8430
		p->iEase = tok[7].toLong();
8432
		p->iChanging = tok[8].ToInt();
8431
		p->iChanging = tok[8].toLong();
8433
		p->iRec = tok[9].ToInt();
8432
		p->iRec = tok[9].toLong();
8434
		p->iPluginType = tok[10].ToInt();
8433
		p->iPluginType = tok[10].toLong();
8435
		p->iScriptType = tok[11].ToInt();
8434
		p->iScriptType = tok[11].toLong();
8436
		if ( num > 12 ) {
8435
		if ( num > 12 ) {
8437
			if ( num > 13 ) {
8436
			if ( num > 13 ) {
8438
				p->sDesc = str.GetToken("::", 14); 
8437
				p->sDesc = tok[13];
8439
				p->bSigned = str.GetToken("::", 13).ToBool();
8438
				p->bSigned = tok[12].toBool();
8440
			}
8439
			}
8441
			else
8440
			else
8442
				p->sDesc = str.GetToken("::", 13); 
8441
				p->sDesc = tok[12];
8443
		}
8442
		}
8444
	}
8443
	}
8445
	else if ( num > 7 )
8444
	else if ( num > 7 )
8446
		p->sDesc = str.GetToken("::", 8); 
8445
		p->sDesc = tok[8];
8447
 
8446
 
8448
	if ( !p->sDesc.Empty() )
8447
	if ( !p->sDesc.Empty() )
8449
		p->sDesc.FindReplace("::newline::", "\\n");
8448
		p->sDesc = p->sDesc.FindReplace("::newline::", "\\n");
8450
 
8449
 
8451
	AddAvailablePackage(p);
8450
	AddAvailablePackage(p);
8452
 
8451
 
8453
	CLEANSPLIT(tok, num);
8452
	CLEANSPLIT(tok, num);
8454
}
8453
}