///Program to test .nif files both on the FileSystem and in BSA archives. #include "../niffile.hpp" #include "../../bsa/bsa_file.hpp" #include "../../bsa/bsa_archive.hpp" #include #include #include #include #include ///See if the file has the named extension bool hasExtension(std::string filename, std::string extensionToFind) { std::string extension = filename.substr(filename.find_last_of(".")+1); //Convert strings to lower case for comparison std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::transform(extensionToFind.begin(), extensionToFind.end(), extensionToFind.begin(), ::tolower); if(extension == extensionToFind) return true; else return false; } ///See if the file has the "nif" extension. bool isNIF(std::string filename) { return hasExtension(filename,"nif"); } ///See if the file has the "bsa" extension. bool isBSA(std::string filename) { return hasExtension(filename,"bsa"); } ///Check all the nif files in the given BSA archive void readBSA(std::string filename) { Bsa::BSAFile bsa; bsa.open(filename.c_str()); const Bsa::BSAFile::FileList &files = bsa.getList(); Bsa::addBSA(filename,"Bsa Files"); for(unsigned int i=0; i