aboutsummaryrefslogtreecommitdiff
path: root/src/tools/extractor_common
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-05-10 15:29:47 +0200
committerShauren <shauren.trinity@gmail.com>2020-05-10 15:29:47 +0200
commitd889228259d98b29c0a4668af45b8a43c14d5983 (patch)
tree6085f408dfd321cca63e5b9f0da8548a1ed57050 /src/tools/extractor_common
parent16761e1d7c21db0cb612ac951bf7ad005d8214e7 (diff)
Core/DataStores: Allow loading encrypted sections when key is known when reading from casc storage
Closes #24456
Diffstat (limited to 'src/tools/extractor_common')
-rw-r--r--src/tools/extractor_common/DB2CascFileSource.cpp9
-rw-r--r--src/tools/extractor_common/DB2CascFileSource.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/extractor_common/DB2CascFileSource.cpp b/src/tools/extractor_common/DB2CascFileSource.cpp
index e09d039c923..3236471c4e8 100644
--- a/src/tools/extractor_common/DB2CascFileSource.cpp
+++ b/src/tools/extractor_common/DB2CascFileSource.cpp
@@ -21,6 +21,7 @@
DB2CascFileSource::DB2CascFileSource(std::shared_ptr<CASC::Storage const> storage, uint32 fileDataId, bool printErrors /*= true*/)
{
+ _storageHandle = storage;
_fileHandle.reset(storage->OpenFile(fileDataId, CASC_LOCALE_NONE, printErrors, true));
_fileName = Trinity::StringFormat("FileDataId: %u", fileDataId);
}
@@ -60,3 +61,11 @@ char const* DB2CascFileSource::GetFileName() const
{
return _fileName.c_str();
}
+
+DB2EncryptedSectionHandling DB2CascFileSource::HandleEncryptedSection(DB2SectionHeader const& sectionHeader) const
+{
+ if (std::shared_ptr<CASC::Storage const> storage = _storageHandle.lock())
+ return storage->HasTactKey(sectionHeader.TactId) ? DB2EncryptedSectionHandling::Process : DB2EncryptedSectionHandling::Skip;
+
+ return DB2EncryptedSectionHandling::Skip;
+}
diff --git a/src/tools/extractor_common/DB2CascFileSource.h b/src/tools/extractor_common/DB2CascFileSource.h
index a1867233596..82809db604e 100644
--- a/src/tools/extractor_common/DB2CascFileSource.h
+++ b/src/tools/extractor_common/DB2CascFileSource.h
@@ -32,8 +32,10 @@ struct DB2CascFileSource : public DB2FileSource
int64 GetFileSize() const override;
CASC::File* GetNativeHandle() const;
char const* GetFileName() const override;
+ DB2EncryptedSectionHandling HandleEncryptedSection(DB2SectionHeader const& sectionHeader) const override;
private:
+ std::weak_ptr<CASC::Storage const> _storageHandle;
std::unique_ptr<CASC::File> _fileHandle;
std::string _fileName;
};