使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
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
214
215
216
217
218
219
220
221
222
223
224
#include "StdAfx.h"
#include "MBFileLogoMgr.h"
 
////////////// ÎļþlogoÐÅÏ¢ ///////////////////////
CMBFileLogoInfo::CMBFileLogoInfo(void)
{
 
 
}
 
CMBFileLogoInfo::~CMBFileLogoInfo(void)
{
 
 
}
 
// ÓÐÎļþÀàÐÍ
bool           CMBFileLogoInfo::HasFilType( CString strFileType )
{
    CString strTmpFileType;
 
    strFileType = strFileType.Trim();
    int nCount =  m_arFileType.GetCount();
    for( int i = 0;i < nCount;i++ )
    {
        strTmpFileType = m_arFileType[i];
        if( strTmpFileType.CompareNoCase(strFileType) ==0 )
            return true;    
    }
    return false;
}
 
///////////// Îļþlogo¹ÜÀíÆ÷ ////////////////////////
CMBFileLogoMgr::CMBFileLogoMgr(void)
{
}
 
 
CMBFileLogoMgr::~CMBFileLogoMgr(void)
{
}
 
// µÃµ½ÎļþlogoÐÅÏ¢
CMBFileLogoInfo *CMBFileLogoMgr::GetFileLogoInfo( CString strName )
{  
    strName = strName.Trim();
    if( strName.IsEmpty() )
    {
        return NULL;
    }
 
    CMBFileLogoInfoMap::iterator    it;
    CMBFileLogoInfo *pFileLogoInfo = NULL;
 
    it = m_mapFileLogoInfo.find(strName);
 
    if( it!= m_mapFileLogoInfo.end() )
        pFileLogoInfo = it->second;
 
    return pFileLogoInfo;   
}
 
// µÃµ½ÎļþlogoÃû³Æ
CString  CMBFileLogoMgr::GetFileLogoName( CString strFileType )
{
    int nPos = strFileType.Find(_T("."));
    if( nPos == 0 )
    {
        strFileType = strFileType.Right(strFileType.GetLength()-1);
    }
 
    CMBFileLogoInfoMap::iterator    it;
    CMBFileLogoInfo *pFileLogoInfo = NULL;
 
    for( it = m_mapFileLogoInfo.begin();it != m_mapFileLogoInfo.end();it++ )
    {
        pFileLogoInfo = it->second;
        if( pFileLogoInfo->HasFilType(strFileType) )
            return pFileLogoInfo->m_strName;
    }
 
    return _T("OtherType");
}
 
// Ìí¼ÓÎļþlogoÐÅÏ¢
bool  CMBFileLogoMgr::AddFileLogoInfo( CMBFileLogoInfo *pFileLogoInfo )
    if( NULL ==  pFileLogoInfo || pFileLogoInfo->m_strName.IsEmpty() )
        return false;
 
    CMBFileLogoInfoMap::iterator    it; 
    CString strName;
 
    strName = pFileLogoInfo->m_strName;
    it = m_mapFileLogoInfo.find(strName);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapFileLogoInfo.end() )
        return false; 
    m_mapFileLogoInfo[strName] = pFileLogoInfo;     
    return true;   
}
 
// ÒƳýÎļþlogoÐÅÏ¢ 
bool  CMBFileLogoMgr::RemoveAllFileLogoInfo()
{
    CMBFileLogoInfoMap::iterator    it;
    CMBFileLogoInfo *pFileLogoInfo = NULL;
 
    for( it = m_mapFileLogoInfo.begin();it != m_mapFileLogoInfo.end();it++ )
    {
        pFileLogoInfo = it->second;
        delete pFileLogoInfo;
        pFileLogoInfo = NULL;        
    }
    m_mapFileLogoInfo.clear(); 
    return true;   
}
 
// µÃµ½´óͼƬ
SStringT  CMBFileLogoMgr::GetFileLogoBigIcon( CString strFileType )
{
    SStringT strTmpSkin;
    strTmpSkin.Format(_T("%sBigIcon\\%s.png"),m_strSkinPath,GetFileLogoName(strFileType));
    return strTmpSkin;
}
 
 // µÃµ½Ð¡Í¼Æ¬
