Пример #1
0
void XMLFileRead()
{
	CMarkup xml;
	xml.Load(L"ServerConnection.xml");

	while (xml.FindChildElem(L"SERVER"))
	{
		_ConnectorInfo connectorInfo;
		xml.IntoElem();

		xml.FindChildElem(L"IP");
		connectorInfo.szIP = xml.GetChildData();

		xml.FindChildElem(L"PORT");
		connectorInfo.port = _ttoi(xml.GetChildData().c_str());

		xml.FindChildElem(L"IDENTIFER");
		connectorInfo.identifier = _ttoi(xml.GetChildData().c_str());

		xml.FindChildElem(L"DESC");
		connectorInfo.szDesc = xml.GetChildData();

		xml.OutOfElem();
	}

}
Пример #2
0
bool SFServerConnectionManager::InitServerList(WCHAR* szFileName)
{
	CMarkup xml;
	xml.Load(L"ServerConnection.xml");

	while (xml.FindChildElem(L"SERVER"))
	{
		_ServerInfo serverInfo;
		xml.IntoElem();

		xml.FindChildElem(L"IP");
		serverInfo.szIP = xml.GetChildData();

		xml.FindChildElem(L"PORT");
		serverInfo.port = _ttoi(xml.GetChildData().c_str());

		xml.FindChildElem(L"IDENTIFER");
		serverInfo.identifer = _ttoi(xml.GetChildData().c_str());

		xml.FindChildElem(L"DESC");
		serverInfo.szDesc = xml.GetChildData();

		xml.OutOfElem();

		SFServerBridge* pServer = new SFServerBridge(serverInfo);

		m_mapServerInfo.insert(std::make_pair(serverInfo.identifer, pServer));
	}

	return true;
}
Пример #3
0
void CDlgLianHaoLanQiu::OnBnClickedJingxuanBtn()
{
	CMarkup Xml;
	CString FormulaName=GetAppCurrentPath()+"FormulaNameList.xml";
	Xml.Load(FormulaName.GetBuffer());
	FormulaName.ReleaseBuffer();

	vector<CString> NameList;

	while(Xml.FindChildElem("FormulaInfo"))
	{
		Xml.IntoElem();
		Xml.FindChildElem("FormulaName");
		CString Name=Xml.GetChildData().c_str();

		Xml.FindChildElem("FormulaType");
		CString StrType=Xml.GetChildData().c_str();
		
		int Type = atoi(StrType.GetBuffer());
		StrType.ReleaseBuffer();

		if(Type == m_FormulaType && !Name.IsEmpty())
			NameList.push_back(Name);
			
		Xml.OutOfElem();
	}

	if(NameList.empty())
	{
		m_FormulaInfoList=CFormulaCenter::GetInstance()->GetFormulaInfoByType(m_FormulaType);
	}
	else
		m_FormulaInfoList=CFormulaCenter::GetInstance()->GetFormulaInfoByName(m_FormulaType,NameList);

	m_CurrentIndex=0;
	FillData(m_FormulaInfoList);
	UpdateBtnStatus();
}
Пример #4
0
//del device
void CDeviceEditDlg::DeleteDevice()
{
	HTREEITEM hItem = m_deviceTree.GetSelectedItem();
	
	if ( hItem == NULL )
	{
		return;
	}
	
	DEV_INFO *pDev = (DEV_INFO *)m_deviceTree.GetItemData(hItem);
	if ( pDev )
	{
		if ( pDev->lLoginID > 0 )
		{
			H264_DVR_Logout(pDev->lLoginID);
		}
		
		Devc_Map::iterator bIter = m_devMap.find( pDev->lID );
		if ( bIter != m_devMap.end() )
		{
			m_devMap.erase(bIter);
		}
		m_deviceTree.DeleteItem(hItem);
		CMarkup xml;
		if (xml.Load(GET_MODULE_FILE_INFO.strPath + "UserInfo.xml"))
		{
			while(xml.FindChildElem("ip"))
			{
				xml.IntoElem();
				xml.FindChildElem("ip2");
				if(xml.GetChildData()==pDev->szIpaddress)
				{
					xml.RemoveElem();
					xml.Save(GET_MODULE_FILE_INFO.strPath + "UserInfo.xml");
				}
				xml.OutOfElem();
			}
			
		}
		delete pDev;
		pDev = NULL;
	}	
}
Пример #5
0
DEV_INFO CDeviceEditDlg::ReadXML()
{
	CMarkup xml;
	DEV_INFO devInfo;
	
	devInfo.nPort=0;
	devInfo.lLoginID=0;
	devInfo.lID=0;
	
	if(xml.Load(GET_MODULE_FILE_INFO.strPath + "UserInfo.xml"))
	{
		while(xml.FindChildElem("ip"))
		{
			//read the information from XML
			CString strIP="",strUserName="",strPsw="",strDevName="";
			UINT nPort;
			long byChanNum=0,lID=0;

			UINT bSerialID,nSerPort;
			CString szSerIP="",szSerialInfo="";			
			xml.IntoElem();		

			xml.FindChildElem("ip2");
			strIP=xml.GetChildData();
			xml.FindChildElem("DEVICENAME");
			strDevName=xml.GetChildData();
			xml.FindChildElem("username");
			strUserName=xml.GetChildData();
			xml.FindChildElem("port");
			nPort=atoi(xml.GetChildData());
			xml.FindChildElem("pwd");
			strPsw=xml.GetChildData();
			xml.FindChildElem("byChanNum");
			byChanNum=atoi(xml.GetChildData());
			xml.FindChildElem("lID");
			lID=atoi(xml.GetChildData());

			xml.FindChildElem("bSerialID");
			bSerialID=atoi(xml.GetChildData());
			xml.FindChildElem("szSerIP");
			szSerIP=xml.GetChildData();
			xml.FindChildElem("nSerPort");
			nSerPort=atoi(xml.GetChildData());
			xml.FindChildElem("szSerialInfo");
			szSerialInfo=xml.GetChildData();//新增ddns记录
			xml.OutOfElem();
			devInfo.nTotalChannel =byChanNum;
			devInfo.nPort = nPort;

			devInfo.bSerialID=bSerialID;		
			devInfo.nSerPort=nSerPort;
			strcpy(devInfo.szSerIP,szSerIP.GetBuffer(0));		
			strcpy(devInfo.szSerialInfo, szSerialInfo.GetBuffer(0));//新增ddns记录		
			strcpy(devInfo.szDevName, strDevName);
			strcpy(devInfo.szUserName, strUserName);
			strcpy(devInfo.szPsw, strPsw);
			strcpy(devInfo.szIpaddress, strIP);
			DEV_INFO *pDev = new DEV_INFO;
			memset( pDev, 0, sizeof(DEV_INFO) );
			memcpy( pDev, &devInfo, sizeof(DEV_INFO) );
			pDev->lID = (long)pDev;
			m_devMap[pDev->lID] = pDev;
			HTREEITEM hAddItem = m_deviceTree.InsertItem(strDevName);
			m_deviceTree.SetItemData(hAddItem, (DWORD)pDev);
			CString strName("");
			for ( int i = 0; i < byChanNum; i ++)
			{
				strName.Format("CAM %d", i+1);
				HTREEITEM item = m_deviceTree.InsertItem(strName, 0, 0, hAddItem);
				m_deviceTree.SetItemData(item, i);
			}
		}
	}
	return devInfo;
}
Пример #6
0
CreatureType::CreatureType(const std::string& xmlstring)
    : age_(18,57), alignment_public_mood_(true),
      attribute_points_(40),
      gender_liberal_(GENDER_RANDOM), gender_conservative_(GENDER_RANDOM),
      infiltration_(0), juice_(0), money_(20,40)
{
    for(int i=0; i<ATTNUM; i++)
        attributes_[i].set_interval(1,10);

    id_=number_of_creaturetypes++;

    CMarkup xml;
    xml.SetDoc(xmlstring);
    xml.FindElem();

    idname_=xml.GetAttrib("idname");
    if(!len(idname_))
    {
        idname_ = "LACKS IDNAME "+tostring(id_);
        xmllog.log("Creature type "+tostring(id_)+" lacks idname.");
    }
    type_=creaturetype_string_to_enum(idname_);

    xml.IntoElem();
    // Loop over all the elements inside the creaturetype element.
    while(xml.FindElem())
    {
        std::string element = xml.GetTagName();

        if (element == "alignment")
        {
            std::string alignment = xml.GetData();
            if (alignment == "PUBLIC MOOD")
                alignment_public_mood_ = true;
            else if (alignment == "LIBERAL")
            {
                alignment_ = ALIGN_LIBERAL;
                alignment_public_mood_ = false;
            }
            else if (alignment == "MODERATE")
            {
                alignment_ = ALIGN_MODERATE;
                alignment_public_mood_ = false;
            }
            else if (alignment == "CONSERVATIVE")
            {
                alignment_ = ALIGN_CONSERVATIVE;
                alignment_public_mood_ = false;
            }
            else
                xmllog.log("Invalid alignment for " + idname_ + ": " + alignment);
        }
        else if (element == "age")
        {
            std::string age = xml.GetData();
            if (age == "DOGYEARS")
                age_.set_interval(2,6);
            else if (age == "CHILD")
                age_.set_interval(7,10);
            else if (age == "TEENAGER")
                age_.set_interval(14,17);
            else if (age == "YOUNGADULT")
                age_.set_interval(18,35);
            else if (age == "MATURE")
                age_.set_interval(20,59);
            else if (age == "GRADUATE")
                age_.set_interval(26,59);
            else if (age == "MIDDLEAGED")
                age_.set_interval(35,59);
            else if (age == "SENIOR")
                age_.set_interval(65,94);
            else
                assign_interval(age_, age, idname_, element);
        }
        else if (element == "attribute_points")
            assign_interval(attribute_points_, xml.GetData(), idname_, element);
        else if (element == "attributes")
        {
            while(xml.FindChildElem())
            {
                int attribute = attribute_string_to_enum(xml.GetChildTagName());
                if (attribute != -1)
                    assign_interval(attributes_[attribute], xml.GetChildData(), idname_, element);
                else
                    xmllog.log("Unknown attribute in " + idname_ + ": " + xml.GetTagName());
            }
        }
        else if (element == "juice")
            assign_interval(juice_, xml.GetData(), idname_, element);
        else if (element == "gender")
        {
            int gender = gender_string_to_enum(xml.GetData());
            if (gender != -1 && gender != GENDER_WHITEMALEPATRIARCH)
                gender_liberal_ = gender_conservative_ = gender;
            else
                xmllog.log("Invalid gender for " + idname_ + ": " + xml.GetData());
        }
        else if (element == "infiltration")
            assign_interval(infiltration_, xml.GetData(), idname_, element);
        else if (element == "money")
            assign_interval(money_, xml.GetData(), idname_, element);
        else if (element == "skills")
        {
            while(xml.FindChildElem())
            {
                int skill = skill_string_to_enum(xml.GetChildTagName());
                if (skill != -1)
                    assign_interval(skills_[skill], xml.GetChildData(), idname_, element);
                else
                    xmllog.log("Unknown skill for " + idname_ + ": " + xml.GetChildTagName());
            }
        }
        else if (element == "armor")
        {
            if (getarmortype(xml.GetData()) != -1)
                armortypes_.push_back(xml.GetData());
            else
                xmllog.log("Invalid armor type for " + idname_ + ": " + xml.GetData());;
        }
        else if (element == "weapon")
        {
            //xml.SavePos("creature");
            weapons_and_clips_.push_back(WeaponsAndClips(xml, idname_));
            //xml.RestorePos("creature");
        }
        else if (element == "encounter_name")
            encounter_name_ = xml.GetData();
        else if (element == "type_name")
            type_name_ = xml.GetData();
        else
            xmllog.log("Unknown element for " + idname_ + ": " + element);
    }

    if (!len(type_name_))
    {
        xmllog.log("type_name not defined for " + idname_ + ".");
        type_name_ = "UNDEFINED";
    }
    // If no weapon type has been given then use WEAPON_NONE.
    if (!len(weapons_and_clips_))
        weapons_and_clips_.push_back(WeaponsAndClips("WEAPON_NONE", 1, "NONE", 0));
    // If no armor type has been given then use ARMOR_NONE.
    if (!len(armortypes_))
        armortypes_.push_back("ARMOR_NONE");
}
Пример #7
0
CreatureType::WeaponsAndClips::WeaponsAndClips(CMarkup& xml, const string& owner)
    : number_weapons(1),
      cliptype("APPROPRIATE"), number_clips(4)
{   // The main position of the CMarkup object is expected not to be changed here.
    weapontype = xml.GetData();

    // Read in values.
    if(!len(weapontype))
    {
        while(xml.FindChildElem())
        {
            std::string element=xml.GetChildTagName();
            if(element=="type") weapontype=xml.GetChildData();
            else if(element=="number_weapons")
                assign_interval(number_weapons,xml.GetChildData(),owner,element);
            else if(element=="cliptype") cliptype=xml.GetChildData();
            else if(element=="number_clips")
                assign_interval(number_clips,xml.GetChildData(),owner,element);
            else xmllog.log("Unknown element for weapon in "+owner+": "+element);
        }
    }

    // Check values.
    if (weapontype != "CIVILIAN")
    {
        if (getweapontype(weapontype) == -1)
        {
            xmllog.log("Invalid weapon type for " + owner + ": " + weapontype);
            weapontype = "WEAPON_NONE";
            cliptype = "NONE";
        }
        else
        {
            const vector<attackst*>& attacks = ::weapontype[getweapontype(weapontype)]->get_attacks();

            // Find a usable clip type for the weapon.
            if (cliptype == "APPROPRIATE")
            {
                cliptype = "NONE";
                for(int i=0; i<len(attacks); i++)
                {
                    if(attacks[i]->uses_ammo)
                    {
                        cliptype=attacks[i]->ammotype;
                        break;
                    }
                }
            }
            // Check clip is usable by the weapon.
            else if (getcliptype(cliptype) != -1) //Must be a clip type too.
            {
                int i;
                for(i=0; i<len(attacks)&&cliptype!=attacks[i]->ammotype; i++);
                if(i==len(attacks))
                {
                    xmllog.log("In " + owner + ", " + cliptype +
                               "can not be used by " + weapontype + ".");
                    cliptype = "NONE";
                }
            }
            // Undefined clip type.
            else
            {
                xmllog.log("Invalid clip type for " + owner + ": " + cliptype);
                cliptype = "NONE";
            }
        }
    }
}
Пример #8
0
//获取手机统计信息
bool CConnectThread::GetPhoneCountInfo(sPhoneInfo& Info)
{
	bool Ret=false;

	CString CmdStr;
	CString CmdRetStr;


	CString TypeValue;
	TypeValue = _T("app;contacts;sms;music;video;picture");

	CmdStr  = _T("<?xml version='1.0'?>");
	CmdStr += _T("<req>");
	CmdStr += _T("<fun>GetStatisticsData</fun>");
	CmdStr += _T("<ps count='0'>");
	CmdStr += _T("<p>");
	CmdStr += _T("<name>request</name>");
	CmdStr += _T("<value>") + TypeValue + _T("</value>");
	CmdStr += _T("</p>");
	CmdStr += _T("</ps>\n");
	CmdStr += _T("</req>\n");

	CCommunication::SendXmlToPhone(CmdStr,CmdRetStr);

	//解析返回值
	//分析返回的XML数据
	CString strData;
	CString strMsg;

	if ( !CmdRetStr.IsEmpty())
	{

		CMarkup Xml;
		if (Xml.SetDoc(CmdStr) )
		{			
			Xml.FindChildElem(_T("ps"));
			if (Xml.IntoElem())
			{
				Ret = true;
				while ( Xml.FindChildElem(_T("p")) )
				{
					strMsg.Empty();

					Xml.IntoElem();

					Xml.FindChildElem(_T("name"));
					strData = Xml.GetChildData().c_str();
					if (strData == _T("msg"))
					{
						Xml.FindChildElem(_T("value"));							
						strMsg = Xml.GetChildData().c_str();

						if (strMsg != _T("0"))
						{
							return false;
						}
					}
					else
					{	
						if (strData == _T("app"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();
							
							Info.m_AppSum = _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

						if (strData == _T("contacts"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();

							Info.m_ContactSum = _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

						if (strData == _T("sms"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();

							Info.m_SmsSum = _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

						if (strData == _T("music"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();

							Info.m_MusicSum = _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

						if (strData == _T("video"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();

							Info.m_VideoSum = _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

						if (strData == _T("picture"))
						{
							Xml.FindChildElem(_T("value"));							
							strMsg = Xml.GetChildData().c_str();

							Info.m_PicSum= _wtoi(strMsg.GetBuffer());
							strMsg.ReleaseBuffer();
						}

					}
					Xml.OutOfElem();
				}
			}
		}
	}

	return Ret;
}
Пример #9
0
//获取手机内存信息
bool CConnectThread::GetPhoneMemInfo(sPhoneInfo& Info)
{
	bool Ret=false;
	CString CmdStr;
	CString CmdRetStr;

	CmdStr =_T("<?xml version='1.0'?><req><fun>GetMemSize</fun><ps count='0'>/ps></req>");
	if(CCommunication::SendXmlToPhone(CmdStr,CmdRetStr) < 0)
		return Ret;

	if (!CmdRetStr.IsEmpty())
	{
		CMarkup Xml;
		if (Xml.SetDoc(CmdRetStr) )
		{			
			CString strXmlName;
			Xml.FindChildElem(_T("ps"));
			if (Xml.IntoElem())
			{
				Ret = true;

				while ( Xml.FindChildElem(_T("p")) )
				{
					Xml.IntoElem();
					CString strXmlValue ;

					Xml.FindChildElem(_T("name"));
					strXmlName = Xml.GetChildData().c_str();
					if (strXmlName == _T("msg"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (strXmlValue != _T("0"))
						{
							return false;
						}
					}
					else if (strXmlName == _T("sdcardall"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_SDTotalMem = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
							Info.m_SDTotalMem = 0;
					}
					else if (strXmlName == _T("sdcarduse"))
					{

						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_SDUsedMem = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
							Info.m_SDUsedMem= 0;
					}
					else if (strXmlName == _T("phoneall"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();
						if (!strXmlValue.IsEmpty())
						{							
							Info.m_PhoneTotalMem = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
						{
							Info.m_PhoneTotalMem = 0;
						}
					}
					else if (strXmlName == _T("phoneuse"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_PhoneUsedMem = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
						{
							Info.m_PhoneUsedMem = 0;
						}
					}/////////////////////////////////////////////
					else if (strXmlName == _T("sdcardimage"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_PicMemInSD = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
						{
							Info.m_PicMemInSD = 0;
						}
					}else if (strXmlName == _T("sdcardmusic"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_MusicMemInSD = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
						{
							Info.m_MusicMemInSD = 0;
						}
					}else if (strXmlName == _T("sdcardvideo"))
					{
						Xml.FindChildElem(_T("value"));							
						strXmlValue = Xml.GetChildData().c_str();

						if (!strXmlValue.IsEmpty())
						{							
							Info.m_VideoMemInSD = _wtoi(strXmlValue.GetBuffer());
							strXmlValue.ReleaseBuffer();
						}
						else
						{
							Info.m_VideoMemInSD = 0;
						}
					}else{;}

					Xml.OutOfElem();
				}
			}
		}
	}

	Info.m_PhoneFreeMem = Info.m_PhoneTotalMem - Info.m_PhoneUsedMem;
	Info.m_SDFreeMem    = Info.m_SDTotalMem - Info.m_SDUsedMem;
	return Ret;
}
Пример #10
0
//获取手机系统信息
bool CConnectThread::GetPhoneSystemInfo(sPhoneInfo& Info)
{
	bool Ret=false;
	CString CmdStr;
	CString CmdRetStr;
	CmdStr=_T("<?xml version='1.0'?><req><fun>GetSystemAgentVar</fun><ps count='0'></ps></req>");

	if(CCommunication::SendXmlToPhone(CmdStr,CmdRetStr) < 0x00)
		return Ret;
	if(CmdRetStr.IsEmpty())
		return Ret;

	CMarkup Xml;
	if(Xml.SetDoc(CmdRetStr))
	{
		CString strData;
		Xml.ResetMainPos();
		Xml.FindChildElem(_T("ps"));

		if (Xml.IntoElem())
		{
			Ret=true;
			while ( Xml.FindChildElem(_T("p")) )
			{
				
				CString strMsg;
				Xml.IntoElem();

				Xml.FindChildElem(_T("name"));
				strData = Xml.GetChildData().c_str();
				if (strData == _T("msg"))
				{
					Xml.FindChildElem(_T("value"));							
					strMsg = Xml.GetChildData().c_str();

					if (strMsg != _T("0"))
					{
						return false;
					}
				}else if  (strData == _T("var"))
				{				
					Xml.FindChildElem(_T("value"));							
					Info.m_PhoneOSVer = Xml.GetChildData().c_str();
					Info.m_PhoneOS = Info.m_PhoneOSVer.Mid(0x00, Info.m_PhoneOSVer.Find(_T(" "))); //Andriod 2.1-Update-1

				}else if  (strData == _T("agent"))
				{				
					Xml.FindChildElem(_T("value"));							
					Info.m_PhoneModel= Xml.GetChildData().c_str();

				}else if  (strData == _T("programver"))
				{				
					Xml.FindChildElem(_T("value"));							
					CString strApkVer = Xml.GetChildData().c_str();
				}else if  (strData == _T("imei"))
				{				
					Xml.FindChildElem(_T("value"));							
					Info.m_PhoneIMEI = Xml.GetChildData().c_str();

				}else if  (strData == _T("imsi"))
				{				
					Xml.FindChildElem(_T("value"));							
					Info.m_PhoneIMSI = Xml.GetChildData().c_str();

				}else{;}

				Xml.OutOfElem();
			}
		}
	}

	return Ret;
}
Пример #11
0
void db_lyricsfly::GetResults(window_config *wcfg, std::vector<lyric_data>* results, tstring title, tstring artist, tstring album)
{
  title = ReplaceString(_T("&"), _T("and"), title);
  artist = ReplaceString(_T("&"), _T("and"), artist);
  title = ReplaceString(_T("pt."), _T("part"), title);
  artist = ReplaceString(_T("pt."), _T("part"), artist);

  tstring out;
  out = _T("api/api.php?i=");
  out += _T("55562032656-reeloo.net/wordpress/lyrics-for-lastfm-radio");
  out += _T("&a=");
  out += CURLEncode::Encode(artist);
  out += _T("&t=");
  out += CURLEncode::Encode(title);

  tstring remoteText;

  if (!ReadInternetText(remoteText, _T("Mozilla/4.0 (compatible) Greasemonkey"), _T("api.lyricsfly.com"), 80, out, _T(""), false, wcfg->cfg_timeout, wcfg))
    return ;

  CMarkup xml;

  if (!xml.SetDoc(remoteText.c_str()))
    return ;

  while (xml.FindChildElem(_T("sg")))
  {
    xml.IntoElem();

    tstring info_artist, info_title, info_album, info_lyrics;

    if (xml.FindChildElem(_T("tx")))
    {
      info_lyrics = xml.GetChildData();
    }
    else
    {
      xml.OutOfElem();
      continue;
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("ar")))
    {
      info_artist = xml.GetChildData();
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("al")))
    {
      info_album = xml.GetChildData();
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("tt")))
    {
      info_title = xml.GetChildData();
    }

    lyric_data newData(wcfg);
    newData.SourceType = ST_INTERNET;
    newData.IsLoaded = true;
    newData.matchArtist = info_artist;
    newData.matchAlbum = info_album;
    newData.matchTitle = info_title;
    newData.db = this;
    newData.OnlineService = LD_LYRICSFLY;
    newData.Quality = Q_MEDIUM;
    newData.Source = _T("lyricsfly");

    newData.Text = info_lyrics;
    newData.Text = ReplaceString(_T("[br]"), _T(""), newData.Text);
    newData.Text = ReplaceString(_T("\r"), _T(""), newData.Text);
    newData.Text = ReplaceString(_T("\n"), _T("\r\n"), newData.Text);

    if (newData.Text.find(_T("[")) != tstring::npos)
      newData.IsTimestamped = true;
    else
      newData.IsTimestamped = false;

    results->push_back(newData);

    xml.OutOfElem();
  }

}