Subversion Repositories spk

Rev

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

Rev 49 Rev 50
Line 271... Line 271...
271
					}
271
					}
272
				}
272
				}
273
				else if ( iStatus == READ_SCRIPT )
273
				else if ( iStatus == READ_SCRIPT )
274
				{
274
				{
275
					if ( cmd == "installspk" )
275
					if ( cmd == "installspk" )
276
						packageFile->SetFilename(rest);
276
						packageFile->setFilename(rest.ToString());
277
					else if ( cmd == "files" )
277
					else if ( cmd == "files" )
278
					{
278
					{
279
						iStatus = READ_SCRIPTFILE;
279
						iStatus = READ_SCRIPTFILE;
280
						if ( spkinstaller )
280
						if ( spkinstaller )
281
						{
281
						{
Line 1340... Line 1340...
1340
	this->WriteData();
1340
	this->WriteData();
1341
 
1341
 
1342
	return installed;
1342
	return installed;
1343
}
1343
}
1344
 
1344
 
-
 
1345
void CPackages::_addToFakePatch(CBaseFile *pPackage)
-
 
1346
{
-
 
1347
	CCatFile cat;
-
 
1348
	if ( CCatFile::Opened(cat.Open(m_sCurrentDir + "/PluginManager/PlugMan_Fake.cat", this->GetAddonDir(), CATREAD_DAT)) ) {
-
 
1349
		for ( CListNode<C_File> *f = pPackage->GetFileList()->Front(); f; f = f->next() ) {
-
 
1350
			if ( f->Data()->GetFileType() != FILETYPE_SHIPSCENE && f->Data()->GetFileType() != FILETYPE_COCKPITSCENE && f->Data()->GetFileType() != FILETYPE_SHIPMODEL && f->Data()->GetFileType() != FILETYPE_SHIPOTHER )
-
 
1351
				continue;
-
 
1352
			if ( CCatFile::IsAddonDir(f->Data()->GetNameDirectory(pPackage)) )
-
 
1353
				continue;
-
 
1354
			CyString toFile;
-
 
1355
			if ( cat.AppendFile(f->Data()->GetFilePointer(), f->Data()->GetNameDirectory(pPackage), true, (m_iGameFlags & EXEFLAG_NOXOR) ? false : true, &toFile) ) {
-
 
1356
				CLog::logf(CLog::Log_Install, 2, "Adding file: %s into the fake patch", f->Data()->GetNameDirectory(pPackage).c_str());
-
 
1357
				CFileIO(f->Data()->GetFilePointer()).Remove();
-
 
1358
				f->Data()->SetFilename(m_sCurrentDir + "/PluginManager/PlugMan_Fake.cat::" + toFile);
-
 
1359
			}
-
 
1360
		}
-
 
1361
	}
-
 
1362
}
-
 
1363
 
1345
bool CPackages::InstallPackage ( CBaseFile *package, CyStringList *errors, CProgressInfo *progress, bool disabled )
1364
bool CPackages::InstallPackage ( CBaseFile *package, CyStringList *errors, CProgressInfo *progress, bool disabled )
1346
{
1365
{
-
 
1366
	CLog::logf(CLog::Log_Install, 1, "Starting to install new package, %s by %s (Version: %s)", package->name().c_str(), package->author().c_str(), package->version().c_str());
1347
	// first check if we are installed a mod
1367
	// first check if we are installed a mod
1348
	bool prevDisabled = disabled;
1368
	bool prevDisabled = disabled;
1349
	if ( package->IsMod() && m_pEnabledMod && !m_bForceModInstall )
1369
	if ( package->IsMod() && m_pEnabledMod && !m_bForceModInstall ) {
1350
		disabled = true;
1370
		disabled = true;
-
 
1371
		CLog::log(CLog::Log_Install, 2, "Package is a mod and another mod is already enabled, setting to disabled");
-
 
1372
	}
1351
	// if vanilla nad package aint signed
1373
	// if vanilla nad package aint signed
1352
	if ( m_bVanilla && !package->IsSigned() )
1374
	if ( m_bVanilla && !package->IsSigned() ) {
1353
		disabled = true;
1375
		disabled = true;
-
 
1376
		CLog::log(CLog::Log_Install, 2, "Package is a not signed and are we in vanilla mode, setting to disabled");
-
 
1377
	}
1354
 
1378
 
1355
	// check any depancies
1379
	// check any depancies
1356
	if ( !disabled && !this->CheckEnabledDependacy(package) )
1380
	if ( !disabled && !this->CheckEnabledDependacy(package) ) {
1357
		disabled = true;
1381
		disabled = true;
-
 
1382
		CLog::log(CLog::Log_Install, 2, "Dependacies missing for package, setting to disabled");
-
 
1383
	}
1358
 
1384
 
1359
	// search for an old version
1385
	// search for an old version
1360
	CBaseFile *oldPackage = FindPackage(package);
1386
	CBaseFile *oldPackage = FindPackage(package);
1361
	if ( oldPackage && oldPackage == m_pEnabledMod && disabled )
1387
	if ( oldPackage && oldPackage == m_pEnabledMod && disabled )
1362
		disabled = prevDisabled;
1388
		disabled = prevDisabled;
Line 1364... Line 1390...
1364
	// update packages must have an old package installed already (should have been checked for already)
1390
	// update packages must have an old package installed already (should have been checked for already)
1365
	if ( package->GetType() == TYPE_SPK )
1391
	if ( package->GetType() == TYPE_SPK )
1366
	{
1392
	{
1367
		if ( ((CSpkFile *)package)->IsPackageUpdate() )
1393
		if ( ((CSpkFile *)package)->IsPackageUpdate() )
1368
		{
1394
		{
-
 
1395
			CLog::log(CLog::Log_Install, 3, "Package is an Update, checking for existing package installed");
1369
			if ( !oldPackage )
1396
			if ( !oldPackage ) {
-
 
1397
				CLog::log(CLog::Log_Install, 2, "Package is an Update but no existing package found, cancelling install");
1370
				return false;
1398
				return false;
-
 
1399
			}
1371
			// change any mods to temp ones
1400
			// change any mods to temp ones
1372
			for ( CListNode<C_File> *f = package->GetFileList()->Front(); f; f = f->next() )
1401
			for ( CListNode<C_File> *f = package->GetFileList()->Front(); f; f = f->next() )
1373
			{
1402
			{
1374
				if ( f->Data()->GetFileType() != FILETYPE_MOD )
1403
				if ( f->Data()->GetFileType() != FILETYPE_MOD )
1375
					continue;
1404
					continue;
1376
 
1405
 
1377
				f->Data()->SetDir("temp");
1406
				f->Data()->SetDir("temp");
1378
				if ( f->Data()->IsFakePatch() )
1407
				if ( f->Data()->IsFakePatch() ) {
-
 
1408
					CLog::logf(CLog::Log_Install, 2, "Moving fake package to temporary location to preper for update, %s", f->Data()->GetFilePointer().c_str());
1379
					f->Data()->SetName(CyString("Fake_") + f->Data()->GetName());
1409
					f->Data()->SetName(CyString("Fake_") + f->Data()->GetName());
-
 
1410
				}
1380
			}
1411
			}
1381
		}
1412
		}
1382
	}
1413
	}
1383
 
1414
 
1384
	// no need to backup if we're disabling them
1415
	// no need to backup if we're disabling them
1385
	if ( !disabled )
1416
	if ( !disabled )
1386
	{
1417
	{
1387
		// find any uninstall files and remove them
1418
		// find any uninstall files and remove them
-
 
1419
		CLog::log(CLog::Log_Install, 3, "Purging uninstall scripts");
1388
		this->PurgeUninstallScripts(package, errors);
1420
		this->PurgeUninstallScripts(package, errors);
1389
 
1421
 
1390
		// backup any original files before installing
1422
		// backup any original files before installing
-
 
1423
		CLog::log(CLog::Log_Install, 3, "Checking for any original files to backup");
1391
		CDirIO oDir(m_sCurrentDir + "/PluginManager/Original");
1424
		CDirIO oDir(m_sCurrentDir + "/PluginManager/Original");
1392
		for ( CListNode<C_File> *oNode = m_lOriginalFiles.Front(); oNode; oNode = oNode->next() )
1425
		for ( CListNode<C_File> *oNode = m_lOriginalFiles.Front(); oNode; oNode = oNode->next() )
1393
		{
1426
		{
1394
			C_File *of = oNode->Data();
1427
			C_File *of = oNode->Data();
1395
			for ( CListNode<C_File> *checkNode = package->GetFileList()->Front(); checkNode; checkNode = checkNode->next() )
1428
			for ( CListNode<C_File> *checkNode = package->GetFileList()->Front(); checkNode; checkNode = checkNode->next() )
Line 1411... Line 1444...
1411
			}
1444
			}
1412
		}
1445
		}
1413
	}
1446
	}
1414
 
1447
 
1415
	// install all the files
1448
	// install all the files
-
 
1449
	CLog::log(CLog::Log_Install, 3, "Checking for any existing files");
1416
	if ( oldPackage )
1450
	if ( oldPackage )
1417
	{
1451
	{
-
 
1452
		CLog::logf(CLog::Log_Install, 3, "Excluding existing package (%s) from file check list", oldPackage->version().c_str());
1418
		CLinkList<CBaseFile> excludeList;
1453
		CLinkList<CBaseFile> excludeList;
1419
		excludeList.push_back(oldPackage);
1454
		excludeList.push_back(oldPackage);
1420
		this->UpdateUsedFiles(&excludeList, true);
1455
		this->UpdateUsedFiles(&excludeList, true);
1421
	}
1456
	}
1422
	else
1457
	else
1423
		this->UpdateUsedFiles(0, true);
1458
		this->UpdateUsedFiles(0, true);
1424
 
1459
 
-
 
1460
	CLog::log(CLog::Log_Install, 3, "Reading all files into memory");
1425
	package->ReadAllFilesToMemory();
1461
	package->ReadAllFilesToMemory();
-
 
1462
 
-
 
1463
	CLog::log(CLog::Log_Install, 3, "Starting to install files");
1426
	if ( !package->InstallFiles (m_sCurrentDir, progress, &m_lFiles, errors, !disabled, this) )
1464
	if ( !package->InstallFiles (m_sCurrentDir, progress, &m_lFiles, errors, !disabled, this) )
1427
	{
1465
	{
-
 
1466
		CLog::log(CLog::Log_Install, 2, "There was an error installing files!!");
-
 
1467
 
1428
		// TODO: clear up installed files
1468
		// TODO: clear up installed files
1429
		return false;
1469
		return false;
1430
	}
1470
	}
1431
 
1471
 
1432
	// if we're installing an addon, lets use the fake patch method for object files
1472
	// if we're installing an addon, lets use the fake patch method for object files
1433
	if ( m_iGameFlags & EXEFLAG_ADDON ) {
1473
	if ( m_iGameFlags & EXEFLAG_ADDON ) this->_addToFakePatch(package);
1434
		CCatFile cat;
-
 
1435
		if ( CCatFile::Opened(cat.Open(m_sCurrentDir + "/PluginManager/PlugMan_Fake.cat", this->GetAddonDir(), CATREAD_DAT)) ) {
-
 
1436
			for ( CListNode<C_File> *f = package->GetFileList()->Front(); f; f = f->next() ) {
-
 
1437
				if ( f->Data()->GetFileType() != FILETYPE_SHIPSCENE && f->Data()->GetFileType() != FILETYPE_COCKPITSCENE && f->Data()->GetFileType() != FILETYPE_SHIPMODEL && f->Data()->GetFileType() != FILETYPE_SHIPOTHER )
-
 
1438
					continue;
-
 
1439
				if ( CCatFile::IsAddonDir(f->Data()->GetNameDirectory(package)) )
-
 
1440
					continue;
-
 
1441
				CyString toFile;
-
 
1442
				if ( cat.AppendFile(f->Data()->GetFilePointer(), f->Data()->GetNameDirectory(package), true, (m_iGameFlags & EXEFLAG_NOXOR) ? false : true, &toFile) ) {
-
 
1443
					CFileIO(f->Data()->GetFilePointer()).Remove();
-
 
1444
					f->Data()->SetFilename(m_sCurrentDir + "/PluginManager/PlugMan_Fake.cat::" + toFile);
-
 
1445
				}
-
 
1446
			}
-
 
1447
		}
-
 
1448
	}
-
 
1449
 
1474
 
1450
	bool shuffle = false;
1475
	bool shuffle = false;
1451
 
1476
 
1452
	// merge the update into the old package
1477
	// merge the update into the old package
1453
	bool dontAdd = false;
1478
	bool dontAdd = false;
Line 1591... Line 1616...
1591
	}
1616
	}
1592
 
1617
 
1593
	// if theres an icon, write it
1618
	// if theres an icon, write it
1594
	if ( package->GetIcon() )
1619
	if ( package->GetIcon() )
1595
	{
1620
	{
-
 
1621
		CLog::log(CLog::Log_Install, 3, "Checking to install icon display file");
1596
		C_File *icon = package->GetIcon();
1622
		C_File *icon = package->GetIcon();
1597
		if ( !icon->GetData() || !icon->GetDataSize() )
1623
		if ( !icon->GetData() || !icon->GetDataSize() ) {
1598
			package->SetIcon(NULL, "");
1624
			package->SetIcon(NULL, "");
-
 
1625
			CLog::log(CLog::Log_Install, 2, "Unable to extract icon, clearing");
-
 
1626
		}
1599
		else
1627
		else
1600
		{
1628
		{
1601
			CDirIO Dir(m_sCurrentDir);
1629
			CDirIO Dir(m_sCurrentDir);
1602
			bool ready = true;
1630
			bool ready = true;
1603
			if ( !Dir.Exists("PluginManager") )
1631
			if ( !Dir.Exists("PluginManager") )
Line 1615... Line 1643...
1615
			{
1643
			{
1616
				if ( !icon->UncompressData() )
1644
				if ( !icon->UncompressData() )
1617
					package->SetIcon(NULL, "");
1645
					package->SetIcon(NULL, "");
1618
				else
1646
				else
1619
				{
1647
				{
1620
					CFileIO iconFile(m_sCurrentDir + "/PluginManager/Icons/" + package->GetAuthor() + "_" + package->GetName() + "." + package->GetIconExt());
1648
					CFileIO iconFile(m_sCurrentDir + "/PluginManager/Icons/" + package->author() + "_" + package->name() + "." + package->GetIconExt());
1621
					if ( iconFile.WriteData((const char *)icon->GetData(), icon->GetDataSize()) )
1649
					if ( iconFile.WriteData((const char *)icon->GetData(), icon->GetDataSize()) )
1622
					{
1650
					{
1623
						icon->SetFilename(package->GetAuthor() + "_" + package->GetName() + "." + package->GetIconExt());
1651
						icon->SetFilename(CyString(package->author()) + "_" + package->name() + "." + package->GetIconExt());
1624
						icon->SetFullDir(m_sCurrentDir + "/PluginManager/Icons");
1652
						icon->SetFullDir(m_sCurrentDir + "/PluginManager/Icons");
1625
					}
1653
					}
1626
					else
1654
					else
1627
						package->SetIcon(NULL, "");
1655
						package->SetIcon(NULL, "");
1628
				}
1656
				}
Line 1632... Line 1660...
1632
				package->GetIcon()->DeleteData();
1660
				package->GetIcon()->DeleteData();
1633
		}
1661
		}
1634
	}
1662
	}
1635
 
1663
 
1636
	// remove all data
1664
	// remove all data
-
 
1665
	CLog::log(CLog::Log_Install, 3, "Clearing all unneeded file data");
1637
	package->ClearFileData();
1666
	package->ClearFileData();
1638
 
1667
 
1639
	// add to list
1668
	// add to list
1640
	if ( !dontAdd )
1669
	if ( !dontAdd )
1641
	{
1670
	{
-
 
1671
		CLog::log(CLog::Log_Install, 1, "Adding package into main list");
1642
		if ( oldPackage )
1672
		if ( oldPackage )
1643
		{
1673
		{
1644
			m_lPackages.insert(oldPackage, package);
1674
			m_lPackages.insert(oldPackage, package);
1645
			m_lPackages.remove(oldPackage, false);
1675
			m_lPackages.remove(oldPackage, false);
1646
		}
1676
		}
1647
		else
1677
		else
1648
			m_lPackages.push_back (package);
1678
			m_lPackages.push_back (package);
1649
	}
1679
	}
1650
 
1680
 
-
 
1681
	CLog::log(CLog::Log_Install, 2, "Updating file used count");
1651
	UpdateUsedFiles();
1682
	UpdateUsedFiles();
1652
 
1683
 
1653
	if ( disabled )
-
 
1654
		package->SetEnabled(false);
1684
	if ( disabled ) package->SetEnabled(false);
1655
 
1685
 
1656
	// remove any files no longer used by old package
1686
	// remove any files no longer used by old package
1657
	if ( oldPackage )
1687
	if ( oldPackage )
1658
	{
1688
	{
-
 
1689
		CLog::log(CLog::Log_Install, 3, "Removing any unused files from previous package");
-
 
1690
 
1659
		CListNode<C_File> *fnode = oldPackage->GetFileList()->Front();
1691
		CListNode<C_File> *fnode = oldPackage->GetFileList()->Front();
1660
		while ( fnode )
1692
		while ( fnode )
1661
		{
1693
		{
1662
			C_File *f = fnode->Data();
1694
			C_File *f = fnode->Data();
1663
 
1695
 
Line 1668... Line 1700...
1668
				m_lFiles.remove(f, false);
1700
				m_lFiles.remove(f, false);
1669
 
1701
 
1670
				// remove from hard drive
1702
				// remove from hard drive
1671
				if ( RemoveFile(f, errors) )
1703
				if ( RemoveFile(f, errors) )
1672
				{
1704
				{
-
 
1705
					CLog::logf(CLog::Log_Install, 1, "Removed unused file: %s", f->GetFilePointer().c_str());
1673
					// if a fake patch, we need to shufle
1706
					// if a fake patch, we need to shufle
1674
					if ( f->IsFakePatch() )
1707
					if ( f->IsFakePatch() )
1675
						shuffle = true;
1708
						shuffle = true;
1676
					else if ( f->IsAutoTextFile() )
1709
					else if ( f->IsAutoTextFile() )
1677
						shuffle = true;
1710
						shuffle = true;
Line 1683... Line 1716...
1683
 
1716
 
1684
	}
1717
	}
1685
 
1718
 
1686
	if ( shuffle )
1719
	if ( shuffle )
1687
	{
1720
	{
-
 
1721
		CLog::log(CLog::Log_Install, 2, "Shuffling Fake patches");
1688
		ShuffleFakePatches(errors);
1722
		ShuffleFakePatches(errors);
-
 
1723
		CLog::log(CLog::Log_Install, 2, "Shuffling Text Files");
1689
		ShuffleTextFiles(errors);
1724
		ShuffleTextFiles(errors);
1690
	}
1725
	}
1691
 
1726
 
1692
	// now we need to link any child/parent packages
1727
	// now we need to link any child/parent packages
1693
	if ( package->GetType() == TYPE_SPK )
1728
	if ( package->GetType() == TYPE_SPK )
1694
	{
1729
	{
1695
		CSpkFile *spk = (CSpkFile *)package;
1730
		CSpkFile *spk = (CSpkFile *)package;
1696
		if ( spk->IsAnotherMod() )
1731
		if ( spk->IsAnotherMod() ) {
1697
			spk->SetParent((CSpkFile *)FindSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()));
1732
			spk->SetParent((CSpkFile *)FindSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()));
-
 
1733
			CLog::logf(CLog::Log_Install, 2, "Linking to parent package: %s by %s (Version: %s)", spk->name().c_str(), spk->author().c_str(), spk->version().c_str());
-
 
1734
		}
1698
	}
1735
	}
1699
 
1736
 
1700
	// store enabled mod
1737
	// store enabled mod
1701
	if ( package->IsMod() && !disabled )
1738
	if ( package->IsMod() && !disabled ) {
1702
		m_pEnabledMod = package;
1739
		m_pEnabledMod = package;
-
 
1740
		CLog::log(CLog::Log_Install, 1, "Setting package as primary mod");
-
 
1741
	}
1703
 
1742
 
1704
	m_bRemoveDir = true;
1743
	m_bRemoveDir = true;
1705
 
1744
 
-
 
1745
	CLog::log(CLog::Log_Install, 1, "Saving data to file");
1706
	this->WriteData();
1746
	this->WriteData();
1707
 
1747
 
-
 
1748
	CLog::log(CLog::Log_Install, 1, "Installation Finished");
1708
	return true;
1749
	return true;
1709
}
1750
}
1710
 
1751
 
1711
bool CPackages::UninstallPreparedPackages(CyStringList *errors, CProgressInfo *progress, CLinkList<CBaseFile> *uninstalledPackages, CLinkList<CBaseFile> *disabledPackages)
1752
bool CPackages::UninstallPreparedPackages(CyStringList *errors, CProgressInfo *progress, CLinkList<CBaseFile> *uninstalledPackages, CLinkList<CBaseFile> *disabledPackages)
1712
{
1753
{
Line 2059... Line 2100...
2059
int CPackages::GetDependacyList(CBaseFile *package, CLinkList<CBaseFile> *list)
2100
int CPackages::GetDependacyList(CBaseFile *package, CLinkList<CBaseFile> *list)
2060
{
2101
{
2061
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
2102
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
2062
	{
2103
	{
2063
		CBaseFile *p = node->Data();
2104
		CBaseFile *p = node->Data();
2064
		if ( p->IsPackageNeeded(package->GetName().ToString(), package->GetAuthor().ToString()) )
2105
		if ( p->IsPackageNeeded(package->name(), package->author()) )
2065
			list->push_back(p);
2106
			list->push_back(p);
2066
	}
2107
	}
2067
 
2108
 
2068
	return list->size();
2109
	return list->size();
2069
}
2110
}
Line 2124... Line 2165...
2124
				if ( spk->IsAnotherMod() )
2165
				if ( spk->IsAnotherMod() )
2125
				{
2166
				{
2126
					for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
2167
					for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
2127
					{
2168
					{
2128
						CBaseFile *p = node->Data();
2169
						CBaseFile *p = node->Data();
2129
						if ( spk->GetOtherName().Compare(p->GetName().ToString()) && spk->GetOtherAuthor().Compare(p->GetAuthor().ToString()) )
2170
						if ( spk->GetOtherName().Compare(p->name()) && spk->GetOtherAuthor().Compare(p->author()) )
2130
						{
2171
						{
2131
							m_lInstallList.insert(m_lInstallList.FindPos(p) + 2, package);
2172
							m_lInstallList.insert(m_lInstallList.FindPos(p) + 2, package);
2132
							added = true;
2173
							added = true;
2133
							break;
2174
							break;
2134
						}
2175
						}
Line 2146... Line 2187...
2146
 
2187
 
2147
					CSpkFile *spk = (CSpkFile *)node->Data();
2188
					CSpkFile *spk = (CSpkFile *)node->Data();
2148
					if ( !spk->IsAnotherMod() )
2189
					if ( !spk->IsAnotherMod() )
2149
						continue;
2190
						continue;
2150
 
2191
 
2151
					if ( spk->GetOtherName().Compare(package->GetName().ToString()) && spk->GetOtherAuthor().Compare(package->GetAuthor().ToString()) )
2192
					if ( spk->GetOtherName().Compare(package->name()) && spk->GetOtherAuthor().Compare(package->author()) )
2152
					{
2193
					{
2153
						added = true;
2194
						added = true;
2154
						m_lInstallList.insert(node->Data(), package);
2195
						m_lInstallList.insert(node->Data(), package);
2155
						break;
2196
						break;
2156
					}
2197
					}
Line 2694... Line 2735...
2694
		else if ( package->GetType() == TYPE_BASE )
2735
		else if ( package->GetType() == TYPE_BASE )
2695
			lines.PushBack("<base>");
2736
			lines.PushBack("<base>");
2696
		else
2737
		else
2697
			continue;
2738
			continue;
2698
 
2739
 
2699
		if ( !package->GetFilename().Empty() )
2740
		if ( !package->filename().empty() )
2700
			lines.PushBack(CyString("Installspk: ") + package->GetFilename());
2741
			lines.PushBack(CyString("Installspk: ") + package->filename());
2701
 
2742
 
2702
		CyString valuesline = package->CreateValuesLine();
2743
		CyString valuesline = package->CreateValuesLine();
2703
		if ( valuesline.Right(1) == '\n' )
2744
		if ( valuesline.Right(1) == '\n' )
2704
			valuesline.Truncate((int)valuesline.Length() - 1);
2745
			valuesline.Truncate((int)valuesline.Length() - 1);
2705
		lines.PushBack(valuesline);
2746
		lines.PushBack(valuesline);
Line 3105... Line 3146...
3105
		if ( f->IsFakePatch() )
3146
		if ( f->IsFakePatch() )
3106
		{
3147
		{
3107
			// find package the fake patch belongs to
3148
			// find package the fake patch belongs to
3108
			if ( checkPackage )
3149
			if ( checkPackage )
3109
			{
3150
			{
3110
				newFilename = m_sCurrentDir + "/PluginManager/Disabled/FakePatches/FakePatch_" + checkPackage->GetNameValidFile() + "_" + checkPackage->GetAuthor() + "_" + f->GetName();
3151
				newFilename = m_sCurrentDir + "/PluginManager/Disabled/FakePatches/FakePatch_" + checkPackage->GetNameValidFile() + "_" + checkPackage->author() + "_" + f->GetName();
3111
				shuffle = true;
3152
				shuffle = true;
3112
			}
3153
			}
3113
		}
3154
		}
3114
		else if ( f->IsAutoTextFile() )
3155
		else if ( f->IsAutoTextFile() )
3115
		{
3156
		{
3116
			if ( checkPackage )
3157
			if ( checkPackage )
3117
			{
3158
			{
3118
				newFilename = m_sCurrentDir + "/PluginManager/Disabled/TextFiles/Text_" + checkPackage->GetNameValidFile() + "_" + checkPackage->GetAuthor() + "_" + f->GetName();
3159
				newFilename = m_sCurrentDir + "/PluginManager/Disabled/TextFiles/Text_" + checkPackage->GetNameValidFile() + "_" + checkPackage->author() + "_" + f->GetName();
3119
				shuffle = true;
3160
				shuffle = true;
3120
			}
3161
			}
3121
		}
3162
		}
3122
		// otherwise we can just use the standard filename
3163
		// otherwise we can just use the standard filename
3123
		else
3164
		else
Line 3255... Line 3296...
3255
	if ( !package )
3296
	if ( !package )
3256
		return 0;
3297
		return 0;
3257
 
3298
 
3258
	// we are checking against a SPK package, so we match the name and author
3299
	// we are checking against a SPK package, so we match the name and author
3259
	if ( package->GetType() == TYPE_SPK )
3300
	if ( package->GetType() == TYPE_SPK )
3260
		return FindSpkPackage(package->GetName(), package->GetAuthor());
3301
		return FindSpkPackage(package->name(), package->author());
3261
	else if ( package->GetType() == TYPE_XSP )
3302
	else if ( package->GetType() == TYPE_XSP )
3262
		return FindXspPackage(((CXspFile *)package)->GetShipID());
3303
		return FindXspPackage(((CXspFile *)package)->GetShipID());
3263
	else if ( package->GetType() == TYPE_ARCHIVE )
3304
	else if ( package->GetType() == TYPE_ARCHIVE )
3264
		return FindArchivePackage(package->GetName());
3305
		return FindArchivePackage(package->name());
3265
 
3306
 
3266
	// nothing found obviously
3307
	// nothing found obviously
3267
	return 0;
3308
	return 0;
3268
}
3309
}
3269
 
3310
 
Line 3326... Line 3367...
3326
		// only look for archive packages
3367
		// only look for archive packages
3327
		if ( file->GetType() != TYPE_ARCHIVE )
3368
		if ( file->GetType() != TYPE_ARCHIVE )
3328
			continue;
3369
			continue;
3329
 
3370
 
3330
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3371
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3331
		if ( file->GetName().Compare(name) )
3372
		if ( file->name().Compare(name.ToString()) )
3332
			return (CArchiveFile *)file;
3373
			return (CArchiveFile *)file;
3333
	}
3374
	}
3334
 
3375
 
3335
	// nothing found
3376
	// nothing found
3336
	return 0;
3377
	return 0;
Line 3351... Line 3392...
3351
		// only look for spk packages
3392
		// only look for spk packages
3352
		if ( file->GetType() != TYPE_SPK )
3393
		if ( file->GetType() != TYPE_SPK )
3353
			continue;
3394
			continue;
3354
 
3395
 
3355
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3396
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3356
		if ( file->GetName().Compare(name) && file->GetAuthor().Compare(author) )
3397
		if ( file->name().Compare(name.ToString()) && file->author().Compare(author.ToString()) )
3357
			return file;
3398
			return file;
3358
	}
3399
	}
3359
 
3400
 
3360
	// nothing found
3401
	// nothing found
3361
	return 0;
3402
	return 0;
Line 3367... Line 3408...
3367
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3408
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3368
	{
3409
	{
3369
		CBaseFile *file = node->Data();
3410
		CBaseFile *file = node->Data();
3370
 
3411
 
3371
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3412
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3372
		if ( file->GetName().Compare(name) && file->GetAuthor().Compare(author) )
3413
		if ( file->name().Compare(name.ToString()) && file->author().Compare(author.ToString()) )
3373
			return file;
3414
			return file;
3374
	}
3415
	}
3375
 
3416
 
3376
	// nothing found
3417
	// nothing found
3377
	return 0;
3418
	return 0;
Line 3490... Line 3531...
3490
	CBaseFile *oldPackage = FindPackage(package);
3531
	CBaseFile *oldPackage = FindPackage(package);
3491
 
3532
 
3492
	// check versions are newer
3533
	// check versions are newer
3493
	if (oldPackage && (check & IC_OLDVERSION))
3534
	if (oldPackage && (check & IC_OLDVERSION))
3494
	{
3535
	{
3495
		if ( oldPackage->GetVersion().CompareVersion(package->GetVersion()) == COMPARE_OLDER )
3536
		if ( oldPackage->version().compareVersion(package->version()) == COMPARE_OLDER )
3496
			return INSTALLCHECK_OLDVERSION;
3537
			return INSTALLCHECK_OLDVERSION;
3497
	}
3538
	}
3498
 
3539
 
3499
	// now check for game version
3540
	// now check for game version
3500
	if ((check & IC_WRONGGAME) || (check & IC_WRONGVERSION))
3541
	if ((check & IC_WRONGGAME) || (check & IC_WRONGVERSION))
Line 3533... Line 3574...
3533
					return false;
3574
					return false;
3534
 
3575
 
3535
				bool found = false;
3576
				bool found = false;
3536
				for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
3577
				for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
3537
				{
3578
				{
3538
					if ( spk->GetOtherName().Compare(node->Data()->GetName().ToString()) && spk->GetOtherAuthor().Compare(node->Data()->GetAuthor().ToString()) )
3579
					if ( spk->GetOtherName().Compare(node->Data()->name()) && spk->GetOtherAuthor().Compare(node->Data()->author()) )
3539
					{
3580
					{
3540
						found = true;
3581
						found = true;
3541
						break;
3582
						break;
3542
					}
3583
					}
3543
				}
3584
				}
Line 3588... Line 3629...
3588
{
3629
{
3589
	CBaseFile *p = this->FindSpkPackage(name, author);
3630
	CBaseFile *p = this->FindSpkPackage(name, author);
3590
	if ( p )
3631
	if ( p )
3591
	{
3632
	{
3592
		// now check version
3633
		// now check version
3593
		if ( version.CompareVersion(p->GetVersion()) == COMPARE_OLDER )
3634
		if ( version.CompareVersion(p->version()) == COMPARE_OLDER )
3594
			return false;
3635
			return false;
3595
 
3636
 
3596
		if ( onlyEnabled && !p->IsEnabled() )
3637
		if ( onlyEnabled && !p->IsEnabled() )
3597
			return false;
3638
			return false;
3598
 
3639
 
Line 3606... Line 3647...
3606
		{
3647
		{
3607
			p = node->Data();
3648
			p = node->Data();
3608
			if ( !p )
3649
			if ( !p )
3609
				continue;
3650
				continue;
3610
 
3651
 
3611
			if ( p->GetName().Compare(name) && p->GetAuthor().Compare(author) )
3652
			if ( p->name().Compare(name.ToString()) && p->author().Compare(author.ToString()) )
3612
			{
3653
			{
3613
				if ( version.CompareVersion(p->GetVersion()) == COMPARE_OLDER )
3654
				if ( version.CompareVersion(p->version()) == COMPARE_OLDER )
3614
					continue;
3655
					continue;
3615
 
3656
 
3616
				if ( onlyEnabled && !p->IsEnabled() )
3657
				if ( onlyEnabled && !p->IsEnabled() )
3617
					continue;
3658
					continue;
3618
 
3659
 
Line 3633... Line 3674...
3633
	if ( neededList )
3674
	if ( neededList )
3634
	{
3675
	{
3635
		for ( CListNode<SNeededLibrary> *node = neededList->Front(); node; node = node->next() )
3676
		for ( CListNode<SNeededLibrary> *node = neededList->Front(); node; node = node->next() )
3636
		{
3677
		{
3637
			SNeededLibrary *nl = node->Data();
3678
			SNeededLibrary *nl = node->Data();
3638
			if ( !CheckInstalledDependacy((nl->sName.Compare("<package>")) ? p->GetName() : nl->sName, (nl->sAuthor.Compare("<author>")) ? p->GetAuthor() : nl->sAuthor, nl->sMinVersion, (nl->sName.Compare("<package>")) ? false : onlyEnabled, (nl->sName.Compare("<package>")) ? false : includePrepared) )
3679
			if ( !CheckInstalledDependacy((nl->sName.Compare("<package>")) ? p->name() : nl->sName, (nl->sAuthor.Compare("<author>")) ? p->author() : nl->sAuthor, nl->sMinVersion, (nl->sName.Compare("<package>")) ? false : onlyEnabled, (nl->sName.Compare("<package>")) ? false : includePrepared) )
3639
			{
3680
			{
3640
				if ( list )
3681
				if ( list )
3641
					list->PushBack(((nl->sName.Compare("<package>")) ? p->GetName() : nl->sName) + "|" + nl->sMinVersion, (nl->sAuthor.Compare("<author>")) ? p->GetAuthor() : nl->sAuthor);
3682
					list->PushBack(((nl->sName.Compare("<package>")) ? CyString(p->name()) : nl->sName) + "|" + nl->sMinVersion, (nl->sAuthor.Compare("<author>")) ? CyString(p->author()) : nl->sAuthor);
3642
				++count;
3683
				++count;
3643
			}
3684
			}
3644
		}
3685
		}
3645
	}
3686
	}
3646
 
3687
 
Line 3656... Line 3697...
3656
				{
3697
				{
3657
					found = false;
3698
					found = false;
3658
					for ( CListNode<CBaseFile> *pNode = m_lInstallList.Front(); pNode; pNode = pNode->next() )
3699
					for ( CListNode<CBaseFile> *pNode = m_lInstallList.Front(); pNode; pNode = pNode->next() )
3659
					{
3700
					{
3660
						CBaseFile *checkP = pNode->Data();
3701
						CBaseFile *checkP = pNode->Data();
3661
						if ( p->GetAuthor().Compare(checkP->GetAuthor()) && p->GetName().Compare(checkP->GetName()) )
3702
						if ( p->author().Compare(checkP->author()) && p->name().Compare(checkP->name()) )
3662
						{
3703
						{
3663
							found = true;
3704
							found = true;
3664
							break;
3705
							break;
3665
						}
3706
						}
3666
					}
3707
					}
Line 4012... Line 4053...
4012
	// make sure the directory exissts
4053
	// make sure the directory exissts
4013
	if ( !oDir.Exists(newDir) )
4054
	if ( !oDir.Exists(newDir) )
4014
	{
4055
	{
4015
		if ( !oDir.Create(newDir) )
4056
		if ( !oDir.Create(newDir) )
4016
		{
4057
		{
-
 
4058
			CLog::logf(CLog::Log_Install, 2, "Unable to create directory to backup original files, %s", newDir.c_str());
4017
			this->AddLogEntry(SPKINSTALL_CREATEDIRECTORY_FAIL, newDir, errors);
4059
			this->AddLogEntry(SPKINSTALL_CREATEDIRECTORY_FAIL, newDir, errors);
4018
			return false;
4060
			return false;
4019
		}
4061
		}
4020
 
4062
 
-
 
4063
		CLog::logf(CLog::Log_Install, 2, "Created new directory, %s", newDir.c_str());
4021
		this->AddLogEntry(SPKINSTALL_CREATEDIRECTORY, newDir, errors);
4064
		this->AddLogEntry(SPKINSTALL_CREATEDIRECTORY, newDir, errors);
4022
	}
4065
	}
4023
 
4066
 
4024
	// now lets copy the file
4067
	// now lets copy the file
4025
	CFileIO CopyFile(f->GetFilePointer());
4068
	CFileIO CopyFile(f->GetFilePointer());
4026
	if ( CopyFile.Copy(oDir.File(newDir + "/" + f->GetFilename())) )
4069
	if ( CopyFile.Copy(oDir.File(newDir + "/" + f->GetFilename())) )
4027
	{
4070
	{
-
 
4071
		CLog::logf(CLog::Log_Install, 2, "Original file: %s has been backed up", f->GetNameDirectory(NULL).c_str());
4028
		this->AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP, f->GetNameDirectory(NULL), errors);
4072
		this->AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP, f->GetNameDirectory(NULL), errors);
4029
		return true;
4073
		return true;
4030
	}
4074
	}
4031
	else
4075
	else
4032
	{
4076
	{
-
 
4077
		CLog::logf(CLog::Log_Install, 2, "Failed to backup the original file: %s", f->GetNameDirectory(NULL).c_str());
4033
		this->AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP_FAIL, f->GetNameDirectory(NULL), errors);
4078
		this->AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP_FAIL, f->GetNameDirectory(NULL), errors);
4034
		return false;
4079
		return false;
4035
	}
4080
	}
4036
}
4081
}
4037
 
4082
 
Line 4106... Line 4151...
4106
 
4151
 
4107
		// check if theres any already ordered (manual)
4152
		// check if theres any already ordered (manual)
4108
		bool added = false;
4153
		bool added = false;
4109
		for ( SStringList *sCheck = fakePatchOrder.Head(); sCheck; sCheck = sCheck->next )
4154
		for ( SStringList *sCheck = fakePatchOrder.Head(); sCheck; sCheck = sCheck->next )
4110
		{
4155
		{
4111
			if ( sCheck->str.Compare(p->GetName()) && sCheck->data.Compare(p->GetAuthor()) )
4156
			if ( sCheck->str.Compare(CyString(p->name())) && sCheck->data.Compare(CyString(p->author())) )
4112
			{
4157
			{
4113
				added = true;
4158
				added = true;
4114
				break;
4159
				break;
4115
			}
4160
			}
4116
		}
4161
		}
Line 4150... Line 4195...
4150
				for ( SStringList *str = p->GetFakePatchBeforeOrder().Head(); str; str = str->next )
4195
				for ( SStringList *str = p->GetFakePatchBeforeOrder().Head(); str; str = str->next )
4151
				{
4196
				{
4152
					int pos = 0;
4197
					int pos = 0;
4153
					for ( CListNode<CBaseFile> *sNode = sortedPackages.Front(); sNode; sNode = sNode->next() )
4198
					for ( CListNode<CBaseFile> *sNode = sortedPackages.Front(); sNode; sNode = sNode->next() )
4154
					{
4199
					{
4155
						if ( str->str.Compare(sNode->Data()->GetName()) && str->data.Compare(sNode->Data()->GetAuthor()) )
4200
						if ( str->str.Compare(CyString(sNode->Data()->name())) && str->data.Compare(CyString(sNode->Data()->author())) )
4156
						{
4201
						{
4157
							if ( earliestPos == -1 || pos < earliestPos )
4202
							if ( earliestPos == -1 || pos < earliestPos )
4158
								earliestPos = pos;
4203
								earliestPos = pos;
4159
							break;
4204
							break;
4160
						}
4205
						}
Line 4183... Line 4228...
4183
			}
4228
			}
4184
		}
4229
		}
4185
 
4230
 
4186
		// add them onto the list
4231
		// add them onto the list
4187
		for ( CListNode<CBaseFile> *pNode = sortedPackages.Front(); pNode; pNode = pNode->next() )
4232
		for ( CListNode<CBaseFile> *pNode = sortedPackages.Front(); pNode; pNode = pNode->next() )
4188
			fakePatchOrder.PushBack(pNode->Data()->GetName(), pNode->Data()->GetAuthor());
4233
			fakePatchOrder.PushBack(CyString(pNode->Data()->name()), CyString(pNode->Data()->author()));
4189
	}
4234
	}
4190
 
4235
 
4191
	// now add to do list
4236
	// now add to do list
4192
	for ( CListNode<CBaseFile> *pNode = packages.Front(); pNode; pNode = pNode->next() )
4237
	for ( CListNode<CBaseFile> *pNode = packages.Front(); pNode; pNode = pNode->next() )
4193
		fakePatchOrder.PushBack(pNode->Data()->GetName(), pNode->Data()->GetAuthor());
4238
		fakePatchOrder.PushBack(CyString(pNode->Data()->name()), CyString(pNode->Data()->author()));
4194
 
4239
 
4195
	for ( SStringList *str = fakePatchOrder.Head(); str; str = str->next )
4240
	for ( SStringList *str = fakePatchOrder.Head(); str; str = str->next )
4196
	{
4241
	{
4197
		CBaseFile *package = FindPackage(str->str, str->data);
4242
		CBaseFile *package = FindPackage(str->str, str->data);
4198
		if ( package )
4243
		if ( package )
Line 4990... Line 5035...
4990
	{
5035
	{
4991
		if ( !node->Data()->CheckGameCompatability(m_iGame) )
5036
		if ( !node->Data()->CheckGameCompatability(m_iGame) )
4992
			continue;
5037
			continue;
4993
		if ( onlyEnabled && !node->Data()->IsEnabled() )
5038
		if ( onlyEnabled && !node->Data()->IsEnabled() )
4994
			continue;
5039
			continue;
4995
		if ( node->Data()->GetAuthor().Compare("PluginManager") )
5040
		if ( node->Data()->author().Compare("PluginManager") )
4996
			++count;
5041
			++count;
4997
	}
5042
	}
4998
 
5043
 
4999
	return count;
5044
	return count;
5000
}
5045
}
Line 5542... Line 5587...
5542
			}
5587
			}
5543
			f = p->GetNextFile(f);
5588
			f = p->GetNextFile(f);
5544
		}
5589
		}
5545
 
5590
 
5546
		CyString sTextCount((long)textCount);
5591
		CyString sTextCount((long)textCount);
5547
		writeData.push_back(CyString("		<t id=\"") + (long)start + "\">" + this->ConvertTextString(p->GetName()) + "</t>");
5592
		writeData.push_back(CyString("		<t id=\"") + (long)start + "\">" + this->ConvertTextString(p->name()) + "</t>");
5548
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 1) + "\">" + this->ConvertTextString(p->GetAuthor()) + "</t>");
5593
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 1) + "\">" + this->ConvertTextString(p->author()) + "</t>");
5549
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 2) + "\">" + this->ConvertTextString(p->GetVersion()) + "</t>");
5594
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 2) + "\">" + this->ConvertTextString(p->version()) + "</t>");
5550
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 3) + "\">" + this->ConvertTextString(p->GetLanguageName(lang)) + "</t>");
5595
		writeData.push_back(CyString("		<t id=\"") + (long)(start + 3) + "\">" + this->ConvertTextString(p->GetLanguageName(lang)) + "</t>");
