// // Created by Иван_Архипов on 24.11.2017. // #include "OggSubfile.h" #include "../BinaryData.h" #include "../DatFile.h" #include "../Common/DatException.h" namespace LOTRO_DAT { OggSubfile::OggSubfile() {} OggSubfile::OggSubfile(DatFile *dat, long long fragments_count, long long unknown1, long long file_id, long long file_offset, long long file_size, long long timestamp, long long version, long long block_size) : Subfile(dat, fragments_count, unknown1, file_id, file_offset, file_size, timestamp, version, block_size) { } FILE_TYPE OggSubfile::FileType() const { return OGG; } std::string OggSubfile::Extension() const { return ".ogg"; } bool OggSubfile::PrepareForExport(const BinaryData &file_data, long long &export_size, std::vector &binary_data, std::vector &text_data, std::vector &options) { export_size = 1; binary_data.emplace_back(file_data.CutData(8)); text_data.emplace_back(u""); options.emplace_back(YAML::Node()); options[0]["file_id"] = file_id(); options[0]["extension"] = Extension(); return true; } BinaryData OggSubfile::MakeForImport(const BinaryData &old_data, const BinaryData &binary_data, const std::u16string &text_data, const YAML::Node &options) { if (!options["extension"] || options["extension"].as() != Extension() || !options["file_id"] || options["file_id"].as() != file_id()) { throw DatException("Bad DdsSubfile::MakeForImport() - invalid options data!", IMPORT_EXCEPTION); } return old_data.CutData(0, 24) + binary_data; } };