diff --git a/Sources/Tools/MaxComponent/Pch.h b/Sources/Tools/MaxComponent/Pch.h index 42566e6f..50773a0f 100644 --- a/Sources/Tools/MaxComponent/Pch.h +++ b/Sources/Tools/MaxComponent/Pch.h @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Standard Library #include #include +#include #include #include #include diff --git a/Sources/Tools/MaxComponent/plMiscComponents.cpp b/Sources/Tools/MaxComponent/plMiscComponents.cpp index 594f7d90..395ae812 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.cpp +++ b/Sources/Tools/MaxComponent/plMiscComponents.cpp @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "resource.h" #include +#include #include #pragma hdrstop @@ -96,6 +97,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Location Related #include "plAgeDescription/plAgeDescription.h" +#include "plFile/plEncryptedStream.h" #include "MaxMain/plMaxCFGFile.h" #include "MaxMain/plAgeDescInterface.h" #include "plResMgr/plPageInfo.h" @@ -649,9 +651,9 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg ) plFileName path = plFileName::Join(ageFolder, plString::Format("%s.age", curAge)); IVerifyLatestAgeAsset( curAge, path, errMsg ); + std::unique_ptr aged(plPageInfoUtils::GetAgeDesc(curAge)); - hsUNIXStream s; - if (!s.Open(path)) + if (!aged) { errMsg->Set( true, "PageInfo Convert Error", @@ -664,13 +666,8 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg ) return; } - // create and read the age desc - plAgeDescription aged; - aged.Read(&s); - s.Close(); - // Update based on the age file now - fCompPB->SetValue( kInfoSeqPrefix, 0, (int)aged.GetSequencePrefix() ); + fCompPB->SetValue( kInfoSeqPrefix, 0, (int)aged->GetSequencePrefix() ); // Find our page const char *compPBPageName = fCompPB->GetStr( kInfoPage ); @@ -688,9 +685,9 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg ) } plAgePage *page; - aged.SeekFirstPage(); + aged->SeekFirstPage(); - while( ( page = aged.GetNextPage() ) != nil ) + while( ( page = aged->GetNextPage() ) != nil ) { if( page->GetName().CompareI( compPBPageName ) == 0 ) { @@ -790,18 +787,16 @@ plAgeDescription *plPageInfoUtils::GetAgeDesc( const plString &ageName ) { plFileName ageFolder = plPageInfoUtils::GetAgeFolder(); if (!ageFolder.IsValid() || ageName.IsNull()) - return nil; - - hsUNIXStream s; - if (!s.Open(plFileName::Join(ageFolder, ageName + ".age"))) - return nil; - - // Create and read the age desc - plAgeDescription *aged = new plAgeDescription; - aged->Read( &s ); - s.Close(); + return nullptr; - return aged; + plAgeDescription* aged = new plAgeDescription; + if (aged->ReadFromFile(plFileName::Join(ageFolder, ageName + ".age"))) + return aged; + else + { + delete aged; + return nullptr; + } } const char* LocCompGetPage(plComponentBase* comp)