bool GunzipString( const RString &sIn, RString &sOut, RString &sError )
{
	RageFileObjMem *mem = new RageFileObjMem;
	mem->PutString( sIn );

	uint32_t iCRC32;
	RageFileBasic *pFile = GunzipFile( mem, sError, &iCRC32 );
	if( pFile == NULL )
		return false;

	pFile->Read( sOut );

	/* Check the CRC. */
	unsigned iRet;
	ASSERT( pFile->GetCRC32( &iRet ) );
	SAFE_DELETE( pFile );

	if( iRet != iCRC32 )
	{
		sError = "CRC error";
		return false;
	}

	return true;
}
示例#2
0
RString XmlFileUtil::GetXML( const XNode *pNode )
{
	RageFileObjMem f;
	int iTabBase = 0;
	InitEntities();
	GetXMLInternal( pNode, f, true, iTabBase );
	return f.GetString();
}
void GzipString( const RString &sIn, RString &sOut )
{
	/* Gzip it. */
	RageFileObjMem mem;
	RageFileObjGzip gzip( &mem );
	gzip.Start();
	gzip.Write( sIn );
	gzip.Finish();

	sOut = mem.GetString();
}
void CourseWriterCRS::GetEditFileContents( const Course *pCourse, RString &sOut )
{
	RageFileObjMem mem;
	CourseWriterCRS::Write( *pCourse, mem, true );
	sOut = mem.GetString();
}
示例#5
0
//========================================================
// Name   : GetXML
// Desc   : convert plain xml text from parsed xml node
// Param  :
// Return : converted plain string
//--------------------------------------------------------
// Coder    Date                      Desc
// bro      2002-10-29
//========================================================
CString XNode::GetXML() const
{
	RageFileObjMem f;
	GetXML( f, NULL );
	return f.GetString();
}