使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#include "StdAfx.h"
#include "MBDocMgr.h"
 
 
CMBDocMgr::CMBDocMgr(void)
{
     
}
 
 
CMBDocMgr::~CMBDocMgr(void)
{
     
}
 
bool  CMBDocMgr::AddDocInfo(CMBDocInfo *pDocInfo)
{
     return AddDocObj(pDocInfo);
}
 
CMBDocInfo* CMBDocMgr::GetDocInfo( CString strID )
{
     
    return (CMBDocInfo*)GetDocObj(strID);  
}
 
bool CMBDocMgr::RemoveAllDocInfo()
{
    return RemoveAllDocObj();
}
 
// Çå¿Õ¹ÜÀíÆ÷
bool  CMBDocMgr::EmptyMgr()
{
    m_mapDocObj.clear();
    m_vecotrDocObj.clear();
    return true;
}
 
bool  CMBDocMgr::RelaceDoc( CMBDocInfo *pOldDocInfo,CMBDocInfo *pNewDocInfo )
{
    if( NULL == pNewDocInfo || NULL == pOldDocInfo || pNewDocInfo->m_strID.IsEmpty() )
        return false;
    
    CMBBaseDocObjMap::iterator    it;
    CString strID;
     
    bool bDelte = false;
     
    ////////////²Á³ý
    it = m_mapDocObj.find(pOldDocInfo->m_strID);
 
    if( it!= m_mapDocObj.end() )
    {
        bDelte = true;
        m_mapDocObj.erase(it);
    } 
 
    for( UINT i = 0;i < m_vecotrDocObj.size();i++ )
    {
        CMBBaseDocObj *pTmpDoc = m_vecotrDocObj[i];
        if( pTmpDoc->m_strID == pOldDocInfo->m_strID )
        {
            bDelte = true;
            m_vecotrDocObj[i] = pNewDocInfo; // Ìæ»»
            break;
        } 
    }
    ////////////²Á³ý 
    if( bDelte ){
        delete pOldDocInfo;
        pOldDocInfo = NULL;
    }
 
    ///////////// ·ÅÈëmap
    strID = pNewDocInfo->m_strID;
    it = m_mapDocObj.find(strID);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapDocObj.end() )
        return false;
 
    m_mapDocObj[strID] = pNewDocInfo; 
    ////////////////////////////////////////
     
    return true;
}
 
bool  CMBDocMgr::ParseXml( CString &strXml,CString &strErrInfo )
{
    if( strXml.IsEmpty() )
    { 
        strErrInfo = _T("CMBDocMgr::ParseXml,²ÎÊýstrXmlΪ¿Õ£¡");
        return false;
    }
 
    CString               strFileSize;
    pugi::xml_document    xmlDoc;
 
    if (!xmlDoc.load(strXml))   
    {  
        return false;
    }   
    pugi::xml_node form  = xmlDoc.child(_T("Body")).child(_T("Doc")); 
    for(pugi::xml_node node = form; node; node = node.next_sibling(_T("Doc")))
    {
        CMBDocInfo *pDocInfo = new CMBDocInfo();  
        pDocInfo->m_strID        = node.attribute(_T("ID")).value();
        pDocInfo->m_strName            = node.child_value(_T("Name"));
        pDocInfo->m_strStatus    = node.attribute(_T("Status")).value();
        pDocInfo->m_strFileType  = node.attribute(_T("FileType")).value();
        pDocInfo->m_strFileTime  = node.attribute(_T("FileTime")).value(); 
        strFileSize              = node.attribute(_T("FileSize")).value();
        pDocInfo->m_nFileSize    = _ttoi(strFileSize);
        pDocInfo->m_strDTCreate  = node.attribute(_T("DTCreate")).value();        
        pDocInfo->m_strCreatorID = node.attribute(_T("CreatorID")).value();
        pDocInfo->m_strCreatorName = node.attribute(_T("CreatorName")).value();
 
        pDocInfo->m_strLocker      = node.attribute(_T("Locker")).value(); 
        pDocInfo->m_strLockerName  = node.attribute(_T("LockerName")).value(); 
        pDocInfo->m_strLockTime    = node.attribute(_T("LockTime")).value(); 
        //pDocInfo->m_strIsLock    = node.attribute(_T("IsLock")).value(); 
        pDocInfo->m_strTags      = node.attribute(_T("Tags")).value();
        pDocInfo->m_strName      = node.child_value(_T("Name"));  
        // ExtAttr
        pDocInfo->m_strCN_C_ACTIVE_VER  = node.child(_T("ExtAttr")).child_value(_T("CN_C_ACTIVE_VER"));  
        pDocInfo->m_strCN_N_DOWNLOAD    = node.child(_T("ExtAttr")).child_value(_T("CN_N_DOWNLOAD"));   
        pDocInfo->m_strCN_N_FILE_SIZE   = node.child(_T("ExtAttr")).child_value(_T("CN_N_FILE_SIZE"));   
        pDocInfo->m_strCN_S_CREATOR     = node.child(_T("ExtAttr")).child_value(_T("CN_S_CREATOR"));   
        pDocInfo->m_strCN_S_VERSION     = node.child(_T("ExtAttr")).child_value(_T("CN_S_VERSION"));   
        pDocInfo->m_strCN_T_CREATE      = node.child(_T("ExtAttr")).child_value(_T("CN_T_CREATE"));  
        // ThumbURL
        pDocInfo->m_strThumbURL         = node.child_value(_T("ThumbURL"));
 
        if( !AddDocInfo(pDocInfo) )
        {
            // ÖØÖÃËõÂÔͼµØÖ·
            GetDocInfo( pDocInfo->m_strID )->m_strThumbURL = pDocInfo->m_strThumbURL;
            delete pDocInfo;
            pDocInfo = NULL;
        }
    } 
 
    return true; 
}
 
