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


C++ NppParameters::getPluginList方法代码示例

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


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

示例1: loadPlugins

bool PluginsManager::loadPlugins(const TCHAR *dir)
{
	if (_isDisabled)
		return false;

	vector<generic_string> dllNames;
	vector<generic_string> dll2Remove;
	NppParameters * nppParams = NppParameters::getInstance();
    generic_string nppPath = nppParams->getNppPath();
	generic_string pluginsFullPathFilter = (dir && dir[0])?dir:nppPath;

	pluginsFullPathFilter += TEXT("\\plugins\\*.dll");

	WIN32_FIND_DATA foundData;
	HANDLE hFindFile = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
	if (hFindFile != INVALID_HANDLE_VALUE)
	{
		generic_string plugins1stFullPath = (dir && dir[0])?dir:nppPath;
		plugins1stFullPath += TEXT("\\plugins\\");
		plugins1stFullPath += foundData.cFileName;
		dllNames.push_back(plugins1stFullPath);

		while (::FindNextFile(hFindFile, &foundData))
		{
            bool isInBlackList = nppParams->isInBlackList(foundData.cFileName);
            if (!isInBlackList)
            {
			    generic_string fullPath = (dir && dir[0])?dir:nppPath;
			    fullPath += TEXT("\\plugins\\");

			    fullPath += foundData.cFileName;
			    dllNames.push_back(fullPath);
            }
            PluginList & pl = nppParams->getPluginList();
            pl.add(foundData.cFileName, isInBlackList);
		}
		::FindClose(hFindFile);


		for (size_t i = 0, len = dllNames.size(); i < len ; ++i)
		{
            loadPlugin(dllNames[i].c_str(),  dll2Remove);
		}

	}

	for (size_t j = 0, len = dll2Remove.size() ; j < len ; ++j)
		::DeleteFile(dll2Remove[j].c_str());

	std::sort(_pluginInfos.begin(), _pluginInfos.end(), [](const PluginInfo *a, const PluginInfo *b) { return a->_funcName < b->_funcName; });

	return true;
}
开发者ID:iabasyan,项目名称:notepad-plus-plus,代码行数:53,代码来源:PluginsManager.cpp

示例2: TEXT

bool PluginsManager::loadPluginsV2(const TCHAR* dir)
{
	if (_isDisabled)
		return false;


	vector<generic_string> dllNames;
	vector<generic_string> dll2Remove;

	NppParameters * nppParams = NppParameters::getInstance();
	generic_string nppPath = nppParams->getNppPath();
	
	generic_string pluginsFolder;
	if (dir && dir[0])
	{
		pluginsFolder = dir;
	}
	else
	{
		pluginsFolder = nppPath;
		PathAppend(pluginsFolder, TEXT("plugins"));
	}
	generic_string pluginsFolderFilter = pluginsFolder;
	PathAppend(pluginsFolderFilter, TEXT("*.*"));
	
	WIN32_FIND_DATA foundData;
	HANDLE hFindFolder = ::FindFirstFile(pluginsFolderFilter.c_str(), &foundData);
	HANDLE hFindDll = INVALID_HANDLE_VALUE;

	// get plugin folder
	if (hFindFolder != INVALID_HANDLE_VALUE && (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
	{
		generic_string pluginsFullPathFilter = pluginsFolder;
		PathAppend(pluginsFullPathFilter, foundData.cFileName);
		generic_string pluginsFolderPath = pluginsFullPathFilter;
		generic_string  dllName = foundData.cFileName;
		dllName += TEXT(".dll");
		PathAppend(pluginsFullPathFilter, dllName);

		// get plugin
		hFindDll = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
		if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			dllNames.push_back(pluginsFullPathFilter);

			PluginList & pl = nppParams->getPluginList();
			pl.add(foundData.cFileName, false);
		}

		// get plugin folder
		while (::FindNextFile(hFindFolder, &foundData))
		{
			generic_string pluginsFullPathFilter2 = pluginsFolder;
			PathAppend(pluginsFullPathFilter2, foundData.cFileName);
			generic_string pluginsFolderPath2 = pluginsFullPathFilter2;
			generic_string  dllName2 = foundData.cFileName;
			dllName2 += TEXT(".dll");
			PathAppend(pluginsFullPathFilter2, dllName2);
			// get plugin
			hFindDll = ::FindFirstFile(pluginsFullPathFilter2.c_str(), &foundData);
			if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
			{
				dllNames.push_back(pluginsFullPathFilter2);

				PluginList & pl = nppParams->getPluginList();
				pl.add(foundData.cFileName, false);
			}
		}

	}
	::FindClose(hFindFolder);
	::FindClose(hFindDll);

	for (size_t i = 0, len = dllNames.size(); i < len; ++i)
	{
		loadPlugin(dllNames[i].c_str(), dll2Remove);
	}

	return true;
}
开发者ID:iabasyan,项目名称:notepad-plus-plus,代码行数:80,代码来源:PluginsManager.cpp


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