Esempio n. 1
0
//
//
//
//	AdFonic specific implementation
//
//
//
bool CzAds::RequestAdAdFonic()
{
	// Get device surface dimensions
	Width = PLATFORM_DISPLAY->getCurrentWidth();
	Height = PLATFORM_DISPLAY->getCurrentHeight();

	CzString urlencoded;

	RequestURI = "http://adfonic.net/ad/";
	RequestURI += ApplicationID;
	RequestURI += "?";
	RequestURI += "r.id=";
	urlencoded.URLEncode(CzString(UDID).c_str());
	RequestURI += urlencoded;
	RequestURI += "&s.test=0";
	RequestURI += "&t.format=xml";
	if (!ExtraInfo.isEmpty())
	{
		RequestURI += ExtraInfo;
	}

	AdRequest.setGET();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.setBody("");
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 2
0
void CzUIWebView::setHtml(const char* html)
{
	if (html == NULL)
		return;

	CzString h = html;
	h.URLDecode();

	printf("****************************************\n");
	printf("%sn", h.c_str());
	printf("****************************************\n");

	if (!TempFilename.isEmpty())
	{
		CzFile::DeleteFile(TempFilename.c_str());
	}
	TempFilename = "ram://web_view_";
	TempFilename += Name;
//	TempFilename += CzString((int)(PLATFORM_SYS->getTimeUTC() & 0xffffffff));	// Ensure filename is unique
	TempFilename += ".html";
	CzFile file;
	if (file.Open(TempFilename.c_str(), "wb"))
	{
		file.Write((void*)h.c_str(), h.getLength());
		file.Close();
	}
	PLATFORM_UI->NavigateWebView(WebView, TempFilename.c_str());
}
Esempio n. 3
0
bool CzString::SplitVarIndex(CzString& var, int& index, CzString& vindex)
{
	char* pData = Data;
	index = -1;

	FindReset();

	// Split string at colon char and return value after colon
	for (int t = 0; t < Length; t++)
	{
		if (*pData++ == ':')
		{
			var.setString(Data, t);
			vindex.Copy(pData, 0, Length - t - 1);
			if (CzString::IsNumber(*pData))
				index = vindex.getAsInt();
			return true;
		}
	}

	// No split found so just copy this string to output
	var = *this;

	return true;
}
Esempio n. 4
0
void CzString::set(const CzVec2& v)
{
	FindIndex = 0;
	CzString s = v.x;
	s += ",";
	s += v.y;
	setString(s.c_str());
}
Esempio n. 5
0
void CzString::set(const CzVec4& v)
{
	CzString s = v.x;
	s += ",";
	s += v.y;
	s += ",";
	s += v.z;
	s += ",";
	s += v.w;
	setString(s.c_str());
}
Esempio n. 6
0
void CzString::set(const CzColour& v)
{
	CzString s = v.r;
	s += ",";
	s += v.g;
	s += ",";
	s += v.b;
	s += ",";
	s += v.a;
	setString(s.c_str());
}
Esempio n. 7
0
int CzXomlLoad::LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node)
{
	CzScene* scene = NULL;
	if (parent->getClassTypeHash() == CzHashes::Scene_Hash)
		scene = (CzScene*)parent;

	CzString* file = NULL;
	CzString* condition = NULL;

	// Process LoadXoml specific attributes
	for (CzXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CzHashes::File_Hash)
			file = &(*it)->getValue();
		else
		if (name_hash == CzHashes::Condition_Hash)
			condition = &(*it)->getValue();
	}

	if (condition != NULL)
	{
		// Find the condition variable
		bool condition_not = false;
		CzXomlVariable* var = NULL;
		if (*(condition->c_str()) == '!')
		{
			condition_not = true;
			CzString cond = condition->c_str() + 1;
			var = CzXomlVariable::GetVariable(cond, scene);
		}
		else
			var = CzXomlVariable::GetVariable(*condition, scene);
		if (var != NULL)
		{
			bool res = var->isTrue();
			if (condition_not)
				res = !res;
			if (!res)
				return -1;
		}
#if defined (_DEBUG)
		else
			CzDebug::Log(CZ_DEBUG_CHANNEL_WARNING, "LoadXOML - Condition variable not found - ", condition->c_str(), DebugInfo.c_str());
#endif // _DEBUG
	}


	if (file != NULL)
		CZ_XOML->Process(parent, file->c_str(), false);

	return -1;
}
Esempio n. 8
0
void CzXmlParser::ShowError(eCzXmlParseError error, int pos) const
{
#ifdef SHOW_ERRORS
	CzString out;
	out += getErrorString(error);
	out += " around line ";
//	out += CzString(m_pDataInput->GetLineNumber(pos));
	out += CzString(pos + 1);
	CzDebug::Log(CZ_DEBUG_CHANNEL_ERROR, out.c_str());
#endif
}
Esempio n. 9
0
bool CzDataInput::getNextQuotedStringAsint(int *pNum)
{
	CzString num;

	if (getNextQuotedString(&num))
	{
		*pNum = num.getAsInt();
		return true;
	}

	return false;
}
Esempio n. 10
0
bool CzCamera::_setName(IzXomlResource* target, const CzXomlProperty& prop, bool add)
{
	if (add)
	{
		CzString name = ((CzCamera*)target)->getName();
		name += (const char*)prop.p_data;
		((CzCamera*)target)->setName(name.c_str());
	}
	else
		((CzCamera*)target)->setName((const char*)prop.p_data);

	return true;
}
Esempio n. 11
0
//
//
//
//	VServ specific implementation
//
//
//
bool CzAds::RequestAdVServ()
{
	// Get device surface dimensions
	Width = PLATFORM_DISPLAY->getCurrentWidth();
	Height = PLATFORM_DISPLAY->getCurrentHeight();

	// Build M2M request URI string
	RequestURI = "http://a.vserv.mobi/delivery/adapi.php?";
	CzString urlencoded;

	RequestURI += "zoneid=";
	RequestURI += ApplicationID;
	RequestURI += "&im=";
	RequestURI += CzString(UDID);
	RequestURI += "&lc=";
	RequestURI += PLATFORM_SYS->getDeviceLocale();
	RequestURI += "&app=1";
	RequestURI += "&ts=1";
	RequestURI += "&ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	RequestURI += urlencoded;
	if (Width != 0)
	{
		RequestURI += "&sw=";
		RequestURI += CzString(Width);
	}
	if (Height != 0)
	{
		RequestURI += "&sh=";
		RequestURI += CzString(Height);
	}
	if (!ExtraInfo.isEmpty())
	{
		RequestURI += ExtraInfo;
	}

	AdRequest.setGET();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Accept", "application/xml");
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", "0");
	AdRequest.setBody("");
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 12
0
bool CzUITextBox::_setVariable(IzXomlResource* target, const CzXomlProperty& prop, bool add)
{
	CzUITextBox* actor = (CzUITextBox*)target;

	if (add)
	{
		CzString s = actor->getTargetVariable();
		s += (const char*)prop.p_data;
		actor->setTargetVariable(s.c_str());

	}
	else
		actor->setTargetVariable((const char*)prop.p_data);

	return true;
}
Esempio n. 13
0
//
//
//
//	MillennialMedia specific implementation
//
//
//
bool CzAds::RequestAdMillennialMedia()
{
	// Build M2M request URI string
	RequestURI = "http://ads.mp.mydas.mobi/getAd.php5?";
	CzString urlencoded;

	RequestURI += "apid=";
	RequestURI += ApplicationID;
	RequestURI += "&auid=";
	RequestURI += CzString(UDID);
	RequestURI += "&ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	RequestURI += urlencoded;
//	RequestURI += "&mode=test";
//	RequestURI += "&uip=";
//	RequestURI += CZ_HTTP_MANAGER->getIPAddress();

	if (UserAge != 0)
	{
		RequestURI += "&age=";
		RequestURI += CzString(UserAge);
	}
	if (UserGender != GenderInvalid)
	{
		if (UserGender == GenderFemale)
			RequestURI += "&gender=female";
		else
			RequestURI += "&gender=male";
	}
	if (!ExtraInfo.isEmpty())
	{
		RequestURI += ExtraInfo;
	}

	AdRequest.setGET();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Accept", "application/xml");
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", "0");
	AdRequest.setBody("");
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 14
0
bool CzString::operator==	(const CzString &op)
{
	if (Data == NULL)
		return false;

	if (AutoHash && op.isAutohash())
	{
		if (DataHash == op.getHash())
			return true;
	}
	else
	{
		if (strcmp(op.c_str(), Data) == 0)
			return true;
	}
	return false;
}
Esempio n. 15
0
int CzXmlNode::SaveAttributes(CzFile* file)
{
	for (CzXmlAttributeList::iterator i = Attributes.begin(); i != Attributes.end(); ++i)
	{
		CzString out;
		out.allocString(512);
		out = " ";
		out += (*i)->Name.c_str();
		out += "=\"";
		out += (*i)->Value.c_str();
		out += "\"";
		if (!file->Write((void*)out.c_str(), out.getLength()))
			return -1;
	}

	return 0;
}
Esempio n. 16
0
void CzString::Split(char split_char, CzSlotArray<CzString*>* strings)
{
	char* pData = Data;

	FindReset();
	strings->clear();
	int start = 0, len = 0;
	for (int t = 0; t < Length + 1; t++)
	{
		char c = *pData++;
		if (c == split_char || c == 0)
		{
			CzString* s = new CzString();
			s->setString(Data + start, t - start);
			start = t + 1;
			strings->add(s);
		}
	}
}
Esempio n. 17
0
bool CzString::SplitFilename(CzString& filename, CzString& ext)
{
	int index = 0;
	
	// Find the dot
	for (int t = getLength() - 1; t != 0; t--)
	{
		if (*(Data + t) == '.')
		{
			index = t;
			break;
		}
	}
	if (index == 0) return false;
	
	filename.Copy(Data, 0, index);
	ext.Copy(Data, index + 1, getLength() - index - 1);
	
	return true;
}
Esempio n. 18
0
CzString::CzString(const CzString &string)
{
	FindIndex = 0;
	Data = NULL;
	Length = 0;
	Size = 0;
	AutoHash = true;
	if (string.c_str() == NULL)
		return;
	else
	{
		int len = (int)strlen(string.c_str());
		allocString(len);
		Length = len;
		memcpy(Data, string.c_str(), Length + 1);

		if (AutoHash)
			DataHash = CzString::CalculateHash(Data);
	}
}
Esempio n. 19
0
CzStringList* CzXmlAttribute::getValueAsList()
{
	CzStringList* pList = new CzStringList;
	
	// Separate Value by commas
	int			len = Value.getLength();
	const char* text = Value.c_str();
	char		c;
	
	while ((c = *text) != 0)
	{
		// Find a none white space
		if (c != ' ' && c != '\t' && c != '\n' && c != ',')
		{
			int count = 0;
			const char* found = text;
			
			// Find end of string
			while (count++ < 63)
			{
				c = *text;
				if (c == '\n' || c == ',' || c == 0)
					break;
				text++;
			}
			int len = text - found;
			if (len > 0)
			{
				CzString *pString = new CzString();
				pString->Copy((char*)found, 0, len);
			
				pList->push_back(pString);
			}
			if (c == 0) break;
		}
		text++;
	}

	return pList;
}
Esempio n. 20
0
bool CzUIImageView::InitView(IzBrush* brush, int width, int height, bool native_res, float min_scale, float max_scale)
{
	Icon = new CzUIIcon();
	Scene->addActor(Icon);
	Icon->setLinkedTo(this);
	Icon->setTappable(false);

	Icon->Init(brush, width, height);
	Icon->setDepth(0);
#if defined(_DEBUG)
	CzString name = Name;
	name += "Icon";
	Icon->setName(name.c_str());
#endif	// _DEBUG

	Area = Icon->getSize();

	MinZoom = min_scale;
	MaxZoom = max_scale;

	return true;
}
Esempio n. 21
0
bool CzString::SplitPropVarIndex(CzString& prop, CzString& var, int& index, CzString& vindex)
{
	char* pData = Data;
	index = -1;

	FindReset();

	// Get property
	int pos = StepFindIndexNoneWhiteSpace();
	if (pos < 0)
		return false;
	int start_pos = 0;
	int len = GetNextMarkedString('[', ']', start_pos);
	if (len >= 0)
		prop.setString(Data + start_pos, len);
	if (StepFindIndex(1) == Length)
		return false;

	// Split string at colon char and return value after colon
	pData += FindIndex;
	for (int t = 0; t < Length - FindIndex; t++)
	{
		if (*pData++ == ':')
		{
			var.setString(Data + FindIndex, t);
			vindex.Copy(pData, 0, Length - t - 1);
			if (CzString::IsNumber(*pData))
				index = vindex.getAsInt();

			return true;
		}
	}

	// No split found so just copy out the var
	var.setString(Data + FindIndex, Length - FindIndex);

	return true;
}
Esempio n. 22
0
void CzXmlNode::UpdateAttribute(const CzString& name, const char* value, CzXmlParser* parser)
{
	CzXmlAttribute* old_attribute = getAttribute(name.c_str());

	if (old_attribute == NULL)
	{
		// Attribute was not present so add
		CzXmlAttribute* attribute;
		if (parser != NULL)
			attribute = parser->AllocAttribute();
		else
			attribute = new CzXmlAttribute();
		attribute->setName((char*)name.c_str(), name.getLength());
		attribute->setValue((char*)value, strlen(value));
		Attributes.push_back(attribute);
	}
	else
	{
		// Attribute was present so update it
		old_attribute->setName((char*)name.c_str(), name.getLength());
		old_attribute->setValue((char*)value, strlen(value));
	}
}
Esempio n. 23
0
//
//
//
//	KomliMobile specific implementation
//
//
//
bool CzAds::RequestAdKomliMobile()
{
	// Get device surface dimensions
	Width = PLATFORM_DISPLAY->getCurrentWidth();
	Height = PLATFORM_DISPLAY->getCurrentHeight();

	// Build M2M request URI string
	RequestURI = "http://a.zestadz.com/waphandler/deliverad?";
	CzString urlencoded;

	RequestURI += "ip=";
	RequestURI += CZ_HTTP_MANAGER->getIPAddress();
	RequestURI += "&cid=";
	RequestURI += ApplicationID;
	RequestURI += "&ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	RequestURI += urlencoded;
	RequestURI += "&response_type=xml";
//	RequestURI += CzString(UDID);
	if (!ExtraInfo.isEmpty())
	{
		RequestURI += ExtraInfo;
	}

	AdRequest.setGET();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Accept", "application/xml");
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", "0");
	AdRequest.setBody("");
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 24
0
void CzApp::UpdateSystemTouches()
{
	CzXomlVariableArrayInt* arr = (CzXomlVariableArrayInt*)CZ_GLOBAL_RESOURCES->getVariableManager()->findVariable("touches");

	// Update system array
	int count = 1;
	if (CZ_INPUT->isMultiTouch())
		count = 5;
	CzString num;
	num.setAutoHash(false);
	int index = 0;
	for (int t = 0; t < 5; t++)
	{
		CzXomlVariableInt* var = (CzXomlVariableInt*)arr->getElement(index++);
		CzTouch* touch = CZ_INPUT->getTouch(t);
		if (touch->x != var->NativeValue)
		{
			var->NativeValue = touch->x;
			num = var->NativeValue;
			var->setValueText(num.c_str());
		}
		var = (CzXomlVariableInt*)arr->getElement(index++);
		if (touch->y != var->NativeValue)
		{
			var->NativeValue = touch->y;
			num = var->NativeValue;
			var->setValueText(num.c_str());
		}
		var = (CzXomlVariableInt*)arr->getElement(index++);
		if ((int)touch->touched != var->NativeValue)
		{
			var->NativeValue = (int)touch->touched;
			num = var->NativeValue;
			var->setValueText(num.c_str());
		}
	}
}
Esempio n. 25
0
//
//
//
//	MobFox specific implementation
//
//
//
bool CzAds::RequestAdMobFox()
{
	// Build request URI string
	RequestURI = "http://my.mobfox.com/request.php";

	CzString body;
	CzString urlencoded;

	body = "rt=api";
	body += "&u=";
	urlencoded.URLEncode(UserAgent.c_str());
	body += urlencoded;
	body += "&i=";
	body += CZ_HTTP_MANAGER->getIPAddress();
	body += "&o=";
	body += CzString(UDID);
	body += "&m=live";
	body += "&s=";
	body += ApplicationID;
	if (!ExtraInfo.isEmpty())
	{
		body += ExtraInfo;
	}

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CzString(body.getLength()).c_str());
	AdRequest.setBody(body.c_str());
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 26
0
//
//
//
//	AdModa specific implementation
//
//
//
bool CzAds::RequestAdAdModa()
{
	// Get device surface dimensions
	Width = PLATFORM_DISPLAY->getCurrentWidth();
	Height = PLATFORM_DISPLAY->getCurrentHeight();

	// Build M2M request URI string
	RequestURI = "http://www.admoda.com/ads/fetch.php?";
	CzString urlencoded;

	RequestURI += "v=4";
	RequestURI += "&l=php";
	RequestURI += "&z=";
	RequestURI += ApplicationID;
//	RequestURI += "&a=";
//	RequestURI += CZ_HTTP_MANAGER->getIPAddress();
	RequestURI += "&ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	RequestURI += urlencoded;
	if (!ExtraInfo.isEmpty())
	{
		RequestURI += ExtraInfo;
	}

	AdRequest.setGET();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", "0");
	AdRequest.setBody("");
	CZ_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(CZ_ADS_TIMEOUT);

	return true;
}
Esempio n. 27
0
int CzString::GetNextMarkedStringAfterString(const char* search_string, char start_mark, char end_mark, CzString& out_string)
{
	int pos = FindNext(search_string);
	if (pos >= 0)
	{
		// Get the text label
		int offset;
		StepFindIndex(strlen(search_string));
		int len = GetNextMarkedString(start_mark, end_mark, offset);
		if (len > 0)
		{
			out_string.setString(getString() + offset, len);
			return pos;
		}
		
		return -1;
	}

	return -1;
}
Esempio n. 28
0
//
//
// Common functions
//
//
bool LUA_ValueToString(lua_State *lua, int stack_index, CzString &string)
{
    if (lua_isnumber(lua, stack_index))
	{
        float n = (float)lua_tonumber(lua, stack_index);
		int in = (int)n;
		if (n == in)
			string = in;
		else
			string = n;
	}
	else
    if (lua_isboolean(lua, stack_index))
        string = lua_toboolean(lua, stack_index) != 0;
	else
    if (lua_isvec(lua, stack_index))
	{
        const float* v = lua_tovec(lua, stack_index);
		string = *v++;
		string += ",";
		string += *v++;
		string += ",";
		string += *v++;
		string += ",";
		string += *v;
	}
	else
    if (lua_isstring(lua, stack_index))
        string = lua_tostring(lua, stack_index);
	else
		return false;

	if (string.c_str() == NULL)
		return false;

	return true;
}
Esempio n. 29
0
bool CzAds::ExtractAdAdModa(CzAd& ad, CzString& ad_body)
{
	int len, offset;

	ad.isHtml = false;
	ad.isText = false;
	ad.ImageURI = "";
	ad.LinkURI = "";
	ad.Text = "";
	ad.AdTime = PLATFORM_SYS->getTimeInMs();

	ad_body.FindReset();

	// Get Ad image
	len = ad_body.GetNextMarkedString('|', '|', offset);
	if (len > 0)
	{
		ad.ImageURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
		CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Ad Image: ", ad.ImageURI.c_str());
#endif	// _DEBUG
	}
	ad_body.StepFindIndex(-1);

	// Get Ad link
	len = ad_body.GetNextMarkedString('|', '|', offset);
	if (len > 1)
	{
		ad.LinkURI.setString(ad_body.getString() + offset, len - 1);
#if defined(_DEBUG)
		CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
	}


	if (ad.ImageURI.isEmpty() || ad.LinkURI.isEmpty())
		return false;

	return true;
}
Esempio n. 30
0
int CzXmlNode::SaveTree(CzFile* file, int level)
{
	int err = 0;

	CzString out;
	out.allocString(256);

	for (int t = 0; t < level; t++)
		out += "\t";
	out += "<";
	out += Name;
	if (!file->Write((void*)out.c_str(), out.getLength()))
		return -1;

	err = SaveAttributes(file);
	if (err < 0)
		return err;
	if (HasValue)
	{
		if (Value.getLength() == 0)
			out = " />\n";
		else
		{
			out = ">";
			out += Value.c_str();
		}
		out += "</";
		out += Name.c_str();
		out += ">\n";
		if (!file->Write((void*)out.c_str(), out.getLength()))
			return -1;
	}
	else
	{
		if (Children.size() == 0)
		{
			out = " />\n";
			if (!file->Write((void*)out.c_str(), out.getLength()))
				return -1;
		}
		else
		{
			out = ">\n";
			if (!file->Write((void*)out.c_str(), out.getLength()))
				return -1;
			for (CzXmlNodeList::iterator i = Children.begin(); i != Children.end(); ++i)
			{
				err = (*i)->SaveTree(file, level + 1);
				if (err < 0)
					return err;
			}
			for (int t = 0; t < level; t++)
			{
				out = "\t";
				if (!file->Write((void*)out.c_str(), out.getLength()))
					return -1;
			}
			out = "</";
			out += Name.c_str();
			out += ">\n";
			if (!file->Write((void*)out.c_str(), out.getLength()))
				return -1;
		}
	}

	return 0;
}