使用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
#include "StdAfx.h"
#include "MBDownloadFileInfo.h"
 
IMPLEMENT_DYNAMIC(CMBDownloadFileInfo, CMBBaseObj)
 
CMBDownloadFileInfo::CMBDownloadFileInfo(void)
{
    m_nStatus             = Status_None;            // ×´Ì¬  
    m_nFileSize              = 0;                      // Îļþ´óС 
    m_nIsDir              = 0;                      // 1ÊÇĿ¼£¬0 ²»ÊÇ  
    m_nTrID                  = 0; 
    m_nTransRate          = 0;     // ´«ÊäËÙÂÊ
    m_nOldTickCount       = 0;
    m_nOldTranferedSize   = 0; 
    m_nCabinetType        = 0;
}
 
 
CMBDownloadFileInfo::~CMBDownloadFileInfo(void)
{
}
 
void CMBDownloadFileInfo::SetStatus( int nStatus )
{
    CSingleLock        lock( &m_cs, true );
 
    if(  m_nStatus == Status_Delete || m_nStatus == Status_DeleteOnQueue )
        return ;
    m_nStatus = nStatus;
}
 
int  CMBDownloadFileInfo::GetStatus()
{
    CSingleLock        lock( &m_cs, true );
    return m_nStatus;
}
 
//void CMBDownloadFileInfo::SetMD5(CString strMD5)
//{
//    CSingleLock        lock( &m_cs, true );
//    
//    m_strMD5 = strMD5;
//}
//
//CString CMBDownloadFileInfo::GetMD5()
//{
//    CSingleLock        lock( &m_cs, true );
//    return m_strMD5;
//}
 
void CMBDownloadFileInfo::SetErr(CString strErr)
{
    CSingleLock        lock( &m_cs, true );
    m_strErr = strErr;
}
 
CString CMBDownloadFileInfo::GetErr()
{
    CSingleLock        lock( &m_cs, true );
    return m_strErr;
}
 
 
 
void CMBDownloadFileInfo::SetTrID( int nTrID )
{
    CSingleLock        lock( &m_cs, true );
    m_nTrID = nTrID;
}
 
int CMBDownloadFileInfo::GetTrID()
{
    CSingleLock        lock( &m_cs, true );
 
    return m_nTrID;
}
 
void CMBDownloadFileInfo::SetLocalPath(CString strLocalPath)
{
    CSingleLock        lock( &m_cs, true );
    m_strLocalPath = strLocalPath;
}
 
CString CMBDownloadFileInfo::GetLocalPath()
{
    CSingleLock        lock( &m_cs, true );
    return m_strLocalPath;
}
 
 
CString CMBDownloadFileInfo::GetFileType()
    CSingleLock        lock( &m_cs, true );
    return CStrFileUtils::GetFileExtName(m_strLocalPath);
}
 
CString CMBDownloadFileInfo::GetFileName()
{
    CSingleLock        lock( &m_cs, true );
    return CStrFileUtils::GetFileName(m_strLocalPath);
}
 
 CString CMBDownloadFileInfo::GetFullFileName()
 {
     CSingleLock        lock( &m_cs, true );
     return m_strLocalPath;
 }
 
CString CMBDownloadFileInfo::GetDownloadFileName()
{  
    CSingleLock        lock( &m_cs, true );
 
    CString strName; 
    CString strPath;
    CString strFileName;
    CString strFileType;
 
    strFileType = GetFileType();  
    strPath = CStrFileUtils::GetPath(m_strLocalPath);
    if(!CStrFileUtils::IsDirExit(strPath))
    {
        CStrFileUtils::CreateDir( strPath );
    }  
 
    //// Èç¹ûÀ´Ô´ÊDZ༭
    //if( m_strFrom == FCTN_ED )
    //{
    //    m_strLocalPath.Format(_T("%s\%s%s"),strPath,m_strFileID,strFileType);
    //    return m_strLocalPath;
    //}
 
 
    if( !CStrFileUtils::IsExist(m_strLocalPath) )
    { 
        return m_strLocalPath;
    }
 
    int nPos = CStrFileUtils::GetFileName(m_strLocalPath).Find(_T("."));
    strName = CStrFileUtils::GetFileName(m_strLocalPath).Mid(0,nPos);
 
    int nIndex = 1;
    while( true )
    {
        strFileName.Format(_T("%s\\%s(%d)%s"),strPath,strName,nIndex,strFileType);
        if( !CStrFileUtils::IsExist(strFileName) )
        {
            return strFileName;
        }
        nIndex++;
    }
    return strFileName;
}