SubDirectory.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // Created by Иван_Архипов on 07.11.2017.
  3. //
  4. #ifndef LOTRO_DAT_PATCHER_SUBDIRECTORY_H
  5. #define LOTRO_DAT_PATCHER_SUBDIRECTORY_H
  6. #include <vector>
  7. #include <map>
  8. #include <unordered_map>
  9. extern "C++"
  10. {
  11. namespace LOTRO_DAT
  12. {
  13. enum FILE_TYPE : int;
  14. class DatFile;
  15. class DatException;
  16. class BinaryData;
  17. class Subfile;
  18. class SubDirectory
  19. {
  20. public:
  21. SubDirectory();
  22. SubDirectory(long long offset, DatFile *dat, long long max_subdirs = 63);
  23. ~SubDirectory();
  24. void MakeDictionary(std::unordered_map<long long, Subfile*> &dict);
  25. void UpdateDirectories(std::unordered_map<long long, BinaryData *> &patched_files, std::unordered_map<long long, Subfile*> &dict);
  26. private:
  27. void MakeSubDirectories();
  28. void MakeSubFiles();
  29. Subfile* MakeSubfile(long long dictionary_offset, long long fragments_count, long long unknown1, long long file_id, long long file_offset,
  30. long long file_size, long long timestamp, long long version, long long block_size);
  31. FILE_TYPE GetSubfileType(long long file_id, long long file_offset) const;
  32. DatFile *dat_;
  33. long long offset_;
  34. long long max_subdirs_;
  35. std::vector<SubDirectory *> subdirs_;
  36. std::vector<Subfile *> subfiles_;
  37. };
  38. }
  39. };
  40. #endif //LOTRO_DAT_PATCHER_SUBDIRECTORY_H