本文整理汇总了C++中CFile::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::Close方法的具体用法?C++ CFile::Close怎么用?C++ CFile::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetZipList
bool CZipManager::GetZipList(const CURL& url, std::vector<SZipEntry>& items)
{
struct __stat64 m_StatData = {};
std::string strFile = url.GetHostName();
if (CFile::Stat(strFile,&m_StatData))
{
CLog::Log(LOGDEBUG,"CZipManager::GetZipList: failed to stat file %s", url.GetRedacted().c_str());
return false;
}
std::map<std::string, std::vector<SZipEntry> >::iterator it = mZipMap.find(strFile);
if (it != mZipMap.end()) // already listed, just return it if not changed, else release and reread
{
std::map<std::string,int64_t>::iterator it2=mZipDate.find(strFile);
if (m_StatData.st_mtime == it2->second)
{
items = it->second;
return true;
}
mZipMap.erase(it);
mZipDate.erase(it2);
}
CFile mFile;
if (!mFile.Open(strFile))
{
CLog::Log(LOGDEBUG,"ZipManager: unable to open file %s!",strFile.c_str());
return false;
}
unsigned int hdr;
if (mFile.Read(&hdr, 4)!=4 || (Endian_SwapLE32(hdr) != ZIP_LOCAL_HEADER &&
Endian_SwapLE32(hdr) != ZIP_DATA_RECORD_HEADER &&
Endian_SwapLE32(hdr) != ZIP_SPLIT_ARCHIVE_HEADER))
{
CLog::Log(LOGDEBUG,"ZipManager: not a zip file!");
mFile.Close();
return false;
}
if (Endian_SwapLE32(hdr) == ZIP_SPLIT_ARCHIVE_HEADER)
CLog::LogF(LOGWARNING, "ZIP split archive header found. Trying to process as a single archive..");
// push date for update detection
mZipDate.insert(make_pair(strFile,m_StatData.st_mtime));
// Look for end of central directory record
// Zipfile comment may be up to 65535 bytes
// End of central directory record is 22 bytes (ECDREC_SIZE)
// -> need to check the last 65557 bytes
int64_t fileSize = mFile.GetLength();
// Don't need to look in the last 18 bytes (ECDREC_SIZE-4)
// But as we need to do overlapping between blocks (3 bytes),
// we start the search at ECDREC_SIZE-1 from the end of file
if (fileSize < ECDREC_SIZE - 1)
{
CLog::Log(LOGERROR, "ZipManager: Invalid zip file length: %" PRId64"", fileSize);
return false;
}
int searchSize = (int) std::min(static_cast<int64_t>(65557), fileSize-ECDREC_SIZE+1);
int blockSize = (int) std::min(1024, searchSize);
int nbBlock = searchSize / blockSize;
int extraBlockSize = searchSize % blockSize;
// Signature is on 4 bytes
// It could be between 2 blocks, so we need to read 3 extra bytes
auto_buffer buffer(blockSize + 3);
bool found = false;
// Loop through blocks starting at the end of the file (minus ECDREC_SIZE-1)
for (int nb=1; !found && (nb <= nbBlock); nb++)
{
mFile.Seek(fileSize-ECDREC_SIZE+1-(blockSize*nb),SEEK_SET);
if (mFile.Read(buffer.get(), blockSize + 3) != blockSize + 3)
return false;
for (int i=blockSize-1; !found && (i >= 0); i--)
{
if ( Endian_SwapLE32(*((unsigned int*)(buffer.get()+i))) == ZIP_END_CENTRAL_HEADER )
{
// Set current position to start of end of central directory
mFile.Seek(fileSize-ECDREC_SIZE+1-(blockSize*nb)+i,SEEK_SET);
found = true;
}
}
}
// If not found, look in the last block left...
if ( !found && (extraBlockSize > 0) )
{
mFile.Seek(fileSize-ECDREC_SIZE+1-searchSize,SEEK_SET);
if (mFile.Read(buffer.get(), extraBlockSize + 3) != extraBlockSize + 3)
return false;
for (int i=extraBlockSize-1; !found && (i >= 0); i--)
{
if ( Endian_SwapLE32(*((unsigned int*)(buffer.get()+i))) == ZIP_END_CENTRAL_HEADER )
{
// Set current position to start of end of central directory
//.........这里部分代码省略.........
示例2: OnMessage
bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
CGUIDialog::OnMessage(message);
ClearFileItems();
m_addNetworkShareEnabled = false;
return true;
}
break;
case GUI_MSG_WINDOW_INIT:
{
m_bConfirmed = false;
m_bFlip = false;
bool bIsDir = false;
// this code allows two different selection modes for directories
// end the path with a slash to start inside the directory
if (URIUtils::HasSlashAtEnd(m_selectedPath))
{
bIsDir = true;
bool bFool;
int iSource = CUtil::GetMatchingSource(m_selectedPath,m_shares,bFool);
bFool = true;
if (iSource > -1 && iSource < (int)m_shares.size())
{
if (m_shares[iSource].strPath.Equals(m_selectedPath))
bFool = false;
}
if (bFool && !CDirectory::Exists(m_selectedPath))
m_selectedPath.Empty();
}
else
{
if (!CFile::Exists(m_selectedPath) && !CDirectory::Exists(m_selectedPath))
m_selectedPath.Empty();
}
// find the parent folder if we are a file browser (don't do this for folders)
m_Directory->SetPath(m_selectedPath);
if (!m_browsingForFolders && !bIsDir)
m_Directory->SetPath(URIUtils::GetParentPath(m_selectedPath));
Update(m_Directory->GetPath());
m_viewControl.SetSelectedItem(m_selectedPath);
return CGUIDialog::OnMessage(message);
}
break;
case GUI_MSG_CLICKED:
{
if (m_viewControl.HasControl(message.GetSenderId())) // list control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
if (iItem < 0) break;
if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
{
OnClick(iItem);
return true;
}
else if (iAction == ACTION_HIGHLIGHT_ITEM && m_multipleSelection)
{
CFileItemPtr pItem = (*m_vecItems)[iItem];
if (!pItem->m_bIsShareOrDrive && !pItem->m_bIsFolder)
{
pItem->Select(!pItem->IsSelected());
CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), message.GetSenderId(), iItem + 1);
OnMessage(msg);
}
}
}
else if (message.GetSenderId() == CONTROL_OK)
{
if (m_browsingForFolders == 2)
{
int iItem = m_viewControl.GetSelectedItem();
CStdString strPath;
if (iItem == 0)
strPath = m_selectedPath;
else
strPath = (*m_vecItems)[iItem]->GetPath();
CStdString strTest = URIUtils::AddFileToFolder(strPath, "1");
CFile file;
if (file.OpenForWrite(strTest,true))
{
file.Close();
CFile::Delete(strTest);
m_bConfirmed = true;
Close();
}
else
CGUIDialogOK::ShowAndGetInput(257,20072,0,0);
}
//.........这里部分代码省略.........
示例3: file
CMmio *CDataFile::OpenAsMMIO( const char *pFilename, const char *pRif )
{
// Get the relative path of the file for which to search.
CString file( pFilename );
CString path;
if ( pFilename == NULL )
path.Format( "language\\%d\\%d.rif", m_countryCode, m_countryCode );
else
path = file + "\\" + file + ".rif";
path.MakeLower ();
// Check to see if the file exists in the patch directory.
if ( m_pPatchDir )
{
CString patchPath = *m_pPatchDir + "\\" + path;
CFile test;
if ( test.Open( patchPath, CFile::modeRead | CFile::shareDenyWrite | CFile::typeBinary ) != FALSE )
{
// Close the file so we can re-open it as an mmio file.
// Otherwise we'd need to keep the CFile around so it's
// destructor wouldn't close the file handle.
test.Close();
CMmio *pNewFile = new CMmio( patchPath );
if ( pNewFile == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
// does the version match?
try
{
pNewFile->DescendRiff ( pRif );
pNewFile->DescendList ('F', 'V', 'E', 'R');
pNewFile->DescendChunk ('D', 'A', 'T', 'A');
int iRifVer = pNewFile->ReadShort ();
pNewFile->AscendChunk ();
pNewFile->AscendList ();
if ( iRifVer == m_iRifVer )
{
// go back to begining (hack!!)
delete pNewFile;
pNewFile = new CMmio( patchPath );
if ( pNewFile == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
return pNewFile;
}
}
catch (...)
{
}
delete pNewFile;
}
// we now look in the patch dir (users version)
if ( pFilename == NULL )
patchPath.Format( "%s\\%d.rif", (char const *) (*m_pPatchDir), m_countryCode );
else
patchPath = *m_pPatchDir + CString ("\\") + file + ".rif";
if ( test.Open( patchPath, CFile::modeRead | CFile::shareDenyWrite | CFile::typeBinary ) != FALSE )
{
// Close the file so we can re-open it as an mmio file.
// Otherwise we'd need to keep the CFile around so it's
// destructor wouldn't close the file handle.
test.Close();
CMmio *pNewFile = new CMmio( patchPath );
if ( pNewFile == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
// does the version match?
try
{
pNewFile->DescendRiff ( pRif );
pNewFile->DescendList ('F', 'V', 'E', 'R');
pNewFile->DescendChunk ('D', 'A', 'T', 'A');
int iRifVer = pNewFile->ReadShort ();
pNewFile->AscendChunk ();
pNewFile->AscendList ();
if ( iRifVer == m_iRifVer )
{
// go back to begining (hack!!)
delete pNewFile;
pNewFile = new CMmio( patchPath );
if ( pNewFile == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
return pNewFile;
}
}
catch (...)
{
}
delete pNewFile;
}
}
//.........这里部分代码省略.........
示例4: Cache
bool CFile::Cache(const CStdString& strFileName, const CStdString& strDest, XFILE::IFileCallback* pCallback, void* pContext)
{
CFile file;
CAsyncFileCallback* helper = NULL;
if (file.Open(strFileName, true, READ_TRUNCATED))
{
if (file.GetLength() <= 0)
{
CLog::Log(LOGWARNING, "FILE::cache: the file %s has a length of 0 bytes", strFileName.c_str());
file.Close();
// Never save 0 byte files from the Plex Media Server.
if (strFileName.Find(":32400") != -1)
return false;
}
CFile newFile;
if (CUtil::IsHD(strDest)) // create possible missing dirs
{
std::vector<CStdString> tokens;
CStdString strDirectory;
CUtil::GetDirectory(strDest,strDirectory);
CUtil::RemoveSlashAtEnd(strDirectory); // for the test below
if (!(strDirectory.size() == 2 && strDirectory[1] == ':'))
{
CUtil::Tokenize(strDirectory,tokens,"\\");
CStdString strCurrPath = tokens[0]+"\\";
for (std::vector<CStdString>::iterator iter=tokens.begin()+1;iter!=tokens.end();++iter)
{
strCurrPath += *iter+"\\";
CDirectory::Create(strCurrPath);
}
}
}
if (CFile::Exists(strDest))
CFile::Delete(strDest);
if (!newFile.OpenForWrite(strDest, true, true)) // overwrite always
{
file.Close();
return false;
}
/* larger then 1 meg, let's do rendering async */
// Async render cannot be done in Linux because of the resulting ThreadMessage deadlock
#ifndef _LINUX
if( file.GetLength() > 1024*1024 )
helper = new CAsyncFileCallback(pCallback, pContext);
#endif
// 128k is optimal for xbox
int iBufferSize = 128 * 1024;
CAutoBuffer buffer(iBufferSize);
int iRead, iWrite;
UINT64 llFileSize = file.GetLength();
UINT64 llFileSizeOrg = llFileSize;
UINT64 llPos = 0;
int ipercent = 0;
CStopWatch timer;
timer.StartZero();
float start = 0.0f;
while (llFileSize > 0)
{
g_application.ResetScreenSaver();
unsigned int iBytesToRead = iBufferSize;
/* make sure we don't try to read more than filesize*/
if (iBytesToRead > llFileSize) iBytesToRead = llFileSize;
iRead = file.Read(buffer.get(), iBytesToRead);
if (iRead == 0) break;
else if (iRead < 0)
{
CLog::Log(LOGERROR, "%s - Failed read from file %s", __FUNCTION__, strFileName.c_str());
break;
}
/* write data and make sure we managed to write it all */
iWrite = 0;
while(iWrite < iRead)
{
int iWrite2 = newFile.Write(buffer.get()+iWrite, iRead-iWrite);
if(iWrite2 <=0)
break;
iWrite+=iWrite2;
}
if (iWrite != iRead)
{
CLog::Log(LOGERROR, "%s - Failed write to file %s", __FUNCTION__, strDest.c_str());
break;
}
llFileSize -= iRead;
llPos += iRead;
// calculate the current and average speeds
//.........这里部分代码省略.........
示例5: tools_jm_file
bool zstringEx::tools_jm_file(char *filename,bool do_add)//do_add=false表示是进行解密
{
CFile fn;
ULONG i;BYTE k;long jsq=0;UINT newlen;
if(!fn.Open(filename,CFile::modeReadWrite|CFile::typeBinary))return false;
UINT flen=(UINT)fn.GetLength();
//上面打开文件
if(do_add==true) //如果是要求加密
{
//下面读文件
BYTE *buffer=(BYTE *)VirtualAlloc(0,(size_t)flen+1,MEM_COMMIT,PAGE_READWRITE);
if(buffer==NULL){fn.Close();AfxMessageBox("file is too big!");return false;}
fn.Read(buffer,(UINT)flen);
//////////////////////////////////判断是否有必要加密
bool is_already_add=true;
for(i=0;i<16;i++){
if(buffer[i]!=120+i){is_already_add=false;break;}
}
if(is_already_add==true)//如果有加密,就返回
{
fn.Close();
VirtualFree((LPVOID)buffer,0,MEM_RELEASE);
return false;
}
//////////////////////////////////判断是否有必要加密
BYTE *buffer2=(BYTE *)VirtualAlloc(0,16+2*((size_t)flen+1),MEM_COMMIT,PAGE_READWRITE);
if(buffer2==NULL){VirtualFree((LPVOID)buffer,0,MEM_RELEASE);fn.Close();AfxMessageBox("file is too big!");return false;}
//准备内存
//下面开始加密
//////////////////////////////////////////////////////////////
for(i=0;i<flen;i++)buffer[i]=255-buffer[i]; //反码
//////////////////////////////////////////////////////////////
for(i=0;i<(flen-1)/2;i++){k=buffer[i];buffer[i]=buffer[flen-1-i];buffer[flen-1-i]=k;}
//倒序
//////////////////////////////////////////////////////////////
zdatetime::setRandSeed();jsq=0;
for(i=0;i<flen-1;i+=2)
{
buffer2[16+i+jsq]=buffer[i];
buffer2[16+i+1+jsq]=buffer[i+1];
if(buffer[i+1]>=buffer[i]){buffer2[16+i+2+jsq]=(BYTE)zdatetime::getRand(255);jsq++;}
}
if(i==flen-1)buffer2[16+i+jsq]=buffer[i];
//插值
//////////////////////////////////////////////////////////////
for(i=0;i<16;i++)buffer2[i]=(BYTE)(120+i);
newlen=flen+16+jsq;
//加16位的文件头
//////////////////////////////////////////////////////////////
fn.SeekToBegin();
fn.Write(buffer2,(UINT)newlen);
fn.Close();
//上面重写文件
VirtualFree((LPVOID)buffer,0,MEM_RELEASE);
VirtualFree((LPVOID)buffer2,0,MEM_RELEASE);
return true;
}
if(do_add==false) //如果是要求解密
{
//下面读文件
BYTE *buffer=(BYTE *)VirtualAlloc(0,(size_t)flen+1,MEM_COMMIT,PAGE_READWRITE);
if(buffer==NULL){fn.Close();AfxMessageBox("file is too big!");return false;}
fn.Read(buffer,(UINT)flen);
//////////////////////////////////判断是否有必要解密
bool is_already_add=true;
for(i=0;i<16;i++){
if(buffer[i]!=120+i){is_already_add=false;break;}
}
if(is_already_add==false)//如果没有加密,就返回
{
fn.Close();
VirtualFree((LPVOID)buffer,0,MEM_RELEASE);
return false;
}
//////////////////////////////////判断是否有必要解密
BYTE *buffer2=(BYTE *)VirtualAlloc(0,(size_t)flen+1,MEM_COMMIT,PAGE_READWRITE);
if(buffer2==NULL){VirtualFree((LPVOID)buffer,0,MEM_RELEASE);fn.Close();AfxMessageBox("file is too big!");return false;}
//准备内存
//下面开始解密
//////////////////////////////////////////////////////////////
//插值还原
jsq=0;
for(i=16;i<flen-1;i+=2)
{
buffer2[i-16-jsq]=buffer[i];
buffer2[i+1-16-jsq]=buffer[i+1];
if(buffer[i+1]>=buffer[i]){i++;jsq++;}
}
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
pOut->Init(&fileOut);
}
if (bDoubleLines) {
pOut->BeginPage(nPage, pPage->width,
pPage->height*2, pPage->dpi, pPage->lpi*2);
} else {
pOut->BeginPage(nPage, pPage->width,
pPage->height, pPage->dpi, pPage->lpi);
}
pOut->BlankLine();
TSFFRecord rec;
while (pInfile->GetRecord(rec))
{
switch(rec.type)
{
case NORMAL :
pOut->BlankLine();
if (pInfile->DecodeRecord(rec, pOut->GetBitSink())) {
pOut->WriteLine();
if (bDoubleLines) {
pOut->WriteLine();
}
}
if (rec.pData != 0) free(rec.pData);
break;
case USERINFO :
// not yet considered
if (rec.pData != 0) free(rec.pData);
break;
case BADLINE :
pOut->WriteLine();
if (bDoubleLines) {
pOut->WriteLine();
}
break;
case WHITESKIP :
pOut->BlankLine();
for (int j=0; j < rec.cb; ++j) {
pOut->WriteLine();
if (bDoubleLines) {
pOut->WriteLine();
}
}
break;
}
}
pOut->EndPage();
if (!bStdOut) {
if ((nFileCountOut > 1) || ((nFileCountOut == 1) && (nPage == nPageCount-1))) {
pOut->Finalize();
fileOut.Close();
if (proc.keepDate()) {
fileOut.SetModificationTime(modTime);
}
}
}
}
if (bStdOut) {
fileOut.DumpToStdOut();
fileOut.Close();
if (pOut) {
pOut->Finalize();
}
}
}
catch (const std::exception & e) {
cerr << "ERROR: " << pathInFileName.string() << ": " << e.what() << endl;
rc = 2;
}
catch (CSimpleException e) {
cerr << "ERROR: " << pathInFileName.string() << ": " << e.what() << endl;
rc = 2;
}
if (pOut) {
delete pOut;
}
if (pInfile) {
delete pInfile;
}
if (!bQuiet) cout << endl;
}
if (!bQuiet) cout << "Finished. " << endl << endl;
}
catch (const std::exception & e) {
cerr << "ERROR: " << e.what() << endl;
rc = 2;
}
catch (const CSimpleException& e) {
cerr << "ERROR: " << e.what() << endl;
rc = 2;
}
return rc;
}
示例7: Load
bool CTriMeshBuilder::Load (int nLevel)
{
CFile cf;
tMeshDataHeader mdh;
int nSize;
bool bOk;
char szFilename [FILENAME_LEN];
char *ioBuffer = NULL, *bufP;
if (!(gameStates.render.bTriangleMesh && gameStates.app.bCacheMeshes))
return false;
if (!cf.Open (DataFilename (szFilename, nLevel), gameFolders.szCacheDir, "rb", 0))
return false;
bOk = (cf.Read (&mdh, sizeof (mdh), 1) == 1);
if (bOk)
bOk = (mdh.nVersion == MESH_DATA_VERSION) &&
(mdh.nSegments == gameData.segs.nSegments) &&
(mdh.nFaces == gameData.segs.nFaces);
if (bOk)
nSize =
(sizeof (*gameData.segs.vertices) +
sizeof (*gameData.segs.fVertices)) * mdh.nVertices +
sizeof (*gameData.segs.faces.faces) * mdh.nFaces +
sizeof (*gameData.segs.faces.tris) * mdh.nTris +
(sizeof (*gameData.segs.faces.vertices) +
sizeof (*gameData.segs.faces.normals) +
sizeof (*gameData.segs.faces.texCoord) +
sizeof (*gameData.segs.faces.ovlTexCoord) +
sizeof (*gameData.segs.faces.color)) * mdh.nTris * 3 +
sizeof (*gameData.segs.faces.lMapTexCoord) * mdh.nFaces * 2 +
sizeof (*gameData.segs.faces.faceVerts) * mdh.nFaceVerts;
if (bOk)
bOk = ((ioBuffer = (char *) D2_ALLOC (nSize)) != NULL);
if (bOk)
bOk = cf.Read (ioBuffer, nSize, 1) == 1;
if (bOk) {
bufP = ioBuffer;
memcpy (gameData.segs.vertices, bufP, sizeof (*gameData.segs.vertices) * mdh.nVertices);
bufP += sizeof (*gameData.segs.vertices) * mdh.nVertices;
memcpy (gameData.segs.fVertices, bufP, sizeof (*gameData.segs.fVertices) * mdh.nVertices);
bufP += sizeof (*gameData.segs.fVertices) * mdh.nVertices;
memcpy (gameData.segs.faces.faces, bufP, sizeof (*gameData.segs.faces.faces) * mdh.nFaces);
bufP += sizeof (*gameData.segs.faces.faces) * mdh.nFaces;
memcpy (gameData.segs.faces.tris, bufP, sizeof (*gameData.segs.faces.tris) * mdh.nTris);
bufP += sizeof (*gameData.segs.faces.tris) * mdh.nTris;
memcpy (gameData.segs.faces.vertices, bufP, sizeof (*gameData.segs.faces.vertices) * mdh.nTris * 3);
bufP += sizeof (*gameData.segs.faces.vertices) * mdh.nTris * 3;
memcpy (gameData.segs.faces.normals, bufP, sizeof (*gameData.segs.faces.normals) * mdh.nTris * 3);
bufP += sizeof (*gameData.segs.faces.normals) * mdh.nTris * 3;
memcpy (gameData.segs.faces.texCoord, bufP, sizeof (*gameData.segs.faces.texCoord) * mdh.nTris * 3);
bufP += sizeof (*gameData.segs.faces.texCoord) * mdh.nTris * 3;
memcpy (gameData.segs.faces.ovlTexCoord, bufP, sizeof (*gameData.segs.faces.ovlTexCoord) * mdh.nTris * 3);
bufP += sizeof (*gameData.segs.faces.ovlTexCoord) * mdh.nTris * 3;
memcpy (gameData.segs.faces.color, bufP, sizeof (*gameData.segs.faces.color) * mdh.nTris * 3);
bufP += sizeof (*gameData.segs.faces.color) * mdh.nTris * 3;
memcpy (gameData.segs.faces.lMapTexCoord, bufP, sizeof (*gameData.segs.faces.lMapTexCoord) * mdh.nFaces * 2);
bufP += sizeof (*gameData.segs.faces.lMapTexCoord) * mdh.nFaces * 2;
memcpy (gameData.segs.faces.faceVerts, bufP, sizeof (*gameData.segs.faces.faceVerts) * mdh.nFaceVerts);
}
if (ioBuffer)
D2_FREE (ioBuffer);
if (bOk) {
gameData.segs.nVertices = mdh.nVertices;
gameData.segs.nTris = mdh.nTris;
SetupVertexNormals ();
}
cf.Close ();
CreateFaceVertLists ();
return bOk;
}
示例8: ReadFile
void CRoutingZone::ReadFile(const wxString& specialNodesdat)
{
if (m_superZone != NULL || (m_filename.IsEmpty() && specialNodesdat.IsEmpty())) {
wxFAIL;
return;
}
bool doHaveVerifiedContacts = false;
// Read in the saved contact list
try {
uint32_t validContacts = 0;
CFile file;
if (CPath::FileExists(specialNodesdat.IsEmpty() ? m_filename : specialNodesdat) && file.Open(m_filename, CFile::read)) {
// Get how many contacts in the saved list.
// NOTE: Older clients put the number of contacts here...
// Newer clients always have 0 here to prevent older clients from reading it.
uint32_t numContacts = file.ReadUInt32();
uint32_t fileVersion = 0;
if (numContacts == 0) {
if (file.GetLength() >= 8) {
fileVersion = file.ReadUInt32();
if (fileVersion == 3) {
uint32_t bootstrapEdition = file.ReadUInt32();
if (bootstrapEdition == 1) {
// this is a special bootstrap-only nodes.dat, handle it in a separate reading function
ReadBootstrapNodesDat(file);
file.Close();
return;
}
}
if (fileVersion >= 1 && fileVersion <= 3) {
numContacts = file.ReadUInt32();
}
}
} else {
// Don't read version 0 nodes.dat files, because they can't tell the kad version of the contacts stored.
AddLogLineC(_("Failed to read nodes.dat file - too old. This version (0) is not supported anymore."));
numContacts = 0;
}
DEBUG_ONLY( unsigned kad1Count = 0; )
if (numContacts != 0 && numContacts * 25 <= (file.GetLength() - file.GetPosition())) {
for (uint32_t i = 0; i < numContacts; i++) {
CUInt128 id = file.ReadUInt128();
uint32_t ip = file.ReadUInt32();
uint16_t udpPort = file.ReadUInt16();
uint16_t tcpPort = file.ReadUInt16();
uint8_t contactVersion = 0;
contactVersion = file.ReadUInt8();
CKadUDPKey kadUDPKey;
bool verified = false;
if (fileVersion >= 2) {
kadUDPKey.ReadFromFile(file);
verified = file.ReadUInt8() != 0;
if (verified) {
doHaveVerifiedContacts = true;
}
}
// IP appears valid
if (contactVersion > 1) {
if(IsGoodIPPort(wxUINT32_SWAP_ALWAYS(ip),udpPort)) {
if (!theApp->ipfilter->IsFiltered(wxUINT32_SWAP_ALWAYS(ip)) &&
!(udpPort == 53 && contactVersion <= 5 /*No DNS Port without encryption*/)) {
// This was not a dead contact, inc counter if add was successful
if (AddUnfiltered(id, ip, udpPort, tcpPort, contactVersion, kadUDPKey, verified, false, false)) {
validContacts++;
}
}
}
} else {
DEBUG_ONLY( kad1Count++; )
}
}
}
file.Close();
AddLogLineN(CFormat(wxPLURAL("Read %u Kad contact", "Read %u Kad contacts", validContacts)) % validContacts);
#ifdef __DEBUG__
if (kad1Count > 0) {
AddDebugLogLineN(logKadRouting, CFormat(wxT("Ignored %u kad1 %s in nodes.dat file.")) % kad1Count % (kad1Count > 1 ? wxT("contacts"): wxT("contact")));
}
#endif
if (!doHaveVerifiedContacts) {
AddDebugLogLineN(logKadRouting, wxT("No verified contacts found in nodes.dat - might be an old file version. Setting all contacts verified for this time to speed up Kad bootstrapping."));
SetAllContactsVerified();
}
}
示例9: ReadVideoReDo
bool CEdl::ReadVideoReDo(const CStdString& strMovie)
{
/*
* VideoReDo file is strange. Tags are XML like, but it isn't an XML file.
*
* http://www.videoredo.com/
*/
Clear();
CStdString videoReDoFilename(URIUtils::ReplaceExtension(strMovie, ".Vprj"));
if (!CFile::Exists(videoReDoFilename))
return false;
CFile videoReDoFile;
if (!videoReDoFile.Open(videoReDoFilename))
{
CLog::Log(LOGERROR, "%s - Could not open VideoReDo file: %s", __FUNCTION__, videoReDoFilename.c_str());
return false;
}
char szBuffer[1024];
if (videoReDoFile.ReadString(szBuffer, 1023)
&& strncmp(szBuffer, VIDEOREDO_HEADER, strlen(VIDEOREDO_HEADER)) != 0)
{
CLog::Log(LOGERROR, "%s - Invalid VideoReDo file: %s. Error reading line 1 - expected %s. Only version 2 files are supported.",
__FUNCTION__, videoReDoFilename.c_str(), VIDEOREDO_HEADER);
videoReDoFile.Close();
return false;
}
int iLine = 1;
bool bValid = true;
while (bValid && videoReDoFile.ReadString(szBuffer, 1023))
{
iLine++;
if (strncmp(szBuffer, VIDEOREDO_TAG_CUT, strlen(VIDEOREDO_TAG_CUT)) == 0) // Found the <Cut> tag
{
/*
* double is used as 32 bit float would overflow.
*/
double dStart, dEnd;
if (sscanf(szBuffer + strlen(VIDEOREDO_TAG_CUT), "%lf:%lf", &dStart, &dEnd) == 2)
{
/*
* Times need adjusting by 1/10,000 to get ms.
*/
Cut cut;
cut.start = (int64_t)(dStart / 10000);
cut.end = (int64_t)(dEnd / 10000);
cut.action = CUT;
bValid = AddCut(cut);
}
else
bValid = false;
}
else if (strncmp(szBuffer, VIDEOREDO_TAG_SCENE, strlen(VIDEOREDO_TAG_SCENE)) == 0) // Found the <SceneMarker > tag
{
int iScene;
double dSceneMarker;
if (sscanf(szBuffer + strlen(VIDEOREDO_TAG_SCENE), " %i>%lf", &iScene, &dSceneMarker) == 2)
bValid = AddSceneMarker((int64_t)(dSceneMarker / 10000)); // Times need adjusting by 1/10,000 to get ms.
else
bValid = false;
}
/*
* Ignore any other tags.
*/
}
videoReDoFile.Close();
if (!bValid)
{
CLog::Log(LOGERROR, "%s - Invalid VideoReDo file: %s. Error in line %i. Clearing any valid cuts or scenes found.",
__FUNCTION__, videoReDoFilename.c_str(), iLine);
Clear();
return false;
}
else if (HasCut() || HasSceneMarker())
{
CLog::Log(LOGDEBUG, "%s - Read %"PRIuS" cuts and %"PRIuS" scene markers in VideoReDo file: %s", __FUNCTION__,
m_vecCuts.size(), m_vecSceneMarkers.size(), videoReDoFilename.c_str());
return true;
}
else
{
CLog::Log(LOGDEBUG, "%s - No cuts or scene markers found in VideoReDo file: %s", __FUNCTION__,
videoReDoFilename.c_str());
return false;
}
}
示例10: GetDataFromPages
//.........这里部分代码省略.........
//-------------------------------------------------------------------------------
RecordPageExtractor PageExtractModule(this->PageSize, EncodedType_parm);
PageExtractModule.GetNormalRecordSet(PageBuff);
UINT type = 0;
TableData tTableData;
tTableData.pageOffset = totalSize;
tTableData.FieldArray = new ARRFieldArray;
tTableData.NorRowArray = new ARRRowArray;
tTableData.DelRowArray = new ARRRowArray;
// NormalTable_InPage
for(int jdx = 0 ; jdx < PageExtractModule.NormalTable_InPage.GetCount() ; jdx++)
{
CRowArray RowArr;
RowArr = PageExtractModule.NormalTable_InPage.GetAt(jdx);
tTableData.NorRowArray->Add(RowArr);
ARRField arrField;
CTypeArray TypeArr;
TypeArr = PageExtractModule.Types_InPage.GetAt(jdx);
for(int i = 0 ; i < TypeArr.GetCount() ; i++)
{
type = TypeArr.GetAt(i);
Field field;
field.cid.Format(_T("%d"), i);
switch(type)
{
case TYPE_NULL:
field.type = _T("NULL");
field.length = -1;
break;
case TYPE_INTEGER0:
field.type = _T("INTEGER");
field.length = 0;
break;
case TYPE_INTEGER1:
field.type = _T("INTEGER");
field.length = 1;
break;
case TYPE_INTEGER2:
field.type = _T("INTEGER");
field.length = 2;
break;
case TYPE_INTEGER3:
field.type = _T("INTEGER");
field.length = 3;
break;
case TYPE_INTEGER4:
field.type = _T("INTEGER");
field.length = 4;
break;
case TYPE_INTEGER6:
field.type = _T("INTEGER");
field.length = 6;
break;
case TYPE_INTEGER8:
field.type = _T("INTEGER");
field.length = 8;
break;
case TYPE_NUMERIC:
field.type = _T("IEEE754");
field.length = 9;
break;
case TYPE_BLOB:
field.type = _T("BLOB");
field.length = 12; // variable length
break;
case TYPE_TEXT:
field.type = _T("TEXT");
field.length = 13; // variable length
break;
}
arrField.Add(field);
}
tTableData.FieldArray->Add(arrField);
}
arrTableData.Add(tTableData);
//-------------------------------------------------------------------------------
ZeroMemory(PageBuff, this->PageSize);
totalSize += readSize;
totalPageCount++;
}
safe_free(PageBuff);
PageFile.Close();
return TRUE;
}
示例11: ReadComskip
bool CEdl::ReadComskip(const CStdString& strMovie, const float fFramesPerSecond)
{
Clear();
CStdString comskipFilename(URIUtils::ReplaceExtension(strMovie, ".txt"));
if (!CFile::Exists(comskipFilename))
return false;
CFile comskipFile;
if (!comskipFile.Open(comskipFilename))
{
CLog::Log(LOGERROR, "%s - Could not open Comskip file: %s", __FUNCTION__, comskipFilename.c_str());
return false;
}
char szBuffer[1024];
if (comskipFile.ReadString(szBuffer, 1023)
&& strncmp(szBuffer, COMSKIP_HEADER, strlen(COMSKIP_HEADER)) != 0) // Line 1.
{
CLog::Log(LOGERROR, "%s - Invalid Comskip file: %s. Error reading line 1 - expected '%s' at start.",
__FUNCTION__, comskipFilename.c_str(), COMSKIP_HEADER);
comskipFile.Close();
return false;
}
int iFrames;
float fFrameRate;
if (sscanf(szBuffer, "FILE PROCESSING COMPLETE %i FRAMES AT %f", &iFrames, &fFrameRate) != 2)
{
/*
* Not all generated Comskip files have the frame rate information.
*/
fFrameRate = fFramesPerSecond;
CLog::Log(LOGWARNING, "%s - Frame rate not in Comskip file. Using detected frames per second: %.3f",
__FUNCTION__, fFrameRate);
}
else
fFrameRate /= 100; // Reduce by factor of 100 to get fps.
comskipFile.ReadString(szBuffer, 1023); // Line 2. Ignore "-------------"
bool bValid = true;
int iLine = 2;
while (bValid && comskipFile.ReadString(szBuffer, 1023)) // Line 3 and onwards.
{
iLine++;
double dStartFrame, dEndFrame;
if (sscanf(szBuffer, "%lf %lf", &dStartFrame, &dEndFrame) == 2)
{
Cut cut;
cut.start = (int64_t)(dStartFrame / fFrameRate * 1000);
cut.end = (int64_t)(dEndFrame / fFrameRate * 1000);
cut.action = COMM_BREAK;
bValid = AddCut(cut);
}
else
bValid = false;
}
comskipFile.Close();
if (!bValid)
{
CLog::Log(LOGERROR, "%s - Invalid Comskip file: %s. Error on line %i. Clearing any valid commercial breaks found.",
__FUNCTION__, comskipFilename.c_str(), iLine);
Clear();
return false;
}
else if (HasCut())
{
CLog::Log(LOGDEBUG, "%s - Read %"PRIuS" commercial breaks from Comskip file: %s", __FUNCTION__, m_vecCuts.size(),
comskipFilename.c_str());
return true;
}
else
{
CLog::Log(LOGDEBUG, "%s - No commercial breaks found in Comskip file: %s", __FUNCTION__, comskipFilename.c_str());
return false;
}
}
示例12: ReadEdl
//.........这里部分代码省略.........
{
fieldParts[1] = fieldParts[1] + "00";
}
else if (fieldParts[1].length() == 2)
{
fieldParts[1] = fieldParts[1] + "0";
}
else if (fieldParts[1].length() > 3)
{
fieldParts[1] = fieldParts[1].Left(3);
}
iCutStartEnd[i] = StringUtils::TimeStringToSeconds(fieldParts[0]) * 1000 + atoi(fieldParts[1]); // seconds to ms
}
else
{
bError = true;
continue;
}
}
else if (strFields[i].Left(1) == "#") // #12345 format for frame number
{
iCutStartEnd[i] = (int64_t)(atol(strFields[i].Mid(1)) / fFramesPerSecond * 1000); // frame number to ms
}
else // Plain old seconds in float format, e.g. 123.45
{
iCutStartEnd[i] = (int64_t)(atof(strFields[i]) * 1000); // seconds to ms
}
}
if (bError) // If there was an error in the for loop, ignore and continue with the next line
continue;
Cut cut;
cut.start = iCutStartEnd[0];
cut.end = iCutStartEnd[1];
switch (iAction)
{
case 0:
cut.action = CUT;
if (!AddCut(cut))
{
CLog::Log(LOGWARNING, "%s - Error adding cut from line %i in EDL file: %s", __FUNCTION__,
iLine, edlFilename.c_str());
continue;
}
break;
case 1:
cut.action = MUTE;
if (!AddCut(cut))
{
CLog::Log(LOGWARNING, "%s - Error adding mute from line %i in EDL file: %s", __FUNCTION__,
iLine, edlFilename.c_str());
continue;
}
break;
case 2:
if (!AddSceneMarker(cut.end))
{
CLog::Log(LOGWARNING, "%s - Error adding scene marker from line %i in EDL file: %s",
__FUNCTION__, iLine, edlFilename.c_str());
continue;
}
break;
case 3:
cut.action = COMM_BREAK;
if (!AddCut(cut))
{
CLog::Log(LOGWARNING, "%s - Error adding commercial break from line %i in EDL file: %s",
__FUNCTION__, iLine, edlFilename.c_str());
continue;
}
break;
default:
CLog::Log(LOGWARNING, "%s - Invalid action on line %i in EDL file: %s", __FUNCTION__, iLine,
edlFilename.c_str());
continue;
}
}
strBuffer.ReleaseBuffer();
if (bError) // Log last line warning, if there was one, since while loop will have terminated.
CLog::Log(LOGWARNING, "%s - Error on line %i in EDL file: %s", __FUNCTION__, iLine, edlFilename.c_str());
edlFile.Close();
if (HasCut() || HasSceneMarker())
{
CLog::Log(LOGDEBUG, "%s - Read %"PRIuS" cuts and %"PRIuS" scene markers in EDL file: %s", __FUNCTION__,
m_vecCuts.size(), m_vecSceneMarkers.size(), edlFilename.c_str());
return true;
}
else
{
CLog::Log(LOGDEBUG, "%s - No cuts or scene markers found in EDL file: %s", __FUNCTION__,
edlFilename.c_str());
return false;
}
}
示例13: OnTeTakePict
void CTimeEv::OnTeTakePict()
{
// CWnd* pWnd = CWnd::GetDesktopWindow();
CWindowDC dc(this);
CDC memDC;
CRect rect;
CBitmap bitmap;
CClientDC pDC(this);
// pWnd->GetWindowRect(rect);
GetWindowRect(rect);
memDC.CreateCompatibleDC(&dc);
// bitmap.CreateCompatibleBitmap(&dc,rect.right,rect.bottom);
bitmap.CreateCompatibleBitmap(&dc,rect.Width(),rect.Height());
CBitmap *oldBM = memDC.SelectObject(&bitmap);
// memDC.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY);
memDC.BitBlt(0, 0, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY);
BITMAP bm;
bitmap.GetObject(sizeof(bm),&bm);
// pDC.BitBlt(0, 0, rect.right, rect.bottom, &memDC, 0, 0, SRCCOPY);
pDC.BitBlt(0, 0, rect.Width(), rect.Height(), &memDC, 0, 0, SRCCOPY);
CFile file;
file.Open("a.pcx",CFile::modeWrite | CFile::modeCreate);
CreatePCXHeader(&file,rect.Width(),rect.Height());
short *bmBit;
RGBQUAD *rgbQuad;
bmBit = (short*) malloc (bm.bmHeight * bm.bmWidthBytes * 2);
int n = bitmap.GetBitmapBits(bm.bmHeight * bm.bmWidthBytes, bmBit);
rgbQuad = (RGBQUAD*) malloc (bm.bmHeight * bm.bmWidthBytes * sizeof(RGBQUAD));
for (int y=0; y< rect.Height();y++)
{
for (char hl=0; hl<3; hl++)
{
for (int x=0; x < rect.Width();x++)
{
char byte; RGBQUAD rgb;
rgb = QuadFromWord( bmBit[y*rect.Width() + x]);
if (hl == 0)
byte = rgb.rgbRed;
if (hl == 1)
byte = rgb.rgbGreen;
if (hl == 2)
byte = rgb.rgbBlue;
char toWr;
toWr = (char) 0xC1;
file.Write(&toWr,1);
file.Write(&byte,1);
}
}
}
free(bmBit);
free(rgbQuad);
file.Close();
char txt[300];
sprintf(txt,"type:%d, width:%d, height:%d, widthbytes:%d, planes:%d, BitsPixel:%d,",
bm.bmType, bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, bm.bmPlanes, bm.bmBitsPixel);
// sprintf(txt,"%d %d", rect.left,rect.right);
pDC.TextOut(10,10,txt);
memDC.SelectObject(oldBM);
MessageBeep(0);
}
示例14: SendFile
FileState SendFile(SOCKET socket, HWND hWrapperWnd, LPCTSTR strFilePathName, ULONGLONG llStartAt)
{
//gl_SenderStop = false;
gl_mapSenderStop[hWrapperWnd] = false;
PostMessage(hWrapperWnd, WM_FILE_OPERATE_BEGIN, 1, 0);
FileState MyFileState = S_FileOK, YouFileState = S_FileOK;
//check dir
CString strFileName = strFilePathName;
CDestFolderHelper folderHelper;
if (!folderHelper.IsDestFileExist(strFileName))
MyFileState = S_FileNotExits;
//open file
CFile LocalFile;
if(!LocalFile.Open(strFileName, CFile::modeRead | CFile::typeBinary))
{
if(MyFileState == S_FileOK)
MyFileState = S_OpenFileFailed;
}
if (MyFileState != S_OpenFileFailed)
{
ULONGLONG uSeeked = LocalFile.Seek(llStartAt, CFile::begin);
if (uSeeked != llStartAt)
{
MyFileState = S_CreateFileFailed;
}
}
//get file time
FILETIME fileTime;
if(!GetFileTime(LocalFile.m_hFile, NULL, NULL, &fileTime))
{
if(MyFileState == S_FileOK)
MyFileState = S_GetFileInfoFailed;
}
//send my file operate state
if(!SendData(socket, (char*)&MyFileState, sizeof(FileState)))
{
if(MyFileState != S_FileNotExits && MyFileState != S_OpenFileFailed)
LocalFile.Close();
return S_SocketError;
}
//receive you file operate state
if(!ReceiveData(socket, (char*)&YouFileState, sizeof(FileState)))
{
LocalFile.Close();
return S_SocketError;
}
if(MyFileState != S_FileOK) return MyFileState;
if(YouFileState != S_FileOK) return YouFileState;
//init basicFileInfo
BasicFileInfo basicFileInfo;
basicFileInfo.CreationTime = fileTime;
char* pFileName = (LPSTR)(LPCTSTR)(LocalFile.GetFileName());
memset(&(basicFileInfo.FileName), 0, MAX_PATH);
CopyMemory(&(basicFileInfo.FileName), pFileName, LocalFile.GetFileName().GetLength());
basicFileInfo.Size = LocalFile.GetLength();
//send file info
if (!SendData(socket, (char*)(&basicFileInfo), sizeof(basicFileInfo)))
{
LocalFile.Close();
return S_SocketError;
}
ULONGLONG nDes = LocalFile.GetLength() > 1024 * 1024 * 1024 ? 1024 * 1024 : 1024; //file's size larger than 1G.
PostMessage(hWrapperWnd, WM_FILE_SETRANGE_MESSAGE, (WPARAM)(LocalFile.GetLength() / nDes), (LPARAM)0);
ULONGLONG nRead = llStartAt;
ULONGLONG nResCount = 0;
ULONGLONG nFileLength = LocalFile.GetLength();
FileDataEx fileData;
PostMessage(hWrapperWnd, WM_FILE_SENDFILETOSERVER_PROGRESS_MESSAGE, (WPARAM)(nRead / nDes), 0);
if (gl_pLogger) gl_pLogger->log_info("SendFile Begin to send: %s", strFilePathName);
bool *pbstatus = NULL;
SendMessage(hWrapperWnd, WM_GETSENDSTATE, 0, (LPARAM)&pbstatus);
//send loop
while(1)
{
int nCount = 0;
try{
nCount= LocalFile.Read(fileData.data.Buf, FILEDATASIZE);
}
catch(...){
fileData.state = S_ReadFileFailed;
}
fileData.data.nLength = nCount;
nRead += nCount;
fileData.state = (*pbstatus) ? S_FileContinue : S_IStop;
if(nRead == nFileLength)
fileData.state = S_Finished;
//.........这里部分代码省略.........
示例15: SaveAsBitmap
// Does: Saves The Picture That Is Stored In The IPicture Object As a Bitmap
// ~~~~ (Converts From Any Known Picture Type To a Bitmap / Icon File)
//
// InPut: sFilePathName - Path And FileName Target To Save
// ~~~~~
//
// OutPut: TRUE If Succeeded...
// ~~~~~~
//-----------------------------------------------------------------------------
BOOL CPicture_Ex::SaveAsBitmap(CString sFilePathName)
//=============================================================================
{
BOOL bResult = FALSE;
ILockBytes *Buffer = 0;
IStorage *pStorage = 0;
IStream *FileStream = 0;
BYTE *BufferBytes;
STATSTG BytesStatistics;
DWORD OutData;
long OutStream;
CFile BitmapFile; CFileException e;
double SkipFloat = 0;
DWORD ByteSkip = 0;
_ULARGE_INTEGER RealData;
CreateILockBytesOnHGlobal(NULL, TRUE, &Buffer); // Create ILockBytes Buffer
HRESULT hr = ::StgCreateDocfileOnILockBytes(Buffer,
STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
hr = pStorage->CreateStream(L"PICTURE",
STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, 0, &FileStream);
m_pPict->SaveAsFile(FileStream, TRUE, &OutStream); // Copy Data Stream
FileStream->Release();
pStorage->Release();
Buffer->Flush();
// Get Statistics For Final Size Of Byte Array
Buffer->Stat(&BytesStatistics, STATFLAG_NONAME);
// Cut UnNeeded Data Coming From SaveAsFile() (Leave Only "Pure" Picture Data)
SkipFloat = (double(OutStream) / 512); // Must Be In a 512 Blocks...
if(SkipFloat > DWORD(SkipFloat)) ByteSkip = (DWORD)SkipFloat + 1;
else ByteSkip = (DWORD)SkipFloat;
ByteSkip = ByteSkip * 512; // Must Be In a 512 Blocks...
// Find Difference Between The Two Values
ByteSkip = (DWORD)(BytesStatistics.cbSize.QuadPart - ByteSkip);
// Allocate Only The "Pure" Picture Data
RealData.LowPart = 0;
RealData.HighPart = 0;
RealData.QuadPart = ByteSkip;
BufferBytes = (BYTE*)malloc(OutStream);
if(BufferBytes == NULL)
{
Buffer->Release();
HWND hWnd = AfxGetApp()->GetMainWnd()->m_hWnd;
MessageBoxEx(hWnd, "Can not allocate enough memory\t", "ERROR"/*ERROR_TITLE*/, MB_OK | MB_ICONSTOP, LANG_ENGLISH);
}
Buffer->ReadAt(RealData, BufferBytes, OutStream, &OutData);
if(BitmapFile.Open(sFilePathName, CFile::typeBinary | CFile::modeCreate | CFile::modeWrite, &e))
{
BitmapFile.Write(BufferBytes, OutData);
BitmapFile.Close();
bResult = TRUE;
}
else // Write File Failed...
{
TCHAR szCause[255];
e.GetErrorMessage(szCause, 255, NULL);
HWND hWnd = AfxGetApp()->GetMainWnd()->m_hWnd;
MessageBoxEx(hWnd, szCause, "ERROR"/*ERROR_TITLE*/, MB_OK | MB_ICONSTOP, LANG_ENGLISH);
bResult = FALSE;
}
Buffer->Release();
free(BufferBytes);
//.........这里部分代码省略.........