5551
 
5596
 
5552
		CLinkList<SSettingType> *settings = spk->GetSettingsList();
5597
		CLinkList<SSettingType> *settings = spk->GetSettingsList();
5553
		if ( settings && settings->size() )
5598
		if ( settings && settings->size() )
5554
		{
5599
		{
Line 7150... Line 7195...
7150
		{
7195
		{
7151
			if ( p == prev )
7196
			if ( p == prev )
7152
				prev = NULL;
7197
				prev = NULL;
7153
			continue;
7198
			continue;
7154
		}
7199
		}
7155
		if ( p->GetAuthor().Compare(author) )
7200
		if ( p->author().Compare(author.ToString()) )
7156
			return p;
7201
			return p;
7157
	}
7202
	}
7158
 
7203
 
7159
	return NULL;
7204
	return NULL;
7160
}
7205
}
Line 7330... Line 7375...
7330
					unknownCommands->PushBack(first, rest);
7375
					unknownCommands->PushBack(first, rest);
7331
			}
7376
			}
7332
		}
7377
		}
7333
	}
7378
	}
7334
 
7379
 
7335
	if ( package->GetFilename().Empty() )
7380
	if ( package->filename().empty() )
7336
		package->LoadPackageData("AutoSave", "$AUTOSAVE");
