SDC C-Project CF Review 프로그램
LYW
2021-10-14 e8ba1e78e72f3f7ec2841f55fd90253b4dc414df
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
#include "StdAfx.h"
#include "NfsDriveRenewer.h"
 
 
CNfsDriveRenewer::CNfsDriveRenewer(DWORD dwInterval, INfsDriveRenewer2Parent* pNDR2P) : m_pNDR2P(pNDR2P), CTimerThreadPools(dwInterval)
{
}
 
CNfsDriveRenewer::~CNfsDriveRenewer(void)
{
 
}
 
void CNfsDriveRenewer::AddDrivePath( const CString& strDrivePath )
{
    CSingleLock localLock(&m_csDrivePath);
    localLock.Lock();
 
    m_vecDrivePath.push_back(strDrivePath);
}
 
void CNfsDriveRenewer::TimerThreadProcess( PVOID pParameter )
{
    CSingleLock localLock(&m_csDrivePath);
    localLock.Lock();
 
    RenewDrivePath();
}
 
void CNfsDriveRenewer::RenewDrivePath()
{
    for (VectorStringIt it=m_vecDrivePath.begin(); it!=m_vecDrivePath.end(); it++)
    {
        CString strDrivePath = *it;
 
        if (strDrivePath.GetLength()<1) continue;
        CString strFilename = strDrivePath + _T("\\RenewFile.txt");
 
        FILE *fp = NULL;
        _tfopen_s(&fp, strFilename, _T("w"));
        if (fp==NULL) 
        {
            if (m_pNDR2P)
            {
                m_pNDR2P->NDR2P_SendDriveDisconnected(strDrivePath);
            }
            continue;
        }
 
        CTime time = CTime::GetCurrentTime();
        _ftprintf_s(fp, _T("%04d-%02d-%02d - %02d:%02d:%02d"), 
            time.GetYear(), time.GetMonth(), time.GetDay(),
            time.GetHour(), time.GetMinute(), time.GetSecond());
 
        fclose(fp);
    }
}
 
BOOL CNfsDriveRenewer::StartThread()
{
    return CTimerThreadPools::StartThread();
}
 
void CNfsDriveRenewer::StopThread()
{
    CTimerThreadPools::StopThread();
}