예제 #1
0
파일: PackFile.cpp 프로젝트: ace13/bootil
	void PackFile::Load( const Bootil::BString& strName )
	{
		Msg( "LoadinG File!! %s\n", strName.c_str() );

		AutoBuffer buffer;

		if ( !Bootil::File::Read( strName, buffer ) )
		{
			Warning( "C0ouldn;t oipen!\n" );
			return;
		}

		buffer.SetPos( 0 );

		// Check file signature
		{
			Bootil::BString strSig = buffer.ReadString();
			Msg( "Signature [%s]\n", strSig.c_str() ); 
			if ( strSig != "FILEPACK001" ) return;
		}

		unsigned int iOffset = 0;

		while ( true )
		{
			if ( buffer.ReadType<unsigned char>() != 1 ) break;

			unsigned int iSize = buffer.ReadType<unsigned int>();
			Bootil::BString strName = buffer.ReadString();

			Msg( "%s %i\n", strName.c_str(), iSize );

			FileEntry fe;
			fe.iLength = iSize;
			fe.iStartPos = iOffset;

			m_FileMap[ strName ] = fe;

			iOffset+= iSize;
		}

		Msg( "End Pos Files: %i\n", iOffset );
		Msg( "End Pos Actual: %i\n", buffer.GetWritten() - buffer.GetPos() );

		// The left over data goes into m_Buffer
		m_Buffer.Clear();
		m_Buffer.Write( buffer.GetCurrent(), buffer.GetWritten() - buffer.GetPos() );
	}
예제 #2
0
			BOOTIL_EXPORT void TrimBefore( Bootil::BString& str, const Bootil::BString& strFind, bool bIncluding )
			{
				std::size_t i = str.find( strFind.c_str() );
				if ( i == std::string::npos ) return;

				if ( bIncluding )
					str = str.substr( i + strFind.length() );
				else
					str = str.substr( i + 1 );
			}