#include "StdAfx.h"
|
#include "MBBaseDocObj.h"
|
|
IMPLEMENT_DYNAMIC(CMBBaseDocObj, CMBAbstBaseObj)
|
|
CMBBaseDocObj::CMBBaseDocObj(void)
|
{
|
m_bGetDocInfo = false;
|
m_nSecretLvl = 0;
|
m_nFileSize = 0;
|
m_nFakeType = DOC_NONE;
|
}
|
|
|
CMBBaseDocObj::~CMBBaseDocObj(void)
|
{
|
|
}
|
|
CString CMBBaseDocObj::GetThumbUrlID( )
|
{
|
int nDotPos = m_strThumbURL.ReverseFind(_T('.'));
|
int nSlashPos = m_strThumbURL.ReverseFind(_T('\\'));
|
if( nDotPos == -1 || nSlashPos == -1 )
|
return _T("");
|
|
return m_strThumbURL.Mid(nSlashPos+1,nDotPos-nSlashPos-1);
|
}
|
|
bool CMBBaseDocObj::GetTags(CStringArray &arTags)
|
{
|
CMBStrOper::SplitString(m_strTags,_T(';'),arTags);
|
|
return true;
|
}
|
|
bool CMBBaseDocObj::AddTags( CString strTags )
|
{
|
if( m_strTags.IsEmpty() )
|
{
|
m_strTags += strTags;
|
return true;
|
}
|
|
int nPos = m_strTags.ReverseFind(_T(';'));
|
if( nPos == (m_strTags.GetLength() -1) )
|
{
|
m_strTags += strTags;
|
}else{
|
m_strTags += _T(";");
|
m_strTags += strTags;
|
}
|
return true;
|
}
|
|
bool CMBBaseDocObj::RemoveTag( CString strTag )
|
{
|
CString strTags;
|
CStringArray arTags;
|
GetTags(arTags);
|
for( int i = 0; i< arTags.GetCount();i++ )
|
{
|
CString strTmpTag = arTags[i];
|
if(strTmpTag == strTag )
|
continue;
|
strTags += strTmpTag;
|
strTags += _T(";");
|
}
|
m_strTags = strTags;
|
return true;
|
}
|
|
bool CMBBaseDocObj::IsInTags( CString strTag )
|
{
|
CStringArray arTags;
|
GetTags(arTags);
|
for( int i = 0; i< arTags.GetCount();i++ )
|
{
|
CString strTmpTag = arTags[i];
|
if(strTmpTag == strTag )
|
return true;
|
}
|
return false;
|
}
|
|
bool CMBBaseDocObj::IsLock()
|
{
|
m_strLocker = m_strLocker.Trim();
|
|
if( m_strLocker.IsEmpty() )
|
return false;
|
|
return true;
|
}
|
|
bool CMBBaseDocObj::ParseXML(CString &strXML,CString &strErrInfo)
|
{
|
if( strXML.IsEmpty() )
|
{
|
m_nSecretLvl = 10000; // ˵Ã÷ µ÷ÓÃGetDocInfoûÓзµ»ØÈκÎÐÅÏ¢,ÉèÖÃΪ10000£¬Ãܼ¶ºÜ´óµÄÒâ˼
|
return true;
|
}
|
pugi::xml_document xmlDoc;
|
if (!xmlDoc.load(strXML))
|
{
|
return false;
|
}
|
CString strSecretLvl; // Ãܼ¶
|
CString strName;
|
|
pugi::xml_node form = xmlDoc.child(_T("Doc"));
|
pugi::xml_node node = form;
|
strName = node.child_value(_T("Name"));
|
if( !strName.IsEmpty() )
|
{
|
m_strName = strName;
|
}
|
m_strCanDownload = node.attribute(_T("CanDownload")).value();
|
m_strVID = node.attribute(_T("VID")).value();
|
m_strVer = node.attribute(_T("Ver")).value();
|
strSecretLvl = node.attribute(_T("SecretLvl")).value();
|
m_nSecretLvl = _ttoi(strSecretLvl);
|
m_strSecretName = node.attribute(_T("SecretName")).value();
|
m_strCreatorName = node.attribute(_T("CreatorName")).value();
|
m_strDTCreate = node.attribute(_T("DTCreate")).value();
|
m_strModifier = node.attribute(_T("Modifier")).value();
|
m_strModifierName = node.attribute(_T("ModifierName")).value();
|
m_strDTModify = node.attribute(_T("DTModify")).value();
|
m_strFileMD5 = node.attribute(_T("FileMD5")).value();
|
m_strFileServer = node.attribute(_T("FileServer")).value();
|
m_strFileID = node.attribute(_T("FileID")).value();
|
m_strPdfFileID = node.attribute(_T("PdfFileID")).value();
|
m_strSwfFileID = node.attribute(_T("SwfFileID")).value();
|
m_strThumbFileID = node.attribute(_T("ThumbFileID")).value();
|
m_strCanEdit = node.attribute(_T("CanEdit")).value();
|
m_strVersion = node.attribute(_T("Version")).value();
|
|
|
return true;
|
}
|