当前位置: 首页>>代码示例>>C++>>正文


C++ Packer::Pack方法代码示例

本文整理汇总了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
//.........这里部分代码省略.........
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:101,代码来源:ResourceCompressor.cpp


注:本文中的Packer::Pack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。