bool  CMBDocMgr::ParseDocListXml( CString &strXml,CString &strErrInfo )
{
    if( strXml.IsEmpty() )
    { 
        strErrInfo = _T("CMBDocMgr::ParseDocListXml,²ÎÊýstrXmlΪ¿Õ£¡");
        return false;
    }
 
    CString               strFileSize;
    pugi::xml_document    xmlDoc; 
 
    if (!xmlDoc.load(strXml))   
    {  
        return false;
    }   
    pugi::xml_node form  = xmlDoc.child(_T("Body")).child(_T("DocList")).child(_T("Doc")); 
    for(pugi::xml_node node = form; node; node = node.next_sibling(_T("Doc")))
    {
        CMBDocInfo *pDocInfo = new CMBDocInfo();  
        // DELETE
        pDocInfo->m_strDeleteBy = node.attribute(_T("DeleteBy")).value();
        pDocInfo->m_strDeleteByName = node.attribute(_T("DeleteByName")).value();
        pDocInfo->m_strDeleteTime = node.attribute(_T("DeleteTime")).value();
 
        // Îĵµ¹ñÐÅÏ¢
        pDocInfo->m_strCabinetID = node.attribute(_T("DeleteBy")).value();
        pDocInfo->m_strDeleteByName = node.attribute(_T("DeleteByName")).value();
        pDocInfo->m_strDeleteTime = node.attribute(_T("DeleteTime")).value();
        // »ù±¾ÐÅÏ¢
        pDocInfo->m_strID        = node.attribute(_T("ID")).value();
        pDocInfo->m_strName            = node.child_value(_T("Name"));
        pDocInfo->m_strStatus    = node.attribute(_T("Status")).value();
        pDocInfo->m_strFileType  = node.attribute(_T("FileType")).value();
        pDocInfo->m_strFileTime  = node.attribute(_T("FileTime")).value(); 
        strFileSize              = node.attribute(_T("FileSize")).value();
        pDocInfo->m_nFileSize    = _ttoi(strFileSize);
        pDocInfo->m_strDTCreate  = node.attribute(_T("DTCreate")).value();        
        pDocInfo->m_strCreatorID = node.attribute(_T("CreatorID")).value();
        pDocInfo->m_strCreatorName = node.attribute(_T("CreatorName")).value();
 
        pDocInfo->m_strLocker      = node.attribute(_T("Locker")).value(); 
        pDocInfo->m_strLockerName  = node.attribute(_T("LockerName")).value(); 
        pDocInfo->m_strLockTime    = node.attribute(_T("LockTime")).value(); 
        //pDocInfo->m_strIsLock    = node.attribute(_T("IsLock")).value(); 
        pDocInfo->m_strTags      = node.attribute(_T("Tags")).value();
        pDocInfo->m_strName      = node.child_value(_T("Name"));  
        // ExtAttr
        pDocInfo->m_strCN_C_ACTIVE_VER  = node.child(_T("ExtAttr")).child_value(_T("CN_C_ACTIVE_VER"));  
        pDocInfo->m_strCN_N_DOWNLOAD    = node.child(_T("ExtAttr")).child_value(_T("CN_N_DOWNLOAD"));   
        pDocInfo->m_strCN_N_FILE_SIZE   = node.child(_T("ExtAttr")).child_value(_T("CN_N_FILE_SIZE"));   
        pDocInfo->m_strCN_S_CREATOR     = node.child(_T("ExtAttr")).child_value(_T("CN_S_CREATOR"));   
        pDocInfo->m_strCN_S_VERSION     = node.child(_T("ExtAttr")).child_value(_T("CN_S_VERSION"));   
        pDocInfo->m_strCN_T_CREATE      = node.child(_T("ExtAttr")).child_value(_T("CN_T_CREATE"));  
        // ThumbURL
        pDocInfo->m_strThumbURL         = node.child_value(_T("ThumbURL"));
 
        if( !AddDocInfo(pDocInfo) )
        {
            // ÖØÖÃËõÂÔͼµØÖ·
            GetDocInfo( pDocInfo->m_strID )->m_strThumbURL = pDocInfo->m_strThumbURL;
            delete pDocInfo;
            pDocInfo = NULL;
        }
    } 
 
    return true; 
}