Exemplo n.º 1
0
void FileList::PluginGetFiles(const wchar_t **DestPath,int Move)
{
	_ALGO(CleverSysLog clv(L"FileList::PluginGetFiles()"));
	PluginPanelItem *ItemList, *PList;
	int ItemNumber;
	SaveSelection();
	CreatePluginItemList(ItemList,ItemNumber);

	if (ItemList && ItemNumber>0)
	{
		int GetCode=CtrlObject->Plugins->GetFiles(hPlugin,ItemList,ItemNumber,Move!=0,DestPath,0);

		if ((Opt.Diz.UpdateMode==DIZ_UPDATE_IF_DISPLAYED && IsDizDisplayed()) ||
		        Opt.Diz.UpdateMode==DIZ_UPDATE_ALWAYS)
		{
			DizList DestDiz;
			int DizFound=FALSE;
			PList=ItemList;

			for (int I=0; I<ItemNumber; I++,PList++)
				if (PList->Flags & PPIF_PROCESSDESCR)
				{
					if (!DizFound)
					{
						CtrlObject->Cp()->LeftPanel->ReadDiz();
						CtrlObject->Cp()->RightPanel->ReadDiz();
						DestDiz.Read(*DestPath);
						DizFound=TRUE;
					}

					string strName = PList->FileName;
					string strShortName = PList->AlternateFileName;
					CopyDiz(strName,strShortName,strName,strName,&DestDiz);
				}

			DestDiz.Flush(*DestPath);
		}

		if (GetCode==1)
		{
			if (!ReturnCurrentFile)
				ClearSelection();

			if (Move)
			{
				SetPluginModified();
				PutDizToPlugin(this,ItemList,ItemNumber,TRUE,FALSE,nullptr,&Diz);
			}
		}
		else if (!ReturnCurrentFile)
			PluginClearSelection(ItemList,ItemNumber);

		DeletePluginItemList(ItemList,ItemNumber);
		Update(UPDATE_KEEP_SELECTION);
		Redraw();
		Panel *AnotherPanel=CtrlObject->Cp()->GetAnotherPanel(this);
		AnotherPanel->Update(UPDATE_KEEP_SELECTION|UPDATE_SECONDARY);
		AnotherPanel->Redraw();
	}
}
Exemplo n.º 2
0
PluginSettings::PluginSettings(const GUID& Guid, bool Local):
    PluginsCfg(nullptr)
{
    const auto pPlugin = Global->CtrlObject->Plugins->FindPlugin(Guid);
    if (pPlugin)
    {
        string strGuid = GuidToStr(Guid);
        PluginsCfg = ConfigProvider().CreatePluginsConfig(strGuid, Local);
        m_Keys.emplace_back(PluginsCfg->CreateKey(HierarchicalConfig::root_key(), strGuid, &pPlugin->GetTitle()));

        if (!Global->Opt->ReadOnlyConfig)
        {
            DizList Diz;
            string strDbPath = Local ? Global->Opt->LocalProfilePath : Global->Opt->ProfilePath;
            AddEndSlash(strDbPath);
            strDbPath += L"PluginsData\\";
            Diz.Read(strDbPath);
            string strDbName = strGuid + L".db";
            string Description = string(pPlugin->GetTitle()) + L" (" + pPlugin->GetDescription() + L")";
            if(Description != NullToEmpty(Diz.GetDizTextAddr(strDbName, L"", 0)))
            {
                Diz.AddDizText(strDbName, L"", Description);
                Diz.Flush(strDbPath);
            }
        }
    }
}
Exemplo n.º 3
0
intptr_t WINAPI GetContentDataW(struct GetContentDataInfo *Info)
{
	if (!Info)
		return FALSE;
	LPCWSTR FilePath = Info->FilePath;
	wchar_t** CustomData = NULL;

	for (size_t i = 0; i < Info->Count; i++)
	{
		if (!fsf.LStricmp(Info->Names[i], L"diz")
			|| !fsf.LStricmp(Info->Names[i], L"C0"))
		{
			CustomData = (wchar_t**)(Info->Values + i);
		}
	}

	if (!FilePath || !CustomData)
		return FALSE;
	
	const wchar_t* pszSlash = wcsrchr(FilePath, L'\\');
	if (!pszSlash || pszSlash <= FilePath) return FALSE;
	if (pszSlash[1] == 0) return FALSE; // Если хотят диз именно для папки - то нужно без слеша
	string  strPath(FilePath, pszSlash-FilePath);
	
	// оптимизацией чтения диз-файла занимается сам diz
	if (diz.Read(strPath) == 0)
	{
		// Если диз пустой - сразу выходим
		return FALSE;
	}

	
	const wchar_t* pszDiz = diz.GetDizTextAddr(pszSlash+1, L"", 0/*???*/);
	//if (!pszDiz || pszDiz[0] == 0) -- ConvertNameToShort занимает очень много времени
	//{
	//	string strShort;
	//	ConvertNameToShort(FilePath, strShort);
	//	pszDiz = diz.GetDizTextAddr(pszSlash+1, strShort, 0/*???*/);
	//}
	if (!pszDiz || pszDiz[0] == 0)
	{
		return FALSE;
	}
	
	size_t nLen = wcslen(pszDiz)+1;
	*CustomData = (wchar_t*)malloc(nLen*2);
	wcscpy(*CustomData, pszDiz);
	// Заменить некоторые символы
	wchar_t* pszTab = wcspbrk(*CustomData, L"\t");
	while (pszTab)
	{
		*pszTab = L' ';
		pszTab = wcspbrk(pszTab+1, L"\t");
	}

	return TRUE;
}
Exemplo n.º 4
0
int WINAPI GetCustomDataW(const wchar_t *FilePath, wchar_t **CustomData)
{
	*CustomData = NULL;
	
	const wchar_t* pszSlash = wcsrchr(FilePath, L'\\');
	if (!pszSlash || pszSlash <= FilePath) return FALSE;
	if (pszSlash[1] == 0) return FALSE; // Если хотят диз именно для папки - то нужно без слеша
	string  strPath(FilePath, pszSlash-FilePath);
	
	// оптимизацией чтения диз-файла занимается сам diz
	if (diz.Read(strPath) == 0)
	{
		// Если диз пустой - сразу выходим
		return FALSE;
	}

	
	const wchar_t* pszDiz = diz.GetDizTextAddr(pszSlash+1, L"", 0/*???*/);
	//if (!pszDiz || pszDiz[0] == 0) -- ConvertNameToShort занимает очень много времени
	//{
	//	string strShort;
	//	ConvertNameToShort(FilePath, strShort);
	//	pszDiz = diz.GetDizTextAddr(pszSlash+1, strShort, 0/*???*/);
	//}
	if (!pszDiz || pszDiz[0] == 0)
	{
		return FALSE;
	}
	
	size_t nLen = wcslen(pszDiz)+1;
	*CustomData = (wchar_t*)malloc(nLen*2);
	wcscpy(*CustomData, pszDiz);
	// Заменить некоторые символы
	wchar_t* pszTab = wcspbrk(*CustomData, L"\t");
	while (pszTab)
	{
		*pszTab = L' ';
		pszTab = wcspbrk(pszTab+1, L"\t");
	}

	return TRUE;
}