本文整理汇总了C++中CKnownFile::IsLargeFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CKnownFile::IsLargeFile方法的具体用法?C++ CKnownFile::IsLargeFile怎么用?C++ CKnownFile::IsLargeFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKnownFile
的用法示例。
在下文中一共展示了CKnownFile::IsLargeFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
void CKnownFileList::Save()
{
if (thePrefs.GetLogFileSaving())
AddDebugLogLine(false, _T("Saving known files list file \"%s\""), KNOWN_MET_FILENAME);
m_nLastSaved = ::GetTickCount();
CString fullpath = thePrefs.GetMuleDirectory(EMULE_CONFIGDIR);
fullpath += KNOWN_MET_FILENAME;
CSafeBufferedFile file;
CFileException fexp;
if (!file.Open(fullpath, CFile::modeWrite|CFile::modeCreate|CFile::typeBinary|CFile::shareDenyWrite, &fexp)){
CString strError(_T("Failed to save ") KNOWN_MET_FILENAME _T(" file"));
TCHAR szError[MAX_CFEXP_ERRORMSG];
if (fexp.GetErrorMessage(szError, ARRSIZE(szError))){
strError += _T(" - ");
strError += szError;
}
LogError(LOG_STATUSBAR, _T("%s"), strError);
}
else{
setvbuf(file.m_pStream, NULL, _IOFBF, 16384);
try{
file.WriteUInt8(0); // we will write the version tag later depending if any large files are on the list
UINT nRecordsNumber = 0;
bool bContainsAnyLargeFiles = false;
file.WriteUInt32(nRecordsNumber);
POSITION pos = m_Files_map.GetStartPosition();
while( pos != NULL )
{
CKnownFile* pFile;
CCKey key;
m_Files_map.GetNextAssoc( pos, key, pFile );
if (!thePrefs.IsRememberingDownloadedFiles() && !theApp.sharedfiles->IsFilePtrInList(pFile)){
continue;
}
else{
pFile->WriteToFile(&file);
nRecordsNumber++;
if (pFile->IsLargeFile())
bContainsAnyLargeFiles = true;
}
}
file.SeekToBegin();
file.WriteUInt8(bContainsAnyLargeFiles ? MET_HEADER_I64TAGS : MET_HEADER);
file.WriteUInt32(nRecordsNumber);
if (thePrefs.GetCommitFiles() >= 2 || (thePrefs.GetCommitFiles() >= 1 && !theApp.emuledlg->IsRunning())){
file.Flush(); // flush file stream buffers to disk buffers
if (_commit(_fileno(file.m_pStream)) != 0) // commit disk buffers to disk
AfxThrowFileException(CFileException::hardIO, GetLastError(), file.GetFileName());
}
file.Close();
}
catch(CFileException* error){
CString strError(_T("Failed to save ") KNOWN_MET_FILENAME _T(" file"));
TCHAR szError[MAX_CFEXP_ERRORMSG];
if (error->GetErrorMessage(szError, ARRSIZE(szError))){
strError += _T(" - ");
strError += szError;
}
LogError(LOG_STATUSBAR, _T("%s"), strError);
error->Delete();
}
}
if (thePrefs.GetLogFileSaving())
AddDebugLogLine(false, _T("Saving known files list file \"%s\""), CANCELLED_MET_FILENAME);
fullpath = thePrefs.GetMuleDirectory(EMULE_CONFIGDIR);
fullpath += CANCELLED_MET_FILENAME;
if (!file.Open(fullpath, CFile::modeWrite|CFile::modeCreate|CFile::typeBinary|CFile::shareDenyWrite, &fexp)){
CString strError(_T("Failed to save ") CANCELLED_MET_FILENAME _T(" file"));
TCHAR szError[MAX_CFEXP_ERRORMSG];
if (fexp.GetErrorMessage(szError, ARRSIZE(szError))){
strError += _T(" - ");
strError += szError;
}
LogError(LOG_STATUSBAR, _T("%s"), strError);
}
else{
setvbuf(file.m_pStream, NULL, _IOFBF, 16384);
try{
file.WriteUInt8(CANCELLED_HEADER);
file.WriteUInt8(CANCELLED_VERSION);
file.WriteUInt32(m_dwCancelledFilesSeed);
if (!thePrefs.IsRememberingCancelledFiles()){
file.WriteUInt32(0);
}
else{
UINT nRecordsNumber = m_mapCancelledFiles.GetCount();
file.WriteUInt32(nRecordsNumber);
POSITION pos = m_mapCancelledFiles.GetStartPosition();
while( pos != NULL )
{
int dwDummy;
CSKey key;
m_mapCancelledFiles.GetNextAssoc( pos, key, dwDummy );
file.WriteHash16(key.m_key);
file.WriteUInt8(0);
//.........这里部分代码省略.........