使用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
#include "StdAfx.h"
#include "MBFileSvrMgr.h"
#include "MBBaseDef.h"
 
CMBFileSvrMgr::CMBFileSvrMgr(void)
{
    RemoveAllFileSvrInfo();
}
 
 
CMBFileSvrMgr::~CMBFileSvrMgr(void)
{
    RemoveAllFileSvrInfo();
}
 
bool   CMBFileSvrMgr::AddFileSvrInfo(CMBFileSvrInfo *pFileSvrInfo)
{
    if( NULL ==  pFileSvrInfo || pFileSvrInfo->m_strFlag.IsEmpty() )
        return false;
 
    CMBFileSvrInfoMap::iterator    it;
    CString strFlag;
 
    strFlag = pFileSvrInfo->m_strFlag;
 
    it = m_mapFileSvrInfo.find(strFlag);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapFileSvrInfo.end() )
        return false;
 
    m_mapFileSvrInfo[strFlag] = pFileSvrInfo;
     
    return true;
}
 
CMBFileSvrInfo * CMBFileSvrMgr::GetFileSvrInfo( CString strFlag )
{
    if( strFlag.IsEmpty() )
    {
        return NULL;
    }
 
    CMBFileSvrInfoMap::iterator    it;
    CMBFileSvrInfo *pFileSvrInfo = NULL;
 
    it = m_mapFileSvrInfo.find(strFlag);
 
    if( it!= m_mapFileSvrInfo.end() )
        pFileSvrInfo = it->second;
 
    return pFileSvrInfo; 
}
 
bool   CMBFileSvrMgr::RemoveAllFileSvrInfo()
{
    CMBFileSvrInfoMap::iterator    it;
    CMBFileSvrInfo *pFileSvrInfo = NULL;
 
    for( it = m_mapFileSvrInfo.begin();it != m_mapFileSvrInfo.end();it++ )
    {
        pFileSvrInfo = it->second;
        delete pFileSvrInfo;
        pFileSvrInfo = NULL;        
    }
    m_mapFileSvrInfo.clear();
     
    return true;   
}
 
void  CMBFileSvrMgr::GetMapFileSvr( CMBFileSvrInfoMap &mapFileSvrInfo )
{
    mapFileSvrInfo.clear();
    mapFileSvrInfo = m_mapFileSvrInfo;
}
 
bool CMBFileSvrMgr::ParseXml(CString strOrgServer, CString strXml,CString &strErrInfo )
{
 
    pugi::xml_document    xmlDoc;    
    if (!xmlDoc.load(strXml))   
    {  
        return false;
    }    
    pugi::xml_node  form = xmlDoc.child(_T("Body")).child(_T("FileService"));
 
    for(pugi::xml_node node = form; node; node = node.next_sibling(_T("FileService")))
    { 
        CMBFileSvrInfo *pSvrInfo = new CMBFileSvrInfo();
        pSvrInfo->m_strFlag        = node.attribute(_T("Flag")).value();
        pSvrInfo->m_strExterIP     = node.attribute(_T("ExterIP")).value();
        pSvrInfo->m_strExterPort   = node.attribute(_T("ExterPort")).value();
        if( _tstol(pSvrInfo->m_strExterPort) < 0)
            pSvrInfo->m_strExterPort.Format(_T("%d"),DEFAULTPORT_FILE);
        pSvrInfo->m_strInterIP     = form.attribute(_T("InterIP")).value();
        pSvrInfo->m_strInterPort   = form.attribute(_T("InterPort")).value();
        if( _tstol(pSvrInfo->m_strInterPort) < 0)
            pSvrInfo->m_strInterPort.Format(_T("%d"),DEFAULTPORT_FILE);
        pSvrInfo->m_strInterURL    = node.child_value(_T("InterURL"));
        pSvrInfo->m_strExterURL       = form.child_value(_T("ExterURL")); 
        pSvrInfo->CheckServerInfo(strOrgServer);
        if( !AddFileSvrInfo(pSvrInfo) )
        {
            delete pSvrInfo;
            pSvrInfo = NULL;
        }
    }
 
    return true;
}