Browse Source

Allow encrypted age files

Yes, this bit me in the ass.
Adam Johnson 12 years ago
parent
commit
66423478cc
  1. 1
      Sources/Tools/MaxComponent/Pch.h
  2. 37
      Sources/Tools/MaxComponent/plMiscComponents.cpp

1
Sources/Tools/MaxComponent/Pch.h

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Standard Library
#include <algorithm>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>

37
Sources/Tools/MaxComponent/plMiscComponents.cpp

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "resource.h"
#include <iparamm2.h>
#include <memory>
#include <notify.h>
#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<plAgeDescription> 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)

Loading…
Cancel
Save