Esempio n. 1
0
bool CGUIIncludes::Load_Internal(const std::string &file)
{
  // check to see if we already have this loaded
  if (HasLoaded(file))
    return true;

  CXBMCTinyXML doc;
  if (!doc.LoadFile(file))
  {
    CLog::Log(LOGINFO, "Error loading include file %s: %s (row: %i, col: %i)", file.c_str(), doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
    return false;
  }

  TiXmlElement *root = doc.RootElement();
  if (!root || !StringUtils::EqualsNoCase(root->Value(), "includes"))
  {
    CLog::Log(LOGERROR, "Error loading include file %s: Root element <includes> required.", file.c_str());
    return false;
  }

  // load components
  LoadDefaults(root);
  LoadConstants(root);
  LoadExpressions(root);
  LoadVariables(root);
  LoadIncludes(root);

  m_files.push_back(file);

  return true;
}
void CTexturePreviewDialog::LoadInfo()
{
    wxFileSystem fileSystem;
    wxString texturePath = CResourcePathManager::GetInstance()->GetResourcePath(CResourcePathManager::eRPT_Texture);
    fileSystem.ChangePathTo(texturePath, true);
    std::vector<wxString> files;
    wxString fileName = fileSystem.FindFirst(_T("*.xml"));
    while (!fileName.IsNull())
    {
        files.push_back(fileSystem.URLToFileName(fileName).GetFullPath());
        fileName = fileSystem.FindNext();
    }

    for (auto itr : files)
    {
        if (!HasLoaded(itr))
        {
            LoadInfoFromFile(itr);
        }
    }
}