1 // Agent/ArchiveFolder.cpp
2
3 #include "StdAfx.h"
4
5 #include "Common/ComTry.h"
6
7 #include "../Common/ArchiveExtractCallback.h"
8
9 #include "Agent.h"
10
11 using namespace NWindows;
12 using namespace NCOM;
13
CopyTo(const UInt32 * indices,UInt32 numItems,const wchar_t * path,IFolderOperationsExtractCallback * callback)14 STDMETHODIMP CAgentFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
15 const wchar_t *path, IFolderOperationsExtractCallback *callback)
16 {
17 COM_TRY_BEGIN
18 CArchiveExtractCallback *extractCallbackSpec = new
19 CArchiveExtractCallback;
20 CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
21 UStringVector pathParts;
22 CProxyFolder *currentProxyFolder = _proxyFolderItem;
23 while (currentProxyFolder->Parent)
24 {
25 pathParts.Insert(0, currentProxyFolder->Name);
26 currentProxyFolder = currentProxyFolder->Parent;
27 }
28
29 CMyComPtr<IFolderArchiveExtractCallback> extractCallback2;
30 {
31 CMyComPtr<IFolderOperationsExtractCallback> callbackWrap = callback;
32 RINOK(callbackWrap.QueryInterface(
33 IID_IFolderArchiveExtractCallback, &extractCallback2));
34 }
35
36 NExtract::NPathMode::EEnum pathMode = _flatMode ?
37 NExtract::NPathMode::kNoPathnames :
38 NExtract::NPathMode::kCurrentPathnames;
39
40 extractCallbackSpec->InitForMulti(false, pathMode, NExtract::NOverwriteMode::kAskBefore);
41 extractCallbackSpec->Init(NULL, &_agentSpec->GetArc(),
42 extractCallback2,
43 false, false, false,
44 path,
45 pathParts,
46 (UInt64)(Int64)-1);
47 CUIntVector realIndices;
48 GetRealIndices(indices, numItems, realIndices);
49 return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
50 realIndices.Size(), BoolToInt(false), extractCallback);
51 COM_TRY_END
52 }
53
MoveTo(const UInt32 *,UInt32,const wchar_t *,IFolderOperationsExtractCallback *)54 STDMETHODIMP CAgentFolder::MoveTo(const UInt32 * /* indices */, UInt32 /* numItems */,
55 const wchar_t * /* path */, IFolderOperationsExtractCallback * /* callback */)
56 {
57 return E_NOTIMPL;
58 }
59
60