#include "StdAfx.h" #include "MBShareCatalogMgr.h" CMBShareCatalogMgr::CMBShareCatalogMgr(void) { } CMBShareCatalogMgr::~CMBShareCatalogMgr(void) { } bool CMBShareCatalogMgr::AddCatalogInfo(CMBShareCatalogInfo *pCatalogInfo) { return AddCatalogObj(pCatalogInfo); } // ÒÆ³ýĿ¼ bool CMBShareCatalogMgr::RemoveAllCatalogInfo() { return RemoveAllCatalogObj(); } bool CMBShareCatalogMgr::ParseXml( CString &strXml,CString &strErrInfo ) { if( strXml.IsEmpty() ) { strXml = _T("CMBCatalogMgr::ParseXml,²ÎÊýΪ¿Õ£¡"); return false; } pugi::xml_document xmlDoc; if (!xmlDoc.load(strXml)) { return false; } pugi::xml_node form = xmlDoc.child(_T("Body")).child(_T("Catalog")); for(pugi::xml_node node = form; node; node = node.next_sibling(_T("Catalog"))) { CMBShareCatalogInfo *pCatalogInfo = new CMBShareCatalogInfo(); //pCatalogInfo->m_strTreeID = CStrFileUtils::GenerateGuid(); pCatalogInfo->m_strID = node.attribute(_T("ID")).value(); pCatalogInfo->m_strListType = node.attribute(_T("ListType")).value(); pCatalogInfo->m_strOrder = node.attribute(_T("Order")).value(); CString strSubCount = node.attribute(_T("SubCount")).value(); pCatalogInfo->m_nSubCount = _ttoi(strSubCount); CString strFileCount = node.attribute(_T("FileCount")).value(); pCatalogInfo->m_nFileCount = _ttoi(strFileCount); pCatalogInfo->m_strDtCreate = node.attribute(_T("DTCreate")).value(); pCatalogInfo->m_strHasAce = node.attribute(_T("HasAce")).value(); pCatalogInfo->m_strPermit = node.attribute(_T("Permit")).value(); pCatalogInfo->m_strGlobalEdit = node.attribute(_T("GlobalEdit")).value(); pCatalogInfo->m_strMasterID = node.attribute(_T("MasterID")).value(); pCatalogInfo->m_strMasterName = node.attribute(_T("MasterName")).value(); pCatalogInfo->m_strName = node.child_value(_T("Name")); if( !AddCatalogInfo(pCatalogInfo) ) { // Èç¹û´æÔÚ ÖØÖà bLoadCatalog GetCatalogObj( pCatalogInfo->m_strID )->m_bLoadCatalog = false; GetCatalogObj( pCatalogInfo->m_strID )->m_nSubCount = pCatalogInfo->m_nSubCount; GetCatalogObj( pCatalogInfo->m_strID )->m_nFileCount = pCatalogInfo->m_nFileCount; delete pCatalogInfo; pCatalogInfo = NULL; } } return true; }