12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // Created by Иван_Архипов on 01.11.2017.
- //
- #include "Subfile.h"
- #include "BinaryData.h"
- #include "DatFile.h"
- #include "Common/DatException.h"
- #include "Database.h"
- #include "Common/CommonFunctions.h"
- #include <algorithm>
- const long long MAXSIZE = 50ll * 1024ll * 1024ll; // Setting maximal file size 50 MB; Files with size more than 50 mb
- // will be recognized as incorrect and passed.
- // This should be done because
- namespace LOTRO_DAT {
- Subfile::Subfile() {}
- Subfile::Subfile(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) :
- dat_(dat), fragments_count_(fragments_count), unknown1_(unknown1), file_id_(file_id),
- file_offset_(file_offset),
- file_size_(file_size), timestamp_(timestamp), version_(version), block_size_(block_size) {
- if (file_size_ > MAXSIZE)
- throw DatException("Bad Subfile::Subfile() - File size is too much... Maybe it's incorrect..?",
- SUBFILE_EXCEPTION);
- }
- long long Subfile::fragments_count() const {
- return fragments_count_;
- }
- long long Subfile::unknown1() const {
- return unknown1_;
- }
- long long Subfile::file_id() const {
- return file_id_;
- }
- long long Subfile::file_offset() const {
- return file_offset_;
- }
- long long Subfile::file_size() const {
- return file_size_;
- }
- long long Subfile::timestamp() const {
- return timestamp_;
- }
- long long Subfile::version() const {
- return version_;
- }
- long long Subfile::block_size() const {
- return block_size_;
- }
- FILE_TYPE Subfile::FileType() const {
- throw DatException("Bad Subfile::FileType() - function is not implemented for this type.", SUBFILE_EXCEPTION);
- }
- std::string Subfile::Extension() const {
- throw DatException("Bad Subfile::Extension() - function is not implemented for this type.", SUBFILE_EXCEPTION);
- }
- bool Subfile::PrepareForExport(const BinaryData &file_data, long long &export_size, std::vector<BinaryData> &binary_data,
- std::vector<std::u16string> &text_data, std::vector<YAML::Node> &options) {
- throw DatException("Bad Subfile::PrepareForExport() - function is not implemented for this type.", EXPORT_EXCEPTION);
- }
- BinaryData Subfile::MakeForImport(const BinaryData &old_data, const BinaryData &binary_data, const std::u16string &text_data,
- const YAML::Node &options) {
- throw DatException("Bad Subfile::MakeForImport() - function is not implemented for this type.", IMPORT_EXCEPTION);
- }
- };
|