diff --git a/SHNFileDecryptor/SHNFileDecryptor.h b/SHNFileDecryptor/SHNFileDecryptor.h index f2ab36d..1696743 100644 --- a/SHNFileDecryptor/SHNFileDecryptor.h +++ b/SHNFileDecryptor/SHNFileDecryptor.h @@ -12,7 +12,6 @@ typedef char sbyte; class SHNFile{ SHNFile(const SHNFile&)=delete; - SHNFile(const SHNFile&&)=delete; std::vectorReadBytes(std::ifstream&file); std::vectorReadBytes(std::ifstream&file,int bytes); void WriteBytes(std::ofstream&file,char*data,int length); @@ -99,8 +98,11 @@ public: void Write(int row,int col,uint32_t val); void Write(int row,int col,float val); void Write(int row,int col,std::string val); - const SHNFile::Data Get(int row,int col)const; + //const SHNFile::Data Get(int row,int col)const; + template + const T Get(int row,int col)const; SHNFile(); + SHNFile(SHNFile&&)noexcept; ~SHNFile(); }; #ifdef OLC_PGEX_SHNFile @@ -523,8 +525,9 @@ void SHNFile::Save(){ WriteBytes(encryptedFile,data,readAmt-0x24); std::cout<<"File "< +const T SHNFile::Get(int row,int col)const{ + return *(std::static_pointer_cast(contents[row][col].data)); }; void SHNFile::Write(int row,int col,std::byte val){ contents[row][col].Set(val); @@ -556,6 +559,13 @@ SHNFile::SHNFile(){ SHNFile::~SHNFile(){ Cleanup(); } +SHNFile::SHNFile(SHNFile&&temp)noexcept{ + temp.cryptHeader=cryptHeader; + temp.data=data; + temp.rawData=rawData; + + cryptHeader=data=rawData=nullptr; +} void SHNFile::Cleanup(){ if(cryptHeader!=nullptr){ delete[] cryptHeader; diff --git a/SHNFileDecryptor/SHNFile_example.cpp b/SHNFileDecryptor/SHNFile_example.cpp index f884bd6..3c59327 100644 --- a/SHNFileDecryptor/SHNFile_example.cpp +++ b/SHNFileDecryptor/SHNFile_example.cpp @@ -8,6 +8,8 @@ int main(){ SHNFile shn3; shn3.Load("ItemViewInfo.shn"); - shn3.Write(3,2,14); - shn3.Save(); + SHNFile shn4((SHNFile&&)shn3); + uint32_t test=shn3.Get(3,2); + //shn3.Write(3,2,14); + //shn3.Save(); } \ No newline at end of file