bool CScript::FindTextHeader( LPCTSTR pszName ) // Find a section in the current script { ADDTOCALLSTACK("CScript::FindTextHeader"); // RETURN: false = EOF reached. ASSERT(pszName); ASSERT( ! IsBinaryMode()); SeekToBegin(); size_t len = strlen( pszName ); ASSERT(len); do { if ( ! ReadTextLine(false)) { return( false ); } if ( IsKeyHead( "[EOF]", 5 )) { return( false ); } } while ( ! IsKeyHead( pszName, len )); return( true ); }
LPCTSTR CFileText::GetModeStr() const { // end of line translation is crap. ftell and fseek don't work correctly when you use it. // fopen() args if ( IsBinaryMode()) return ( IsWriteMode()) ? "wb" : "rb"; if ( GetMode() & OF_READWRITE ) return "a+b"; if ( GetMode() & OF_CREATE ) return "w"; if ( IsWriteMode() ) return "w"; else return "rb"; // don't parse out the \n\r }
bool CResourceLock::ReadTextLine( bool fRemoveBlanks ) // Read a line from the opened script file { ADDTOCALLSTACK("CResourceLock::ReadTextLine"); // ARGS: // fRemoveBlanks = Don't report any blank lines, (just keep reading) // ASSERT(m_pLock); ASSERT( ! IsBinaryMode()); while ( PhysicalScriptFile::ReadString( GetKeyBufferRaw(SCRIPT_MAX_LINE_LEN), SCRIPT_MAX_LINE_LEN )) { m_pLock->m_iLineNum = ++m_iLineNum; // share this with original open. if ( fRemoveBlanks ) { if ( ParseKeyEnd() <= 0 ) continue; } return( true ); } m_pszKey[0] = '\0'; return( false ); }