本文整理汇总了C++中Packer::Pack方法的典型用法代码示例。如果您正苦于以下问题:C++ Packer::Pack方法的具体用法?C++ Packer::Pack怎么用?C++ Packer::Pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packer
的用法示例。
在下文中一共展示了Packer::Pack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
if (argc <= 2)
{
printf("Usage: resourcepacker.exe [-d] [-u] [resourceDirectoryPath] [archiveName]\n");
printf("Written by Borodovsky Vitaliy (C) 2006.\n");
printf("Example:\n");
printf("resourcepacker.exe -d data data.re\n\t- pack directory data to archive data.re\n");
printf("resourcepacker.exe -u data data.re\n\t- unpack archive data.re to directory data\n");
printf("Options:\n");
printf("\t -d don't include to archive relative pathnames\n");
printf("\t -u unpack archive with contents\n");
return 0;
}
bool packPaths = true;
bool showMode = false;
String directoryPath;
String archiveName;
String headerName;
int32 pathIndex = 1;
for (int flag = 0; flag < 2; ++flag)
{
if (String(argv[pathIndex]) == "-d")
{
pathIndex++;
packPaths = false;
}
else if (String(argv[pathIndex]) == "-u")
{
pathIndex++;
showMode = true;
}
}
// IEngineSystem * es = CreateConsoleEngine();
new AnsiFileSystem();
IFileSystem * fs = Singleton<IO::IFileSystem>::Instance();
String programmPath = fs->GetCurrentDirectory();
if (showMode) // show mode of ResourcePacker tool
{
directoryPath = argv[pathIndex];
if (directoryPath.find(':') == -1)
{
directoryPath = programmPath + "/" + directoryPath;
}
if ((pathIndex + 1) > (argc - 1))
{
String::size_type pos = directoryPath.rfind('/');
if (pos == -1)
{
archiveName = directoryPath + ".re";
}else
{
archiveName = directoryPath.substr(pos + 1) + ".re";
}
}else
{
archiveName = argv[pathIndex + 1];
String::size_type pos = archiveName.rfind('.');
if (pos == -1)
{
headerName = archiveName;
archiveName += ".re";
headerName += ".h";
}
}
printf("===================================================\n");
printf("=== Unpacker started\n");
printf("=== Unpack directory: %s\n", directoryPath.c_str());
printf("=== Unpack archiveName: %s\n", archiveName.c_str());
printf("===================================================\n");
fs->CreateDirectory(directoryPath.c_str());
ResourceArchive ra;
ra.Open(programmPath + "/" + archiveName);
for (int file = 0; file < ra.GetFileCount(); ++file)
{
String pathName = ra.GetResourcePathname(file);
pathName = directoryPath + pathName;
String::size_type pos = pathName.rfind('/');
if (pos == -1)
{
}else
//.........这里部分代码省略.........