#include "StdAfx.h" #include "MBCabinetMgr.h" CMBCabinetMgr::CMBCabinetMgr(void) { } CMBCabinetMgr::~CMBCabinetMgr(void) { } bool CMBCabinetMgr::AddCabinetInfo(CMBCabinetInfo *pCabinetInfo) { return AddCabinetObj(pCabinetInfo); } CMBCabinetInfo* CMBCabinetMgr::GetCabinetInfo( CString strID ) { return (CMBCabinetInfo*)GetCabinetObj( strID ); } //bool CMBCabinetMgr::RemoveAllCabinetInfo() //{ // CMBCabinetInfoMap::iterator it; // CMBCabinetInfo *pCabinetInfo = NULL; // // for( it = m_mapCabinetInfo.begin();it != m_mapCabinetInfo.end();it++ ) // { // pCabinetInfo = it->second; // delete pCabinetInfo; // pCabinetInfo = NULL; // } // m_mapCabinetInfo.clear(); // //m_listCabinetInfo.clear(); // m_vectorCabinetInfo.clear(); // return true; //} bool CMBCabinetMgr::ParseXml( CString &strXml,CString &strErrInfo ) { if( strXml.IsEmpty() ) { strErrInfo = _T("½âÎöµÄxmlΪ¿Õ£¡"); return false; } pugi::xml_document xmlDoc; if (!xmlDoc.load(strXml)) { return false; } pugi::xml_node form = xmlDoc.child(_T("Body")).child(_T("Cabinet")); for(pugi::xml_node node = form; node; node = node.next_sibling(_T("Cabinet"))) { CMBCabinetInfo *pCabinetInfo = new CMBCabinetInfo(); //pCabinetInfo->m_strTreeID = CStrFileUtils::GenerateGuid(); pCabinetInfo->m_strID = node.attribute(_T("ID")).value(); pCabinetInfo->m_strStatus = node.attribute(_T("Status")).value(); pCabinetInfo->m_strOrder = node.attribute(_T("Order")).value(); pCabinetInfo->m_strPType = node.attribute(_T("PType")).value(); pCabinetInfo->m_strPID = node.attribute(_T("PID")).value(); pCabinetInfo->m_strPName = node.attribute(_T("PName")).value(); pCabinetInfo->m_strCapacity = node.attribute(_T("Capacity")).value(); pCabinetInfo->m_strUsed = node.attribute(_T("Used")).value(); /*CString strFileCount = node.attribute(_T("FileCount")).value(); pCabinetInfo->m_nFileCount = _ttoi(strFileCount);*/ CString strSubCount = node.attribute(_T("SubCount")).value(); pCabinetInfo->m_nSubCount = _ttoi(strSubCount); pCabinetInfo->m_strBkColor = node.attribute(_T("BkColor")).value(); pCabinetInfo->m_strFileSFlag = node.attribute(_T("FileSFlag")).value(); pCabinetInfo->m_strDocState = node.attribute(_T("DocState")).value(); pCabinetInfo->m_strAdminLogin = node.attribute(_T("AdminLogin")).value(); pCabinetInfo->m_strAdminName = node.attribute(_T("AdminName")).value(); pCabinetInfo->m_strRecycleAdminLogin = node.attribute(_T("RecycleAdminLogin")).value(); pCabinetInfo->m_strRecycleAdminName = node.attribute(_T("RecycleAdminName")).value(); pCabinetInfo->m_strArchiveAdmin = node.attribute(_T("ArchiveAdmin")).value(); pCabinetInfo->m_strImgFontStyle = node.attribute(_T("ImgFontStyle")).value(); pCabinetInfo->m_strHasAce = node.attribute(_T("HasAce")).value(); pCabinetInfo->m_strPermit = node.attribute(_T("Permit")).value(); pCabinetInfo->m_strEnableDocMonitor = node.attribute(_T("EnableDocMonitor")).value(); pCabinetInfo->m_strFTR = node.attribute(_T("FTR")).value(); pCabinetInfo->m_strName = node.child_value(_T("Name")); pCabinetInfo->m_strMemo = node.child_value(_T("Memo")); pCabinetInfo->m_pRecycleBinInfo->m_strCabinetID = pCabinetInfo->m_strID; if( !AddCabinetInfo(pCabinetInfo) ) { // Èç¹û´æÔÚ ÖØÖà bLoadCatalog GetCabinetInfo( pCabinetInfo->m_strID )->m_bLoadCatalog = false; //GetCabinetInfo( pCabinetInfo->m_strID )->m_nFileCount = pCabinetInfo->m_nFileCount; GetCabinetInfo( pCabinetInfo->m_strID )->m_nSubCount = pCabinetInfo->m_nSubCount; delete pCabinetInfo; pCabinetInfo = NULL; } } return true; }