// // // // CzSettings implementation // // // int CzSettings::Init() { PreventPowerSaving = false; CzXmlParser* xml = new CzXmlParser(); if (xml->Parse("AppEasy.xml") == XmlErrorNone) { CzXmlNode* root = xml->getRoot()->getFirstNode(); if (root != NULL) { // Get debug trace info level CzXmlNode* node = root->getFirstNamedNode(CZ_HASH("debug")); if (node != NULL) { CzXmlAttribute* attrib = node->getAttribute(CZ_HASH("level")); if (attrib != NULL) { g_CzShowTracing = attrib->getValueAsInt(); CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Debugging trace level set to ", CzString(g_CzShowTracing).c_str()); } } // Get Facebook App ID node = root->getFirstNamedNode(CZ_HASH("facebook")); if (node != NULL) { CzXmlAttribute* attrib = node->getAttribute(CZ_HASH("app_id")); if (attrib != NULL) { FacebookAppID = attrib->getValue(); CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "Got Facebook App ID"); } } } } delete xml; return 1; }
CzXmlNode* CzXmlNode::getFirstNamedNode(unsigned int name_hash) { // Check this mode if (Name.getHash() == name_hash) return this; // Check child nodes for (CzXmlNodeList::iterator i = Children.begin(); i != Children.end(); ++i) { CzXmlNode* pNode = *i; CzXmlNode* pFound = pNode->getFirstNamedNode(name_hash); if (pFound != NULL) return pFound; } return NULL; }