uint32_t CLocalizeStrings::LoadBlock(const CStdString &id, const CStdString &path, const CStdString &fallbackPath) { iBlocks it = m_blocks.find(id); if (it != m_blocks.end()) return it->second; // already loaded // grab a new block uint32_t offset = block_start + m_blocks.size()*block_size; m_blocks.insert(make_pair(id, offset)); // load the strings CStdString encoding; bool success = LoadXML(path, encoding, offset); if (!success) { if (path == fallbackPath) // no fallback, nothing to do return 0; } // load the fallback if (path != fallbackPath) success |= LoadXML(fallbackPath, encoding, offset); return success ? offset : 0; }
virtual RetCodeEnum convert(const std::string &inputFormat, const std::string &outputFormat, const std::string &opCode) { if ( inputFormat == "XMesh" && outputFormat== "BFXM" ) { if ( opCode == "add" ) { bool forcenormals=atoi(getNamedOption("forcenormals").c_str())!=0; string input = getNamedOption("inputPath"); string output= getNamedOption("outputPath"); FILE *Outputfile=fopen(output.c_str(),"rb+"); //append to end, but not append, which doesn't do what you want it to. fseek(Outputfile, 0, SEEK_END); XML memfile=(LoadXML(input.c_str(),1)); xmeshToBFXM(memfile,Outputfile,'a',forcenormals); return RC_OK; } else if ( opCode == "create" ) { bool forcenormals=atoi(getNamedOption("forcenormals").c_str())!=0; string input = getNamedOption("inputPath"); string output= getNamedOption("outputPath"); FILE *Outputfile=fopen(output.c_str(),"wb+"); //create file for BFXM output XML memfile=(LoadXML(input.c_str(),1)); xmeshToBFXM(memfile,Outputfile,'c',forcenormals); return RC_OK; } else { return RC_NOT_IMPLEMENTED; } } else { return RC_NOT_IMPLEMENTED; } }
// load the color file in void CGUIColorManager::Load(const CStdString &colorFile) { Clear(); // load the global color map if it exists TiXmlDocument xmlDoc; if (xmlDoc.LoadFile(CSpecialProtocol::TranslatePathConvertCase("special://xbmc/system/colors.xml"))) LoadXML(xmlDoc); // first load the default color map if it exists CStdString path, basePath; URIUtils::AddFileToFolder(g_SkinInfo->Path(), "colors", basePath); URIUtils::AddFileToFolder(basePath, "defaults.xml", path); if (xmlDoc.LoadFile(CSpecialProtocol::TranslatePathConvertCase(path))) LoadXML(xmlDoc); // now the color map requested if (colorFile.CompareNoCase("SKINDEFAULT") == 0) return; // nothing to do URIUtils::AddFileToFolder(basePath, colorFile, path); CLog::Log(LOGINFO, "Loading colors from %s", path.c_str()); if (xmlDoc.LoadFile(path)) LoadXML(xmlDoc); }
// load the color file in void CGUIColorManager::Load(const CStdString &colorFile) { Clear(); // load the global color map if it exists CXBMCTinyXML xmlDoc; if (xmlDoc.LoadFile(CSpecialProtocol::TranslatePathConvertCase("special://xbmc/system/colors.xml"))) LoadXML(xmlDoc); // first load the default color map if it exists CStdString basePath = URIUtils::AddFileToFolder(g_SkinInfo->Path(), "colors"); CStdString path = URIUtils::AddFileToFolder(basePath, "defaults.xml"); if (xmlDoc.LoadFile(CSpecialProtocol::TranslatePathConvertCase(path))) LoadXML(xmlDoc); // now the color map requested if (StringUtils::EqualsNoCase(colorFile, "SKINDEFAULT")) return; // nothing to do path = URIUtils::AddFileToFolder(basePath, colorFile); if (!URIUtils::HasExtension(path)) path += ".xml"; CLog::Log(LOGINFO, "Loading colors from %s", path.c_str()); if (xmlDoc.LoadFile(path)) LoadXML(xmlDoc); }
int CPlayerWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if ( CChildWnd::OnCreate( lpCreateStruct ) == -1 ) return -1; // Load Definitions Skin.LoadFromResource( AfxGetResourceHandle(), IDR_XML_DEFINITIONS ); Skin.LoadFromResource( AfxGetResourceHandle(), IDR_XML_DEFAULT ); // Panel //m_wndPanel.Create( WS_VISIBLE, rectDefault, this ); // Header if ( ! m_wndHeaderBar.Create( this, WS_CHILD|WS_VISIBLE|CBRS_NOALIGN, AFX_IDW_TOOLBAR ) ) return -1; m_wndHeaderBar.SetBarStyle( m_wndHeaderBar.GetBarStyle() | CBRS_TOOLTIPS|CBRS_BORDER_BOTTOM ); Skin.CreateToolBar( _T("CPlayerWnd.Header"), &m_wndHeaderBar ); m_wndHistory.Create( WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWN|CBS_AUTOHSCROLL, rectDefault, &m_wndHeaderBar, ID_PLAYER_HISTORY ); m_wndHistory.SetFont( &CoolInterface.m_fntNormal ); CXMLElement* pXML = LoadXML( _T("XlivePlayer"), TRUE ); if ( pXML ) LoadXML( pXML ); pXML->Delete(); // Bottom if ( ! m_wndBottom.Create( this, WS_CHILD|WS_VISIBLE|CBRS_NOALIGN, AFX_IDW_TOOLBAR ) ) return -1; m_wndBottom.SetBarStyle( m_wndBottom.GetBarStyle() | CBRS_TOOLTIPS|CBRS_BORDER_TOP ); Skin.CreateToolBar( _T("CPlayerWnd.Bottom"), &m_wndBottom ); return 0; }
//---------------------------------------------------------------------------- // Load : Per carregar un fitxer XML amb tots els scrits //---------------------------------------------------------------------------- bool CPhysicsManager::Load ( const std::string &_PhysXConfig ) { LOGGER->AddNewLog ( ELL_INFORMATION, "CPhysicsManager::Load-->Loading physics." ); m_szConfigFileName = _PhysXConfig; Init(); return LoadXML(); }
bool CAnimationManager::LoadAnimation(std::string szFilename, bool bIsXML) { if(bIsXML) return LoadXML(szFilename); else return LoadBinary(szFilename); }
//---------------------------------------------------------------------------- // Load : Per carregar un fitxer XML amb tots els enemics //---------------------------------------------------------------------------- bool CCharactersManager::Load( const std::string &_PropertyFileName, const std::string &_AnimatedStatesFileName ) { LOGGER->AddNewLog ( ELL_INFORMATION, "CCharactersManager::Load-->Loading characters, properties and states" ); m_PropertiesFileName = _PropertyFileName; m_AnimatedFileName = _AnimatedStatesFileName; return LoadXML(); }
/*! \brief Loads language ids and strings to memory map `strings`. * It tries to load a strings.po file first. If doesn't exist, it loads a strings.xml file instead. \param pathname The directory name, where we look for the strings file. \param language We load the strings for this language. Fallback language is always English. \param strings [out] The resulting strings map. \param encoding Encoding of the strings. For PO files we only use utf-8. \param offset An offset value to place strings from the id value. \return false if no strings.po or strings.xml file was loaded. */ static bool LoadStr2Mem(const std::string &pathname_in, const std::string &language, std::map<uint32_t, LocStr>& strings, std::string &encoding, uint32_t offset = 0 ) { std::string pathname = CSpecialProtocol::TranslatePathConvertCase(pathname_in + language); if (!XFILE::CDirectory::Exists(pathname)) { bool exists = false; std::string lang; // check if there's a language addon using the old language naming convention if (ADDON::CLanguageResource::FindLegacyLanguage(language, lang)) { pathname = CSpecialProtocol::TranslatePathConvertCase(pathname_in + lang); exists = XFILE::CDirectory::Exists(pathname); } if (!exists) return false; } bool useSourceLang = StringUtils::EqualsNoCase(language, LANGUAGE_DEFAULT) || StringUtils::EqualsNoCase(language, LANGUAGE_OLD_DEFAULT); if (LoadPO(URIUtils::AddFileToFolder(pathname, "strings.po"), strings, encoding, offset, useSourceLang)) return true; return LoadXML(URIUtils::AddFileToFolder(pathname, "strings.xml"), strings, encoding, offset); }
void ProcessController::LoadXML() { string filename = m_Filename+".xml"; XML* xml = new XML(filename.c_str()); XMLElement* e = xml->GetRootElement(); LoadXML(e); }
void MainDialog::EnableAppProfiles() { if (mpAppProfilePanel->EnableAppProfiles()) { LoadXML(mpAppProfilePanel->GetDefaultProfile()); } }
virtual RetCodeEnum convert(const std::string &inputFormat, const std::string &outputFormat, const std::string &opCode) { if ( inputFormat == "XMesh" && outputFormat== "Ogre" ) { if ( opCode == "create" ) { string input = getNamedOption("inputPath"); string output= getNamedOption("outputPath"); string base = input.substr(0,input.rfind('.')); string mtl = base + string(".material"); XML memfile=(LoadXML(input.c_str(),1)); OgreMeshConverter::ConverterInit(); void *data = OgreMeshConverter::Init(); OgreMeshConverter::Add(data, memfile); OgreMeshConverter::DoneMeshes(data); OgreMeshConverter::Dump(data, output.c_str(), mtl.c_str()); OgreMeshConverter::ConverterClose(); return RC_OK; } else if (opCode == "append") { string input = getNamedOption("inputPath"); string output= getNamedOption("outputPath"); string base = input.substr(0,input.rfind('.')); string mtl = base + string(".material"); XML memfile=(LoadXML(input.c_str(),1)); OgreMeshConverter::ConverterInit(); void *data = OgreMeshConverter::Init(output.c_str(), mtl.c_str()); OgreMeshConverter::Add(data, memfile); OgreMeshConverter::DoneMeshes(data); OgreMeshConverter::Dump(data, output.c_str(), mtl.c_str()); OgreMeshConverter::ConverterClose(); return RC_OK; } else if (opCode == "optimize") { string input = getNamedOption("inputPath"); string output= getNamedOption("outputPath"); string base = input.substr(0,input.rfind('.')); string mtl = base + string(".material"); OgreMeshConverter::ConverterInit(); void *data = OgreMeshConverter::Init(output.c_str(), mtl.c_str()); OgreMeshConverter::Optimize(data); OgreMeshConverter::DoneMeshes(data); OgreMeshConverter::Dump(data, output.c_str(), mtl.c_str()); OgreMeshConverter::ConverterClose(); } else { return RC_NOT_IMPLEMENTED; } } else { return RC_NOT_IMPLEMENTED; } }
MainDialog::~MainDialog() { if (!mStartupProfileName.IsEmpty()) { LoadXML(mStartupProfileName); } delete mpTaskBarIcon; }
bool ValueAnimation::BeginLoad(Deserializer& source) { XMLFile xmlFile(context_); if (!xmlFile.Load(source)) return false; return LoadXML(xmlFile.GetRoot()); }
bool CLocalizeStrings::LoadSkinStrings(const CStdString& path, const CStdString& fallbackPath) { ClearSkinStrings(); // load the skin strings in. CStdString encoding; if (!LoadXML(path, encoding)) { if (path == fallbackPath) // no fallback, nothing to do return false; } // load the fallback if (path != fallbackPath) LoadXML(fallbackPath, encoding); return true; }
bool CLocalizeStrings::Load(const CStdString& strFileName, const CStdString& strFallbackFileName) { bool bLoadFallback = !strFileName.Equals(strFallbackFileName); CStdString encoding; Clear(); if (!LoadXML(strFileName, encoding)) { // try loading the fallback if (!bLoadFallback || !LoadXML(strFallbackFileName, encoding)) return false; bLoadFallback = false; } if (bLoadFallback) LoadXML(strFallbackFileName, encoding); // fill in the constant strings m_strings[20022] = ""; m_strings[20027] = ToUTF8(encoding, "°F"); m_strings[20028] = ToUTF8(encoding, "K"); m_strings[20029] = ToUTF8(encoding, "°C"); m_strings[20030] = ToUTF8(encoding, "°Ré"); m_strings[20031] = ToUTF8(encoding, "°Ra"); m_strings[20032] = ToUTF8(encoding, "°Rø"); m_strings[20033] = ToUTF8(encoding, "°De"); m_strings[20034] = ToUTF8(encoding, "°N"); m_strings[20200] = ToUTF8(encoding, "km/h"); m_strings[20201] = ToUTF8(encoding, "m/min"); m_strings[20202] = ToUTF8(encoding, "m/s"); m_strings[20203] = ToUTF8(encoding, "ft/h"); m_strings[20204] = ToUTF8(encoding, "ft/min"); m_strings[20205] = ToUTF8(encoding, "ft/s"); m_strings[20206] = ToUTF8(encoding, "mph"); m_strings[20207] = ToUTF8(encoding, "kts"); m_strings[20208] = ToUTF8(encoding, "Beaufort"); m_strings[20209] = ToUTF8(encoding, "inch/s"); m_strings[20210] = ToUTF8(encoding, "yard/s"); m_strings[20211] = ToUTF8(encoding, "Furlong/Fortnight"); return true; }
bool CNtlXMLDoc::LoadXML( char* szXMLBuffer ) { USES_CONVERSION; if(false != m_bIsFileLoaded) return false; return LoadXML(A2W(szXMLBuffer)); }
void CParamNode::LoadXML(CParamNode& ret, const VfsPath& path, const std::string& validatorName) { CXeromyces xero; PSRETURN ok = xero.Load(g_VFS, path, validatorName); if (ok != PSRETURN_OK) return; // (Xeromyces already logged an error) LoadXML(ret, xero, path.string().c_str()); }
void MainDialog::mLoadButtonClick(wxCommandEvent& WXUNUSED(event)) { wxFileDialog OpenFileDialog(this, wxT("Open AMD/ATI Overdrive profile"), wxT(""), wxT(""), wxT("ovdr files (*.ovdr)|*.ovdr"), wxFD_OPEN|wxFD_FILE_MUST_EXIST); if(OpenFileDialog.ShowModal() == wxID_OK) { LoadXML(OpenFileDialog.GetPath()); } }
void CPlayProfilePage::OnDblClkList(NMHDR* pNMHDR, LRESULT* pResult) { int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED ); if ( nItem < 0 ) return; if ( CXMLElement* pXML = (CXMLElement*)m_wndList.GetItemData( nItem ) ) { if ( ! pXML->IsNamed( "Play" ) ) LoadXML( pXML ); } }
bool CTriggerManager::Reload() { if ( mConfigPath != "" ) { Clear(); return LoadXML( mConfigPath ); } return false; }
/// Called when the component is added to a scene node. Other components may not yet exist. void Dungeon::Start() { auto resourceCache = GetSubsystem<Urho3D::ResourceCache>(); // Create dungeon node auto dungeonNode = GetNode()->CreateChild("Dungeon", Urho3D::CreateMode::LOCAL); // Generate dungeon dungeonNode->LoadXML(resourceCache->GetResource<Urho3D::XMLFile>("Dungeon_Test.xml")->GetRoot()); }
void CWebWindow::OnCmdSetVariable(LPCTSTR bstrVarName, LPCTSTR bstrVarValue) { USES_CONVERSION; if(CString("Invoke_StartAutoUpdate").CompareNoCase(bstrVarName)==0) { _bstr_t VarValue = bstrVarValue; //((CMainDlg*)GetMessageParent())->Invoke_StartAutoUpdate(bstrVarValue); GetMessageParent()->PostMessage(WM_INVOKE_STARTAUTO_UPDATE,(WPARAM)VarValue.copy()); PostMessage(WM_CLOSE); } else if(CString("LoadXML").CompareNoCase(bstrVarName)==0) { m_bQueryAttachXML =TRUE; LoadXML(bstrVarValue); } else if(CString(_T("_LoadDropFiles")).CompareNoCase(bstrVarName)==0) { // Load Script Function bstrVarValue, and SendFiles Array [4/22/2002] CComPtr<IHTMLDocument> pDoc; pDoc.Attach((IHTMLDocument*)m_browser.GetDocument()); if(pDoc!=NULL) { CComPtr<IDispatch> spDispScript = NULL; HRESULT hr = pDoc->get_Script(&spDispScript); if(spDispScript) { DISPID dispid = -1; OLECHAR FAR* szMember = T2OLE(const_cast<LPTSTR>(bstrVarValue)); hr = spDispScript->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid); if(SUCCEEDED(hr)) { CComVariant varResult; DISPPARAMS params = { &varFilesData, NULL, 1, 0 }; hr = spDispScript->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL); } } } } else if(CString("Invoke_CreateChat").CompareNoCase(bstrVarName)==0) { // <строка вида> = "Name#Description#Message#UserId,UserId,UserId" [11/5/2002] _bstr_t VarValue = bstrVarValue; GetMessageParent()->PostMessage(WM_INVOKE_CREATECHAT,(WPARAM)VarValue.copy()); } else if(CString("Invoke_SendMessage").CompareNoCase(bstrVarName)==0) { // <строка вида> = "Message#UserId,UserId,UserId" [11/5/2002] _bstr_t VarValue = bstrVarValue; GetMessageParent()->PostMessage(WM_INVOKE_SENDMESSAGE,(WPARAM)VarValue.copy()); } else g_ViewVariablesList.SetVariable(bstrVarName,bstrVarValue); }
BOOL CRulerSettingsPage::OnInitDialog() { CSettingsPage::OnInitDialog(); if ( m_pXML ) LoadXML(); OnEditChangeExtList(); OnSelChangeExtList(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CParticleSystemManager::Refresh() { mCores.Destroy(); mInstances.Destroy(); LoadXML(); LoadInstances( "Data/sala1/particles.xml", "sala1" ); LoadInstances( "Data/sala2/particles.xml", "sala2" ); LoadInstances( "Data/sala3/particles.xml", "sala3" ); LoadInstances( "Data/sala4/particles.xml", "sala4" ); LoadInstances( "Data/pasillo/particles.xml", "pasillo" ); LoadInstances( "Data/space/particles.xml", "space" ); }
BOOL CEmoticons::Load() { Clear(); m_pImage.Create( EMOTICON_SIZE, EMOTICON_SIZE, ILC_COLOR32|ILC_MASK, 1, 8 ) || m_pImage.Create( EMOTICON_SIZE, EMOTICON_SIZE, ILC_COLOR24|ILC_MASK, 1, 8 ) || m_pImage.Create( EMOTICON_SIZE, EMOTICON_SIZE, ILC_COLOR16|ILC_MASK, 1, 8 ); if ( ! LoadXML( Settings.General.Path + _T("\\Data\\Emoticons.xml") ) ) // Settings.General.DataPath ? return FALSE; BuildTokens(); return TRUE; }
// load the color file in void CGUIColorManager::Load(const CStdString &colorFile) { Clear(); // first load the default color map if it exists CStdString path, basePath; CUtil::AddFileToFolder(g_SkinInfo.GetBaseDir(), "colors", basePath); CUtil::AddFileToFolder(basePath, "defaults.xml", path); TiXmlDocument xmlDoc; if (xmlDoc.LoadFile(PTH_IC(path.c_str()))) LoadXML(xmlDoc); // now the color map requested if (colorFile.CompareNoCase("SKINDEFAULT") == 0) return; // nothing to do CUtil::AddFileToFolder(basePath, colorFile, path); CLog::Log(LOGINFO, "Loading colors from %s", path.c_str()); if (xmlDoc.LoadFile(path.c_str())) LoadXML(xmlDoc); }
BOOL CPlayProfilePage::OnInitDialog() { CSettingsPage::OnInitDialog(); m_wndList.InsertColumn( 0, _T("按键代码"), LVCFMT_LEFT, 80, -1 ); m_wndList.InsertColumn( 1, _T("节目名称"), LVCFMT_LEFT, 220, 0 ); m_wndList.SetImageList( &CoolInterface.m_pImages, LVSIL_SMALL ); m_wndList.SetExtendedStyle( LVS_EX_FULLROWSELECT ); if ( m_pXML ) LoadXML(); m_wndDelete.EnableWindow( FALSE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void JukeBox::Init() { const Config* cfg = Config::GetConstInstance(); ActiveMusic(cfg->GetSoundMusic()); SetFrequency(cfg->GetSoundFrequency()); if (!OpenDevice()) { End(); return; } Mix_ChannelFinished(JukeBox::EndChunk); Mix_HookMusicFinished(JukeBox::EndMusic); LoadXML("default"); LoadMusicXML(); }
bool Node::LoadXML(const XMLElement& source) { SceneResolver resolver; // Read own ID. Will not be applied, only stored for resolving possible references unsigned nodeID = source.GetInt("id"); resolver.AddNode(nodeID, this); // Read attributes, components and child nodes bool success = LoadXML(source, resolver); if (success) { resolver.Resolve(); ApplyAttributes(); } return success; }