void RawManager::loadActionRaws(SimpleXML& aXml) { aXml.resetCurrentChild(); while(aXml.findChild("Action")) { Action* a = NULL; try { a = addAction(aXml.getIntChildAttrib("ID"), aXml.getChildAttrib("Name"), aXml.getBoolChildAttrib("Enabled")); } catch(const Exception&) { continue; } aXml.stepIn(); while(aXml.findChild("Raw")) { try { Raw r; r.setEnabled(aXml.getBoolChildAttrib("Enabled")); r.setId(aXml.getIntChildAttrib("ID")); r.setName(aXml.getChildAttrib("Name")); r.setRaw(aXml.getChildAttrib("Raw")); r.setTime(aXml.getIntChildAttrib("Time")); r.setLua(aXml.getBoolChildAttrib("UseLua")); addRaw(a, r); } catch(const Exception&) { // ... } } aXml.stepOut(); } }
void HighlightManager::load(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { ColorSettings cs; cs.setMatch( Text::utf8ToWide( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); cs.setIncludeNickList( aXml.getBoolChildAttrib("IncludeNickList") ); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); //cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); //cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor( aXml.getBoolChildAttrib("HasFgColor") ); cs.setHasBgColor( aXml.getBoolChildAttrib("HasBgColor") ); cs.setBgColor( (int)aXml.getLongLongChildAttrib("BgColor") ); cs.setFgColor( (int)aXml.getLongLongChildAttrib("FgColor") ); cs.setSoundFile( Text::utf8ToWide( aXml.getChildAttrib("SoundFile") ) ); colorSettings.push_back(cs); } aXml.stepOut(); } else { aXml.resetCurrentChild(); } }
void MessageManager::load(SimpleXML& aXml) { if (aXml.findChild("ChatFilterItems")) { aXml.stepIn(); while (aXml.findChild("ChatFilterItem")) { WLock l(Ignorecs); ChatFilterItems.push_back(ChatFilterItem(aXml.getChildAttrib("Nick"), aXml.getChildAttrib("Text"), (StringMatch::Method)aXml.getIntChildAttrib("NickMethod"), (StringMatch::Method)aXml.getIntChildAttrib("TextMethod"), aXml.getBoolChildAttrib("MC"), aXml.getBoolChildAttrib("PM"), aXml.getBoolChildAttrib("Enabled"))); } aXml.stepOut(); } loadUsers(); }
void ResourceManager::loadLanguage(const string& aFile) { try { File f(aFile, File::READ, File::OPEN); SimpleXML xml; xml.fromXML(f.read()); unordered_map<string, int> h; for(int i = 0; i < LAST; ++i) { h[names[i]] = i; } if(xml.findChild("Language")) { rtl = xml.getBoolChildAttrib("RightToLeft"); xml.stepIn(); if(xml.findChild("Strings")) { xml.stepIn(); while(xml.findChild("String")) { unordered_map<string, int>::const_iterator j = h.find(xml.getChildAttrib("Name")); if(j != h.end()) { strings[j->second] = xml.getChildData(); } } createWide(); } } } catch(const Exception&) { // ... } }
void FireResourceManager::loadLanguage(const string& aFile) { try { File f(aFile, File::READ, File::OPEN); SimpleXML xml; xml.fromXML(f.read()); HASH_MAP<string, int> h; //FireDC++ start HASH_MAP<string, int> e; //FireDC++ end for(int i = 0; i < LAST; ++i) { h[names[i]] = i; } //FireDC++ start for(int i = 0; i < LASTTWO; ++i) { e[namesTwo[i]] = i; } //FireDC++ end if(xml.findChild("Language")) { rtl = xml.getBoolChildAttrib("RightToLeft"); xml.stepIn(); if(xml.findChild("Strings")) { xml.stepIn(); while(xml.findChild("String")) { HASH_MAP<string, int>::iterator j = h.find(xml.getChildAttrib("Name")); if(j != h.end()) { strings[j->second] = xml.getChildData(); } } createWide(); } //FireDC++ start xml.stepOut(); if(xml.findChild("StringsTwo")) { xml.stepIn(); while(xml.findChild("StringTwo")) { HASH_MAP<string, int>::iterator j = e.find(xml.getChildAttrib("Name")); if(j != e.end()) { stringsTwo[j->second] = xml.getChildData(); } } createWideTwo(); } //FireDC++ end } } catch(const Exception&) { // ... } }
void ResourceManager::loadLanguage(const string& aFile) { try { File f(aFile, File::READ, File::OPEN, File::BUFFER_SEQUENTIAL, false); SimpleXML xml; xml.fromXML(f.read()); unordered_map<string, int> h; for(int i = 0; i < LAST; ++i) { h[names[i]] = i; } string childName = "String"; string attribName = "Name"; if (xml.findChild("Language")) { rtl = xml.getBoolChildAttrib("RightToLeft"); xml.stepIn(); if (xml.findChild("Strings")) { xml.stepIn(); } } else { xml.resetCurrentChild(); if (xml.findChild("resources")) { xml.stepIn(); childName = "string"; attribName = "name"; } else { throw Exception("Invalid format"); } } while (xml.findChild(childName)) { const auto j = h.find(xml.getChildAttrib(attribName)); if(j != h.end()) { strings[j->second] = xml.getChildData(); } } createWide(); } catch(const Exception& e) { LogManager::getInstance()->message("Failed to load the language file " + aFile + ": " + e.getError(), LogManager::LOG_ERROR); } }
void IpManager::loadWatch(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("IPWatch")) { aXml.stepIn(); while(aXml.findChild("IPWatch")) { addWatch(aXml.getIntChildAttrib("Mode"), aXml.getChildAttrib("Pattern"), aXml.getIntChildAttrib("Task"), aXml.getIntChildAttrib("Action"), aXml.getBoolChildAttrib("DisplayCheat"), aXml.getChildAttrib("Cheat"), aXml.getIntChildAttrib("MatchType"), aXml.getChildAttrib("ISP")); } aXml.stepOut(); aXml.resetCurrentChild(); if(aXml.findChild("RevisionInfo")) { aXml.stepIn(); if(aXml.findChild("Version")) { setIpWatchVersion(aXml.getChildData()); aXml.resetCurrentChild(); } aXml.stepOut(); } } }
void WebShortcuts::load(SimpleXML& xml) { xml.resetCurrentChild(); if(xml.findChild("WebShortcuts")){ xml.stepIn(); clear(); while(xml.findChild("WebShortcut")){ auto tmp = new WebShortcut(); tmp->name = xml.getChildAttrib("Name"); tmp->key = xml.getChildAttrib("Key"); tmp->url = xml.getChildAttrib("URL"); tmp->clean = xml.getBoolChildAttrib("Clean"); list.push_back(tmp); } xml.stepOut(); } }
void HighlightManager::load(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { try{ ColorSettings cs; cs.setContext(aXml.getIntChildAttrib("Context")); cs.setMatch( Text::toT( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); //Convert old setting to correct context if(aXml.getBoolChildAttrib("IncludeNickList") == true) cs.setContext(CONTEXT_NICKLIST); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); //cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor(aXml.getBoolChildAttrib("HasFgColor")); cs.setHasBgColor(aXml.getBoolChildAttrib("HasBgColor")); cs.setBgColor(aXml.getIntChildAttrib("BgColor")); cs.setFgColor(aXml.getIntChildAttrib("FgColor")); cs.setSoundFile(aXml.getChildAttrib("SoundFile")); cs.setMatchColumn(aXml.getIntChildAttrib("MatchColumn")); cs.setRegexp(); colorSettings.push_back(cs); }catch(...) { } } aXml.stepOut(); } else { aXml.resetCurrentChild(); } }
void HighlightManager::load(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { try{ ColorSettings cs; cs.setContext(aXml.getIntChildAttrib("Context")); cs.setMatch( Text::utf8ToWide( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); //Convert old setting to correct context if(aXml.getBoolChildAttrib("IncludeNickList") == true) cs.setContext(CONTEXT_NICKLIST); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); //cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor( aXml.getBoolChildAttrib("HasFgColor") ); cs.setHasBgColor( aXml.getBoolChildAttrib("HasBgColor") ); cs.setBgColor( (int)aXml.getLongLongChildAttrib("BgColor") ); cs.setFgColor( (int)aXml.getLongLongChildAttrib("FgColor") ); cs.setSoundFile( Text::utf8ToWide( aXml.getChildAttrib("SoundFile") ) ); cs.setMatchColumn(aXml.getIntChildAttrib("MatchColumn")); cs.setRegexp(); colorSettings.push_back(cs); }catch(...) { } } aXml.stepOut(); } else { aXml.resetCurrentChild(); } //convert the old setting to highlights if(!SETTING(HIGHLIGHT_LIST).empty()) { ColorSettings cs; cs.setContext(CONTEXT_FILELIST); cs.setMatch(Text::toT(SETTING(HIGHLIGHT_LIST))); cs.setHasFgColor(true); cs.setFgColor( SETTING(LIST_HL_COLOR) ); cs.setHasBgColor(true); cs.setBgColor( SETTING(LIST_HL_BG_COLOR) ); SettingsManager::getInstance()->set(SettingsManager::HIGHLIGHT_LIST, ""); SettingsManager::getInstance()->set(SettingsManager::USE_HIGHLIGHT, true); colorSettings.push_back(cs); } }