本文整理汇总了C++中TMemoryStream::ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C++ TMemoryStream::ReadByte方法的具体用法?C++ TMemoryStream::ReadByte怎么用?C++ TMemoryStream::ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMemoryStream
的用法示例。
在下文中一共展示了TMemoryStream::ReadByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: method
void z3ResEx::parseMsf( TMemoryStream &msf )
{
switch( m_fileindexVer )
{
case 0 :
{
unsigned char method( 0 );
FILEINDEX_ENTRY info;
unsigned char *strMRFN( nullptr );
unsigned char *strName( nullptr );
unsigned int items( 0 ), errors( 0 );
while( ( msf.Position() < msf.Size() ) && ( errors < MAX_ERRORS ) )
{
method = msf.ReadByte();
msf.Read( &info, sizeof( FILEINDEX_ENTRY ) );
unpackStringEx( msf, strMRFN, info.lenMRFN );
unpackStringEx( msf, strName, info.lenName );
if( m_listContents )
{
printf( "%s (%u bytes)\n", strName, info.size );
}
else
{
if( !( extractItem( info, method, (char *)strMRFN, (char *)strName ) ) )
++errors;
}
++items;
delete strMRFN;
delete strName;
}
printf( "Processed %u items (%u issues)\n\n", items, errors );
break;
}
case 1 :
{
parseMsfMethod2( msf );
break;
}
}
}
示例2: method
void z3ResEx::parseMsf( TMemoryStream &msf )
{
switch( m_fileindexVer )
{
case 0 :
{
unsigned char method( 0 );
FILEINDEX_ENTRY info;
vector<unsigned char> strMRFN(MAX_STRING_SIZE);
vector<unsigned char> strName(MAX_STRING_SIZE);
unsigned int items( 0 ), errors( 0 );
while( ( msf.Position() < msf.Size() ) && ( errors < MAX_ERRORS ) )
{
method = msf.ReadByte();
msf.Read( &info, sizeof( FILEINDEX_ENTRY ) );
unpackStringEx(msf, strMRFN, info.lenMRFN);
unpackStringEx(msf, strName, info.lenName);
if( m_listContents )
{
printf( "%s (%u bytes)\n", &strName[0], info.size );
}
else
{
if( !( extractItem( info, method, reinterpret_cast<const char*>(&strMRFN[0]), reinterpret_cast<const char*>(&strName[0]) ) ) )
++errors;
}
++items;
}
printf( "Processed %u items (%u issues)\n\n", items, errors );
break;
}
case 1 :
{
parseMsfMethod2( msf );
break;
}
}
}
示例3: extractionMain
void extractionMain( TMemoryStream &msf )
{
const unsigned int MAX_ERRORS( 50 );
unsigned int items( 0 );
FILEINDEX_ENTRY info;
unsigned char method;
char *strMRFN( nullptr ), *strName( nullptr );
#define unpackString(buf,len) \
{ \
buf = new char[ len +1 ]; \
msf.Read( buf, len ); \
buf[ len ] = 0; \
}
#ifdef SAVE_MSF_FILEINDEX
msf.SaveToFile("z3debug_fileindex.msf");
#endif
// Are we just listing files?
if( user_opt_list_files )
{
std::string fname;
printf("Listing filesystem contents\n\n");
while( msf.Position() < msf.Size() )
{
method = msf.ReadByte();
msf.Read( &info, sizeof( FILEINDEX_ENTRY ) );
unpackString( strMRFN, info.lenMRFN );
unpackString( strName, info.lenName );
fname = fsRename( strMRFN, strName );
printf("%s\n", fname.c_str());
++items;
delete strMRFN;
delete strName;
}
fname.clear();
printf("\nLocated %u files\n", items);
}
else
// Run the main extraction loop
{
unsigned int errors( 0 );
printf("Extracting filesystem contents\n\n");
while( ( msf.Position() < msf.Size() ) && ( errors < MAX_ERRORS ) )
{
method = msf.ReadByte();
msf.Read( &info, sizeof( FILEINDEX_ENTRY ) );
unpackString( strMRFN, info.lenMRFN );
unpackString( strName, info.lenName );
if( !( extractItem( info, method, strMRFN, strName ) ) )
++errors;
++items;
delete strMRFN;
delete strName;
}
if( errors >= MAX_ERRORS )
printf("ERROR: Extraction stopped as there were too many errors\n");
else
printf("\nExtracted %u files (%u problems)\n", items, errors);
}
}