使用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
#include "StdAfx.h"
#include "MBFileMD5Mgr.h"
 
 
CMBFileMD5Info::CMBFileMD5Info()
{
 
 
}
 
CMBFileMD5Info::~CMBFileMD5Info()
{
    
    
}
 
/////////////////////////////////////////////////
 
 
CMBFileMD5Mgr::CMBFileMD5Mgr(void)
{
    RemoveAllFileMD5Info();
}
 
 
CMBFileMD5Mgr::~CMBFileMD5Mgr(void)
{
    RemoveAllFileMD5Info();
}
 
bool  CMBFileMD5Mgr::AddFileMD5Info(CMBFileMD5Info *pFileMD5Info)
{
    CSingleLock        lock( &m_cs, true );
 
    if( NULL ==  pFileMD5Info || pFileMD5Info->m_strKey.IsEmpty() )
        return false;
 
    CMBFileMD5InfoMap::iterator    it;
    CString strKey;
 
    strKey = pFileMD5Info->m_strKey;
    it = m_mapFileMD5Info.find(strKey);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapFileMD5Info.end() )
        return false; 
    m_mapFileMD5Info[strKey] = pFileMD5Info;     
    return true;   
}
 
CMBFileMD5Info*   CMBFileMD5Mgr::GetFileMD5Info( CString strKey )
{
    CSingleLock        lock( &m_cs, true );
 
    if( strKey.IsEmpty() )
    {
        return NULL;
    }
 
    CMBFileMD5InfoMap::iterator    it;
    CMBFileMD5Info *pFileMD5Info = NULL;
 
    it = m_mapFileMD5Info.find(strKey);
 
    if( it!= m_mapFileMD5Info.end() )
        pFileMD5Info = it->second;
 
    return pFileMD5Info;  
}
 
// ÒƳý 
bool  CMBFileMD5Mgr::RemoveMD5Info( CString strKey )
{
    CSingleLock        lock( &m_cs, true );
 
    if( strKey.IsEmpty() )
        return false;
 
    CMBFileMD5InfoMap::iterator    it;
    CMBFileMD5Info *pFileMD5Info = NULL;
 
    it = m_mapFileMD5Info.find(strKey);
 
    if( it!= m_mapFileMD5Info.end() ){
        pFileMD5Info = it->second;
        m_mapFileMD5Info.erase(it);
        delete pFileMD5Info;
        pFileMD5Info = NULL;
    }
    return true;
}
 
bool   CMBFileMD5Mgr::RemoveAllFileMD5Info()
{
    CMBFileMD5InfoMap::iterator    it;
    CMBFileMD5Info *pFileMD5Info = NULL;
 
    for( it = m_mapFileMD5Info.begin();it != m_mapFileMD5Info.end();it++ )
    {
        pFileMD5Info = it->second;
        delete pFileMD5Info;
        pFileMD5Info = NULL;        
    }
    m_mapFileMD5Info.clear(); 
    return true;   
}
 
CString  CMBFileMD5Mgr::GetKey(  CString strFullPathFileName )
{
    return CStrFileUtils::GetMD5(strFullPathFileName);
}