Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2011-04-11 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:05 +0300
commit35596517f203f1c4970413b3b5b2e216b849e462 (patch)
tree93240df3eb4ddbd8eebbe6a5fc65e93f2ccb6495 /CPP/7zip/UI/Agent
parentde4f8c22fe4b9e59b60495b84db2e81de50999a9 (diff)
9.219.21
Diffstat (limited to 'CPP/7zip/UI/Agent')
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.cpp130
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.h60
-rwxr-xr-xCPP/7zip/UI/Agent/AgentOut.cpp226
-rwxr-xr-xCPP/7zip/UI/Agent/AgentProxy.cpp12
-rwxr-xr-xCPP/7zip/UI/Agent/AgentProxy.h10
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolder.cpp33
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOpen.cpp29
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOut.cpp115
-rwxr-xr-xCPP/7zip/UI/Agent/IFolderArchive.h10
-rwxr-xr-xCPP/7zip/UI/Agent/UpdateCallbackAgent.cpp2
10 files changed, 244 insertions, 383 deletions
diff --git a/CPP/7zip/UI/Agent/Agent.cpp b/CPP/7zip/UI/Agent/Agent.cpp
index 4a099308..c11bd490 100755
--- a/CPP/7zip/UI/Agent/Agent.cpp
+++ b/CPP/7zip/UI/Agent/Agent.cpp
@@ -18,7 +18,7 @@ STDMETHODIMP CAgentFolder::GetAgentFolder(CAgentFolder **agentFolder)
return S_OK;
}
-void CAgentFolder::LoadFolder(CProxyFolder *folder)
+void CAgentFolder::LoadFolder(const CProxyFolder *folder)
{
int i;
CProxyItem item;
@@ -56,22 +56,15 @@ STDMETHODIMP CAgentFolder::GetNumberOfItems(UInt32 *numItems)
return S_OK;
}
+#define SET_realIndex_AND_folder \
+ UInt32 realIndex; const CProxyFolder *folder; \
+ if (_flatMode) { const CProxyItem &item = _items[index]; folder = item.Folder; realIndex = item.Index; } \
+ else { folder = _proxyFolderItem; realIndex = index; }
+
+
UString CAgentFolder::GetName(UInt32 index) const
{
- UInt32 realIndex;
- const CProxyFolder *folder;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
-
+ SET_realIndex_AND_folder
if (realIndex < (UInt32)folder->Folders.Size())
return folder->Folders[realIndex].Name;
return folder->Files[realIndex - folder->Folders.Size()].Name;
@@ -97,32 +90,17 @@ UString CAgentFolder::GetFullPathPrefixPlusPrefix(UInt32 index) const
return _proxyFolderItem->GetFullPathPrefix() + GetPrefix(index);
}
-void CAgentFolder::GetPrefixIfAny(UInt32 index, NCOM::CPropVariant &prop) const
-{
- if (!_flatMode)
- return;
- prop = GetPrefix(index);
-}
-
-
-STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
+STDMETHODIMP CAgentFolder::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
+ COM_TRY_BEGIN
NCOM::CPropVariant prop;
- const CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
+ SET_realIndex_AND_folder
+ if (propID == kpidPrefix)
{
- const CProxyItem &item = _items[itemIndex];
- folder = item.Folder;
- realIndex = item.Index;
+ if (_flatMode)
+ prop = GetPrefix(index);
}
- else
- {
- folder = _proxyFolderItem;
- realIndex = itemIndex;
- }
-
- if (realIndex < (UInt32)folder->Folders.Size())
+ else if (realIndex < (UInt32)folder->Folders.Size())
{
const CProxyFolder &item = folder->Folders[realIndex];
if (!_flatMode && propID == kpidSize)
@@ -130,12 +108,12 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
else if (!_flatMode && propID == kpidPackSize)
prop = item.PackSize;
else
- switch(propID)
+ switch (propID)
{
- case kpidIsDir: prop = true; break;
+ case kpidIsDir: prop = true; break;
case kpidNumSubDirs: prop = item.NumSubFolders; break;
- case kpidNumSubFiles: prop = item.NumSubFiles; break;
- case kpidName: prop = item.Name; break;
+ case kpidNumSubFiles: prop = item.NumSubFiles; break;
+ case kpidName: prop = item.Name; break;
case kpidCRC:
{
if (item.IsLeaf)
@@ -146,8 +124,6 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
prop = item.Crc;
break;
}
- case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
-
default:
if (item.IsLeaf)
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
@@ -155,22 +131,21 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
}
else
{
- realIndex -= folder->Folders.Size();
- const CProxyFile &item = folder->Files[realIndex];
- switch(propID)
+ const CProxyFile &item = folder->Files[realIndex - folder->Folders.Size()];
+ switch (propID)
{
case kpidIsDir: prop = false; break;
case kpidName: prop = item.Name; break;
- case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
default:
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
}
}
prop.Detach(value);
return S_OK;
+ COM_TRY_END
}
-HRESULT CAgentFolder::BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder)
+HRESULT CAgentFolder::BindToFolder(const CProxyFolder *folder, IFolderFolder **resultFolder)
{
CMyComPtr<IFolderFolder> parentFolder;
if (folder->Parent != _proxyFolderItem)
@@ -189,20 +164,7 @@ HRESULT CAgentFolder::BindToFolder(CProxyFolder *folder, IFolderFolder **resultF
STDMETHODIMP CAgentFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
COM_TRY_BEGIN
-
- CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
+ SET_realIndex_AND_folder
if (realIndex >= (UInt32)folder->Folders.Size())
return E_INVALIDARG;
return BindToFolder(&folder->Folders[realIndex], resultFolder);
@@ -235,19 +197,7 @@ STDMETHODIMP CAgentFolder::GetStream(UInt32 index, ISequentialInStream **stream)
if (!getStream)
return S_OK;
- const CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
+ SET_realIndex_AND_folder
UInt32 indexInArchive;
if (realIndex < (UInt32)folder->Folders.Size())
@@ -262,7 +212,7 @@ STDMETHODIMP CAgentFolder::GetStream(UInt32 index, ISequentialInStream **stream)
return getStream->GetStream(indexInArchive, stream);
}
-STATPROPSTG kProperties[] =
+static const STATPROPSTG kProperties[] =
{
{ NULL, kpidNumSubDirs, VT_UI4},
{ NULL, kpidNumSubFiles, VT_UI4},
@@ -325,7 +275,7 @@ STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *pro
COM_TRY_END
}
-STATPROPSTG kFolderProps[] =
+static const STATPROPSTG kFolderProps[] =
{
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackSize, VT_UI8},
@@ -340,7 +290,7 @@ STDMETHODIMP CAgentFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
- switch(propID)
+ switch (propID)
{
case kpidSize: prop = _proxyFolderItem->Size; break;
case kpidPackSize: prop = _proxyFolderItem->PackSize; break;
@@ -399,7 +349,7 @@ void CAgentFolder::GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntV
return;
}
realIndices.Clear();
- for(UInt32 i = 0; i < numItems; i++)
+ for (UInt32 i = 0; i < numItems; i++)
{
const CProxyItem &item = _items[indices[i]];
const CProxyFolder *folder = item.Folder;
@@ -423,13 +373,8 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
UStringVector pathParts;
- CProxyFolder *currentProxyFolder = _proxyFolderItem;
- while (currentProxyFolder->Parent)
- {
- pathParts.Insert(0, currentProxyFolder->Name);
- currentProxyFolder = currentProxyFolder->Parent;
- }
-
+ _proxyFolderItem->GetPathParts(pathParts);
+
/*
if (_flatMode)
pathMode = NExtract::NPathMode::kNoPathnames;
@@ -437,10 +382,13 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
extractCallbackSpec->InitForMulti(false, pathMode, overwriteMode);
+ FString pathU;
+ if (path)
+ pathU = us2fs(path);
extractCallbackSpec->Init(NULL, &_agentSpec->GetArc(),
extractCallback2,
false, testMode ? true : false, false,
- (path ? path : L""),
+ path ? pathU : FTEXT(""),
pathParts,
(UInt64)(Int64)-1);
CUIntVector realIndices;
@@ -474,10 +422,10 @@ STDMETHODIMP CAgent::Open(
{
COM_TRY_BEGIN
_archiveFilePath = filePath;
- NFile::NFind::CFileInfoW fi;
+ NFile::NFind::CFileInfo fi;
if (!inStream)
{
- if (!fi.Find(_archiveFilePath))
+ if (!fi.Find(us2fs(_archiveFilePath)))
return ::GetLastError();
if (fi.IsDir())
return E_FAIL;
@@ -571,7 +519,7 @@ STDMETHODIMP CAgent::Extract(
extractCallbackSpec->Init(NULL, &GetArc(),
extractCallback2,
false, testMode ? true : false, false,
- path,
+ us2fs(path),
UStringVector(),
(UInt64)(Int64)-1);
return GetArchive()->Extract(0, (UInt32)(Int32)-1, testMode, extractCallback);
@@ -607,7 +555,7 @@ STDMETHODIMP CAgent::GetArcProp(UInt32 level, PROPID propID, PROPVARIANT *value)
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
CArc &arc = _archiveLink.Arcs[level];
- switch(propID)
+ switch (propID)
{
case kpidType: prop = GetTypeOfArc(arc); break;
case kpidPath: prop = arc.Path; break;
diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h
index 454964bc..cc92b0dd 100755
--- a/CPP/7zip/UI/Agent/Agent.h
+++ b/CPP/7zip/UI/Agent/Agent.h
@@ -27,12 +27,21 @@ DECL_INTERFACE(IArchiveFolderInternal, 0x01, 0xC)
struct CProxyItem
{
- CProxyFolder *Folder;
+ const CProxyFolder *Folder;
UInt32 Index;
};
class CAgent;
+enum AGENT_OP
+{
+ AGENT_OP_Uni,
+ AGENT_OP_Delete,
+ AGENT_OP_CreateFolder,
+ AGENT_OP_Rename,
+ AGENT_OP_CopyFromFile
+};
+
class CAgentFolder:
public IFolderFolder,
public IFolderProperties,
@@ -46,6 +55,7 @@ class CAgentFolder:
#endif
public CMyUnknownImp
{
+ void LoadFolder(const CProxyFolder *folder);
public:
MY_QUERYINTERFACE_BEGIN2(IFolderFolder)
@@ -61,8 +71,7 @@ public:
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
- void LoadFolder(CProxyFolder *folder);
- HRESULT BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder);
+ HRESULT BindToFolder(const CProxyFolder *folder, IFolderFolder **resultFolder);
void GetRealIndices(const UINT32 *indices, UINT32 numItems, CUIntVector &realIndices) const;
INTERFACE_FolderFolder(;)
@@ -90,8 +99,8 @@ public:
CAgentFolder(): _proxyFolderItem(NULL), _flatMode(0) {}
- void Init(CProxyArchive *proxyHandler,
- CProxyFolder *proxyFolderItem,
+ void Init(const CProxyArchive *proxyHandler,
+ const CProxyFolder *proxyFolderItem,
IFolderFolder *parentFolder,
CAgent *agent)
{
@@ -104,9 +113,7 @@ public:
void GetPathParts(UStringVector &pathParts);
HRESULT CommonUpdateOperation(
- bool deleteOperation,
- bool createFolderOperation,
- bool renameOperation,
+ AGENT_OP operation,
const wchar_t *newItemName,
const NUpdateArchive::CActionSet *actionSet,
const UINT32 *indices, UINT32 numItems,
@@ -116,11 +123,10 @@ public:
UString GetPrefix(UInt32 index) const;
UString GetName(UInt32 index) const;
UString GetFullPathPrefixPlusPrefix(UInt32 index) const;
- void GetPrefixIfAny(UInt32 index, NWindows::NCOM::CPropVariant &propVariant) const;
public:
- CProxyArchive *_proxyArchive;
- CProxyFolder *_proxyFolderItem;
+ const CProxyArchive *_proxyArchive;
+ const CProxyFolder *_proxyFolderItem;
CMyComPtr<IFolderFolder> _parentFolder;
CMyComPtr<IInFolderArchive> _agent;
CAgent *_agentSpec;
@@ -156,21 +162,19 @@ public:
#ifndef EXTRACT_ONLY
INTERFACE_IOutFolderArchive(;)
- HRESULT CommonUpdate(
- const wchar_t *newArchiveName,
- int numUpdateItems,
- IArchiveUpdateCallback *updateCallback);
+ HRESULT CommonUpdate(ISequentialOutStream *outArchiveStream,
+ int numUpdateItems, IArchiveUpdateCallback *updateCallback);
- HRESULT CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
- IFolderArchiveUpdateCallback *updateCallback100);
+ HRESULT CreateFolder(ISequentialOutStream *outArchiveStream,
+ const wchar_t *folderName, IFolderArchiveUpdateCallback *updateCallback100);
- HRESULT RenameItem(
- const wchar_t *newArchiveName,
- const UINT32 *indices, UINT32 numItems,
- const wchar_t *newItemName,
- IFolderArchiveUpdateCallback *updateCallback100);
+ HRESULT RenameItem(ISequentialOutStream *outArchiveStream,
+ const UInt32 *indices, UInt32 numItems, const wchar_t *newItemName,
+ IFolderArchiveUpdateCallback *updateCallback100);
+
+ HRESULT UpdateOneFile(ISequentialOutStream *outArchiveStream,
+ const UInt32 *indices, UInt32 numItems, const wchar_t *diskFilePath,
+ IFolderArchiveUpdateCallback *updateCallback100);
// ISetProperties
STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
@@ -190,8 +194,8 @@ public:
UString ArchiveType;
- UStringVector _names;
- UString _folderPrefix;
+ FStringVector _names;
+ FString _folderPrefix;
UString _archiveNamePrefix;
CAgentFolder *_agentFolder;
@@ -203,8 +207,8 @@ public:
CObjectVector<NWindows::NCOM::CPropVariant> m_PropValues;
#endif
- const CArc &GetArc() { return _archiveLink.Arcs.Back(); }
- IInArchive *GetArchive() { if ( _archiveLink.Arcs.IsEmpty()) return 0; return GetArc().Archive; }
+ const CArc &GetArc() const { return _archiveLink.Arcs.Back(); }
+ IInArchive *GetArchive() const { if ( _archiveLink.Arcs.IsEmpty()) return 0; return GetArc().Archive; }
bool CanUpdate() const { return _archiveLink.Arcs.Size() <= 1; }
UString GetTypeOfArc(const CArc &arc) const { return _codecs->Formats[arc.FormatIndex].Name; }
diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp
index 5d9ae62d..17f5443a 100755
--- a/CPP/7zip/UI/Agent/AgentOut.cpp
+++ b/CPP/7zip/UI/Agent/AgentOut.cpp
@@ -2,23 +2,14 @@
#include "StdAfx.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
+#include "Windows/FileName.h"
#include "Windows/Time.h"
#include "../../Compress/CopyCoder.h"
#include "../../Common/FileStreams.h"
-#include "../Common/EnumDirItems.h"
-#include "../Common/OpenArchive.h"
-#include "../Common/UpdateCallback.h"
-#include "../Common/UpdatePair.h"
-
#include "Agent.h"
#include "UpdateCallbackAgent.h"
@@ -33,7 +24,7 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
_agentFolder = NULL;
return S_OK;
}
- else
+
{
CMyComPtr<IFolderFolder> archiveFolder = folder;
CMyComPtr<IArchiveFolderInternal> archiveFolderInternal;
@@ -41,40 +32,18 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
RINOK(archiveFolderInternal->GetAgentFolder(&_agentFolder));
}
- UStringVector pathParts;
- pathParts.Clear();
- CMyComPtr<IFolderFolder> folderItem = folder;
- if (folderItem != NULL)
- for (;;)
- {
- CMyComPtr<IFolderFolder> newFolder;
- folderItem->BindToParentFolder(&newFolder);
- if (newFolder == NULL)
- break;
-
- NCOM::CPropVariant prop;
- if (folderItem->GetFolderProperty(kpidName, &prop) == S_OK)
- if (prop.vt == VT_BSTR)
- pathParts.Insert(0, (const wchar_t *)prop.bstrVal);
- folderItem = newFolder;
- }
-
- for (int i = 0; i < pathParts.Size(); i++)
- {
- _archiveNamePrefix += pathParts[i];
- _archiveNamePrefix += WCHAR_PATH_SEPARATOR;
- }
+ _archiveNamePrefix = _agentFolder->_proxyFolderItem->GetFullPathPrefix();
return S_OK;
}
STDMETHODIMP CAgent::SetFiles(const wchar_t *folderPrefix,
const wchar_t **names, UInt32 numNames)
{
- _folderPrefix = folderPrefix;
+ _folderPrefix = us2fs(folderPrefix);
_names.Clear();
_names.Reserve(numNames);
for (UInt32 i = 0; i < numNames; i++)
- _names.Add(names[i]);
+ _names.Add(us2fs(names[i]));
return S_OK;
}
@@ -89,12 +58,7 @@ static HRESULT EnumerateArchiveItems(CAgent *agent,
const CProxyFile &fileItem = item.Files[i];
CArcItem ai;
RINOK(agent->GetArc().GetItemMTime(fileItem.Index, ai.MTime, ai.MTimeDefined));
-
- CPropVariant property;
- agent->GetArchive()->GetProperty(fileItem.Index, kpidSize, &property);
- ai.SizeDefined = (property.vt != VT_EMPTY);
- if (ai.SizeDefined)
- ai.Size = ConvertPropVariantToUInt64(property);
+ RINOK(agent->GetArc().GetItemSize(fileItem.Index, ai.Size, ai.SizeDefined));
ai.IsDir = false;
ai.Name = prefix + fileItem.Name;
ai.Censored = true; // test it
@@ -139,7 +103,7 @@ HRESULT CAgUpCallbackImp::ShowDeleteFile(int arcIndex)
STDMETHODIMP CAgent::DoOperation(
CCodecs *codecs,
int formatIndex,
- const wchar_t *newArchiveName,
+ ISequentialOutStream *outArchiveStream,
const Byte *stateActions,
const wchar_t *sfxModule,
IFolderArchiveUpdateCallback *updateCallback100)
@@ -154,9 +118,9 @@ STDMETHODIMP CAgent::DoOperation(
CDirItems dirItems;
{
- UString folderPrefix = _folderPrefix;
+ FString folderPrefix = _folderPrefix;
NFile::NName::NormalizeDirPathPrefix(folderPrefix);
- UStringVector errorPaths;
+ FStringVector errorPaths;
CRecordVector<DWORD> errorCodes;
dirItems.EnumerateDirItems2(folderPrefix, _archiveNamePrefix, _names, errorPaths, errorCodes);
if (errorCodes.Size() > 0)
@@ -239,22 +203,6 @@ STDMETHODIMP CAgent::DoOperation(
updateCallbackSpec->Archive = GetArchive();
updateCallbackSpec->Callback = &updateCallbackAgent;
- COutFileStream *outStreamSpec = new COutFileStream;
- CMyComPtr<IOutStream> outStream(outStreamSpec);
- UString archiveName = newArchiveName;
- {
- UString resultPath;
- int pos;
- if (!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
- return E_FAIL;
- NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
- }
- if (!outStreamSpec->Create(archiveName, true))
- {
- // ShowLastErrorMessage();
- return E_FAIL;
- }
-
CMyComPtr<ISetProperties> setProperties;
if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
{
@@ -268,7 +216,7 @@ STDMETHODIMP CAgent::DoOperation(
for(i = 0; i < m_PropNames.Size(); i++)
names.Add((const wchar_t *)m_PropNames[i]);
- NWindows::NCOM::CPropVariant *propValues = new NWindows::NCOM::CPropVariant[m_PropValues.Size()];
+ CPropVariant *propValues = new CPropVariant[m_PropValues.Size()];
try
{
for (int i = 0; i < m_PropValues.Size(); i++)
@@ -290,88 +238,38 @@ STDMETHODIMP CAgent::DoOperation(
{
CInFileStream *sfxStreamSpec = new CInFileStream;
CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
- if (!sfxStreamSpec->Open(sfxModule))
+ if (!sfxStreamSpec->Open(us2fs(sfxModule)))
return E_FAIL;
// throw "Can't open sfx module";
- RINOK(NCompress::CopyStream(sfxStream, outStream, NULL));
+ RINOK(NCompress::CopyStream(sfxStream, outArchiveStream, NULL));
}
- RINOK(outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback));
- return outStreamSpec->Close();
+ return outArchive->UpdateItems(outArchiveStream, updatePairs2.Size(),updateCallback);
}
-STDMETHODIMP CAgent::DoOperation2(
- const wchar_t *newArchiveName,
- const Byte *stateActions,
- const wchar_t *sfxModule,
- IFolderArchiveUpdateCallback *updateCallback100)
+STDMETHODIMP CAgent::DoOperation2(ISequentialOutStream *outArchiveStream,
+ const Byte *stateActions, const wchar_t *sfxModule, IFolderArchiveUpdateCallback *updateCallback100)
{
- return DoOperation(_codecs, -1, newArchiveName,
- stateActions, sfxModule, updateCallback100);
+ return DoOperation(_codecs, -1, outArchiveStream, stateActions, sfxModule, updateCallback100);
}
-HRESULT CAgent::CommonUpdate(
- const wchar_t *newArchiveName,
- int numUpdateItems,
- IArchiveUpdateCallback *updateCallback)
+HRESULT CAgent::CommonUpdate(ISequentialOutStream *outArchiveStream,
+ int numUpdateItems, IArchiveUpdateCallback *updateCallback)
{
if (!CanUpdate())
return E_NOTIMPL;
CMyComPtr<IOutArchive> outArchive;
RINOK(GetArchive()->QueryInterface(IID_IOutArchive, (void **)&outArchive));
-
- COutFileStream *outStreamSpec = new COutFileStream;
- CMyComPtr<IOutStream> outStream(outStreamSpec);
-
- UString archiveName = newArchiveName;
- {
- UString resultPath;
- int pos;
- if (!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
- throw 141716;
- NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
- }
-
- /*
- bool isOK = false;
- for (int i = 0; i < (1 << 16); i++)
- {
- resultName = newArchiveName;
- if (i > 0)
- {
- wchar_t s[16];
- ConvertUInt32ToString(i, s);
- resultName += s;
- }
- if (outStreamSpec->Open(realPath))
- {
- isOK = true;
- break;
- }
- if (::GetLastError() != ERROR_FILE_EXISTS)
- return ::GetLastError();
- }
- if (!isOK)
- return ::GetLastError();
- */
- if (!outStreamSpec->Create(archiveName, true))
- {
- // ShowLastErrorMessage();
- return E_FAIL;
- }
-
- RINOK(outArchive->UpdateItems(outStream, numUpdateItems, updateCallback));
- return outStreamSpec->Close();
+ return outArchive->UpdateItems(outArchiveStream, numUpdateItems, updateCallback);
}
-
-STDMETHODIMP CAgent::DeleteItems(
- const wchar_t *newArchiveName,
+STDMETHODIMP CAgent::DeleteItems(ISequentialOutStream *outArchiveStream,
const UInt32 *indices, UInt32 numItems,
IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
return E_NOTIMPL;
+ CRecordVector<CUpdatePair2> updatePairs;
CUpdateCallbackAgent updateCallbackAgent;
updateCallbackAgent.SetCallback(updateCallback100);
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
@@ -379,7 +277,6 @@ STDMETHODIMP CAgent::DeleteItems(
CUIntVector realIndices;
_agentFolder->GetRealIndices(indices, numItems, realIndices);
- CRecordVector<CUpdatePair2> updatePairs;
int curIndex = 0;
UInt32 numItemsInArchive;
RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
@@ -400,22 +297,21 @@ STDMETHODIMP CAgent::DeleteItems(
updateCallbackSpec->UpdatePairs = &updatePairs;
updateCallbackSpec->Archive = GetArchive();
updateCallbackSpec->Callback = &updateCallbackAgent;
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
+ return CommonUpdate(outArchiveStream, updatePairs.Size(), updateCallback);
}
-HRESULT CAgent::CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
- IFolderArchiveUpdateCallback *updateCallback100)
+HRESULT CAgent::CreateFolder(ISequentialOutStream *outArchiveStream,
+ const wchar_t *folderName, IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
return E_NOTIMPL;
+ CRecordVector<CUpdatePair2> updatePairs;
+ CDirItems dirItems;
CUpdateCallbackAgent updateCallbackAgent;
updateCallbackAgent.SetCallback(updateCallback100);
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
- CRecordVector<CUpdatePair2> updatePairs;
UInt32 numItemsInArchive;
RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
for (UInt32 i = 0; i < numItemsInArchive; i++)
@@ -435,7 +331,6 @@ HRESULT CAgent::CreateFolder(
updatePairs.ReserveDown();
- CDirItems dirItems;
CDirItem di;
di.Attrib = FILE_ATTRIBUTE_DIRECTORY;
@@ -452,20 +347,19 @@ HRESULT CAgent::CreateFolder(
updateCallbackSpec->DirItems = &dirItems;
updateCallbackSpec->UpdatePairs = &updatePairs;
updateCallbackSpec->Archive = GetArchive();
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
+ return CommonUpdate(outArchiveStream, updatePairs.Size(), updateCallback);
}
-HRESULT CAgent::RenameItem(
- const wchar_t *newArchiveName,
- const UInt32 *indices, UInt32 numItems,
- const wchar_t *newItemName,
+HRESULT CAgent::RenameItem(ISequentialOutStream *outArchiveStream,
+ const UInt32 *indices, UInt32 numItems, const wchar_t *newItemName,
IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
return E_NOTIMPL;
if (numItems != 1)
return E_INVALIDARG;
+ CRecordVector<CUpdatePair2> updatePairs;
CUpdateCallbackAgent updateCallbackAgent;
updateCallbackAgent.SetCallback(updateCallback100);
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
@@ -478,7 +372,6 @@ HRESULT CAgent::RenameItem(
UString oldItemPath = fullPrefix + _agentFolder->GetName(indices[0]);
UString newItemPath = fullPrefix + newItemName;
- CRecordVector<CUpdatePair2> updatePairs;
UStringVector newNames;
int curIndex = 0;
@@ -516,7 +409,64 @@ HRESULT CAgent::RenameItem(
updateCallbackSpec->UpdatePairs = &updatePairs;
updateCallbackSpec->NewNames = &newNames;
updateCallbackSpec->Archive = GetArchive();
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
+ return CommonUpdate(outArchiveStream, updatePairs.Size(), updateCallback);
+}
+
+HRESULT CAgent::UpdateOneFile(ISequentialOutStream *outArchiveStream,
+ const UInt32 *indices, UInt32 numItems, const wchar_t *diskFilePath,
+ IFolderArchiveUpdateCallback *updateCallback100)
+{
+ if (!CanUpdate())
+ return E_NOTIMPL;
+ CRecordVector<CUpdatePair2> updatePairs;
+ CDirItems dirItems;
+ CUpdateCallbackAgent updateCallbackAgent;
+ updateCallbackAgent.SetCallback(updateCallback100);
+ CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
+ CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
+
+ UInt32 realIndex;
+ {
+ CUIntVector realIndices;
+ _agentFolder->GetRealIndices(indices, numItems, realIndices);
+ if (realIndices.Size() != 1)
+ return E_FAIL;
+ realIndex = realIndices[0];
+ }
+
+ {
+ FStringVector filePaths;
+ filePaths.Add(us2fs(diskFilePath));
+ FStringVector errorPaths;
+ CRecordVector<DWORD> errorCodes;
+ dirItems.EnumerateDirItems2(FString(), UString(), filePaths, errorPaths, errorCodes);
+ if (dirItems.Items.Size() != 1)
+ return E_FAIL;
+ }
+
+ UInt32 numItemsInArchive;
+ RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
+ for (UInt32 i = 0; i < numItemsInArchive; i++)
+ {
+ CUpdatePair2 up2;
+ up2.ArcIndex = i;
+ up2.IsAnti = false;
+ up2.NewData = false;
+ up2.NewProps = false;
+ if (realIndex == i)
+ {
+ up2.DirIndex = 0;
+ up2.NewData = true;
+ up2.NewProps = true;
+ }
+ updatePairs.Add(up2);
+ }
+ updateCallbackSpec->DirItems = &dirItems;
+ updateCallbackSpec->Callback = &updateCallbackAgent;
+ updateCallbackSpec->UpdatePairs = &updatePairs;
+ updateCallbackSpec->Archive = GetArchive();
+ updateCallbackSpec->KeepOriginalItemNames = true;
+ return CommonUpdate(outArchiveStream, updatePairs.Size(), updateCallback);
}
STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
diff --git a/CPP/7zip/UI/Agent/AgentProxy.cpp b/CPP/7zip/UI/Agent/AgentProxy.cpp
index 9686cf34..ce9b3bfb 100755
--- a/CPP/7zip/UI/Agent/AgentProxy.cpp
+++ b/CPP/7zip/UI/Agent/AgentProxy.cpp
@@ -7,8 +7,6 @@
#include "Windows/PropVariant.h"
#include "Windows/PropVariantConversions.h"
-#include "../Common/OpenArchive.h"
-
#include "AgentProxy.h"
using namespace NWindows;
@@ -79,11 +77,10 @@ void CProxyFolder::Clear()
void CProxyFolder::GetPathParts(UStringVector &pathParts) const
{
pathParts.Clear();
- UString result;
const CProxyFolder *current = this;
while (current->Parent != NULL)
{
- pathParts.Insert(0, (const wchar_t *)current->Name);
+ pathParts.Insert(0, current->Name);
current = current->Parent;
}
}
@@ -100,13 +97,6 @@ UString CProxyFolder::GetFullPathPrefix() const
return result;
}
-UString CProxyFolder::GetItemName(UInt32 index) const
-{
- if (index < (UInt32)Folders.Size())
- return Folders[index].Name;
- return Files[index - Folders.Size()].Name;
-}
-
void CProxyFolder::AddRealIndices(CUIntVector &realIndices) const
{
if (IsLeaf)
diff --git a/CPP/7zip/UI/Agent/AgentProxy.h b/CPP/7zip/UI/Agent/AgentProxy.h
index d4caca16..dcf52f04 100755
--- a/CPP/7zip/UI/Agent/AgentProxy.h
+++ b/CPP/7zip/UI/Agent/AgentProxy.h
@@ -3,8 +3,6 @@
#ifndef __AGENT_PROXY_H
#define __AGENT_PROXY_H
-#include "Common/MyString.h"
-
#include "../Common/OpenArchive.h"
struct CProxyFile
@@ -13,8 +11,11 @@ struct CProxyFile
UString Name;
};
-struct CProxyFolder: public CProxyFile
+class CProxyFolder: public CProxyFile
{
+ int FindDirSubItemIndex(const UString &name, int &insertPos) const;
+ void AddRealIndices(CUIntVector &realIndices) const;
+public:
CProxyFolder *Parent;
CObjectVector<CProxyFolder> Folders;
CObjectVector<CProxyFile> Files;
@@ -28,7 +29,6 @@ struct CProxyFolder: public CProxyFile
UInt32 NumSubFiles;
CProxyFolder(): Parent(NULL) {};
- int FindDirSubItemIndex(const UString &name, int &insertPos) const;
int FindDirSubItemIndex(const UString &name) const;
CProxyFolder* AddDirSubItem(UInt32 index, bool leaf, const UString &name);
void AddFileSubItem(UInt32 index, const UString &name);
@@ -36,8 +36,6 @@ struct CProxyFolder: public CProxyFile
void GetPathParts(UStringVector &pathParts) const;
UString GetFullPathPrefix() const;
- UString GetItemName(UInt32 index) const;
- void AddRealIndices(CUIntVector &realIndices) const;
void GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntVector &realIndices) const;
void CalculateSizes(IInArchive *archive);
};
diff --git a/CPP/7zip/UI/Agent/ArchiveFolder.cpp b/CPP/7zip/UI/Agent/ArchiveFolder.cpp
index 57975e7d..237afa05 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolder.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolder.cpp
@@ -8,46 +8,20 @@
#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));
+ 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);
+ return Extract(indices,numItems, pathMode, NExtract::NOverwriteMode::kAskBefore,
+ path, BoolToInt(false), extractCallback2);
COM_TRY_END
}
@@ -56,4 +30,3 @@ STDMETHODIMP CAgentFolder::MoveTo(const UInt32 * /* indices */, UInt32 /* numIte
{
return E_NOTIMPL;
}
-
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
index 477e052c..3a16a667 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
@@ -1,22 +1,9 @@
-// Zip/ArchiveFolder.cpp
+// Agent/ArchiveFolderOpen.cpp
#include "StdAfx.h"
#include "Agent.h"
-#include "Common/StringConvert.h"
-
-extern HINSTANCE g_hInstance;
-
-static inline UINT GetCurrentFileCodePage()
-{
- #ifdef UNDER_CE
- return CP_ACP;
- #else
- return AreFileApisANSI() ? CP_ACP : CP_OEMCP;
- #endif
-}
-
void CArchiveFolderManager::LoadFormats()
{
if (!_codecs)
@@ -39,7 +26,7 @@ STDMETHODIMP CArchiveFolderManager::OpenFolderFile(IInStream *inStream,
IFolderFolder **resultFolder, IProgress *progress)
{
CMyComPtr<IArchiveOpenCallback> openArchiveCallback;
- if (progress != 0)
+ if (progress)
{
CMyComPtr<IProgress> progressWrapper = progress;
progressWrapper.QueryInterface(IID_IArchiveOpenCallback, &openArchiveCallback);
@@ -104,16 +91,18 @@ STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPa
if (lib.FindIconIndex(ext, ii))
{
*iconIndex = ii;
- return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
+ return StringToBstr(fs2us(lib.Path), iconPath);
}
}
int ii;
if (_codecs->InternalIcons.FindIconIndex(ext, ii))
{
- *iconIndex = ii;
- UString path;
- NWindows::NDLL::MyGetModuleFileName(g_hInstance, path);
- return StringToBstr(path, iconPath);
+ FString path;
+ if (NWindows::NDLL::MyGetModuleFileName(path))
+ {
+ *iconIndex = ii;
+ return StringToBstr(fs2us(path), iconPath);
+ }
}
return S_OK;
}
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
index cf3e2d5a..656602cb 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
@@ -6,6 +6,7 @@
#include "Windows/FileDir.h"
+#include "../../Common/FileStreams.h"
#include "../Common/WorkDir.h"
#include "Agent.h"
@@ -14,32 +15,20 @@ using namespace NWindows;
using namespace NFile;
using namespace NDirectory;
-static LPCWSTR kTempArcivePrefix = L"7zA";
-
void CAgentFolder::GetPathParts(UStringVector &pathParts)
{
_proxyFolderItem->GetPathParts(pathParts);
}
HRESULT CAgentFolder::CommonUpdateOperation(
- bool deleteOperation,
- bool createFolderOperation,
- bool renameOperation,
+ AGENT_OP operation,
const wchar_t *newItemName,
const NUpdateArchive::CActionSet *actionSet,
const UINT32 *indices, UINT32 numItems,
IFolderArchiveUpdateCallback *updateCallback100)
{
- NWorkDir::CInfo workDirInfo;
- workDirInfo.Load();
- UString archiveFilePath = _agentSpec->_archiveFilePath;
- UString workDir = GetWorkDir(workDirInfo, archiveFilePath);
- CreateComplexDirectory(workDir);
-
- CTempFileW tempFile;
- UString tempFileName;
- if (tempFile.Create(workDir, kTempArcivePrefix, tempFileName) == 0)
- return E_FAIL;
+ CWorkDirTempFile tempFile;
+ RINOK(tempFile.CreateTempFile(us2fs(_agentSpec->_archiveFilePath)));
/*
if (SetOutProperties(anOutArchive, aCompressionInfo.Method) != S_OK)
@@ -53,44 +42,39 @@ HRESULT CAgentFolder::CommonUpdateOperation(
GetPathParts(pathParts);
HRESULT result;
- if (deleteOperation)
- result = _agentSpec->DeleteItems(tempFileName,
- indices, numItems, updateCallback100);
- else if (createFolderOperation)
+ switch (operation)
{
- result = _agentSpec->CreateFolder(tempFileName,
- newItemName, updateCallback100);
- }
- else if (renameOperation)
- {
- result = _agentSpec->RenameItem(
- tempFileName,
- indices, numItems,
- newItemName,
- updateCallback100);
- }
- else
- {
- Byte actionSetByte[NUpdateArchive::NPairState::kNumValues];
- for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
- actionSetByte[i] = (Byte)actionSet->StateActions[i];
- result = _agentSpec->DoOperation2(tempFileName, actionSetByte, NULL, updateCallback100);
+ case AGENT_OP_Delete:
+ result = _agentSpec->DeleteItems(tempFile.OutStream, indices, numItems, updateCallback100);
+ break;
+ case AGENT_OP_CreateFolder:
+ result = _agentSpec->CreateFolder(tempFile.OutStream, newItemName, updateCallback100);
+ break;
+ case AGENT_OP_Rename:
+ result = _agentSpec->RenameItem(tempFile.OutStream, indices, numItems, newItemName, updateCallback100);
+ break;
+ case AGENT_OP_CopyFromFile:
+ result = _agentSpec->UpdateOneFile(tempFile.OutStream, indices, numItems, newItemName, updateCallback100);
+ break;
+ case AGENT_OP_Uni:
+ {
+ Byte actionSetByte[NUpdateArchive::NPairState::kNumValues];
+ for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
+ actionSetByte[i] = (Byte)actionSet->StateActions[i];
+ result = _agentSpec->DoOperation2(tempFile.OutStream, actionSetByte, NULL, updateCallback100);
+ break;
+ }
+ default:
+ return E_FAIL;
}
- if (result != S_OK)
- return result;
+ RINOK(result);
_agentSpec->Close();
// m_FolderItem = NULL;
- if (NFind::DoesFileExist(archiveFilePath))
- if (!DeleteFileAlways(archiveFilePath))
- return GetLastError();
-
- tempFile.DisableDeleting();
- if (!MyMoveFile(tempFileName, archiveFilePath))
- return GetLastError();
+ RINOK(tempFile.MoveToOriginal(true));
{
CMyComPtr<IArchiveOpenCallback> openCallback;
@@ -134,7 +118,7 @@ STDMETHODIMP CAgentFolder::CopyFrom(
{
COM_TRY_BEGIN
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
+ if (progress)
{
RINOK(progress->QueryInterface(IID_IFolderArchiveUpdateCallback, (void **)&updateCallback100));
}
@@ -142,7 +126,7 @@ STDMETHODIMP CAgentFolder::CopyFrom(
{
RINOK(_agentSpec->SetFiles(fromFolderPath, itemsPaths, numItems));
RINOK(_agentSpec->SetFolder(this));
- return CommonUpdateOperation(false, false, false, NULL,
+ return CommonUpdateOperation(AGENT_OP_Uni, NULL,
&NUpdateArchive::kAddActionSet, 0, 0, updateCallback100);
}
catch(const UString &s)
@@ -153,18 +137,43 @@ STDMETHODIMP CAgentFolder::CopyFrom(
COM_TRY_END
}
+STDMETHODIMP CAgentFolder::CopyFromFile(UInt32 destIndex, const wchar_t *itemPath, IProgress * progress)
+{
+ COM_TRY_BEGIN
+ CUIntVector indices;
+ indices.Add(destIndex);
+ CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
+ if (progress)
+ {
+ RINOK(progress->QueryInterface(IID_IFolderArchiveUpdateCallback, (void **)&updateCallback100));
+ }
+ try
+ {
+ RINOK(_agentSpec->SetFolder(this));
+ return CommonUpdateOperation(AGENT_OP_CopyFromFile, itemPath,
+ &NUpdateArchive::kAddActionSet,
+ &indices.Front(), indices.Size(), updateCallback100);
+ }
+ catch(const UString &s)
+ {
+ RINOK(updateCallback100->UpdateErrorMessage(UString(L"Error: ") + s));
+ return E_FAIL;
+ }
+ COM_TRY_END
+}
+
STDMETHODIMP CAgentFolder::Delete(const UINT32 *indices, UINT32 numItems, IProgress *progress)
{
COM_TRY_BEGIN
RINOK(_agentSpec->SetFolder(this));
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
+ if (progress)
{
CMyComPtr<IProgress> progressWrapper = progress;
RINOK(progressWrapper.QueryInterface(
IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(true, false, false, NULL,
+ return CommonUpdateOperation(AGENT_OP_Delete, NULL,
&NUpdateArchive::kDeleteActionSet, indices, numItems, updateCallback100);
COM_TRY_END
}
@@ -176,12 +185,12 @@ STDMETHODIMP CAgentFolder::CreateFolder(const wchar_t *name, IProgress *progress
return ERROR_ALREADY_EXISTS;
RINOK(_agentSpec->SetFolder(this));
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
+ if (progress)
{
CMyComPtr<IProgress> progressWrapper = progress;
RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(false, true, false, name, NULL, NULL, 0, updateCallback100);
+ return CommonUpdateOperation(AGENT_OP_CreateFolder, name, NULL, NULL, 0, updateCallback100);
COM_TRY_END
}
@@ -192,12 +201,12 @@ STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgres
indices.Add(index);
RINOK(_agentSpec->SetFolder(this));
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
+ if (progress)
{
CMyComPtr<IProgress> progressWrapper = progress;
RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
+ return CommonUpdateOperation(AGENT_OP_Rename, newName, NULL, &indices.Front(),
indices.Size(), updateCallback100);
COM_TRY_END
}
diff --git a/CPP/7zip/UI/Agent/IFolderArchive.h b/CPP/7zip/UI/Agent/IFolderArchive.h
index 867ae279..2357af31 100755
--- a/CPP/7zip/UI/Agent/IFolderArchive.h
+++ b/CPP/7zip/UI/Agent/IFolderArchive.h
@@ -3,7 +3,6 @@
#ifndef __IFOLDER_ARCHIVE_H
#define __IFOLDER_ARCHIVE_H
-#include "../../IDecl.h"
#include "../../Archive/IArchive.h"
#include "../../UI/Common/LoadCodecs.h"
#include "../../UI/FileManager/IFolder.h"
@@ -57,13 +56,14 @@ FOLDER_ARCHIVE_INTERFACE_SUB(IFolderArchiveUpdateCallback, IProgress, 0x0B)
#define INTERFACE_IOutFolderArchive(x) \
STDMETHOD(SetFolder)(IFolderFolder *folder) x; \
STDMETHOD(SetFiles)(const wchar_t *folderPrefix, const wchar_t **names, UInt32 numNames) x; \
- STDMETHOD(DeleteItems)(const wchar_t *newArchiveName, \
+ STDMETHOD(DeleteItems)(ISequentialOutStream *outArchiveStream, \
const UInt32 *indices, UInt32 numItems, IFolderArchiveUpdateCallback *updateCallback) x; \
STDMETHOD(DoOperation)(CCodecs *codecs, int index, \
- const wchar_t *newArchiveName, const Byte *stateActions, const wchar_t *sfxModule, \
+ ISequentialOutStream *outArchiveStream, const Byte *stateActions, const wchar_t *sfxModule, \
+ IFolderArchiveUpdateCallback *updateCallback) x; \
+ STDMETHOD(DoOperation2)( \
+ ISequentialOutStream *outArchiveStream, const Byte *stateActions, const wchar_t *sfxModule, \
IFolderArchiveUpdateCallback *updateCallback) x; \
- STDMETHOD(DoOperation2)(const wchar_t *newArchiveName, const Byte *stateActions, \
- const wchar_t *sfxModule, IFolderArchiveUpdateCallback *updateCallback) x; \
FOLDER_ARCHIVE_INTERFACE(IOutFolderArchive, 0x0A)
{
diff --git a/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp b/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
index e4aa4438..3687c3d0 100755
--- a/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
+++ b/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
@@ -66,7 +66,7 @@ HRESULT CUpdateCallbackAgent::OpenFileError(const wchar_t *name, DWORD systemErr
UString(L"WARNING: ") +
NError::MyFormatMessageW(systemError) +
UString(L": ") +
- UString(name)));
+ name));
return S_FALSE;
}
}