Exemplo n.º 1
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 );
			}
Exemplo n.º 2
0
	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() );
	}
Exemplo n.º 3
0
	int Buffer::WriteString( const Bootil::BString & str )
	{
		int iWritten = 0;

		for ( int i = 0; i < str.length(); i++ )
		{
			WriteType<char>( str[i] );
			iWritten++;
		}

		WriteType<char>( 0 );
		iWritten++;
		return iWritten;
	}