#include "StdAfx.h"
|
#include "FolderMonitoring_08.h"
|
|
CFolderMonitoring_08::CFolderMonitoring_08( DWORD dwPeriod/*=50*/ )
|
{
|
|
}
|
|
CFolderMonitoring_08::~CFolderMonitoring_08( void )
|
{
|
|
}
|
|
BOOL CFolderMonitoring_08::PostProcessing( const VecString& vecFilePath, const SFolderMonitorParam& sMonitorParam )
|
{
|
for (constVecStringIt it=vecFilePath.begin(); it!=vecFilePath.end(); it++)
|
{
|
// 0.8 Only
|
// Image Copy½Ã Full Image Á¦¿Ü.
|
CString strSeparate =_T("");
|
AfxExtractSubString(strSeparate,*it,1,_T('_'));
|
|
if(strSeparate.CompareNoCase(_T("f")) == 0)
|
continue;
|
|
CString strExistFileName = sMonitorParam.strMonitorFolderPath + _T("\\") + *it;
|
|
// 1. ÆÄÀÏ Å©±â°¡ º¯ÇÏ´ÂÁö È®ÀÎ
|
BOOL bFind = FALSE;
|
ULONGLONG nStartLength = -1;
|
ULONGLONG nCurLength = 0;
|
do
|
{
|
CFileFind finder;
|
BOOL bFind = finder.FindFile(strExistFileName);
|
bFind = finder.FindNextFile();
|
nCurLength = finder.GetLength();
|
if ( (nStartLength!=-1) && ((nCurLength-nStartLength)==0) )
|
{
|
break;
|
}
|
nStartLength = nCurLength;
|
::Sleep(50);
|
} while (TRUE);
|
|
// 2. ÆÄÀÏÀ» ÈÄó¸® ÇÔ.
|
CString strNewFileName = sMonitorParam.strProcessFolderPath + _T("\\") + *it;
|
|
switch(sMonitorParam.nProcessType)
|
{
|
case MonitorProcessType_Copy: // copy
|
if (CopyFile(strExistFileName, strNewFileName, FALSE))
|
{
|
// º¹»ç½Ã¿¡´Â °á°ú ¹éÅÍ¿¡ ÆÄÀÏÀ̸§ ÀúÀåÇÔ.
|
SFolderMonitorResult result;
|
result.strProcessFileName = *it;
|
m_vecMonitorResult.push_back(result);
|
}
|
break;
|
|
case MonitorProcessType_Move: // move
|
if (MoveFile(strExistFileName, strNewFileName))
|
{
|
|
}
|
break;
|
}
|
|
::Sleep(10);
|
}
|
|
return TRUE;
|
}
|