TextSubfile.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // Created by Иван_Архипов on 24.11.2017.
  3. //
  4. #ifndef LOTRO_DAT_LIBRARY_TEXTSUBFILE_H
  5. #define LOTRO_DAT_LIBRARY_TEXTSUBFILE_H
  6. #include "../../include/Subfile.h"
  7. #include <vector>
  8. #include <unordered_map>
  9. namespace LOTRO_DAT {
  10. class TextSubfile : public Subfile {
  11. public:
  12. TextSubfile();
  13. TextSubfile(DatFile *dat, long long dictionary_offset, long long fragments_count, long long unknown1,
  14. long long file_id, long long file_offset, long long file_size, long long timestamp,
  15. long long version, long long block_size);
  16. FILE_TYPE FileType() const override;
  17. std::string Extension() const override;
  18. SubfileData PrepareForExport(const BinaryData &file_data) override;
  19. BinaryData MakeForImport(const BinaryData &old_data, const SubfileData &data) override;
  20. private:
  21. std::vector<std::u16string> MakePieces(const BinaryData &data, long long &offset);
  22. std::vector<long long> MakeArgumentReferences(const BinaryData &data, long long &offset);
  23. std::vector<std::vector<BinaryData>> MakeArgumentStrings(const BinaryData &data, long long &offset);
  24. std::vector<SubfileData> FileFragments;
  25. std::unordered_map<long long, SubfileData> ParsePatchFragments(const SubfileData &data);
  26. BinaryData BuildPieces(const BinaryData &data, const SubfileData &new_data, long long &offset);
  27. BinaryData BuildArgumentReferences(const BinaryData &data, const SubfileData &new_data, long long &offset);
  28. BinaryData BuildArgumentStrings(const BinaryData &data, const SubfileData &new_data, long long &offset);
  29. BinaryData GetPieceData(const BinaryData &data, long long &offset) const;
  30. BinaryData GetArgumentReferenceData(const BinaryData &data, long long &offset) const;
  31. BinaryData GetArgumentStringsData(const BinaryData &data, long long &offset) const;
  32. };
  33. };
  34. #endif //LOTRO_DAT_LIBRARY_TEXTSUBFILE_H