Subfile.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 EXTENSION
  15. {
  16. TXT, JPG, DDS, WAV, OGG, FONT, UNKNOWN
  17. };
  18. class Subfile
  19. {
  20. public:
  21. Subfile();
  22. Subfile(DatFile *dat, long long fragments_count, long long unknown1, long long file_id, long long file_offset, long long file_size,
  23. long long timestamp, long long version, long long block_size);
  24. bool ExportFile(const char* filename, Database *db = nullptr) const;
  25. bool ExportFileAsTXT(const char *filename, Database *db = nullptr) const;
  26. bool PatchBinaryFile(const BinaryData &file);
  27. bool PatchTextFile();
  28. long long fragments_count() const;
  29. long long unknown1() const;
  30. long long file_id() const;
  31. long long file_offset() const;
  32. long long file_size() const;
  33. long long timestamp() const;
  34. long long version() const;
  35. long long block_size() const;
  36. EXTENSION ext() const;
  37. private:
  38. long long fragments_count_;
  39. long long unknown1_;
  40. long long file_id_;
  41. long long file_offset_;
  42. long long file_size_;
  43. long long timestamp_;
  44. long long version_;
  45. long long block_size_;
  46. bool compressed_;
  47. DatFile *dat_;
  48. EXTENSION ext_;
  49. EXTENSION GetExtension() const;
  50. std::string ExtensionToString(LOTRO_DAT::EXTENSION ext) const;
  51. BinaryData GetFileData(long long offset = 8) const;
  52. // Export functions block
  53. const BinaryData PrepareAsJPG() const;
  54. const BinaryData PrepareAsDDS() const;
  55. const BinaryData PrepareAsOGG() const;
  56. const BinaryData PrepareAsFont() const;
  57. const BinaryData PrepareAsWAV() const;
  58. const BinaryData PrepareAsUnk() const;
  59. // Patch functions block
  60. const BinaryData MakeFromJPG(const BinaryData &file) const;
  61. const BinaryData MakeFromDDS(const BinaryData &file) const;
  62. const BinaryData MakeFromOGG(const BinaryData &file) const;
  63. const BinaryData MakeFromFont(const BinaryData &file) const;
  64. const BinaryData MakeFromWAV(const BinaryData &file) const;
  65. const BinaryData MakeFromUnk(const BinaryData &file) const;
  66. };
  67. }
  68. };
  69. #endif //LOTRO_DAT_PATCHER_SUBFILE_H