Added functionality to import filenames from .pak.contents.txt files

This commit is contained in:
parax0
2016-12-24 00:47:45 -07:00
parent ed446ccbec
commit d96a3c2af7
12 changed files with 245 additions and 78 deletions

View File

@@ -0,0 +1,50 @@
#include "CAssetNameMap.h"
std::map<EGame, CAssetNameMap*> CAssetNameMap::smGameMap;
CAssetNameMap::CAssetNameMap(EGame Game)
: mGame(Game)
{
TString ListPath = GetAssetListPath(mGame);
CXMLReader Reader(ListPath);
Serialize(Reader);
}
void CAssetNameMap::SaveAssetNames()
{
TString ListPath = GetAssetListPath(mGame);
CXMLWriter Writer(ListPath, "AssetList", 0, mGame);
Serialize(Writer);
}
void CAssetNameMap::GetNameInfo(CAssetID ID, TString& rOutDirectory, TString& rOutName)
{
auto It = mMap.find(ID);
if (It != mMap.end())
{
SAssetNameInfo& rInfo = It->second;
rOutName = rInfo.Name;
rOutDirectory = rInfo.Directory;
}
else
{
rOutDirectory = "Uncategorized\\";
rOutName = ID.ToString();
}
}
void CAssetNameMap::CopyFromStore(CResourceStore *pStore /*= gpResourceStore*/)
{
for (CResourceIterator It(pStore); It; ++It)
{
if (It->IsCategorized() || It->IsNamed())
{
CAssetID ID = It->ID();
TWideString Name = It->Name();
TWideString Directory = It->Directory()->FullPath();
mMap[ID] = SAssetNameInfo { Name, Directory };
}
}
}