Subversion Repositories spk

Rev

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

Rev 13 Rev 14
Line 1028... Line 1028...
1028
	}
1028
	}
1029
 
1029
 
1030
	fclose ( id );
1030
	fclose ( id );
1031
}
1031
}
1032
 
1032
 
1033
bool CBaseFile::InstallFiles ( CyString destdir, CProgressInfo *progress, CLinkList<C_File> *filelist, CyStringList *errorStr, bool enabled, CPackages *packages )
1033
void CBaseFile::_install_adjustFakePatches(CPackages *pPackages)
1034
{
1034
{
1035
	// first rename any fake patches
-
 
1036
	CyStringList lPatches;
1035
	CyStringList lPatches;
-
 
1036
	int startfake = pPackages->FindNextFakePatch();
-
 
1037
 
-
 
1038
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
-
 
1039
	{
-
 
1040
		C_File *fit = node->Data();
-
 
1041
		// only do fake patchs
-
 
1042
		if ( !fit->IsFakePatch() )
-
 
1043
			continue;
-
 
1044
 
-
 
1045
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
-
 
1046
		if ( !fit->CheckFileExt ("cat") && !fit->CheckFileExt("dat") )
-
 
1047
			continue;
-
 
1048
 
-
 
1049
		// search for the name on the list
-
 
1050
		SStringList *opposite = lPatches.FindString(fit->GetBaseName());
-
 
1051
		CyString newname;
-
 
1052
		if ( opposite )
-
 
1053
			newname = opposite->data;
-
 
1054
		else
-
 
1055
		{
-
 
1056
			newname = CyString::Number((long)startfake).PadNumber(2);
-
 
1057
			lPatches.PushBack(fit->GetBaseName(), newname);
-
 
1058
		}
-
 
1059
 
-
 
1060
		// rename the file
-
 
1061
		fit->FixOriginalName();
-
 
1062
		fit->SetName ( newname + "." + fit->GetFileExt() );
-
 
1063
 
-
 
1064
		// find the next gap
-
 
1065
		if ( !opposite ) {
-
 
1066
			startfake = pPackages->FindNextFakePatch(startfake + 1);
-
 
1067
		}
-
 
1068
	}
-
 
1069
 
-
 
1070
}
1037
 
1071
 
-
 
1072
bool CBaseFile::InstallFiles ( CyString destdir, CProgressInfo *progress, CLinkList<C_File> *filelist, CyStringList *errorStr, bool enabled, CPackages *packages )
-
 
1073
{
1038
	if ( enabled )
1074
	if ( enabled )
1039
	{
1075
	{
1040
		int startfake = 1;
1076
/*		int startfake = packages->FindNextFakePatch();
1041
		while ( startfake < 99 )
1077
		while ( startfake < 99 )
1042
		{
1078
		{
1043
			CyString filename = destdir;
1079
			CyString filename = destdir;
1044
			if ( !filename.Empty() )
1080
			if ( !filename.Empty() )
1045
				filename += "/";
1081
				filename += "/";
Line 1096... Line 1132...
1096
					}
1132
					}
1097
					startfake++;
1133
					startfake++;
1098
				}
1134
				}
1099
			}
1135
			}
1100
		}
1136
		}
-
 
1137
		*/
-
 
1138
		this->_install_adjustFakePatches(packages);
1101
 
1139
 
1102
		// find renable text file
1140
		// find renameable text file
1103
		if ( packages )
1141
		if ( packages )
1104
		{
1142
		{
1105
			int starttext = 3;
1143
			int starttext = packages->FindNextTextFile();
-
 
1144
			/*
1106
			while ( starttext < 9999 )
1145
			while ( starttext < 9999 )
1107
			{
1146
			{
1108
				CyString filename = destdir;
1147
				CyString filename = destdir;
1109
				if ( !filename.Empty() )
1148
				if ( !filename.Empty() )
1110
					filename += "/t/";
1149
					filename += "/t/";
Line 1114... Line 1153...
1114
				{
1153
				{
1115
					if ( !CFileIO(filename + ".pck").Exists() )
1154
					if ( !CFileIO(filename + ".pck").Exists() )
1116
						break;
1155
						break;
1117
				}
1156
				}
1118
				starttext++;
1157
				starttext++;
1119
			}
1158
			}*/
1120
 
1159
 
1121
			for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
1160
			for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
1122
			{
1161
			{
1123
				C_File *fit = node->Data();
1162
				C_File *fit = node->Data();
1124
				if ( !fit->IsAutoTextFile() )
1163
				if ( !fit->IsAutoTextFile() )
Line 1185... Line 1224...
1185
		ClearError ();
1224
		ClearError ();
1186
		bool dofile = true;
1225
		bool dofile = true;
1187
 
1226
 
1188
		// new check if we should install the file
1227
		// new check if we should install the file
1189
		// first get the version
1228
		// first get the version
1190
		if ( fit->ReadScriptVersion () && !m_bOverrideFiles )
1229
		if ( !m_bOverrideFiles && fit->ReadScriptVersion() )
1191
		{
1230
		{
1192
			C_File checkfile;
1231
			C_File checkfile;
1193
			CyString checkfilename = destdir;
1232
			CyString checkfilename = destdir;
1194
			if ( !checkfilename.Empty() )
1233
			if ( !checkfilename.Empty() )
1195
				checkfilename += "/";
1234
				checkfilename += "/";
Line 1515... Line 1554...
1515
	Return: Boolean - If string is a valid header
1554
	Return: Boolean - If string is a valid header
1516
	Desc:   Splits up the main header string to get all required settings
1555
	Desc:   Splits up the main header string to get all required settings
1517
*/
1556
*/
1518
bool CBaseFile::ParseHeader ( CyString header )
1557
bool CBaseFile::ParseHeader ( CyString header )
1519
{
1558
{
1520
	if ( !this->CheckHeader(header.GetToken ( 1, ';' )) )
1559
	if ( !this->CheckHeader(header.GetToken ( 1, ';' ).ToString()) )
1521
		return false;
1560
		return false;
1522
 
1561
 
1523
	m_SHeader.fVersion = header.GetToken ( 2, ';' ).ToFloat();
1562
	m_SHeader.fVersion = header.GetToken ( 2, ';' ).ToFloat();
1524
	if ( m_SHeader.fVersion > FILEVERSION )
1563
	if ( m_SHeader.fVersion > FILEVERSION )
1525
		return false;
1564
		return false;
Line 1528... Line 1567...
1528
	m_SHeader.lValueCompressSize = header.GetToken ( 4, ';' ).ToLong();
1567
	m_SHeader.lValueCompressSize = header.GetToken ( 4, ';' ).ToLong();
1529
 
1568
 
1530
	return true;
1569
	return true;
1531
}
1570
}
1532
 
1571
 
1533
bool CBaseFile::CheckHeader ( CyString header )
1572
bool CBaseFile::CheckHeader(const Utils::String header) const
1534
{
1573
{
1535
	if ( header.Compare("BaseCycrow") )
1574
	if ( header.Compare("BaseCycrow") )
1536
		return true;
1575
		return true;
1537
	return false;
1576
	return false;
1538
}
1577
}
Line 1562... Line 1601...
1562
	Func:   ParseValueLine
1601
	Func:   ParseValueLine
1563
	Input:  String - single line from a file to set
1602
	Input:  String - single line from a file to set
1564
	Return: Boolean - returns true if value exists
1603
	Return: Boolean - returns true if value exists
1565
	Desc:   Reads the line and assigns the parameters for the file
1604
	Desc:   Reads the line and assigns the parameters for the file
1566
*/
1605
*/
1567
bool CBaseFile::ParseValueLine ( CyString line )
1606
bool CBaseFile::ParseValueLine(const Utils::String &sLine)
1568
{
1607
{
1569
	CyString first = line.GetToken ( 1, ' ' );
1608
	Utils::String first = sLine.token(" ", 1);
1570
	CyString rest  = line.GetToken ( 2, -1, ' ' );
1609
	Utils::String rest  = sLine.tokens(" ", 2);
1571
 
1610
 
1572
	if ( first == "Name:" )
1611
	if ( first.Compare("Name:") )
1573
		m_sName = rest;
1612
		m_sName = rest;
1574
	else if ( first == "Author:" )
1613
	else if ( first.Compare("Author:") )
1575
		m_sAuthor = rest;
1614
		m_sAuthor = rest;
1576
	else if ( first == "Version:" )
1615
	else if ( first.Compare("Version:") )
1577
		m_sVersion = rest;
1616
		m_sVersion = rest;
1578
	else if ( first == "fGameVersion:" ) {
1617
	else if ( first.Compare("fGameVersion:") ) {
1579
		if ( m_lGames.Back() ) {
1618
		if ( m_lGames.Back() ) {
1580
			m_lGames.Back()->Data()->sVersion = rest;
1619
			m_lGames.Back()->Data()->sVersion = rest;
1581
		}
1620
		}
1582
	}
1621
	}
1583
	else if ( first == "GameVersion:" ) {
1622
	else if ( first.Compare("GameVersion:") ) {
1584
		if ( m_lGames.Back() ) {
1623
		if ( m_lGames.Back() ) {
1585
			m_lGames.Back()->Data()->iVersion = rest.ToInt();
1624
			m_lGames.Back()->Data()->iVersion = rest;
1586
		}
1625
		}
1587
	}
1626
	}
1588
	else if ( first == "Game:" )
1627
	else if ( first.Compare("Game:") )
1589
		this->AddGameCompatability(rest.ToInt(), NullString);
1628
		this->AddGameCompatability(rest, NullString);
1590
	else if ( first == "GameCompat:" )
1629
	else if ( first.Compare("GameCompat:") )
1591
		this->AddGameCompatability(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2));
1630
		this->AddGameCompatability(rest.token(" ", 1), rest.tokens(" ", 2));
1592
	else if ( first == "GameCompatExact:" )
1631
	else if ( first.Compare("GameCompatExact:") )
1593
		this->AddGameCompatability(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2));
1632
		this->AddGameCompatability(rest.token(" ", 1), rest.tokens(" ", 2));
1594
	else if ( first == "Date:" )
1633
	else if ( first.Compare("Date:") )
1595
		m_sCreationDate = rest;
1634
		m_sCreationDate = rest;
1596
	else if ( first == "WebAddress:" )
1635
	else if ( first.Compare("WebAddress:") )
1597
		m_sWebAddress = rest;
1636
		m_sWebAddress = rest;
1598
	else if ( first == "WebSite:" )
1637
	else if ( first.Compare("WebSite:") )
1599
		m_sWebSite = rest;
1638
		m_sWebSite = rest;
1600
	else if ( first == "Email:" )
1639
	else if ( first.Compare("Email:") )
1601
		m_sEmail = rest;
1640
		m_sEmail = rest;
1602
	else if ( first == "WebMirror1:" || first == "Mirror1:" || first == "WebMirror:" )
1641
	else if ( first.Compare("WebMirror1:") || first.Compare("Mirror1:") || first.Compare("WebMirror:") )
1603
		this->AddWebMirror(rest);
1642
		this->AddWebMirror(rest);
1604
	else if ( first == "WebMirror2:" || first == "Mirror2:" )
1643
	else if ( first.Compare("WebMirror2:") || first.Compare("Mirror2:") )
1605
		this->AddWebMirror(rest);
1644
		this->AddWebMirror(rest);
1606
	else if ( first == "PluginType:" )
1645
	else if ( first.Compare("PluginType:") )
1607
		m_iPluginType = rest.ToInt();
1646
		m_iPluginType = rest;
1608
	else if ( first == "Desc:" )
1647
	else if ( first.Compare("Desc:") )
1609
	{
1648
	{
1610
		m_sDescription = rest;
1649
		m_sDescription = rest;
1611
		m_sDescription.RemoveFirstChar('\n');
1650
		m_sDescription.RemoveFirstChar('\n');
1612
		m_sDescription.RemoveFirstChar('\r');
1651
		m_sDescription.RemoveFirstChar('\r');
1613
		m_sDescription.RemoveFirstSpace();
1652
		m_sDescription.RemoveFirstSpace();
Line 1646... Line 1685...
1646
 
1685
 
1647
				m_sDescription = firstStr + lastStr;
1686
				m_sDescription = firstStr + lastStr;
1648
			}
1687
			}
1649
		}
1688
		}
1650
	}
1689
	}
1651
	else if ( first == "UninstallAfter:" )
1690
	else if ( first.Compare("UninstallAfter:") )
1652
		AddUninstallAfterText ( ParseInstallText(rest.GetToken ( 1, '|' )), rest.GetToken ( 2, -1, '|' ) );
1691
		AddUninstallAfterText(ParseInstallText(rest.token("|", 1)), rest.tokens("|", 2));
1653
	else if ( first == "UninstallBefore:" )
1692
	else if ( first.Compare("UninstallBefore:") )
1654
		AddUninstallBeforeText ( ParseInstallText(rest.GetToken ( 1, '|' )), rest.GetToken ( 2, -1, '|' ) );
1693
		AddUninstallBeforeText(ParseInstallText(rest.token("|", 1)), rest.tokens("|", 2));
1655
	else if ( first == "InstallAfter:" )
1694
	else if ( first.Compare("InstallAfter:") )
1656
		AddInstallAfterText ( ParseInstallText(rest.GetToken ( 1, '|' )), rest.GetToken ( 2, -1, '|' ) );
1695
		AddInstallAfterText(ParseInstallText(rest.token("|", 1)), rest.tokens("|", 2));
1657
	else if ( first == "InstallBefore:" )
1696
	else if ( first.Compare("InstallBefore:") )
1658
		AddInstallBeforeText ( ParseInstallText(rest.GetToken ( 1, '|' )), rest.GetToken ( 2, -1, '|' ) );
1697
		AddInstallBeforeText(ParseInstallText(rest.token("|", 1)), rest.tokens("|", 2));
1659
	else if ( first == "ScriptName:" )
1698
	else if ( first.Compare("ScriptName:") )
1660
		AddLanguageName ( ParseLanguage(rest.GetToken ( 1, ':' )),  rest.GetToken ( 2, -1, ':' ) );
1699
		AddLanguageName(ParseLanguage(rest.token(":", 1)), rest.token(":", 2));
1661
	else if ( first == "GameChanging:" )
1700
	else if ( first.Compare("GameChanging:") )
1662
		m_iGameChanging = rest.ToInt();
1701
		m_iGameChanging = rest;
1663
	else if ( first == "EaseOfUse:" )
1702
	else if ( first.Compare("EaseOfUse:") )
1664
		m_iEaseOfUse = rest.ToInt();
1703
		m_iEaseOfUse = rest;
1665
	else if ( first == "Recommended:" )
1704
	else if ( first.Compare("Recommended:") )
1666
		m_iRecommended = rest.ToInt();
1705
		m_iRecommended = rest;
1667
	else if ( first == "NeededLibrary:" )
1706
	else if ( first.Compare("NeededLibrary:") )
1668
		this->AddNeededLibrary(rest.GetToken("||", 1, 1), rest.GetToken("||", 2, 2), rest.GetToken("||", 3, 3));
1707
		this->AddNeededLibrary(rest.token("||", 1), rest.token("||", 2), rest.token("||", 3));
1669
	else if ( first == "FakePatchBefore:" )
1708
	else if ( first.Compare("FakePatchBefore:") )
1670
		this->AddFakePatchOrder(false, rest.GetToken("||", 1, 1), rest.GetToken("||", 2, 2));
1709
		this->AddFakePatchOrder(false, rest.token("||", 1), rest.token("||", 2));
1671
	else if ( first == "FakePatchAfter:" )
1710
	else if ( first.Compare("FakePatchAfter:") )
1672
		this->AddFakePatchOrder(true, rest.GetToken("||", 1, 1), rest.GetToken("||", 2, 2));
1711
		this->AddFakePatchOrder(true, rest.token("||", 1), rest.token("||", 2));
1673
	else if ( first == "ForumLink:" )
1712
	else if ( first.Compare("ForumLink:") )
1674
		m_sForumLink = rest;
1713
		m_sForumLink = rest;
1675
	else
1714
	else
1676
		return false;
1715
		return false;
1677
 
1716
 
1678
	return true;
1717
	return true;
Line 1718... Line 1757...
1718
{
1757
{
1719
	int num = 0;
1758
	int num = 0;
1720
	CyString *lines = values.SplitToken ( '\n', &num );
1759
	CyString *lines = values.SplitToken ( '\n', &num );
1721
 
1760
 
1722
	for ( int i = 0; i < num; i++ )
1761
	for ( int i = 0; i < num; i++ )
1723
		ParseValueLine ( lines[i] );
1762
		ParseValueLine ( lines[i].ToString() );
1724
 
1763
 
1725
	CLEANSPLIT(lines, num)
1764
	CLEANSPLIT(lines, num)
1726
}
1765
}
1727
 
1766
 
1728
/*
1767
/*
Line 2053... Line 2092...
2053
	}
2092
	}
2054
 
2093
 
2055
	return false;
2094
	return false;
2056
}
2095
}
2057
 
2096
 
2058
CyString CBaseFile::CreateValuesLine ()
2097
Utils::String CBaseFile::CreateValuesLine () const
2059
{
2098
{
2060
	CyString values ( "Name: " );
2099
	Utils::String values("Name: ");
2061
	values += (m_sName + "\n");
2100
	values += Utils::String(m_sName.ToString()) + "\n";
2062
	values += (CyString("Author: ") + m_sAuthor + "\n");
2101
	values += Utils::String("Author: ") + m_sAuthor.ToString() + "\n";
2063
	values += (CyString("Version: ") + m_sVersion + "\n");
2102
	values += Utils::String("Version: ") + m_sVersion.ToString() + "\n";
2064
	if ( !m_sCreationDate.Empty() )
2103
	if ( !m_sCreationDate.Empty() )
2065
		values += (CyString("Date: ") + m_sCreationDate + "\n");
2104
		values += Utils::String("Date: ") + m_sCreationDate.ToString() + "\n";
2066
	if ( !m_sWebAddress.Empty() )
2105
	if ( !m_sWebAddress.Empty() )
2067
		values += (CyString("WebAddress: ") + m_sWebAddress + "\n");
2106
		values += Utils::String("WebAddress: ") + m_sWebAddress.ToString() + "\n";
2068
	if ( !m_sWebSite.Empty() )
2107
	if ( !m_sWebSite.Empty() )
2069
		values += (CyString("WebSite: ") + m_sWebSite + "\n");
2108
		values += Utils::String("WebSite: ") + m_sWebSite.ToString() + "\n";
2070
	if ( !m_sEmail.Empty() )
2109
	if ( !m_sEmail.Empty() )
2071
		values += (CyString("Email: ") + m_sEmail + "\n");
2110
		values += Utils::String("Email: ") + m_sEmail.ToString() + "\n";
2072
	for ( SStringList *str = m_lMirrors.Head(); str; str = str->next )
2111
	for ( SStringList *str = m_lMirrors.Head(); str; str = str->next )
2073
		values += (CyString("WebMirror: ") + str->str + "\n");
2112
		values += Utils::String("WebMirror: ") + str->str.ToString() + "\n";
2074
	if ( !m_sDescription.Empty() )
2113
	if ( !m_sDescription.Empty() )
2075
	{
2114
	{
2076
		CyString desc = m_sDescription;
2115
		Utils::String desc = m_sDescription.ToString();
2077
		desc = desc.FindReplace("<newline>", "<br>");
2116
		desc = desc.findReplace("<newline>", "<br>");
2078
		desc = desc.FindReplace("\n", "<br>");
2117
		desc = desc.findReplace("\n", "<br>");
2079
		desc.RemoveChar("\r");
2118
		desc.remove('\r');
2080
		values += (CyString("Desc: ") + desc + "\n");
2119
		values += "Desc: " + desc + "\n";
2081
	}
2120
	}
2082
 
2121
 
2083
	for ( CListNode<SGameCompat> *gc = m_lGames.Front(); gc; gc = gc->next() ) {
2122
	for ( CListNode<SGameCompat> *gc = m_lGames.Front(); gc; gc = gc->next() ) {
2084
		if ( !gc->Data()->sVersion.Empty() )
2123
		if ( !gc->Data()->sVersion.Empty() )
2085
			values += CyString("GameCompatExact: ") + (long)gc->Data()->iGame + " " + gc->Data()->sVersion + "\n";
2124
			values += Utils::String("GameCompatExact: ") + (long)gc->Data()->iGame + " " + gc->Data()->sVersion.ToString() + "\n";
2086
		else
2125
		else
2087
			values += CyString("GameCompat: ") + (long)gc->Data()->iGame + " " + (long)gc->Data()->iVersion + "\n";
2126
			values += Utils::String("GameCompat: ") + (long)gc->Data()->iGame + " " + (long)gc->Data()->iVersion + "\n";
2088
	}
2127
	}
2089
	if ( !m_sForumLink.Empty() )
2128
	if ( !m_sForumLink.Empty() )
2090
		values += (CyString("ForumLink: ") + m_sForumLink + "\n");
2129
		values += Utils::String("ForumLink: ") + m_sForumLink.ToString() + "\n";
2091
 
2130
 
2092
	if ( m_bSigned )
2131
	if ( m_bSigned )
2093
		values += "Signed\n";
2132
		values += "Signed\n";
2094
 
2133
 
2095
	SInstallText *it;
2134
	CListNode<SInstallText> *it;
2096
	for ( it = m_lUninstallText.First(); it; it = m_lUninstallText.Next() )
2135
	for ( it = m_lUninstallText.Front(); it; it = it->next() ) {
2097
	{
-
 
2098
		if ( !it->sAfter.Empty() )
2136
		if ( !it->Data()->sAfter.Empty() )
2099
			values += (CyString("UninstallAfter: ") + CyString::Number(it->iLanguage) + "|" + it->sAfter + "\n");
2137
			values += (CyString("UninstallAfter: ") + CyString::Number(it->Data()->iLanguage) + "|" + it->Data()->sAfter + "\n").ToString();
2100
		if ( !it->sBefore.Empty() )
2138
		if ( !it->Data()->sBefore.Empty() )
2101
			values += (CyString("UninstallBefore: ") + CyString::Number(it->iLanguage) + "|" + it->sBefore + "\n");
2139
			values += (CyString("UninstallBefore: ") + CyString::Number(it->Data()->iLanguage) + "|" + it->Data()->sBefore + "\n").ToString();
2102
	}
2140
	}
2103
	for ( it = m_lInstallText.First(); it; it = m_lInstallText.Next() )
2141
	for ( it = m_lInstallText.Front(); it; it = it->next() ) {
2104
	{
-
 
2105
		if ( !it->sAfter.Empty() )
2142
		if ( !it->Data()->sAfter.Empty() )
2106
			values += (CyString("InstallAfter: ") + CyString::Number(it->iLanguage) + "|" + it->sAfter + "\n");
2143
			values += (CyString("InstallAfter: ") + CyString::Number(it->Data()->iLanguage) + "|" + it->Data()->sAfter + "\n").ToString();
2107
		if ( !it->sBefore.Empty() )
2144
		if ( !it->Data()->sBefore.Empty() )
2108
			values += (CyString("InstallBefore: ") + CyString::Number(it->iLanguage) + "|" + it->sBefore + "\n");
2145
			values += (CyString("InstallBefore: ") + CyString::Number(it->Data()->iLanguage) + "|" + it->Data()->sBefore + "\n").ToString();
2109
	}
2146
	}
2110
 
2147
 
2111
	values += CyString("GameChanging: ") + CyString::Number(m_iGameChanging) + "\n";
2148
	values += Utils::String("GameChanging: ") + (long)m_iGameChanging + "\n";
2112
	values += CyString("EaseOfUse: ") + CyString::Number(m_iEaseOfUse) + "\n";
2149
	values += Utils::String("EaseOfUse: ") + (long)m_iEaseOfUse + "\n";
2113
	values += CyString("Recommended: ") + CyString::Number(m_iRecommended) + "\n";
2150
	values += Utils::String("Recommended: ") + (long)m_iRecommended + "\n";
2114
 
2151
 
2115
	for ( SNames *sn = m_lNames.First(); sn; sn = m_lNames.Next() )
2152
	for ( CListNode<SNames> *nNode = m_lNames.Front(); nNode; nNode = nNode->next() )
2116
		values += CyString("ScriptName: ") + CyString::Number(sn->iLanguage) + ":" + sn->sName + "\n";
2153
		values += Utils::String("ScriptName: ") + (long)nNode->Data()->iLanguage + ":" + nNode->Data()->sName.ToString() + "\n";
2117
 
2154
 
2118
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() )
2155
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() ) {
2119
	{
-
 
2120
		SNeededLibrary *l = libNode->Data();
2156
		SNeededLibrary *l = libNode->Data();
2121
		values += (CyString("NeededLibrary: ") + l->sName + "||" + l->sAuthor + "||" + l->sMinVersion + "\n");
2157
		values += (CyString("NeededLibrary: ") + l->sName + "||" + l->sAuthor + "||" + l->sMinVersion + "\n").ToString();
2122
	}
2158
	}
2123
 
2159
 
2124
	for ( SStringList *fpbNode = m_lFakePatchBefore.Head(); fpbNode; fpbNode = fpbNode->next )
2160
	for ( SStringList *fpbNode = m_lFakePatchBefore.Head(); fpbNode; fpbNode = fpbNode->next )
2125
		values += (CyString("FakePatchBefore: ") + fpbNode->str + "||" + fpbNode->data + "\n");
2161
		values += (CyString("FakePatchBefore: ") + fpbNode->str + "||" + fpbNode->data + "\n").ToString();
2126
	for ( SStringList *fpaNode = m_lFakePatchAfter.Head(); fpaNode; fpaNode = fpaNode->next )
2162
	for ( SStringList *fpaNode = m_lFakePatchAfter.Head(); fpaNode; fpaNode = fpaNode->next )
2127
		values += (CyString("FakePatchAfter: ") + fpaNode->str + "||" + fpaNode->data + "\n");
2163
		values += (CyString("FakePatchAfter: ") + fpaNode->str + "||" + fpaNode->data + "\n").ToString();
2128
 
2164
 
2129
	values += (CyString("PluginType: ") + (long)m_iPluginType + "\n");
2165
	values += Utils::String("PluginType: ") + (long)m_iPluginType + "\n";
2130
 
2166
 
2131
	return values;
2167
	return values;
2132
}
2168
}
2133
 
2169
 
2134
 
2170
 
Line 2916... Line 2952...
2916
	else
2952
	else
2917
		Found->iVersion = version.ToInt();
2953
		Found->iVersion = version.ToInt();
2918
	m_bChanged = true;
2954
	m_bChanged = true;
2919
}
2955
}
2920
 
2956
 
2921
bool CBaseFile::LoadPackageData(CyString first, CyString rest)
2957
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest)
2922
{
2958
{
2923
	if ( first.Compare("Name") )
2959
	if ( sFirst.Compare("Name") )
2924
		m_sName = rest;
2960
		m_sName = sRest;
2925
	else if ( first.Compare("Author") )
2961
	else if ( sFirst.Compare("Author") )
2926
		m_sAuthor = rest;
2962
		m_sAuthor = sRest;
2927
	else if ( first.Compare("ScriptName") )
2963
	else if ( sFirst.Compare("ScriptName") )
2928
		AddLanguageName(ParseLanguage(rest.GetToken(" ", 1, 1)), rest.GetToken(" ", 2));
2964
		AddLanguageName(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2929
	else if ( first.Compare("UninstallBefore") )
2965
	else if ( sFirst.Compare("UninstallBefore") )
2930
		this->AddUninstallBeforeText(ParseLanguage(rest.GetToken(" ", 1, 1)), rest.GetToken(" ", 2));
2966
		this->AddUninstallBeforeText(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2931
	else if ( first.Compare("UninstallAfter") )
2967
	else if ( sFirst.Compare("UninstallAfter") )
2932
		this->AddUninstallAfterText(ParseLanguage(rest.GetToken(" ", 1, 1)), rest.GetToken(" ", 2));
2968
		this->AddUninstallAfterText(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2933
	else if ( first.Compare("InstallBefore") )
2969
	else if ( sFirst.Compare("InstallBefore") )
2934
		this->AddInstallBeforeText(ParseLanguage(rest.GetToken(" ", 1, 1)), rest.GetToken(" ", 2));
2970
		this->AddInstallBeforeText(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2935
	else if ( first.Compare("InstallAfter") )
2971
	else if ( sFirst.Compare("InstallAfter") )
2936
		this->AddInstallAfterText(ParseLanguage(rest.GetToken(" ", 1, 1)), rest.GetToken(" ", 2));
2972
		this->AddInstallAfterText(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2937
	else if ( first.Compare("Date") )
2973
	else if ( sFirst.Compare("Date") )
2938
		m_sCreationDate = rest;
2974
		m_sCreationDate = sRest;
2939
	else if ( first.Compare("Version") )
2975
	else if ( sFirst.Compare("Version") )
2940
		m_sVersion = rest;
2976
		m_sVersion = sRest;
2941
	// old version
2977
	// old version
2942
	else if ( first.Compare("GameVersion") )
2978
	else if ( sFirst.Compare("GameVersion") )
2943
		this->AddGameCompatability(-1, rest);
2979
		this->AddGameCompatability(-1, sRest);
2944
	else if ( first.Compare("PluginType") )
2980
	else if ( sFirst.Compare("PluginType") )
2945
	{
2981
	{
2946
		if ( rest.IsNumber() )
2982
		if ( sRest.isNumber() )
2947
			this->SetPluginType(rest.ToInt());
2983
			this->SetPluginType(sRest);
2948
		else if ( rest.Compare("Normal") )
2984
		else if ( sRest.Compare("Normal") )
2949
			this->SetPluginType(PLUGIN_NORMAL);
2985
			this->SetPluginType(PLUGIN_NORMAL);
2950
		else if ( rest.Compare("Stable") )
2986
		else if ( sRest.Compare("Stable") )
2951
			this->SetPluginType(PLUGIN_STABLE);
2987
			this->SetPluginType(PLUGIN_STABLE);
2952
		else if ( rest.Compare("Experimental") )
2988
		else if ( sRest.Compare("Experimental") )
2953
			this->SetPluginType(PLUGIN_EXPERIMENTAL);
2989
			this->SetPluginType(PLUGIN_EXPERIMENTAL);
2954
		else if ( rest.Compare("Cheat") )
2990
		else if ( sRest.Compare("Cheat") )
2955
			this->SetPluginType(PLUGIN_CHEAT);
2991
			this->SetPluginType(PLUGIN_CHEAT);
2956
		else if ( rest.Compare("Mod") )
2992
		else if ( sRest.Compare("Mod") )
2957
			this->SetPluginType(PLUGIN_MOD);
2993
			this->SetPluginType(PLUGIN_MOD);
2958
	}
2994
	}
2959
	// new version
2995
	// new version
2960
	else if ( first.Compare("GenerateUpdateFile") )
2996
	else if ( sFirst.Compare("GenerateUpdateFile") )
2961
		m_bAutoGenerateUpdateFile = true;
2997
		m_bAutoGenerateUpdateFile = true;
2962
	else if ( first.Compare("Game") )
2998
	else if ( sFirst.Compare("Game") )
2963
	{
2999
	{
2964
		Utils::String sGame = rest.GetToken(" ", 1, 1).ToString();
3000
		Utils::String sGame = sRest.token(" ", 1);
2965
		this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), rest.GetToken(" ", 2, 2));
3001
		this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), sRest.token(" ", 2));
2966
	}
3002
	}
2967
	else if ( first.Compare("Description") )
3003
	else if ( sFirst.Compare("Description") )
2968
		m_sDescription = rest;
3004
		m_sDescription = sRest;
2969
	else if ( first.Compare("AutoSave") || first.Compare("AutoExport") || first.Compare("AutoRarExport") || first.Compare("AutoZipExport") )
3005
	else if ( sFirst.Compare("AutoSave") || sFirst.Compare("AutoExport") || sFirst.Compare("AutoRarExport") || sFirst.Compare("AutoZipExport") )
2970
	{
3006
	{
2971
		CyString filename = rest;
3007
		CyString filename = sRest;
2972
		CyString name = m_sName;
3008
		CyString name = m_sName;
2973
		CyString author = m_sAuthor;
3009
		CyString author = m_sAuthor;
2974
		CyString cdate = m_sCreationDate;
3010
		CyString cdate = m_sCreationDate;
2975
		cdate = cdate.FindReplace("/", ".").Remove(" ");
3011
		cdate = cdate.FindReplace("/", ".").Remove(" ");
2976
		if ( filename.IsIn("$AUTOSAVE") )
3012
		if ( filename.IsIn("$AUTOSAVE") )
Line 2989... Line 3025...
2989
		if ( filename.IsIn("$CDATE") )
3025
		if ( filename.IsIn("$CDATE") )
2990
			filename.FindReplace("$CDATE", cdate);
3026
			filename.FindReplace("$CDATE", cdate);
2991
		if ( filename.IsIn("$VERSION") )
3027
		if ( filename.IsIn("$VERSION") )
2992
			filename.FindReplace("$VERSION", m_sVersion);
3028
			filename.FindReplace("$VERSION", m_sVersion);
2993
 
3029
 
2994
		if ( first.Compare("AutoZipExport") || first.Compare("AutoExport") )
3030
		if ( sFirst.Compare("AutoZipExport") || sFirst.Compare("AutoExport") )
2995
			m_sExportFilename = CFileIO(filename).ChangeFileExtension("zip");
3031
			m_sExportFilename = CFileIO(filename).ChangeFileExtension("zip");
2996
		else if ( first.Compare("AutoRarExport") )
3032
		else if ( sFirst.Compare("AutoRarExport") )
2997
			m_sExportFilename = CFileIO(filename).ChangeFileExtension("rar");
3033
			m_sExportFilename = CFileIO(filename).ChangeFileExtension("rar");
2998
		else
3034
		else
2999
			m_sFilename = filename;
3035
			m_sFilename = filename;
3000
	}
3036
	}
3001
	else if ( first.Compare("WebSite") )
3037
	else if ( sFirst.Compare("WebSite") )
3002
		m_sWebSite = rest;
3038
		m_sWebSite = sRest;
3003
	else if ( first.Compare("ForumLink") || first.Compare("Forum") )
3039
	else if ( sFirst.Compare("ForumLink") || sFirst.Compare("Forum") )
3004
		m_sForumLink = rest;
3040
		m_sForumLink = sRest;
3005
	else if ( first.Compare("Email") )
3041
	else if ( sFirst.Compare("Email") )
3006
		m_sEmail = rest;
3042
		m_sEmail = sRest;
3007
	else if ( first.Compare("WebAddress") )
3043
	else if ( sFirst.Compare("WebAddress") )
3008
		m_sWebAddress = rest;
3044
		m_sWebAddress = sRest;
3009
	else if ( first.Compare("WebMirror") )
3045
	else if ( sFirst.Compare("WebMirror") )
3010
		this->AddWebMirror(rest);
3046
		this->AddWebMirror(sRest);
3011
	else if ( first.Compare("WebMirror1") )
3047
	else if ( sFirst.Compare("WebMirror1") )
3012
		this->AddWebMirror(rest);
3048
		this->AddWebMirror(sRest);
3013
	else if ( first.Compare("WebMirror2") )
3049
	else if ( sFirst.Compare("WebMirror2") )
3014
		this->AddWebMirror(rest);
3050
		this->AddWebMirror(sRest);
3015
	else if ( first.Compare("Ftp") )
3051
	else if ( sFirst.Compare("Ftp") )
3016
		m_sFtpAddr = rest;
3052
		m_sFtpAddr = sRest;
3017
	else if ( first.Compare("Ratings") )
3053
	else if ( sFirst.Compare("Ratings") )
3018
	{
3054
	{
3019
		m_iEaseOfUse = rest.GetToken(" ", 1, 1).ToInt();
3055
		m_iEaseOfUse = sRest.token(" ", 1);
3020
		m_iGameChanging = rest.GetToken(" ", 2, 2).ToInt();
3056
		m_iGameChanging = sRest.token(" ", 2);
3021
		m_iRecommended = rest.GetToken(" ", 3, 3).ToInt();
3057
		m_iRecommended = sRest.token(" ", 3);
3022
	}
3058
	}
3023
	else if ( first.Compare("EaseOfUse") )
3059
	else if ( sFirst.Compare("EaseOfUse") )
3024
		m_iEaseOfUse = rest.ToInt();
3060
		m_iEaseOfUse = sRest;
3025
	else if ( first.Compare("GameChanging") )
3061
	else if ( sFirst.Compare("GameChanging") )
3026
		m_iGameChanging = rest.ToInt();
3062
		m_iGameChanging = sRest;
3027
	else if ( first.Compare("Recommended") )
3063
	else if ( sFirst.Compare("Recommended") )
3028
		m_iRecommended = rest.ToInt();
3064
		m_iRecommended = sRest;
3029
	else if ( first.Compare("Depend") )
3065
	else if ( sFirst.Compare("Depend") )
3030
	{
3066
	{
3031
		CyString version = rest.GetToken("|", 2, 2);
3067
		CyString version = sRest.token("|", 2);
3032
		CyString name = rest.GetToken("|", 1, 1);
3068
		CyString name = sRest.token("|", 1);
3033
		CyString author = rest.GetToken("|", 3);
3069
		CyString author = sRest.tokens("|", 3);
3034
 
3070
 
3035
		this->AddNeededLibrary(name, author, version);
3071
		this->AddNeededLibrary(name, author, version);
3036
	}
3072
	}
3037
	else if ( first.Compare("DependPackage") )
3073
	else if ( sFirst.Compare("DependPackage") )
3038
	{
3074
	{
3039
		CPackages p;
3075
		CPackages p;
3040
		CBaseFile *spk =  p.OpenPackage(rest, 0, 0, SPKREAD_VALUES);
3076
		CBaseFile *spk =  p.OpenPackage(sRest, 0, 0, SPKREAD_VALUES);
3041
		if ( spk )
3077
		if ( spk )
3042
		{
3078
		{
3043
			this->AddNeededLibrary(spk->GetName(), spk->GetAuthor(), spk->GetVersion());
3079
			this->AddNeededLibrary(spk->GetName(), spk->GetAuthor(), spk->GetVersion());
3044
			delete spk;
3080
			delete spk;
3045
		}
3081
		}
3046
	}
3082
	}
3047
	else if ( first.Compare("Icon") )
3083
	else if ( sFirst.Compare("Icon") )
3048
	{
3084
	{
3049
		C_File *icon = new C_File(rest);
3085
		C_File *icon = new C_File(sRest.c_str());
3050
		if ( icon->ReadFromFile() )
3086
		if ( icon->ReadFromFile() )
3051
			this->SetIcon(icon, CFileIO(rest).GetFileExtension());
3087
			this->SetIcon(icon, CFileIO(sRest).GetFileExtension());
3052
	}
3088
	}
3053
	else
3089
	else
3054
	{
3090
	{
3055
		CyString checkType = first;
3091
		Utils::String checkType = sFirst;
3056
		bool shared = false;
3092
		bool shared = false;
3057
		if ( checkType.Left(6).Compare("Shared") )
3093
		if ( checkType.left(6).Compare("Shared") )
3058
		{
3094
		{
3059
			checkType = first.Right(-6);
3095
			checkType = sFirst.right(-6);
3060
			shared = true;
3096
			shared = true;
3061
		}
3097
		}
3062
 
3098
 
3063
		// now check type name
3099
		// now check type name
3064
		int filetype = GetFileTypeFromString(checkType);
3100
		int filetype = GetFileTypeFromString(checkType);
3065
		if ( filetype != -1 )
3101
		if ( filetype != -1 )
3066
			this->AddFileScript(filetype, shared, rest);
3102
			this->AddFileScript(filetype, shared, sRest);
3067
		else if ( !checkType.Compare("changelog") )
3103
		else if ( !checkType.Compare("changelog") )
3068
			return false;
3104
			return false;
3069
	}
3105
	}
3070
 
3106
 
3071
	return true;
3107
	return true;