当前位置: 首页>>代码示例>>C++>>正文


C++ CFileReader::ReadFile方法代码示例

本文整理汇总了C++中CFileReader::ReadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileReader::ReadFile方法的具体用法?C++ CFileReader::ReadFile怎么用?C++ CFileReader::ReadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileReader的用法示例。


在下文中一共展示了CFileReader::ReadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnReadJpeg

LRESULT CMainFrame::OnReadJpeg( WPARAM wParam, LPARAM lParam )
{
	int nSegmentCount = 0;
	CSegmentData *lpSegmentData = NULL;
	CSegmentInfo *lpSegmentInfo = NULL;

	CFileReader FileReader;
	CJpegAnalyzer JpegAnalyzer;
	CUserDatas* lpUserDatas = ((CIFuzzMakerDoc*)GetActiveDocument())->GetUserDatas();
	
	lpUserDatas->GetReadBufferArray().RemoveAll();
	if( !FileReader.ReadFile( lpUserDatas->GetJpegFileName(), lpUserDatas->GetReadBufferArray() ) )
	{
		//	エラー
		return FALSE;
	}

	//	Jpeg解析
	lpUserDatas->GetSegmentDataArray().RemoveAllWithDelete();
	if( !JpegAnalyzer.Analyze( lpUserDatas->GetReadBufferArray(), m_FixedDatas.GetSegmentInfoMap(), lpUserDatas->GetSegmentDataArray() ) )
		return FALSE;

	//	Exif解析
	for(nSegmentCount=0; nSegmentCount<lpUserDatas->GetSegmentDataArray().GetSize(); nSegmentCount++ )
	{
		lpSegmentData = lpUserDatas->GetSegmentDataArray().GetAt( nSegmentCount );
		if( lpSegmentData )
		{
			lpSegmentInfo = lpSegmentData->GetSegmentInfo();
			if( lpSegmentInfo )
			{
				if( lpSegmentInfo->GetMarker() == _T("FFE1") )
				{
					CExifAnalyzer ExifAnalyzer;
					ExifAnalyzer.Analyze( lpUserDatas->GetReadBufferArray().GetSize(), lpSegmentData, &m_FixedDatas.GetImageFileDirectoryInfoMap(), &m_FixedDatas.GetTagTypeInfoMap() );
				}
				if( lpSegmentInfo->IsAnalysisSegment() )
				{
					CSegmentAnalyzer SegmentAnalyzer;
					SegmentAnalyzer.Analyze( lpUserDatas->GetReadBufferArray().GetSize(), lpSegmentData );
				}
			}
		}
	}

	SendMessageToDescendants( WM_APP_EXIF_ANALYZED, NULL, NULL );

	return TRUE;
}
开发者ID:cherry-wb,项目名称:iFuzzMaker,代码行数:49,代码来源:MainFrm.cpp

示例2: OnReadGroup


//.........这里部分代码省略.........
				}else if( lpPatternInfo->GetDataType() == CPatternData::DATATYPE_DEC_32_LITTLE )
				{
					nDecValueInteger = (unsigned int)strtoul( szValue, NULL, 10 );
					nDecValueInteger = CEndianConverter::ConvertToInteger( (unsigned char*)&nDecValueInteger, FALSE );
					BinaryDataArray.SetSize( sizeof(nDecValueInteger) * (!lpPatternInfo->GetRepeat()?1:lpPatternInfo->GetRepeat()) );
					lpBuffer = BinaryDataArray.GetData();
					for( int nRepeat=0; nRepeat<(!lpPatternInfo->GetRepeat()?1:lpPatternInfo->GetRepeat()); nRepeat++ )
					{
						CopyMemory( &lpBuffer[nRepeat*sizeof(nDecValueInteger)], &nDecValueInteger, sizeof(nDecValueInteger) );
					}
				}else if( lpPatternInfo->GetDataType() == CPatternData::DATATYPE_DEC_32_BIG )
				{
					nDecValueInteger = (unsigned int)strtoul( szValue, NULL, 10 );
					nDecValueInteger = CEndianConverter::ConvertToInteger( (unsigned char*)&nDecValueInteger, TRUE );
					BinaryDataArray.SetSize( sizeof(nDecValueInteger) * (!lpPatternInfo->GetRepeat()?1:lpPatternInfo->GetRepeat()) );
					lpBuffer = BinaryDataArray.GetData();
					for( int nRepeat=0; nRepeat<(!lpPatternInfo->GetRepeat()?1:lpPatternInfo->GetRepeat()); nRepeat++ )
					{
						CopyMemory( &lpBuffer[nRepeat*sizeof(nDecValueInteger)], &nDecValueInteger, sizeof(nDecValueInteger) );
					}
				}else if( lpPatternInfo->GetDataType() == CPatternData::DATATYPE_HEX )
				{
					//
					BinaryDataArray.SetSize( (int)(szValue.GetLength()/2) );
					for( int cCnt=0; cCnt<(int)(szValue.GetLength()/2); cCnt++ )
					{
						unsigned int nVal = strtol( szValue.Mid( cCnt*2, 2 ),NULL,16 );
						BinaryDataArray.SetAt(cCnt, nVal);
					}
				}else if( lpPatternInfo->GetDataType() == CPatternData::DATATYPE_BIN )
				{
					//
					CFileReader fl;
					if( !fl.ReadFile( lpPatternInfo->GetFileName(), BinaryDataArray ) )
						continue;
				}
				lpPatternGroupData->GetPatternDataArray()->AddWithNew( lpPatternData );

				lpPatternData->SetCheck( lpPatternInfo->GetSelectFlag() );
				lpPatternData->SetDispName( lpPatternInfo->GetDispName() );
				lpPatternData->SetDataType( lpPatternInfo->GetDataType() );
				lpPatternData->SetValue( lpPatternInfo->GetValue() );
				lpPatternData->SetRepeat( lpPatternInfo->GetRepeat() );
				lpPatternData->SetWriteMode( lpPatternInfo->GetWriteMode() );
				lpPatternData->SetFuzzArea( lpPatternInfo->GetFuzzArea() );
				lpPatternData->SetSearchField( lpPatternInfo->GetSearchField() );
				lpPatternData->SetFieldKey( lpPatternInfo->GetFieldKey() );
				lpPatternData->SetDescription( lpPatternInfo->GetDescription() );
				lpPatternData->SetBinaryDataArray( BinaryDataArray );

				if( lpPatternInfo->GetFuzzArea() == CPatternData::FUZZAREA_FILE )
				{
					TCHAR* endptr = NULL;
					int nFilePos = _tcstol( lpPatternInfo->GetFieldKey(), &endptr, 10 );
					if( _tcslen(endptr) )
						continue;
					lpPatternData->SetFilePos( nFilePos );
				}

				if( lpPatternData->GetSearchField() == CPatternData::SEARCHFIELD_TAG ||
					lpPatternData->GetSearchField() == CPatternData::SEARCHFIELD_TYPE ||
					lpPatternData->GetSearchField() == CPatternData::SEARCHFIELD_SEGMENT )
				{
					POSITION pos = NULL;
					CString szKey;
					CImageFileDirectoryInfo *lpImageFileDirectoryInfo = NULL;
开发者ID:cherry-wb,项目名称:iFuzzMaker,代码行数:67,代码来源:MainFrm.cpp


注:本文中的CFileReader::ReadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。