Ejemplo n.º 1
0
int ArchiveFilter::QueryFilters(const TCHAR* lpFileName, ArchiveFilterArray& filters, bool& bStopped)
{
	bStopped = false;

	for (unsigned int i = 0; i < m_pFilters.count(); i++)
	{
		ArchiveFilterEntry* pFE = m_pFilters[i];

		if ( !pFE->IsEnabled() || !pFE->IsValid() )
			continue;

#ifdef UNICODE
		if ( FSF.ProcessName(pFE->GetMask(), (TCHAR*)lpFileName, 0, PN_CMPNAME|PN_SKIPPATH) )
#else
		if ( FSF.ProcessName(pFE->GetMask(), (TCHAR*)lpFileName, PN_CMPNAME|PN_SKIPPATH) )
#endif
		{
			if ( !pFE->IsExclude() )
				filters.add(pFE);
			else
				m_pStopFilters.add(pFE);

			if ( !pFE->IsContinueProcessing() )
			{
				bStopped = true;
				break;
			}
		}
	}

	return 0;
}
Ejemplo n.º 2
0
bool ArchiveFilter::Filtered(const GUID* puidModule, const GUID* puidPlugin, const GUID* puidFormat)
{
	for (unsigned int i = 0; i < m_pStopFilters.count(); i++)
	{
		ArchiveFilterEntry* pFE = m_pStopFilters[i];

		if ( !pFE->IsEnabled() || !pFE->IsValid() )
			continue;

		bool bFormatFiltered = (pFE->IsAllFormats() || (puidFormat && (pFE->GetFormat()->GetUID() == *puidFormat)));
		bool bPluginFiltered = bFormatFiltered && (pFE->IsAllPlugins() || (puidPlugin && (pFE->GetPlugin()->GetUID() == *puidPlugin)));
		bool bModuleFiltered = bPluginFiltered && (pFE->IsAllModules() || (puidModule && (pFE->GetModule()->GetUID() == *puidModule)));

		if ( bModuleFiltered )
			return true;
	}

	return false;
}