mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 07:14:55 -06:00
60 lines
1.8 KiB
C++
Executable File
60 lines
1.8 KiB
C++
Executable File
// Agent/ArchiveFolder.cpp
|
|
|
|
#include "StdAfx.h"
|
|
|
|
#include "Common/ComTry.h"
|
|
|
|
#include "../Common/ArchiveExtractCallback.h"
|
|
|
|
#include "Agent.h"
|
|
|
|
using namespace NWindows;
|
|
using namespace NCOM;
|
|
|
|
STDMETHODIMP CAgentFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
|
|
const wchar_t *path, IFolderOperationsExtractCallback *callback)
|
|
{
|
|
COM_TRY_BEGIN
|
|
CArchiveExtractCallback *extractCallbackSpec = new
|
|
CArchiveExtractCallback;
|
|
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
|
|
UStringVector pathParts;
|
|
CProxyFolder *currentProxyFolder = _proxyFolderItem;
|
|
while (currentProxyFolder->Parent)
|
|
{
|
|
pathParts.Insert(0, currentProxyFolder->Name);
|
|
currentProxyFolder = currentProxyFolder->Parent;
|
|
}
|
|
|
|
CMyComPtr<IFolderArchiveExtractCallback> extractCallback2;
|
|
{
|
|
CMyComPtr<IFolderOperationsExtractCallback> callbackWrap = callback;
|
|
RINOK(callbackWrap.QueryInterface(
|
|
IID_IFolderArchiveExtractCallback, &extractCallback2));
|
|
}
|
|
|
|
NExtract::NPathMode::EEnum pathMode = _flatMode ?
|
|
NExtract::NPathMode::kNoPathnames :
|
|
NExtract::NPathMode::kCurrentPathnames;
|
|
|
|
extractCallbackSpec->InitForMulti(false, pathMode, NExtract::NOverwriteMode::kAskBefore);
|
|
extractCallbackSpec->Init(NULL, &_agentSpec->GetArc(),
|
|
extractCallback2,
|
|
false, false, false,
|
|
path,
|
|
pathParts,
|
|
(UInt64)(Int64)-1);
|
|
CUIntVector realIndices;
|
|
GetRealIndices(indices, numItems, realIndices);
|
|
return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
|
|
realIndices.Size(), BoolToInt(false), extractCallback);
|
|
COM_TRY_END
|
|
}
|
|
|
|
STDMETHODIMP CAgentFolder::MoveTo(const UInt32 * /* indices */, UInt32 /* numItems */,
|
|
const wchar_t * /* path */, IFolderOperationsExtractCallback * /* callback */)
|
|
{
|
|
return E_NOTIMPL;
|
|
}
|
|
|