Try every format by first uses the "is" functions which try to detect whether a given file is a good match to that file format or not. Those functions are much less tolerant than the load functions and so should help to discriminate whether a file could be loaded or not by a given loader. The loader return is still used in case the guess was wrong.
| 228 | //file format or not. Those functions are much less tolerant than the load functions and so should help to discriminate |
| 229 | //whether a file could be loaded or not by a given loader. The loader return is still used in case the guess was wrong. |
| 230 | bool FrameFileIO::autoDetectLoadFile(QString filename, QVector<CANFrame>* frames) |
| 231 | { |
| 232 | if (isCanalyzerBLF(filename)) |
| 233 | { |
| 234 | if (loadCanalyzerBLF(filename, frames)) |
| 235 | { |
| 236 | qDebug() << "Loaded as Canalyzer BLF successfully!"; |
| 237 | return true; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | if (isNativeCSVFile(filename)) |
| 242 | { |
| 243 | if (loadNativeCSVFile(filename, frames)) |
| 244 | { |
| 245 | qDebug() << "Loaded as native CSV successfully!"; |
| 246 | return true; |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | if (isCanalyzerASC(filename)) |
| 251 | { |
| 252 | if (loadCanalyzerASC(filename, frames)) |
| 253 | { |
| 254 | qDebug() << "Loaded as Canalyzer ASC successfully!"; |
| 255 | return true; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | if (isCRTDFile(filename)) |
| 260 | { |
| 261 | if (loadCRTDFile(filename, frames)) |
| 262 | { |
| 263 | qDebug() << "Loaded as CRTD successfully!"; |
| 264 | return true; |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | |
| 269 | if (isTraceFile(filename)) |
| 270 | { |
| 271 | if (loadTraceFile(filename, frames)) |
| 272 | { |
| 273 | qDebug() << "Loaded as trace successfully!"; |
| 274 | return true; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | if (isVehicleSpyFile(filename)) |
| 279 | { |
| 280 | if (loadVehicleSpyFile(filename, frames)) |
| 281 | { |
| 282 | qDebug() << "Loaded as vehicle spy successfully!"; |
| 283 | return true; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | if (isCanDumpFile(filename)) |
nothing calls this directly
no outgoing calls
no test coverage detected