SStringT  CMBFileLogoMgr::GetFileLogoSmallIcon( CString strFileType )
{
    SStringT strTmpSkin;
    strTmpSkin.Format(_T("%sSmallIcon\\%s.png"),m_strSkinPath,GetFileLogoName(strFileType));
    return strTmpSkin;
}
 // µÃµ½ÖÐͼƬ
SStringT  CMBFileLogoMgr::GetFileLogoMiddleIcon( CString strFileType )
{
    SStringT strTmpSkin;
    strTmpSkin.Format(_T("%sMiddleIcon\\%s.png"),m_strSkinPath,GetFileLogoName(strFileType));
    return strTmpSkin;
}
// ½âÎöxmlÎļþÐÅÏ¢
bool  CMBFileLogoMgr::ParseXml( CString  &strErrInfo )
{
    CString strWorkDir   =    CBaseCommFun::GetWorkDir();
    CString strFileName;
    pugi::xml_document    xmlDoc;
 
    m_strSkinPath.Format( _T("%s\\skin\\"),strWorkDir );
     
    strFileName       = strWorkDir + _T("\\skin\\FileLogo.xml");
    
    if (!xmlDoc.load_file(strFileName))   
    {  
        strErrInfo = _T("¼ÓÔØÎļþ ") + strFileName + _T(" Ê§°Ü£¡");
        return false;
    }   
    pugi::xml_node form  = xmlDoc.child(_T("Body")).child(_T("FileLogo")); 
    for(pugi::xml_node node = form; node; node = node.next_sibling(_T("FileLogo")))
    {
        CMBFileLogoInfo *pFileLogoInfo = new CMBFileLogoInfo();
        pFileLogoInfo->m_strName = node.attribute(_T("Name")).value();
 
        form  = node.child(_T("FileType")); 
        for(pugi::xml_node nodeTmp = form; nodeTmp; nodeTmp = nodeTmp.next_sibling(_T("FileType")))
        {
            pFileLogoInfo->m_arFileType.Add(nodeTmp.child_value());             
        }
 
        if( !AddFileLogoInfo( pFileLogoInfo ) )
        {
            delete pFileLogoInfo;
            pFileLogoInfo = NULL;
        } 
    } 
      
    return true;
}
 
//ISkinObj *CMBFileLogoMgr::GetFileLogoSmallIconSkin( CString strFileType )
//{
//    SStringT _skinId = L"skin.richedit.msgwaitimg";
//    ISkinObj* pSkin =NULL;
//    if (!ImageProvider::IsExist(_skinId))
//    {
//        pSkin = GETSKIN(_skinId, 100);
//        pSkin->AddRef();
//        if (pSkin)
//        {
//            ImageProvider::Insert(_skinId, pSkin);
//        }
//    }
//    _skinId = L"skin.richedit.msgerrorimg";
//    if (!ImageProvider::IsExist(_skinId))
//    {
//        pSkin = GETSKIN(_skinId, 100);
//        pSkin->AddRef();
//        if (pSkin)
//        {
//            ImageProvider::Insert(_skinId, pSkin);
//        }
//    }
//     SAntialiasSkin* pSkin = new SAntialiasSkin();
//    pSkin->SetRoundCorner(5, 5, 5, 5); // Ìí¼ÓÔ²½Ç´¦Àí
//    if (pSkin->LoadFromFile(info.AvatarPath))
//    {
//        ImageProvider::Insert(info.AvatarId, pSkin);
//    }
//    else
//    {
//        delete pSkin;
//    }
//}
//
//ISkinObj *CMBFileLogoMgr::GetFileLogoMiddleIconSkin( CString strFileType )
//{
//}
 
// µÃµ½ÎļþlogoÃû³Æ
CMBFileLogoInfoMap * CMBFileLogoMgr::GetFileLogoMap (  )
{
    return &m_mapFileLogoInfo;
    
}