| 36 | namespace mdf { |
| 37 | |
| 38 | bool IsMdfFile(const std::string &filename) { |
| 39 | std::filebuf file; |
| 40 | |
| 41 | try { |
| 42 | file.open(filename, std::ios_base::in | std::ios_base::binary); |
| 43 | } catch (const std::exception&) { |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | if (!file.is_open()) { |
| 48 | return false; |
| 49 | } |
| 50 | const bool is_mdf = IsMdfFile(file); |
| 51 | file.close(); |
| 52 | return is_mdf; |
| 53 | } |
| 54 | |
| 55 | bool IsMdfFile(std::streambuf &buffer) { |
| 56 |