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


C++ CExtension::SetDisabled方法代码示例

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


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

示例1: CreateExtensionFromRoot

ALERROR CExtension::CreateExtensionFromRoot (const CString &sFilespec, CXMLElement *pDesc, EFolderTypes iFolder, CExternalEntityTable *pEntities, DWORD dwInheritAPIVersion, CExtension **retpExtension, CString *retsError)

//	CreateExtension
//
//	Loads the given extension or adventure. We take ownership of pEntities.

	{
	int i;

	//	Create an extension object

	CExtension *pExtension = new CExtension;
	pExtension->m_sFilespec = sFilespec;
	pExtension->m_dwUNID = pDesc->GetAttributeInteger(UNID_ATTRIB);
	if (pExtension->m_dwUNID == 0)
		{
		delete pExtension;
		*retsError = CONSTLIT("Invalid UNID.");
		return ERR_FAIL;
		}

	if (strEquals(pDesc->GetTag(), TRANSCENDENCE_ADVENTURE_TAG))
		{
		pExtension->m_iGame = gameTranscendence;
		pExtension->m_iType = extAdventure;
		}
	else if (strEquals(pDesc->GetTag(), TRANSCENDENCE_LIBRARY_TAG))
		{
		pExtension->m_iGame = gameTranscendence;
		pExtension->m_iType = extLibrary;
		}
	else if (strEquals(pDesc->GetTag(), TRANSCENDENCE_EXTENSION_TAG))
		{
		pExtension->m_iGame = gameTranscendence;
		pExtension->m_iType = extExtension;
		}
	else if (strEquals(pDesc->GetTag(), CORE_LIBRARY_TAG))
		{
		//	For core libraries, we don't care what game it is. It's always 
		//	whatever game the base file is.

		pExtension->m_iGame = gameUnknown;
		pExtension->m_iType = extLibrary;
		}
	else
		{
		delete pExtension;
		*retsError = strPatternSubst(CONSTLIT("Unknown root element: %s"), pDesc->GetTag());
		return ERR_FAIL;
		}
	
	pExtension->m_iLoadState = loadEntities;
	pExtension->m_iFolderType = iFolder;
	pExtension->m_pEntities = pEntities;
	pExtension->m_ModifiedTime = fileGetModifiedTime(sFilespec);
	pExtension->m_bDebugOnly = pDesc->GetAttributeBool(DEBUG_ONLY_ATTRIB);
	pExtension->m_bRegistered = IsRegisteredUNID(pExtension->m_dwUNID);
	pExtension->m_bPrivate = pDesc->GetAttributeBool(PRIVATE_ATTRIB);
	pExtension->m_bAutoInclude = pDesc->GetAttributeBool(AUTO_INCLUDE_ATTRIB);
	pExtension->m_bUsesXML = pDesc->GetAttributeBool(USES_XML_ATTRIB);

	//	API version

	CString sAPIVersion;
	if (pDesc->FindAttribute(API_VERSION_ATTRIB, &sAPIVersion))
		{
		pExtension->m_dwAPIVersion = (DWORD)strToInt(sAPIVersion, 0);
		if (pExtension->m_dwAPIVersion < 12)
			pExtension->m_dwAPIVersion = 0;
		pExtension->m_sVersion = pDesc->GetAttribute(VERSION_ATTRIB);
		}
	else if (dwInheritAPIVersion)
		{
		pExtension->m_dwAPIVersion = dwInheritAPIVersion;
		pExtension->m_sVersion = pDesc->GetAttribute(VERSION_ATTRIB);
		}
	else
		{
		sAPIVersion = pDesc->GetAttribute(VERSION_ATTRIB);
		pExtension->m_dwAPIVersion = ::LoadExtensionVersion(sAPIVersion);
		}

	if (pExtension->m_dwAPIVersion == 0)
		{
		pExtension->m_pEntities = NULL;	//	Let our parent clean up.
		delete pExtension;
		*retsError = strPatternSubst(CONSTLIT("Unable to load extension: incompatible version: %s"), sAPIVersion);
		return ERR_FAIL;
		}

	//	If this is a later version, then disabled it

	if (pExtension->m_dwAPIVersion > API_VERSION)
		pExtension->SetDisabled(CONSTLIT("Requires a newer version of Transcendence.exe"));

	//	Release

	pExtension->m_dwRelease = pDesc->GetAttributeInteger(RELEASE_ATTRIB);

	//	Registered extensions default to release 1.
//.........这里部分代码省略.........
开发者ID:bmer,项目名称:Mammoth,代码行数:101,代码来源:CExtension.cpp


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