Implemented some basic logic to try and detect the file format for the tools::loadSample function.