7381
		package->LoadPackageData("AutoSave", "$AUTOSAVE");
7337
 
7382
 
7338
	if ( !ftpaddr.Empty() )
7383
	if ( !ftpaddr.Empty() )
7339
	{
7384
	{
7340
		if ( !ftpuser.Empty() )
7385
		if ( !ftpuser.Empty() )
Line 7900... Line 7945...
7900
		for ( int i = 0; i < cat.GetNumFiles(); i++ )
7945
		for ( int i = 0; i < cat.GetNumFiles(); i++ )
7901
		{
7946
		{
7902
			SInCatFile *f = cat.GetFile(i);
7947
			SInCatFile *f = cat.GetFile(i);
7903
			CyString filename = f->sFile;
7948
			CyString filename = f->sFile;
7904
			filename = filename.FindReplace("\\", "/");
7949
			filename = filename.FindReplace("\\", "/");
-
 
7950
			bool found = false;
7905
			if ( filename.Left(2).Compare("t/") || filename.Left(6).Compare("types/") )
7951
			if ( filename.Left(2).Compare("t/") || filename.Left(6).Compare("types/") )
-
 
7952
				found = true;
-
 
7953
			else if ( filename.Left(8).Compare("addon/t/") || filename.Left(12).Compare("addon/types/") )
-
 
7954
				found = true;
7906
			{
7955
 
-
 
7956
			if ( found ) {
7907
				if ( list )
7957
				if ( list )
7908
					list->PushBack(filename, CyString(f->lSize));
7958
					list->PushBack(filename, CyString(f->lSize));
7909
				else
7959
				else
7910
					return true;
7960
					return true;
7911
			}
7961
			}
Line 8052... Line 8102...
8052
bool CPackages::IsSamePackage(CBaseFile *p1, CBaseFile *p2)
8102
bool CPackages::IsSamePackage(CBaseFile *p1, CBaseFile *p2)
8053
{
8103
{
8054
	if ( !p1 || !p2 ) return false;
8104
	if ( !p1 || !p2 ) return false;
8055
	if ( p1 == p2 ) return true;
8105
	if ( p1 == p2 ) return true;
8056
 
8106
 
8057
	if ( p1->GetName().Compare(p2->GetName()) && p1->GetAuthor().Compare(p2->GetAuthor()) )
8107
	if ( p1->name().Compare(p2->name()) && p1->author().Compare(p2->author()) )
8058
		return true;
8108
		return true;
8059
	return false;
8109
	return false;
8060
}
8110
}
8061
 
8111
 
8062
void CPackages::ApplyFakePatchOrder(CyStringList *list)
8112
void CPackages::ApplyFakePatchOrder(CyStringList *list)
Line 8093... Line 8143...
8093
	else 
8143
	else 
8094
	{
8144
	{
8095
		p->iType = ((CSpkFile *)package)->GetPackageType();
8145
		p->iType = ((CSpkFile *)package)->GetPackageType();
8096
		p->iScriptType = ((CSpkFile *)package)->GetScriptType();
8146
		p->iScriptType = ((CSpkFile *)package)->GetScriptType();
8097
	}
8147
	}
8098
	p->sAuthor = package->GetAuthor();
8148
	p->sAuthor = package->author();
8099
	p->sDesc = package->description().findReplace("\n", "::newline::");
8149
	p->sDesc = package->description().findReplace("\n", "::newline::");
8100
	p->sName = package->GetName();
8150
	p->sName = package->name();
8101
	p->sUpdated = package->GetCreationDate();
8151
	p->sUpdated = package->creationDate();
8102
	p->sVersion = package->GetVersion();
8152
	p->sVersion = package->version();
8103
	p->sFilename = CFileIO(package->GetFilename()).GetFilename();
8153
	p->sFilename = CFileIO(package->filename()).GetFilename();
8104
 
8154
 
8105
	return p;
8155
	return p;
8106
}
8156
}
8107
 
8157
 
8108
CyString CPackages::FormatAvailablePackageData(CBaseFile *package)
8158
CyString CPackages::FormatAvailablePackageData(CBaseFile *package)
Line 8553... Line 8603...
8553
		archive = this->_archive_fromRar(filename, toInstall);
8603
		archive = this->_archive_fromRar(filename, toInstall);
8554
	else if ( CFileIO(filename).CheckFileExtension("zip") )
8604
	else if ( CFileIO(filename).CheckFileExtension("zip") )
8555
		archive = this->_archive_fromZip(filename, toInstall);
8605
		archive = this->_archive_fromZip(filename, toInstall);
8556
 
8606
 
8557
	if ( archive ) {
8607
	if ( archive ) {
8558
		archive->SetFilename(CFileIO(filename).ChangeFileExtension("spk"));
8608
		archive->setFilename(CFileIO(filename).ChangeFileExtension("spk").ToString());
8559
		if ( toInstall )
8609
		if ( toInstall )
8560
			archive->SetName(CFileIO(filename).GetFilename());
8610
			archive->setName(CFileIO(filename).GetFilename().ToString());
8561
		else
8611
		else
8562
			archive->SetName(CFileIO(filename).GetBaseName());
8612
			archive->setName(CFileIO(filename).GetBaseName().ToString());
8563
	}
8613
	}
8564
 
8614
 
8565
	return archive;
8615
	return archive;
8566
}
8616
}
8567
 
8617
 
Line 8574... Line 8624...
8574
	CBaseFile *package = p.LoadPackagerScript(filename, NULL, NULL, NULL, &variables);
8624
	CBaseFile *package = p.LoadPackagerScript(filename, NULL, NULL, NULL, &variables);
8575
 
8625
 
8576
	if ( !package )
8626
	if ( !package )
8577
		return NullString;
8627
		return NullString;
8578
 
8628
 
8579
	CyString saveto = package->GetFilename();
8629
	CyString saveto = package->filename();
8580
	saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
8630
	saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
8581
	saveto = saveto.FindReplace("$PATH", curDir);
8631
	saveto = saveto.FindReplace("$PATH", curDir);
8582
	saveto = saveto.FindReplace("\\", "/");
8632
	saveto = saveto.FindReplace("\\", "/");
8583
	saveto = saveto.FindReplace("//", "/");
8633
	saveto = saveto.FindReplace("//", "/");
8584
	if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
8634
	if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )