Example #1
0
bool CIwGameAds::ExtractAdMillennialMedia(CIwGameAd& ad, CIwGameString& ad_body)
{
	ad.isHtml = false;
	ad.isText = false;
	ad.ImageURI = "";
	ad.LinkURI = "";
	ad.Text = "";
	ad.AdTime = s3eTimerGetMs();

	ExtractLinkAndImageFromtHTML(ad, ad_body);

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

	return true;
}
Example #2
0
bool CzAds::ExtractAdMillennialMedia(CzAd& ad, CzString& ad_body)
{
	ad.isHtml = false;
	ad.isText = false;
	ad.ImageURI = "";
	ad.LinkURI = "";
	ad.Text = "";
	ad.AdTime = PLATFORM_SYS->getTimeInMs();

	ExtractLinkAndImageFromtHTML(ad, ad_body);

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

	return true;
}
Example #3
0
bool CIwGameAds::ExtractAdVServ(CIwGameAd& ad, CIwGameString& ad_body)
{
	// We dont use a full on XML parser to parse the returned XML, instead we just search for the required info
	int pos;

	ad.isHtml = false;
	ad.isText = false;
	ad.ImageURI = "";
	ad.LinkURI = "";
	ad.Text = "";
	ad.AdTime = s3eTimerGetMs();

	ad_body.FindReset();

	// Find render section
	if (ad_body.FindNext("\"action\"") < 0)
	{
		ad_body.FindReset();
		ExtractLinkAndImageFromtHTML(ad, ad_body);

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

		return true;
	}

	// Find click URL
	pos = ad_body.GetNextMarkedStringAfterString("\"data\"", '"', '"', ad.LinkURI);
	if (pos >= 0)
	{
#if defined(_DEBUG)
		CIwGameError::LogError("Info: Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;

	// Find render section
	if (ad_body.FindNext("\"render\"") < 0)
	{
		return false;
	}

	// Find Image URL
	pos = ad_body.GetNextMarkedStringAfterString("\"data\"", '"', '"', ad.ImageURI);
	if (pos > 0)
	{
#if defined(_DEBUG)
		CIwGameError::LogError("Info: Ad Image URL: ", ad.ImageURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;

/*	// Find click URL
	pos = ad_body.GetNextMarkedStringAfterString("\"notify\"", '"', '"', ad.LinkURI);
	if (pos >= 0)
	{
#if defined(_DEBUG)
		CIwGameError::LogError("Info: Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;(*/

	return true;
}
Example #4
0
bool CIwGameAds::ExtractAdMobFox(CIwGameAd& ad, CIwGameString& ad_body)
{
	// We dont use a full on XML parser to parse the returned XML, instead we just search for the required info
	int pos, offset, len;

	ad.isHtml = false;
	ad.isText = false;
	ad.ImageURI = "";
	ad.LinkURI = "";
	ad.Text = "";
	ad.AdTime = s3eTimerGetMs();

	// Get Error Response
	ad_body.FindReset();
	pos = ad_body.FindNext("<request type=");
	if (pos >= 0)
	{
		len = ad_body.GetNextMarkedString('"', '"', offset);
		if (len > 0)
		{
			ErrorString.setString(ad_body.getString() + offset, len);
			if (ErrorString == "noAd")
			{
				Error = ErrorNoAd;
				return false;
			}
			else
				Error = ErrorNone;
			if (ErrorString == "textAd")
			{
				ad.isHtml = true;
				ad.isText = true;
			}
		}
	}

	// Get Ad text
	pos = ad_body.FindNext("<htmlString>");
	if (pos >= 0)
	{
		// Find closeing tag
		int end_pos = ad_body.FindNext("</htmlString>");
		if (end_pos > 0)
		{
			ad.Text.setString(ad_body.getString() + pos, end_pos - pos);
			ad.Text.ReplaceHTMLCodes();
#if defined(_DEBUG)
			CIwGameError::LogError("Info: Ad Text: ", ad.Text.c_str());
#endif	// _DEBUG
		}
		// If we can successfully extract the link and banner information from the text ad then unmark the ad as html/text
		if (ExtractLinkAndImageFromtHTML(ad, ad.Text))
		{
			ad.isHtml = false;
			ad.isText = false;
			return true;
		}
	}
	else
		ad_body.FindReset();

	// Get Ad link
	pos = ad_body.FindNext("<clickurl");
	if (pos >= 0)
	{
		len = ad_body.GetNextMarkedString('>', '<', offset);
		if (len > 0)
		{
			ad.LinkURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
			CIwGameError::LogError("Info: Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
		}
	}

	// Get Ad image
	pos = ad_body.FindNext("<imageurl");
	if (pos >= 0)
	{
		len = ad_body.GetNextMarkedString('>', '<', offset);
		if (len > 0)
		{
			ad.ImageURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
			CIwGameError::LogError("Info: Ad Image URL: ", ad.ImageURI.c_str());
#endif	// _DEBUG
		}
	}

	return true;
}
Example #5
0
bool CzAds::ExtractAdVServ(CzAd& ad, CzString& ad_body)
{
	// We dont use a full on XML parser to parse the returned XML, instead we just search for the required info
	int pos;

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

	ad_body.FindReset();

	// Find render section
	if (ad_body.FindNext("\"action\"") < 0)
	{
		ad_body.FindReset();
		ExtractLinkAndImageFromtHTML(ad, ad_body);

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

		return true;
	}

	// Find click URL
	pos = ad_body.GetNextMarkedStringAfterString("\"data\"", '"', '"', ad.LinkURI);
	if (pos >= 0)
	{
#if defined(_DEBUG)
		CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;

	// Find render section
	if (ad_body.FindNext("\"render\"") < 0)
	{
		return false;
	}

	// Find Image URL
	pos = ad_body.GetNextMarkedStringAfterString("\"data\"", '"', '"', ad.ImageURI);
	if (pos > 0)
	{
#if defined(_DEBUG)
		CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Ad Image URL: ", ad.ImageURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;

/*	// Find click URL
	pos = ad_body.GetNextMarkedStringAfterString("\"notify\"", '"', '"', ad.LinkURI);
	if (pos >= 0)
	{
#if defined(_DEBUG)
		CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Ad Click URL: ", ad.LinkURI.c_str());
#endif	// _DEBUG
	}
	else
		return false;(*/

	return true;
}