1 //////////////////////////////////////////////////////////////////////////////// 2 // Scorched3D (c) 2000-2011 3 // 4 // This file is part of Scorched3D. 5 // 6 // Scorched3D is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation; either version 2 of the License, or 9 // (at your option) any later version. 10 // 11 // Scorched3D is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License along 17 // with this program; if not, write to the Free Software Foundation, Inc., 18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 //////////////////////////////////////////////////////////////////////////////// 20 21 #if !defined(__INCLUDE_ModFilesh_INCLUDE__) 22 #define __INCLUDE_ModFilesh_INCLUDE__ 23 24 #include <engine/ModFileEntry.h> 25 #include <common/ProgressCounter.h> 26 #include <map> 27 28 class ModFiles 29 { 30 public: 31 ModFiles(); 32 virtual ~ModFiles(); 33 34 bool exportModFiles(const std::string &mod, const std::string &fileName); 35 bool importModFiles(std::string &mod, const std::string &fileName); 36 bool importModFiles(std::string &mod, NetBuffer &buffer); 37 38 bool loadModFiles(const std::string &mod, bool createDir, 39 ProgressCounter *counter = 0); 40 void clearAll(); 41 getFiles()42 std::map<std::string, ModFileEntry *> &getFiles() { return files_; } 43 static bool excludeSpecialFile(const std::string &file); 44 static bool excludeFile(const std::string &file); 45 static bool fileEnding(const std::string &file, const std::string &ext); 46 47 protected: 48 std::map<std::string, ModFileEntry *> files_; 49 50 bool loadModDir(NetBuffer &tmpFileContents, 51 const std::string &moddir, const std::string &mod, 52 ProgressCounter *counter = 0); 53 bool loadModFile(NetBuffer &tmpFileContents, 54 const std::string &fullFileName, 55 const std::string &modDir, const std::string &mod); 56 bool loadLocalModFile(NetBuffer &tmpFileContents, 57 const std::string &local, 58 const std::string &mod); 59 60 private: 61 ModFiles(const ModFiles&other); 62 ModFiles &operator=(ModFiles &other); 63 64 }; 65 66 #endif 67 68