Subversion Repositories spk

Rev

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

Rev 203 Rev 207
Line 69... Line 69...
69
	Func:   ParseValueLine
69
	Func:   ParseValueLine
70
	Input:  String - single line from a file to set
70
	Input:  String - single line from a file to set
71
	Return: Boolean - returns true if value exists
71
	Return: Boolean - returns true if value exists
72
	Desc:   Reads the line and assigns the parameters for the file
72
	Desc:   Reads the line and assigns the parameters for the file
73
*/
73
*/
74
bool CSpkFile::ParseValueLine(const Utils::String &line)
74
bool CSpkFile::parseValueLine(const Utils::WString &line)
75
{
75
{
76
	Utils::String first = line.token(" ", 1);
76
	Utils::WString first = line.token(L" ", 1);
77
	Utils::String rest  = line.tokens(" ", 2);
77
	Utils::WString rest  = line.tokens(L" ", 2);
78
 
78
 
79
	if ( first == "AnotherMod:" )
79
	if ( first == L"AnotherMod:" )
80
	{
80
	{
81
		m_sOtherAuthor = rest.token("|", 1);
81
		m_sOtherAuthor = rest.token(L"|", 1).toString();
82
		m_sOtherName = rest.tokens("|", 2);
82
		m_sOtherName = rest.tokens(L"|", 2).toString();
83
	}
83
	}
84
	else if ( line == "CustomStart" )
84
	else if ( line == L"CustomStart" )
85
		m_iPackageType = PACKAGETYPE_CUSTOMSTART;
85
		m_iPackageType = PACKAGETYPE_CUSTOMSTART;
86
	else if ( line == "PackageUpdate" )
86
	else if ( line == L"PackageUpdate" )
87
		m_iPackageType = PACKAGETYPE_UPDATE;
87
		m_iPackageType = PACKAGETYPE_UPDATE;
88
	else if ( line == "Patch" )
88
	else if ( line == L"Patch" )
89
		m_iPackageType = PACKAGETYPE_PATCH;
89
		m_iPackageType = PACKAGETYPE_PATCH;
90
	else if ( line == "ForceProfile" )
90
	else if ( line == L"ForceProfile" )
91
		m_bForceProfile = true;
91
		m_bForceProfile = true;
92
	else if ( line == "Signed" )
92
	else if ( line == L"Signed" )
93
		m_bSigned = true;
93
		m_bSigned = true;
94
	else if ( first == "ScriptType:" )
94
	else if ( first == L"ScriptType:" )
95
		m_sScriptType = rest;
95
		m_sScriptType = rest.toString();
96
	else if ( first == "ScriptTypeNew:" )
96
	else if ( first == L"ScriptTypeNew:" )
97
		m_iScriptType = rest;
97
		m_iScriptType = rest;
98
	else if ( first == "PackageType:" )
98
	else if ( first == L"PackageType:" )
99
		m_iPackageType = rest;
99
		m_iPackageType = rest;
100
	else if ( first == "Ware:" )
100
	else if ( first == L"Ware:" )
101
		AddWare ( rest );
101
		AddWare ( rest.toString() );
102
	else if ( (first == "WareText:") && (m_pLastWare) )
102
	else if ( (first == L"WareText:") && (m_pLastWare) )
103
		addWareText ( rest );
103
		addWareText ( rest );
104
	else if ( first == "Setting:" )
104
	else if ( first == L"Setting:" )
105
	{
105
	{
106
		SSettingType *t = AddSetting ( rest.token("|", 2), rest.token("|", 1) );
106
		SSettingType *t = AddSetting(rest.token(L"|", 2).toString(), rest.token(L"|", 1));
107
		ConvertSetting ( t, rest.tokens("|", 3));
107
		ConvertSetting ( t, rest.tokens(L"|", 3).toString());
108
	}
108
	}
109
	else
109
	else
110
		return CBaseFile::ParseValueLine ( line );
110
		return CBaseFile::parseValueLine ( line );
111
 
111
 
112
	return true;
112
	return true;
113
}
113
}
114
 
114
 
