26#include <wx/wfstream.h>
27#include <wx/txtstrm.h>
32 0xA1, 0xB1, 0x1A, 0xE1 };
35 bool aIgnoreWhitespace )
37 wxFFileInputStream input( aFilePath );
39 if( input.IsOk() && !input.Eof() )
42 wxTextInputStream
text( input );
43 wxString line =
text.ReadLine();
45 if( aIgnoreWhitespace )
47 while( !input.Eof() && line.IsEmpty() )
48 line =
text.ReadLine().Trim(
false );
51 if( line.StartsWith( aPrefix ) )
61 wxFFileInputStream input( aFilePath );
63 if( input.IsOk() && !input.Eof() )
65 if(
static_cast<size_t>( input.GetLength() ) < aHeader.size() )
68 std::vector<uint8_t> parsedHeader( aHeader.size() );
70 if( !input.ReadAll( parsedHeader.data(), parsedHeader.size() ) )
73 return parsedHeader == aHeader;
bool fileStartsWithBinaryHeader(const wxString &aFilePath, const std::vector< uint8_t > &aHeader)
Check if a file starts with a defined binary header.
bool fileStartsWithPrefix(const wxString &aFilePath, const wxString &aPrefix, bool aIgnoreWhitespace)
Check if a file starts with a defined string.
const std::vector< uint8_t > COMPOUND_FILE_HEADER