All pastes #194720 Raw Edit

Donno

public cpp v1 · immutable
·published 2006-10-08 05:53 UTC
rendered paste body
  if (iButton == btnDownload)  {    CFileItem item(*pItem);    CHTTP http;    CStdString strURL;    if (item.m_musicInfoTag.GetTitle() != "")    {      //strURL.Format("http://www.megaxkey.com/unleashx.php?gameid=%s",item.m_musicInfoTag.GetTitle());      strURL.Format("http://blackbolt.x-scene.com/xbmc.php?gameid=%s",item.m_musicInfoTag.GetTitle()); // donnos little fix the unleashx.php is broken (content lenght is greater then lenght sent)      string theHtml;      bool foundsaves = false;      CLog::Log(LOGINFO,"GSM: %s",  theHtml.c_str());      if (http.Get(strURL, theHtml))      {        CLog::Log(LOGINFO,"GSM: %s",  theHtml.c_str());        TiXmlDocument gsXml;        gsXml.Parse(theHtml.c_str(), 0);        TiXmlElement *pRootElement = gsXml.RootElement();        if (pRootElement)        {          if (pRootElement->Value())          {            if (strcmpi(pRootElement->Value(),"xboxsaves") == 0)            {              TiXmlElement* pGame = pRootElement->FirstChildElement("game");              if (pGame)              {                TiXmlElement* pSave = pGame->FirstChildElement("save");                if (pSave->Value())                {                  CGUIDialogSelect *pDlg = (CGUIDialogSelect*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SELECT);                  if (pDlg)                  {                    foundsaves = true;                    pDlg->SetHeading(20320);                    pDlg->Reset();                    pDlg->EnableButton(false);                    std::vector<CStdString> vecSaveUrl;                    vecSaveUrl.clear();                    while (pSave)                    {                      if (pSave->Value())                      {                          pDlg->Add(pSave->Attribute("desc"));                          vecSaveUrl.push_back(pSave->Attribute("url"));                      }                      pSave = pSave->NextSiblingElement("save");                    }                                                      //pDlg->Sort();                    pDlg->DoModal();                    int iSelectedSave = pDlg->GetSelectedLabel();                    CLog::Log(LOGINFO,"GSM: %i",  iSelectedSave);                    if (iSelectedSave > -1)                    {                      CLog::Log(LOGINFO,"GSM vecSaveUrl[i] : %s",  vecSaveUrl[iSelectedSave].c_str());                      if (http.Download(vecSaveUrl[iSelectedSave], "Z:\\gamesave.zip"))                      {                         if (g_ZipManager.ExtractArchive("Z:\\gamesave.zip","E:\\"))                        {                          ::DeleteFile("E:\\gameid.ini");   // delete file E:\\gameid.ini artifcat continatin info about the save we got                          CGUIDialogOK::ShowAndGetInput(20317, 0, 20318, 0);                        } else {                          CGUIDialogOK::ShowAndGetInput(20317, 0, 20319, 0);  // Download Failed                          CLog::Log(LOGINFO,"GSM: [download failed] Failed to extract zip : %s", vecSaveUrl[iSelectedSave].c_str());                        }                      } else {                          CGUIDialogOK::ShowAndGetInput(20317, 0, 20319, 0);  // Download Failed                          CLog::Log(LOGINFO,"GSM: Failed to download: %s",  vecSaveUrl[iSelectedSave].c_str());                      }                    }                  }                }              }            }          }        }        if (!foundsaves)        {          CGUIDialogOK::ShowAndGetInput(20317, 0, 20319, 0);  // Download Failed          CLog::Log(LOGINFO,"GSM: No saves avaible for game on internet: %s",  item.GetLabel().c_str());        }      }    }  }