void CWakeOnAccess::SaveMACDiscoveryResult(const std::string& host, const std::string& mac) { CLog::Log(LOGNOTICE, "%s - Mac discovered for host '%s' -> '%s'", __FUNCTION__, host.c_str(), mac.c_str()); for (EntriesVector::iterator i = m_entries.begin(); i != m_entries.end(); ++i) { if (StringUtils::EqualsNoCase(host, i->host)) { i->mac = mac; ShowDiscoveryMessage(__FUNCTION__, host.c_str(), false); AddMatchingUPnPServers(m_UPnPServers, host, mac, i->timeout); SaveToXML(); return; } } // not found entry to update - create using default values WakeUpEntry entry (true); entry.host = host; entry.mac = mac; m_entries.push_back(entry); ShowDiscoveryMessage(__FUNCTION__, host.c_str(), true); AddMatchingUPnPServers(m_UPnPServers, host, mac, entry.timeout); SaveToXML(); }
void CWakeOnAccess::SaveMACDiscoveryResult(const std::string& host, const std::string& mac) { CLog::Log(LOGNOTICE, "%s - Mac discovered for host '%s' -> '%s'", __FUNCTION__, host.c_str(), mac.c_str()); std::string heading = LOCALIZED(13033); for (EntriesVector::iterator i = m_entries.begin(); i != m_entries.end(); ++i) { if (StringUtils::EqualsNoCase(host, i->host)) { CLog::Log(LOGDEBUG, "%s - Update existing entry for host '%s'", __FUNCTION__, host.c_str()); if (!StringUtils::EqualsNoCase(mac, i->mac)) { if (IsEnabled()) // show notification only if we have general feature enabled { std::string message = StringUtils::Format(LOCALIZED(13034).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000); } i->mac = mac; SaveToXML(); } return; } } // not found entry to update - create using default values WakeUpEntry entry (true); entry.host = host; entry.mac = mac; m_entries.push_back(entry); CLog::Log(LOGDEBUG, "%s - Create new entry for host '%s'", __FUNCTION__, host.c_str()); if (IsEnabled()) // show notification only if we have general feature enabled { std::string message = StringUtils::Format(LOCALIZED(13035).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000); } SaveToXML(); }
static void SaveToXML(const XmlNodeRef& n, const char* name, const TTimeStampedData<T>& data) { XmlNodeRef v = gEnv->pSystem->CreateXmlNode("values"); v->setAttr("name", name); for(int i=0;i<data.m_data.size(); ++i) { XmlNodeRef c = gEnv->pSystem->CreateXmlNode("value"); SaveToXML(c, "time", data.m_data[i].first); T::SaveToXML(c, "", data.m_data[i].second); v->addChild(c); } n->addChild(v); }
void DBDictionary::Init() { // 사전 초기화 _dic.clear(); // 사전 생성 옵션 로드 XmlDocument xmlDoc; std::string path = "./resource/DBDicConfig.xml"; xmlDoc.LoadFile( path.c_str() ); const XmlNode * resNode = xmlDoc.GetNode( "resource" ); std::string create = resNode->GetAttribute( "create" ); if( create == "true" ) { // 사전 생성 CreateDBDic( resNode ); // 사전 저장 XmlDocument xmlDoc; XmlNode * resNode = xmlDoc.AddNode( "resource" ); SaveToXML( resNode ); std::string path = "./resource/DBDic.xml"; xmlDoc.SaveFile( path.c_str() ); } else { // 사전 로드 XmlDocument xmlDoc; std::string path = "./resource/DBDic.xml"; xmlDoc.LoadFile( path.c_str() ); const XmlNode * resNode = xmlDoc.GetNode( "resource" ); LoadFromXML( resNode ); } }