mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 17:15:00 -06:00
4.45 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
d9666cf046
commit
a145bfc7cf
@@ -15,15 +15,17 @@ static inline UINT GetCurrentFileCodePage()
|
||||
|
||||
void CArchiveFolderManager::LoadFormats()
|
||||
{
|
||||
if (!_formatsLoaded)
|
||||
ReadArchiverInfoList(_formats);
|
||||
if (!_codecs)
|
||||
{
|
||||
_compressCodecsInfo = _codecs = new CCodecs;
|
||||
_codecs->Load();
|
||||
}
|
||||
}
|
||||
|
||||
int CArchiveFolderManager::FindFormat(const UString &type)
|
||||
{
|
||||
// LoadFormats();
|
||||
for (int i = 0; i < _formats.Size(); i++)
|
||||
if (type.CompareNoCase(_formats[i].Name) == 0)
|
||||
for (int i = 0; i < _codecs->Formats.Size(); i++)
|
||||
if (type.CompareNoCase(_codecs->Formats[i].Name) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
@@ -51,14 +53,68 @@ HRESULT CAgent::FolderReOpen(
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *extensions)
|
||||
{
|
||||
*extensions = 0;
|
||||
int formatIndex = FindFormat(type);
|
||||
if (formatIndex < 0)
|
||||
return E_INVALIDARG;
|
||||
CMyComBSTR valueTemp = _codecs.Formats[formatIndex].GetAllExtensions(); // Exts[0].Ext;
|
||||
*extensions = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
*/
|
||||
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
|
||||
{
|
||||
LoadFormats();
|
||||
*extensions = 0;
|
||||
UString res;
|
||||
for (int i = 0; i < _codecs->Libs.Size(); i++)
|
||||
{
|
||||
const CCodecLib &lib = _codecs->Libs[i];
|
||||
for (int j = 0; j < lib.IconPairs.Size(); j++)
|
||||
{
|
||||
if (!res.IsEmpty())
|
||||
res += L' ';
|
||||
res += lib.IconPairs[j].Ext;
|
||||
}
|
||||
}
|
||||
CMyComBSTR valueTemp = res;
|
||||
*extensions = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
|
||||
{
|
||||
LoadFormats();
|
||||
*iconPath = 0;
|
||||
*iconIndex = 0;
|
||||
for (int i = 0; i < _codecs->Libs.Size(); i++)
|
||||
{
|
||||
const CCodecLib &lib = _codecs->Libs[i];
|
||||
int ii = lib.FindIconIndex(ext);
|
||||
if (ii >= 0)
|
||||
{
|
||||
CMyComBSTR iconPathTemp = GetUnicodeString(lib.Path, GetCurrentFileCodePage());
|
||||
*iconIndex = ii;
|
||||
*iconPath = iconPathTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
|
||||
{
|
||||
LoadFormats();
|
||||
UString typesStrings;
|
||||
for(int i = 0; i < _formats.Size(); i++)
|
||||
for(int i = 0; i < _codecs.Formats.Size(); i++)
|
||||
{
|
||||
const CArchiverInfo &ai = _formats[i];
|
||||
if (!ai.Associate)
|
||||
const CArcInfoEx &ai = _codecs.Formats[i];
|
||||
if (ai.AssociateExts.Size() == 0)
|
||||
continue;
|
||||
if (i != 0)
|
||||
typesStrings += L' ';
|
||||
@@ -68,31 +124,9 @@ STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
|
||||
*types = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveFolderManager::GetExtension(const wchar_t *type, BSTR *extension)
|
||||
{
|
||||
*extension = 0;
|
||||
int formatIndex = FindFormat(type);
|
||||
if (formatIndex < 0)
|
||||
return E_INVALIDARG;
|
||||
CMyComBSTR valueTemp = _formats[formatIndex].Extensions[0].Ext;
|
||||
*extension = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *type, BSTR *iconPath)
|
||||
{
|
||||
*iconPath = 0;
|
||||
int formatIndex = FindFormat(type);
|
||||
if (formatIndex < 0)
|
||||
return E_INVALIDARG;
|
||||
CMyComBSTR iconPathTemp = _formats[formatIndex].FilePath;
|
||||
*iconPath = iconPathTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * /* type */,
|
||||
const wchar_t * /* filePath */, IProgress * /* progress */)
|
||||
STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
|
||||
const wchar_t * filePath, IProgress progress)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user