Subfile.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // Created by Иван_Архипов on 01.11.2017.
  3. //
  4. #ifndef LOTRO_DAT_PATCHER_SUBFILE_H
  5. #define LOTRO_DAT_PATCHER_SUBFILE_H
  6. #include <string>
  7. extern "C++"
  8. {
  9. namespace LOTRO_DAT
  10. {
  11. class DatFile;
  12. class BinaryData;
  13. class Database;
  14. enum FILE_TYPE : int;
  15. class Subfile
  16. {
  17. public:
  18. Subfile();
  19. Subfile(DatFile *dat, long long fragments_count, long long unknown1, long long file_id, long long file_offset, long long file_size,
  20. long long timestamp, long long version, long long block_size);
  21. bool ExportFile(const char* filename) const;
  22. bool ExportFile(Database *db) const;
  23. bool ExportFileAsTXT(Database *db = nullptr) const;
  24. bool PatchBinaryFile(const BinaryData &file);
  25. bool PatchTextFile();
  26. long long fragments_count() const;
  27. long long unknown1() const;
  28. long long file_id() const;
  29. long long file_offset() const;
  30. long long file_size() const;
  31. long long timestamp() const;
  32. long long version() const;
  33. long long block_size() const;
  34. FILE_TYPE ext() const;
  35. private:
  36. long long fragments_count_;
  37. long long unknown1_;
  38. long long file_id_;
  39. long long file_offset_;
  40. long long file_size_;
  41. long long timestamp_;
  42. long long version_;
  43. long long block_size_;
  44. bool compressed_;
  45. DatFile *dat_;
  46. FILE_TYPE ext_;
  47. FILE_TYPE GetExtension() const;
  48. std::string ExtensionToString(LOTRO_DAT::FILE_TYPE ext) const;
  49. BinaryData GetFileData(long long offset = 8) const;
  50. // Export functions block
  51. const BinaryData PrepareAsJPG() const;
  52. const BinaryData PrepareAsDDS() const;
  53. const BinaryData PrepareAsOGG() const;
  54. const BinaryData PrepareAsFont() const;
  55. const BinaryData PrepareAsWAV() const;
  56. const BinaryData PrepareAsUnk() const;
  57. // Patch functions block
  58. const BinaryData MakeFromJPG(const BinaryData &file) const;
  59. const BinaryData MakeFromDDS(const BinaryData &file) const;
  60. const BinaryData MakeFromOGG(const BinaryData &file) const;
  61. const BinaryData MakeFromFont(const BinaryData &file) const;
  62. const BinaryData MakeFromWAV(const BinaryData &file) const;
  63. const BinaryData MakeFromUnk(const BinaryData &file) const;
  64. };
  65. }
  66. };
  67. #endif //LOTRO_DAT_PATCHER_SUBFILE_H