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


C++ CConfigFile::Read方法代码示例

本文整理汇总了C++中CConfigFile::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigFile::Read方法的具体用法?C++ CConfigFile::Read怎么用?C++ CConfigFile::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CConfigFile的用法示例。


在下文中一共展示了CConfigFile::Read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[])
{
	char cmd[512];
	int ret;

	if( argc < 2 )
	{
		return PrintUsage();
	}


	// All output gets redirected to this file.
	SECURITY_ATTRIBUTES fileAttribs;
	fileAttribs.nLength = sizeof(fileAttribs);
	fileAttribs.lpSecurityDescriptor = NULL;
	fileAttribs.bInheritHandle = TRUE;

	g_hOutputFile = CreateFile( 
		"vmapbuilder.out", 
		GENERIC_WRITE,
		FILE_SHARE_READ,
		&fileAttribs,
		CREATE_ALWAYS,
		FILE_FLAG_WRITE_THROUGH|FILE_ATTRIBUTE_NORMAL,
		NULL );


	// Low priority..
	SetPriorityClass( GetCurrentProcess(), IDLE_PRIORITY_CLASS );

	bool bSave = !FindArg( "-nosave" );
	bool bNoVis = !!FindArg( "-novis" );
	bool bNoRad = !!FindArg( "-norad" );

	char const *pCFGFile = argv[1];
	while( 1 )
	{
		DWORD startTime = GetTickCount();

		CConfigFile file;
		if( file.Read( pCFGFile ) && file.m_Entries.Size() > 0 )
		{
			// Move the first entry in the file to the end.
			CConfigFile::Entry entry = file.m_Entries[0];
			file.m_Entries.Remove( 0 );
			file.m_Entries.AddToTail( entry );
			if( bSave )
			{
				file.Write( pCFGFile );
			}


			char ssCmd[256];
			_snprintf( ssCmd, sizeof(ssCmd), "%s\\win32\\ss.exe", file.m_SSDatabase );

			// Grab the SourceSafe tree.			  
			AppPrint( "\n\n-------------------------------------------------------------\n" );
			AppPrint( "Processing %s\n", entry.m_Filename );
			AppPrint( "-------------------------------------------------------------\n" );
			AppPrint( "Grabbing resources in %s\n", file.m_SSDatabase );
			
			sprintf( cmd, "ssdir=%s", file.m_SSDatabase );
			ret = _putenv( cmd );
			
			// Get the VMF.
			char vmfFilename[512];
			sprintf( vmfFilename, "%s/%s.vmf", entry.m_VMFPath, entry.m_Filename );
			sprintf( cmd, "%s get %s -I-", ssCmd, vmfFilename );
			ret = RunProcess( cmd );

			// Check the timestamp (don't reprocess if it's up-to-date).
			sprintf( vmfFilename, "%s.vmf", entry.m_Filename );
			struct _stat fileStat;
			ret = _stat( vmfFilename, &fileStat );
			long vmfTime = fileStat.st_mtime;
			if( vmfTime == entry.m_VMFTime )
			{
				AppPrint( "%s is up-to-date\n", vmfFilename );
			}
			else
			{
				char localBSPFilename[512];
				sprintf( localBSPFilename, "%s.bsp", entry.m_Filename );
				
				// Attrib the bsp if it exists.
				sprintf( cmd, "attrib -r %s", localBSPFilename );
				RunProcess( cmd );
				
				sprintf( cmd, "%s cp %s", ssCmd, file.m_SSResourcePath );
				ret = RunProcess( cmd );
				
				if( !FindArg( "-noget" ) )
				{
					sprintf( cmd, "%s get * -R -I-", ssCmd );
					ret = RunProcess( cmd );
				}

				// run each tool.
				char vbspCommand[256], vradCommand[256], vvisCommand[256];
				sprintf( vbspCommand, "bin\\vbsp -low %s", entry.m_Filename );
//.........这里部分代码省略.........
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:101,代码来源:vmapbuilder.cpp


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