HRESULT AutoUpdater::ParseCurrentVersionXML(HttpItem *itm) { // Add File Path to internal structure xmlDoc.xmlHeader.szFilePath = itm->getSaveAsPath(); // Parse the file if it exists XMLReader * xmlFile = LoadConfigFile(xmlDoc.xmlHeader.szFilePath); // Read XML File and Fill in VersionDescriptors while(!EndAttribute(xmlFile, "Header")) { if(StartAttribute(xmlFile, "Document")) { xmlDoc.xmlHeader.docHeader.defName = xmlFile->getAttributeValue("name"); xmlDoc.xmlHeader.docHeader.updDate = xmlFile->getAttributeValue("updated"); } if(StartAttribute(xmlFile, "UpdateList")) { xmlDoc.xmlHeader.updHeader.dashTotal = xmlFile->getAttributeValueAsInt("dash"); xmlDoc.xmlHeader.updHeader.skinTotal = xmlFile->getAttributeValueAsInt("skins"); xmlDoc.xmlHeader.updHeader.pluginTotal = xmlFile->getAttributeValueAsInt("plugins"); } } DebugMsg("AutoUpdater", "Version Definition File: Header Data Loaded"); // Parse the dash update data and place into version descriptors xmlFile->restart(); while(!EndAttribute(xmlFile, "DashUpdate")) { if(StartAttribute(xmlFile, "Dash")) { tempVersion = new VersionDescriptor; tempVersion->szName = xmlFile->getAttributeValue("name"); tempVersion->nMajorVersion = xmlFile->getAttributeValueAsInt("major"); tempVersion->nMinorVersion = xmlFile->getAttributeValueAsInt("minor"); tempVersion->nRevisionNumber = xmlFile->getAttributeValueAsInt("rev"); tempVersion->nVersionType = xmlFile->getAttributeValueAsInt("type"); tempVersion->szFileName = xmlFile->getAttributeValue("file"); tempVersion->nUpdateID = xmlFile->getAttributeValueAsInt("uid"); tempVersion->nFileType = FILETYPE_DASH; // Insert data into xmlDoc version descriptor map xmlDoc.xmlDescriptors.insert(map<int, VersionDescriptor>::value_type(tempVersion->nUpdateID, *tempVersion)); delete tempVersion; } } DebugMsg("AutoUpdater", "Version Definition File: Dash Data Loaded: %d", xmlDoc.xmlHeader.updHeader.dashTotal); // Parse the Skin update data and place into version descriptors xmlFile->restart(); while(!EndAttribute(xmlFile, "SkinUpdate")) { if(StartAttribute(xmlFile, "Skin")) { tempVersion = new VersionDescriptor; tempVersion->szName = xmlFile->getAttributeValue("name"); tempVersion->nMajorVersion = xmlFile->getAttributeValueAsInt("major"); tempVersion->nMinorVersion = xmlFile->getAttributeValueAsInt("minor"); tempVersion->nRevisionNumber = xmlFile->getAttributeValueAsInt("rev"); tempVersion->nVersionType = xmlFile->getAttributeValueAsInt("type"); tempVersion->szFileName = xmlFile->getAttributeValue("file"); tempVersion->nUpdateID = xmlFile->getAttributeValueAsInt("uid"); tempVersion->nFileType = FILETYPE_SKIN; // Insert data into xmlDoc version descriptor map xmlDoc.xmlDescriptors.insert(map<int, VersionDescriptor>::value_type(tempVersion->nUpdateID, *tempVersion)); delete tempVersion; } } DebugMsg("AutoUpdater", "Version Definition File: Skin Data Loaded: %d", xmlDoc.xmlHeader.updHeader.skinTotal); // Parse the Skin update data and place into version descriptors xmlFile->restart(); while(!EndAttribute(xmlFile, "PluginUpdate")) { if(StartAttribute(xmlFile, "Plugin")) { tempVersion = new VersionDescriptor; tempVersion->szName = xmlFile->getAttributeValue("name"); tempVersion->nMajorVersion = xmlFile->getAttributeValueAsInt("major"); tempVersion->nMinorVersion = xmlFile->getAttributeValueAsInt("minor"); tempVersion->nRevisionNumber = xmlFile->getAttributeValueAsInt("rev"); tempVersion->nVersionType = xmlFile->getAttributeValueAsInt("type"); tempVersion->szFileName = xmlFile->getAttributeValue("file"); tempVersion->nUpdateID = xmlFile->getAttributeValueAsInt("uid"); tempVersion->nFileType = FILETYPE_PLUGIN; // Insert data into xmlDoc version descriptor map xmlDoc.xmlDescriptors.insert(map<int, VersionDescriptor>::value_type(tempVersion->nUpdateID, *tempVersion)); delete tempVersion; } } DebugMsg("AutoUpdater", "Version Definition File: Plugin Data Loaded: %d", xmlDoc.xmlHeader.updHeader.pluginTotal); // Parse the ChangeLog update data and place into version descriptors xmlFile->restart(); tempChangelog = new ChangelogDescriptor; while(!EndAttribute(xmlFile, "Update")) { if(StartAttribute(xmlFile, "Changelog")) { tempChangelog->szName = xmlFile->getAttributeValue("name"); tempChangelog->szDate = xmlFile->getAttributeValue("date"); string key, val; while (!EndAttribute(xmlFile, "Changelog")) { key = xmlFile->getNodeName(); key = xmlFile->getNodeData(); if (StartAttribute(xmlFile, key.c_str())) { val = xmlFile->getSubNodeData(); if(strcmp(make_lowercaseA(key).c_str(), "data")==0) { tempChangelog->szLogData = val; } } } } } // Insert data into xmlDoc version descriptor map xmlDoc.xmlChangeLog = *tempChangelog; delete tempChangelog; DebugMsg("AutoUpdater", "Version Definition File: Plugin Data Loaded: %d", xmlDoc.xmlHeader.updHeader.pluginTotal); return S_OK; }