115
/*
115
/*
116
	Func:   CreateValuesLine
116
	Func:   CreateValuesLine
117
	Return: String - returns the full string for values
117
	Return: String - returns the full string for values
118
	Desc:   Creates a single string for all values, this is used when compressing to write to the spk file
118
	Desc:   Creates a single string for all values, this is used when compressing to write to the spk file
119
*/
119
*/
120
Utils::String CSpkFile::createValuesLine () const
120
Utils::WString CSpkFile::createValuesLine () const
121
{
121
{
122
	Utils::String values = CBaseFile::createValuesLine ();
122
	Utils::WString values = CBaseFile::createValuesLine ();
123
	// combine all values together
123
	// combine all values together
124
	if ( (!m_sOtherAuthor.empty()) && (!m_sOtherName.empty()) )
124
	if ( (!m_sOtherAuthor.empty()) && (!m_sOtherName.empty()) )
125
		values += "AnotherMod: " + m_sOtherAuthor + "|" + m_sOtherName + "\n";
125
		values += L"AnotherMod: " + m_sOtherAuthor.toWString() + L"|" + m_sOtherName.toWString() + L"\n";
126
	if ( m_bForceProfile )
126
	if ( m_bForceProfile )
127
		values += "ForceProfile\n";
127
		values += L"ForceProfile\n";
128
	if ( !m_sScriptType.empty() )
128
	if ( !m_sScriptType.empty() )
129
		values += "ScriptType: " + m_sScriptType + "\n";
129
		values += L"ScriptType: " + m_sScriptType.toWString() + L"\n";
130
	values += Utils::String("PackageType: ") + (long)m_iPackageType + "\n";
130
	values += Utils::WString(L"PackageType: ") + (long)m_iPackageType + L"\n";
131
	values += Utils::String("ScriptTypeNew: ") + (long)m_iScriptType + "\n";
131
	values += Utils::WString(L"ScriptTypeNew: ") + (long)m_iScriptType + L"\n";
132
 
132
 
133
	for ( CListNode<SSettingType> *node = m_lSettings.Front(); node; node = node->next() )
133
	for ( CListNode<SSettingType> *node = m_lSettings.Front(); node; node = node->next() )
134
		values += Utils::String("Setting: ") + (long)node->Data()->iType + "|" + node->Data()->sKey + "|&quot; + GetSetting(node->Data()) + "\n";
134
		values += Utils::WString(L"Setting: ") + (long)node->Data()->iType + L"|" + node->Data()->sKey.toWString() + L"|&quot; + GetSetting(node->Data()).toWString() + L"\n";
135
 
135
 
136
	for ( CListNode<SWares> *wNode = m_lWares.Front(); wNode; wNode = wNode->next() ) {
136
	for ( CListNode<SWares> *wNode = m_lWares.Front(); wNode; wNode = wNode->next() ) {
137
		SWares *ware = wNode->Data();
137
		SWares *ware = wNode->Data();
138
		if ( wNode->Data()->iTextID > 0 )
138
		if ( wNode->Data()->iTextID > 0 )
139
			values += Utils::String("Ware: ") + Utils::WString(ware->cType).toString() + ":" + ware->iPrice + ":" + (long)ware->iSize + ":" + (long)ware->iVolumn + ":"; + ware->sID.toString() + ":" + (long)ware->iNotority + ":" + (long)ware->iTextID + "," + (long)ware->iTextPage + "\n";
139
			values += Utils::WString(L"Ware: ") + Utils::WString(ware->cType) + L":" + ware->iPrice + L":" + (long)ware->iSize + L":" + (long)ware->iVolumn + L":"; + ware->sID + L":" + (long)ware->iNotority + L":" + (long)ware->iTextID + L"," + (long)ware->iTextPage + L"\n";
140
		else
140
		else
141
			values += Utils::String("Ware: ") + Utils::WString(ware->cType).toString() + ":" + ware->iPrice + ":" + (long)ware->iSize + ":" + (long)ware->iVolumn + ":"; + ware->sID.toString() + ":" + (long)ware->iNotority + "\n";
141
			values += Utils::WString(L"Ware: ") + Utils::WString(ware->cType) + L":" + ware->iPrice + L":" + (long)ware->iSize + ":" + (long)ware->iVolumn + L":"; + ware->sID + L":" + (long)ware->iNotority + L"\n";
142
		for ( CListNode<SWaresText> *wtNode = ware->lText.Front(); wtNode; wtNode = wtNode->next() )
142
		for ( CListNode<SWaresText> *wtNode = ware->lText.Front(); wtNode; wtNode = wtNode->next() )
143
			values += Utils::String("WareText: ") + (long)wtNode->Data()->iLang + " " + wtNode->Data()->sName.toString() + "|" + wtNode->;Data()->sDesc.toString() + "\n";
143
			values += Utils::WString(L"WareText: ") + (long)wtNode->Data()->iLang + L" " + wtNode->Data()->sName + L"|" + wtNode->;Data()->sDesc + L"\n";
144
	}
144
	}
145
 
145
 
146
	return values;
146
	return values;
147
}
147
}
148
 
148