mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 08:07:12 -06:00
4.37 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
8304895f29
commit
cb9eea7264
@@ -70,7 +70,7 @@ STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
|
|||||||
propVariant = L"iso";
|
propVariant = L"iso";
|
||||||
break;
|
break;
|
||||||
case NArchive::kUpdate:
|
case NArchive::kUpdate:
|
||||||
propVariant = true;
|
propVariant = false;
|
||||||
break;
|
break;
|
||||||
case NArchive::kKeepName:
|
case NArchive::kKeepName:
|
||||||
propVariant = false;
|
propVariant = false;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|||||||
case kpidSize:
|
case kpidSize:
|
||||||
case kpidPackedSize:
|
case kpidPackedSize:
|
||||||
{
|
{
|
||||||
propVariant = (UInt64)be.GetSize();
|
propVariant = (UInt64)_archive.GetBootItemSize(index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|||||||
if (_archive.IsJoliet())
|
if (_archive.IsJoliet())
|
||||||
s = item.GetPathU();
|
s = item.GetPathU();
|
||||||
else
|
else
|
||||||
s = MultiByteToUnicodeString(item.GetPath(), CP_OEMCP);
|
s = MultiByteToUnicodeString(item.GetPath(_archive.IsSusp, _archive.SuspSkipSize), CP_OEMCP);
|
||||||
|
|
||||||
int pos = s.ReverseFind(L';');
|
int pos = s.ReverseFind(L';');
|
||||||
if (pos >= 0 && pos == s.Length() - 2)
|
if (pos >= 0 && pos == s.Length() - 2)
|
||||||
@@ -210,8 +210,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const CBootInitialEntry &be = _archive.BootEntries[index - _archive.Refs.Size()];
|
totalSize += _archive.GetBootItemSize(index - _archive.Refs.Size());
|
||||||
totalSize += be.GetSize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extractCallback->SetTotal(totalSize);
|
extractCallback->SetTotal(totalSize);
|
||||||
@@ -248,8 +247,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const CBootInitialEntry &be = _archive.BootEntries[index - _archive.Refs.Size()];
|
int bootIndex = index - _archive.Refs.Size();
|
||||||
currentItemSize = be.GetSize();
|
const CBootInitialEntry &be = _archive.BootEntries[bootIndex];
|
||||||
|
currentItemSize = _archive.GetBootItemSize(bootIndex);
|
||||||
blockIndex = be.LoadRBA;
|
blockIndex = be.LoadRBA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ void CInArchive::ReadDir(CDir &d, int level)
|
|||||||
SeekToBlock(d.ExtentLocation);
|
SeekToBlock(d.ExtentLocation);
|
||||||
UInt64 startPos = _position;
|
UInt64 startPos = _position;
|
||||||
|
|
||||||
|
bool firstItem = true;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
UInt64 offset = _position - startPos;
|
UInt64 offset = _position - startPos;
|
||||||
@@ -263,8 +264,13 @@ void CInArchive::ReadDir(CDir &d, int level)
|
|||||||
continue;
|
continue;
|
||||||
CDir subItem;
|
CDir subItem;
|
||||||
ReadDirRecord2(subItem, len);
|
ReadDirRecord2(subItem, len);
|
||||||
|
if (firstItem && level == 0)
|
||||||
|
IsSusp = subItem.CheckSusp(SuspSkipSize);
|
||||||
|
|
||||||
if (!subItem.IsSystemItem())
|
if (!subItem.IsSystemItem())
|
||||||
d._subItems.Add(subItem);
|
d._subItems.Add(subItem);
|
||||||
|
|
||||||
|
firstItem = false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < d._subItems.Size(); i++)
|
for (int i = 0; i < d._subItems.Size(); i++)
|
||||||
ReadDir(d._subItems[i], level + 1);
|
ReadDir(d._subItems[i], level + 1);
|
||||||
@@ -404,6 +410,10 @@ HRESULT CInArchive::Open2()
|
|||||||
HRESULT CInArchive::Open(IInStream *inStream)
|
HRESULT CInArchive::Open(IInStream *inStream)
|
||||||
{
|
{
|
||||||
_stream = inStream;
|
_stream = inStream;
|
||||||
|
UInt64 pos;
|
||||||
|
RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &pos));
|
||||||
|
RINOK(_stream->Seek(0, STREAM_SEEK_END, &_archiveSize));
|
||||||
|
RINOK(_stream->Seek(pos, STREAM_SEEK_SET, &_position));
|
||||||
HRESULT res = S_FALSE;
|
HRESULT res = S_FALSE;
|
||||||
try { res = Open2(); }
|
try { res = Open2(); }
|
||||||
catch(...) { Clear(); res = S_FALSE; }
|
catch(...) { Clear(); res = S_FALSE; }
|
||||||
@@ -418,6 +428,8 @@ void CInArchive::Clear()
|
|||||||
VolDescs.Clear();
|
VolDescs.Clear();
|
||||||
_bootIsDefined = false;
|
_bootIsDefined = false;
|
||||||
BootEntries.Clear();
|
BootEntries.Clear();
|
||||||
|
SuspSkipSize = 0;
|
||||||
|
IsSusp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ struct CDir: public CDirRecord
|
|||||||
_subItems.Clear();
|
_subItems.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLength() const
|
int GetLength(bool checkSusp, int skipSize) const
|
||||||
{
|
{
|
||||||
int len = FileId.GetCapacity();
|
int len = GetLengthCur(checkSusp, skipSize);
|
||||||
if (Parent != 0)
|
if (Parent != 0)
|
||||||
if (Parent->Parent != 0)
|
if (Parent->Parent != 0)
|
||||||
len += 1 + Parent->GetLength();
|
len += 1 + Parent->GetLength(checkSusp, skipSize);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,19 +43,19 @@ struct CDir: public CDirRecord
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
AString GetPath() const
|
AString GetPath(bool checkSusp, int skipSize) const
|
||||||
{
|
{
|
||||||
AString s;
|
AString s;
|
||||||
int len = GetLength();
|
int len = GetLength(checkSusp, skipSize);
|
||||||
char *p = s.GetBuffer(len + 1);
|
char *p = s.GetBuffer(len + 1);
|
||||||
p += len;
|
p += len;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
const CDir *cur = this;
|
const CDir *cur = this;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
int curLen = cur->FileId.GetCapacity();
|
int curLen = cur->GetLengthCur(checkSusp, skipSize);
|
||||||
p -= curLen;
|
p -= curLen;
|
||||||
memmove(p, (const char *)(const Byte *)cur->FileId, curLen);
|
memmove(p, (const char *)(const Byte *)cur->GetNameCur(checkSusp, skipSize), curLen);
|
||||||
cur = cur->Parent;
|
cur = cur->Parent;
|
||||||
if (cur == 0)
|
if (cur == 0)
|
||||||
break;
|
break;
|
||||||
@@ -262,13 +262,38 @@ public:
|
|||||||
HRESULT Open(IInStream *inStream);
|
HRESULT Open(IInStream *inStream);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
CObjectVector<CRef> Refs;
|
UInt64 _archiveSize;
|
||||||
|
|
||||||
|
CRecordVector<CRef> Refs;
|
||||||
CObjectVector<CVolumeDescriptor> VolDescs;
|
CObjectVector<CVolumeDescriptor> VolDescs;
|
||||||
int MainVolDescIndex;
|
int MainVolDescIndex;
|
||||||
UInt32 BlockSize;
|
UInt32 BlockSize;
|
||||||
CObjectVector<CBootInitialEntry> BootEntries;
|
CObjectVector<CBootInitialEntry> BootEntries;
|
||||||
|
|
||||||
|
|
||||||
bool IsJoliet() const { return VolDescs[MainVolDescIndex].IsJoliet(); }
|
bool IsJoliet() const { return VolDescs[MainVolDescIndex].IsJoliet(); }
|
||||||
|
|
||||||
|
UInt64 GetBootItemSize(int index) const
|
||||||
|
{
|
||||||
|
const CBootInitialEntry &be = BootEntries[index];
|
||||||
|
UInt64 size = be.GetSize();
|
||||||
|
if (be.BootMediaType == NBootMediaType::k1d2Floppy)
|
||||||
|
size = (1200 << 10);
|
||||||
|
else if (be.BootMediaType == NBootMediaType::k1d44Floppy)
|
||||||
|
size = (1440 << 10);
|
||||||
|
else if (be.BootMediaType == NBootMediaType::k2d88Floppy)
|
||||||
|
size = (2880 << 10);
|
||||||
|
UInt64 startPos = be.LoadRBA * BlockSize;
|
||||||
|
if (startPos < _archiveSize)
|
||||||
|
{
|
||||||
|
if (_archiveSize - startPos < size)
|
||||||
|
size = _archiveSize - startPos;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsSusp;
|
||||||
|
int SuspSkipSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -64,6 +64,80 @@ struct CDirRecord
|
|||||||
Byte b = *(const Byte *)FileId;
|
Byte b = *(const Byte *)FileId;
|
||||||
return (b == 0 || b == 1);
|
return (b == 0 || b == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Byte* FindSuspName(int skipSize, int &lenRes) const
|
||||||
|
{
|
||||||
|
lenRes = 0;
|
||||||
|
const Byte *p = (const Byte *)SystemUse + skipSize;
|
||||||
|
int length = SystemUse.GetCapacity() - skipSize;
|
||||||
|
while (length >= 5)
|
||||||
|
{
|
||||||
|
int len = p[2];
|
||||||
|
if (p[0] == 'N' && p[1] == 'M' && p[3] == 1)
|
||||||
|
{
|
||||||
|
lenRes = len - 5;
|
||||||
|
return p + 5;
|
||||||
|
}
|
||||||
|
p += len;
|
||||||
|
length -= len;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetLengthCur(bool checkSusp, int skipSize) const
|
||||||
|
{
|
||||||
|
if (checkSusp)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
const Byte *res = FindSuspName(skipSize, len);
|
||||||
|
if (res != 0)
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
return FileId.GetCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Byte* GetNameCur(bool checkSusp, int skipSize) const
|
||||||
|
{
|
||||||
|
if (checkSusp)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
const Byte *res = FindSuspName(skipSize, len);
|
||||||
|
if (res != 0)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return (const Byte *)FileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CheckSusp(const Byte *p, int &startPos) const
|
||||||
|
{
|
||||||
|
if (p[0] == 'S' &&
|
||||||
|
p[1] == 'P' &&
|
||||||
|
p[2] == 0x7 &&
|
||||||
|
p[3] == 0x1 &&
|
||||||
|
p[4] == 0xBE &&
|
||||||
|
p[5] == 0xEF)
|
||||||
|
{
|
||||||
|
startPos = p[6];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckSusp(int &startPos) const
|
||||||
|
{
|
||||||
|
const Byte *p = (const Byte *)SystemUse;
|
||||||
|
int length = SystemUse.GetCapacity();
|
||||||
|
const int kMinLen = 7;
|
||||||
|
if (length < kMinLen)
|
||||||
|
return false;
|
||||||
|
if (CheckSusp(p, startPos))
|
||||||
|
return true;
|
||||||
|
const int kOffset2 = 14;
|
||||||
|
if (length < kOffset2 + kMinLen)
|
||||||
|
return false;
|
||||||
|
return CheckSusp(p + kOffset2, startPos);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ STDMETHODIMP_(UInt32) CMatchFinderMT::GetMatchLen(Int32 index, UInt32 distance,
|
|||||||
distance++;
|
distance++;
|
||||||
const Byte *pby = m_DataCurrentPos + index;
|
const Byte *pby = m_DataCurrentPos + index;
|
||||||
UInt32 i;
|
UInt32 i;
|
||||||
for(i = 0; i < limit && pby[i] == pby[i - distance]; i++);
|
for(i = 0; i < limit && pby[i] == pby[(size_t)i - distance]; i++);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ int main2(int n, const char *args[])
|
|||||||
g_IsNT = IsItWindowsNT();
|
g_IsNT = IsItWindowsNT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "\nLZMA 4.35 Copyright (c) 1999-2006 Igor Pavlov 2006-03-03\n");
|
fprintf(stderr, "\nLZMA 4.37 Copyright (c) 1999-2006 Igor Pavlov 2006-03-18\n");
|
||||||
|
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
|||||||
folderPrefix = srcPanel._currentFolderPrefix;
|
folderPrefix = srcPanel._currentFolderPrefix;
|
||||||
filePaths.Reserve(indices.Size());
|
filePaths.Reserve(indices.Size());
|
||||||
for(int i = 0; i < indices.Size(); i++)
|
for(int i = 0; i < indices.Size(); i++)
|
||||||
filePaths.Add(srcPanel.GetItemName(indices[i]));
|
filePaths.Add(srcPanel.GetItemRelPath(indices[i]));
|
||||||
|
|
||||||
result = destPanel.CopyFrom(folderPrefix, filePaths, true, 0);
|
result = destPanel.CopyFrom(folderPrefix, filePaths, true, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,8 @@ public:
|
|||||||
void SetListSettings();
|
void SetListSettings();
|
||||||
void SetShowSystemMenu();
|
void SetShowSystemMenu();
|
||||||
void SwitchOnOffOnePanel();
|
void SwitchOnOffOnePanel();
|
||||||
|
bool GetFlatMode() { return Panels[LastFocusedPanel].GetFlatMode(); }
|
||||||
|
void ChangeFlatMode() { Panels[LastFocusedPanel].ChangeFlatMode(); }
|
||||||
|
|
||||||
void OpenBookmark(int index)
|
void OpenBookmark(int index)
|
||||||
{ GetFocusedPanel().OpenBookmark(index); }
|
{ GetFocusedPanel().OpenBookmark(index); }
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ static STATPROPSTG kProperties[] =
|
|||||||
{ NULL, kpidLastAccessTime, VT_FILETIME},
|
{ NULL, kpidLastAccessTime, VT_FILETIME},
|
||||||
{ NULL, kpidAttributes, VT_UI4},
|
{ NULL, kpidAttributes, VT_UI4},
|
||||||
{ NULL, kpidPackedSize, VT_UI8},
|
{ NULL, kpidPackedSize, VT_UI8},
|
||||||
{ NULL, kpidComment, VT_BSTR}
|
{ NULL, kpidComment, VT_BSTR},
|
||||||
|
{ NULL, kpidPrefix, VT_BSTR}
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
|
HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
|
||||||
@@ -42,6 +43,8 @@ HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
|
|||||||
_parentFolder = parentFolder;
|
_parentFolder = parentFolder;
|
||||||
_path = path;
|
_path = path;
|
||||||
|
|
||||||
|
_findChangeNotificationDefined = false;
|
||||||
|
|
||||||
if (_findChangeNotification.FindFirst(_path, false,
|
if (_findChangeNotification.FindFirst(_path, false,
|
||||||
FILE_NOTIFY_CHANGE_FILE_NAME |
|
FILE_NOTIFY_CHANGE_FILE_NAME |
|
||||||
FILE_NOTIFY_CHANGE_DIR_NAME |
|
FILE_NOTIFY_CHANGE_DIR_NAME |
|
||||||
@@ -77,8 +80,7 @@ static HRESULT GetFolderSize(const UString &path, UInt64 &size, IProgress *progr
|
|||||||
if (fileInfo.IsDirectory())
|
if (fileInfo.IsDirectory())
|
||||||
{
|
{
|
||||||
UInt64 subSize;
|
UInt64 subSize;
|
||||||
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name,
|
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subSize, progress));
|
||||||
subSize, progress));
|
|
||||||
size += subSize;
|
size += subSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -87,29 +89,67 @@ static HRESULT GetFolderSize(const UString &path, UInt64 &size, IProgress *progr
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
CEnumeratorW enumerator(path + L"*");
|
||||||
|
CDirItem fileInfo;
|
||||||
|
while (enumerator.Next(fileInfo))
|
||||||
|
{
|
||||||
|
fileInfo.CompressedSizeIsDefined = false;
|
||||||
|
/*
|
||||||
|
if (!GetCompressedFileSize(_path + fileInfo.Name,
|
||||||
|
fileInfo.CompressedSize))
|
||||||
|
fileInfo.CompressedSize = fileInfo.Size;
|
||||||
|
*/
|
||||||
|
if (fileInfo.IsDirectory())
|
||||||
|
{
|
||||||
|
// fileInfo.Size = GetFolderSize(_path + fileInfo.Name);
|
||||||
|
fileInfo.Size = 0;
|
||||||
|
}
|
||||||
|
dirItem.Files.Add(fileInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_flatMode)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
for (int i = 0; i < dirItem.Files.Size(); i++)
|
||||||
|
{
|
||||||
|
CDirItem &item = dirItem.Files[i];
|
||||||
|
if (item.IsDirectory())
|
||||||
|
LoadSubItems(item, path + item.Name + L'\\');
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFSFolder::AddRefs(CDirItem &dirItem)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < dirItem.Files.Size(); i++)
|
||||||
|
{
|
||||||
|
CDirItem &item = dirItem.Files[i];
|
||||||
|
item.Parent = &dirItem;
|
||||||
|
_refs.Add(&item);
|
||||||
|
}
|
||||||
|
if (!_flatMode)
|
||||||
|
return;
|
||||||
|
for (i = 0; i < dirItem.Files.Size(); i++)
|
||||||
|
{
|
||||||
|
CDirItem &item = dirItem.Files[i];
|
||||||
|
if (item.IsDirectory())
|
||||||
|
AddRefs(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP CFSFolder::LoadItems()
|
STDMETHODIMP CFSFolder::LoadItems()
|
||||||
{
|
{
|
||||||
// OutputDebugString(TEXT("Start\n"));
|
// OutputDebugString(TEXT("Start\n"));
|
||||||
INT32 dummy;
|
INT32 dummy;
|
||||||
WasChanged(&dummy);
|
WasChanged(&dummy);
|
||||||
_files.Clear();
|
Clear();
|
||||||
CEnumeratorW enumerator(_path + L"*");
|
RINOK(LoadSubItems(_root, _path));
|
||||||
CFileInfoEx fileInfo;
|
AddRefs(_root);
|
||||||
while (enumerator.Next(fileInfo))
|
|
||||||
{
|
|
||||||
fileInfo.CompressedSizeIsDefined = false;
|
|
||||||
/*
|
|
||||||
if (!GetCompressedFileSize(_path + fileInfo.Name,
|
|
||||||
fileInfo.CompressedSize))
|
|
||||||
fileInfo.CompressedSize = fileInfo.Size;
|
|
||||||
*/
|
|
||||||
if (fileInfo.IsDirectory())
|
|
||||||
{
|
|
||||||
// fileInfo.Size = GetFolderSize(_path + fileInfo.Name);
|
|
||||||
fileInfo.Size = 0;
|
|
||||||
}
|
|
||||||
_files.Add(fileInfo);
|
|
||||||
}
|
|
||||||
// OutputDebugString(TEXT("Finish\n"));
|
// OutputDebugString(TEXT("Finish\n"));
|
||||||
_commentsAreLoaded = false;
|
_commentsAreLoaded = false;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -178,7 +218,7 @@ bool CFSFolder::SaveComments()
|
|||||||
|
|
||||||
STDMETHODIMP CFSFolder::GetNumberOfItems(UInt32 *numItems)
|
STDMETHODIMP CFSFolder::GetNumberOfItems(UInt32 *numItems)
|
||||||
{
|
{
|
||||||
*numItems = _files.Size();
|
*numItems = _refs.Size();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,9 +237,9 @@ STDMETHODIMP CFSFolder::GetNumberOfSubFolders(UInt32 *numSubFolders)
|
|||||||
STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
|
STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
|
||||||
{
|
{
|
||||||
NCOM::CPropVariant propVariant;
|
NCOM::CPropVariant propVariant;
|
||||||
if (itemIndex >= (UInt32)_files.Size())
|
if (itemIndex >= (UInt32)_refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
CFileInfoEx &fileInfo = _files[itemIndex];
|
CDirItem &fileInfo = *_refs[itemIndex];
|
||||||
switch(propID)
|
switch(propID)
|
||||||
{
|
{
|
||||||
case kpidIsFolder:
|
case kpidIsFolder:
|
||||||
@@ -216,8 +256,7 @@ STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT
|
|||||||
{
|
{
|
||||||
fileInfo.CompressedSizeIsDefined = true;
|
fileInfo.CompressedSizeIsDefined = true;
|
||||||
if (fileInfo.IsDirectory () ||
|
if (fileInfo.IsDirectory () ||
|
||||||
!MyGetCompressedFileSizeW(_path + fileInfo.Name,
|
!MyGetCompressedFileSizeW(_path + GetRelPath(fileInfo), fileInfo.CompressedSize))
|
||||||
fileInfo.CompressedSize))
|
|
||||||
fileInfo.CompressedSize = fileInfo.Size;
|
fileInfo.CompressedSize = fileInfo.Size;
|
||||||
}
|
}
|
||||||
propVariant = fileInfo.CompressedSize;
|
propVariant = fileInfo.CompressedSize;
|
||||||
@@ -235,11 +274,21 @@ STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT
|
|||||||
propVariant = fileInfo.LastWriteTime;
|
propVariant = fileInfo.LastWriteTime;
|
||||||
break;
|
break;
|
||||||
case kpidComment:
|
case kpidComment:
|
||||||
|
{
|
||||||
LoadComments();
|
LoadComments();
|
||||||
UString comment;
|
UString comment;
|
||||||
if (_comments.GetValue(fileInfo.Name, comment))
|
if (_comments.GetValue(GetRelPath(fileInfo), comment))
|
||||||
propVariant = comment;
|
propVariant = comment;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case kpidPrefix:
|
||||||
|
{
|
||||||
|
if (_flatMode)
|
||||||
|
{
|
||||||
|
propVariant = GetPrefix(fileInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
propVariant.Detach(value);
|
propVariant.Detach(value);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -250,19 +299,35 @@ HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultF
|
|||||||
*resultFolder = 0;
|
*resultFolder = 0;
|
||||||
CFSFolder *folderSpec = new CFSFolder;
|
CFSFolder *folderSpec = new CFSFolder;
|
||||||
CMyComPtr<IFolderFolder> subFolder = folderSpec;
|
CMyComPtr<IFolderFolder> subFolder = folderSpec;
|
||||||
RINOK(folderSpec ->Init(_path + name + UString(L'\\'), 0));
|
RINOK(folderSpec->Init(_path + name + UString(L'\\'), 0));
|
||||||
*resultFolder = subFolder.Detach();
|
*resultFolder = subFolder.Detach();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UString CFSFolder::GetPrefix(const CDirItem &item) const
|
||||||
|
{
|
||||||
|
UString path;
|
||||||
|
CDirItem *cur = item.Parent;
|
||||||
|
while (cur->Parent != 0)
|
||||||
|
{
|
||||||
|
path = cur->Name + UString('\\') + path;
|
||||||
|
cur = cur->Parent;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
UString CFSFolder::GetRelPath(const CDirItem &item) const
|
||||||
|
{
|
||||||
|
return GetPrefix(item) + item.Name;
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP CFSFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
|
STDMETHODIMP CFSFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
|
||||||
{
|
{
|
||||||
*resultFolder = 0;
|
*resultFolder = 0;
|
||||||
const NFind::CFileInfoW &fileInfo = _files[index];
|
const CDirItem &fileInfo = *_refs[index];
|
||||||
if (!fileInfo.IsDirectory())
|
if (!fileInfo.IsDirectory())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
return BindToFolderSpec(fileInfo.Name, resultFolder);
|
return BindToFolderSpec(GetRelPath(fileInfo), resultFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CFSFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
|
STDMETHODIMP CFSFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
|
||||||
@@ -328,6 +393,8 @@ STDMETHODIMP CFSFolder::GetName(BSTR *name)
|
|||||||
STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties)
|
STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties)
|
||||||
{
|
{
|
||||||
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
|
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
|
||||||
|
if (!_flatMode)
|
||||||
|
(*numProperties)--;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +462,7 @@ STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
|
|||||||
|
|
||||||
HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
|
HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
|
||||||
{
|
{
|
||||||
const CFileInfoW &fileInfo = _files[index];
|
const CDirItem &fileInfo = *_refs[index];
|
||||||
if (fileInfo.IsDirectory())
|
if (fileInfo.IsDirectory())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -415,7 +482,7 @@ HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
|
|||||||
*totalSize += size;
|
*totalSize += size;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return GetFolderSize(_path + fileInfo.Name, size, progress);
|
return GetFolderSize(_path + GetRelPath(fileInfo), size, progress);
|
||||||
}
|
}
|
||||||
size = fileInfo.Size;
|
size = fileInfo.Size;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -424,7 +491,7 @@ HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
|
|||||||
STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
|
STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
|
||||||
{
|
{
|
||||||
NCOM::CPropVariant propVariant;
|
NCOM::CPropVariant propVariant;
|
||||||
if (index >= (UInt32)_files.Size())
|
if (index >= (UInt32)_refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
UInt64 size = 0;
|
UInt64 size = 0;
|
||||||
HRESULT result = GetItemFullSize(index, size, progress);
|
HRESULT result = GetItemFullSize(index, size, progress);
|
||||||
@@ -476,8 +543,9 @@ STDMETHODIMP CFSFolder::CreateFile(const wchar_t *name, IProgress *progress)
|
|||||||
|
|
||||||
STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *progress)
|
STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *progress)
|
||||||
{
|
{
|
||||||
const CFileInfoW &fileInfo = _files[index];
|
const CDirItem &fileInfo = *_refs[index];
|
||||||
if (!NDirectory::MyMoveFile(_path + fileInfo.Name, _path + newName))
|
const UString fullPrefix = _path + GetPrefix(fileInfo);
|
||||||
|
if (!NDirectory::MyMoveFile(fullPrefix + fileInfo.Name, fullPrefix + newName))
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@@ -489,8 +557,8 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,
|
|||||||
for (UInt32 i = 0; i < numItems; i++)
|
for (UInt32 i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
int index = indices[i];
|
int index = indices[i];
|
||||||
const CFileInfoW &fileInfo = _files[indices[i]];
|
const CDirItem &fileInfo = *_refs[indices[i]];
|
||||||
const UString fullPath = _path + fileInfo.Name;
|
const UString fullPath = _path + GetRelPath(fileInfo);
|
||||||
bool result;
|
bool result;
|
||||||
if (fileInfo.IsDirectory())
|
if (fileInfo.IsDirectory())
|
||||||
result = NDirectory::RemoveDirectoryWithSubItems(fullPath);
|
result = NDirectory::RemoveDirectoryWithSubItems(fullPath);
|
||||||
@@ -507,9 +575,11 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,
|
|||||||
STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
|
STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
|
||||||
const PROPVARIANT *value, IProgress *progress)
|
const PROPVARIANT *value, IProgress *progress)
|
||||||
{
|
{
|
||||||
if (index >= (UInt32)_files.Size())
|
if (index >= (UInt32)_refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
CFileInfoEx &fileInfo = _files[index];
|
CDirItem &fileInfo = *_refs[index];
|
||||||
|
if (fileInfo.Parent->Parent != 0)
|
||||||
|
return E_NOTIMPL;
|
||||||
switch(propID)
|
switch(propID)
|
||||||
{
|
{
|
||||||
case kpidComment:
|
case kpidComment:
|
||||||
@@ -543,12 +613,12 @@ STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
|
|||||||
|
|
||||||
STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
|
STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
|
||||||
{
|
{
|
||||||
if (index >= (UInt32)_files.Size())
|
if (index >= (UInt32)_refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
const CFileInfoEx &fileInfo = _files[index];
|
const CDirItem &fileInfo = *_refs[index];
|
||||||
*iconIndex = 0;
|
*iconIndex = 0;
|
||||||
int iconIndexTemp;
|
int iconIndexTemp;
|
||||||
if (GetRealIconIndex(_path + fileInfo.Name, fileInfo.Attributes, iconIndexTemp) != 0)
|
if (GetRealIconIndex(_path + GetRelPath(fileInfo), fileInfo.Attributes, iconIndexTemp) != 0)
|
||||||
{
|
{
|
||||||
*iconIndex = iconIndexTemp;
|
*iconIndex = iconIndexTemp;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -556,5 +626,11 @@ STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
|
|||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP CFSFolder::SetFlatMode(Int32 flatMode)
|
||||||
|
{
|
||||||
|
_flatMode = IntToBool(flatMode);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// static const LPCTSTR kInvalidFileChars = TEXT("\\/:*?\"<>|");
|
// static const LPCTSTR kInvalidFileChars = TEXT("\\/:*?\"<>|");
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,20 @@ struct CFileInfoEx: public NWindows::NFile::NFind::CFileInfoW
|
|||||||
UInt64 CompressedSize;
|
UInt64 CompressedSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CDirItem;
|
||||||
|
|
||||||
|
struct CDirItem: public CFileInfoEx
|
||||||
|
{
|
||||||
|
CDirItem *Parent;
|
||||||
|
CObjectVector<CDirItem> Files;
|
||||||
|
|
||||||
|
CDirItem(): Parent(0) {}
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
Files.Clear();
|
||||||
|
Parent = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class CFSFolder:
|
class CFSFolder:
|
||||||
public IFolderFolder,
|
public IFolderFolder,
|
||||||
@@ -32,6 +46,7 @@ class CFSFolder:
|
|||||||
public IFolderGetItemFullSize,
|
public IFolderGetItemFullSize,
|
||||||
public IFolderClone,
|
public IFolderClone,
|
||||||
public IFolderGetSystemIconIndex,
|
public IFolderGetSystemIconIndex,
|
||||||
|
public IFolderSetFlatMode,
|
||||||
public CMyUnknownImp
|
public CMyUnknownImp
|
||||||
{
|
{
|
||||||
UInt64 GetSizeOfItem(int anIndex) const;
|
UInt64 GetSizeOfItem(int anIndex) const;
|
||||||
@@ -46,6 +61,7 @@ public:
|
|||||||
MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize)
|
MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize)
|
||||||
MY_QUERYINTERFACE_ENTRY(IFolderClone)
|
MY_QUERYINTERFACE_ENTRY(IFolderClone)
|
||||||
MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex)
|
MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex)
|
||||||
|
MY_QUERYINTERFACE_ENTRY(IFolderSetFlatMode)
|
||||||
MY_QUERYINTERFACE_END
|
MY_QUERYINTERFACE_END
|
||||||
MY_ADDREF_RELEASE
|
MY_ADDREF_RELEASE
|
||||||
|
|
||||||
@@ -67,6 +83,8 @@ public:
|
|||||||
STDMETHOD(Clone)(IFolderFolder **resultFolder);
|
STDMETHOD(Clone)(IFolderFolder **resultFolder);
|
||||||
STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress);
|
STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress);
|
||||||
|
|
||||||
|
STDMETHOD(SetFlatMode)(Int32 flatMode);
|
||||||
|
|
||||||
// IFolderOperations
|
// IFolderOperations
|
||||||
|
|
||||||
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress);
|
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress);
|
||||||
@@ -84,7 +102,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
UString _path;
|
UString _path;
|
||||||
CObjectVector<CFileInfoEx> _files;
|
CDirItem _root;
|
||||||
|
CRecordVector<CDirItem *> _refs;
|
||||||
|
|
||||||
CMyComPtr<IFolderFolder> _parentFolder;
|
CMyComPtr<IFolderFolder> _parentFolder;
|
||||||
|
|
||||||
bool _findChangeNotificationDefined;
|
bool _findChangeNotificationDefined;
|
||||||
@@ -92,6 +112,8 @@ private:
|
|||||||
bool _commentsAreLoaded;
|
bool _commentsAreLoaded;
|
||||||
CPairsStorage _comments;
|
CPairsStorage _comments;
|
||||||
|
|
||||||
|
bool _flatMode;
|
||||||
|
|
||||||
NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
|
NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
|
||||||
|
|
||||||
HRESULT GetItemFullSize(int index, UInt64 &size, IProgress *progress);
|
HRESULT GetItemFullSize(int index, UInt64 &size, IProgress *progress);
|
||||||
@@ -100,8 +122,22 @@ private:
|
|||||||
|
|
||||||
bool LoadComments();
|
bool LoadComments();
|
||||||
bool SaveComments();
|
bool SaveComments();
|
||||||
|
HRESULT LoadSubItems(CDirItem &dirItem, const UString &path);
|
||||||
|
void AddRefs(CDirItem &dirItem);
|
||||||
public:
|
public:
|
||||||
HRESULT Init(const UString &path, IFolderFolder *parentFolder);
|
HRESULT Init(const UString &path, IFolderFolder *parentFolder);
|
||||||
|
|
||||||
|
CFSFolder() : _flatMode(false) {}
|
||||||
|
|
||||||
|
UString GetPrefix(const CDirItem &item) const;
|
||||||
|
UString GetRelPath(const CDirItem &item) const;
|
||||||
|
UString GetRelPath(UInt32 index) const { return GetRelPath(*_refs[index]); }
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
_root.Clear();
|
||||||
|
_refs.Clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
|
|||||||
for (i = 0; i < numItems; i++)
|
for (i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
int index = indices[i];
|
int index = indices[i];
|
||||||
if (index >= _files.Size())
|
if (index >= _refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
UINT64 size;
|
UINT64 size;
|
||||||
RINOK(GetItemFullSize(indices[i], size, callback));
|
RINOK(GetItemFullSize(indices[i], size, callback));
|
||||||
@@ -286,11 +286,11 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
|
|||||||
RINOK(callback->SetCompleted(&completedSize));
|
RINOK(callback->SetCompleted(&completedSize));
|
||||||
for (i = 0; i < numItems; i++)
|
for (i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
const CFileInfoW &fileInfo = _files[indices[i]];
|
const CDirItem &fileInfo = *_refs[indices[i]];
|
||||||
UString destPath2 = destPath;
|
UString destPath2 = destPath;
|
||||||
if (!directName)
|
if (!directName)
|
||||||
destPath2 += fileInfo.Name;
|
destPath2 += fileInfo.Name;
|
||||||
UString srcPath = _path + fileInfo.Name;
|
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
|
||||||
if (fileInfo.IsDirectory())
|
if (fileInfo.IsDirectory())
|
||||||
{
|
{
|
||||||
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
|
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
|
||||||
@@ -415,7 +415,7 @@ STDMETHODIMP CFSFolder::MoveTo(
|
|||||||
for (i = 0; i < numItems; i++)
|
for (i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
int index = indices[i];
|
int index = indices[i];
|
||||||
if (index >= _files.Size())
|
if (index >= _refs.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
UINT64 size;
|
UINT64 size;
|
||||||
RINOK(GetItemFullSize(indices[i], size, callback));
|
RINOK(GetItemFullSize(indices[i], size, callback));
|
||||||
@@ -445,11 +445,11 @@ STDMETHODIMP CFSFolder::MoveTo(
|
|||||||
RINOK(callback->SetCompleted(&completedSize));
|
RINOK(callback->SetCompleted(&completedSize));
|
||||||
for (i = 0; i < numItems; i++)
|
for (i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
const CFileInfoW &fileInfo = _files[indices[i]];
|
const CDirItem &fileInfo = *_refs[indices[i]];
|
||||||
UString destPath2 = destPath;
|
UString destPath2 = destPath;
|
||||||
if (!directName)
|
if (!directName)
|
||||||
destPath2 += fileInfo.Name;
|
destPath2 += fileInfo.Name;
|
||||||
UString srcPath = _path + fileInfo.Name;
|
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
|
||||||
if (fileInfo.IsDirectory())
|
if (fileInfo.IsDirectory())
|
||||||
{
|
{
|
||||||
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
|
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
|
||||||
|
|||||||
@@ -133,8 +133,13 @@ FOLDER_INTERFACE(IFolderClone, 0x09)
|
|||||||
STDMETHOD(Clone)(IFolderFolder **resultFolder) PURE;
|
STDMETHOD(Clone)(IFolderFolder **resultFolder) PURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FOLDER_INTERFACE(IFolderSetFlatMode, 0x0A)
|
||||||
|
{
|
||||||
|
STDMETHOD(SetFlatMode)(Int32 flatMode) PURE;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FOLDER_INTERFACE(IFolderOpen, 0x0A)
|
FOLDER_INTERFACE(IFolderOpen, 0x10)
|
||||||
{
|
{
|
||||||
STDMETHOD(FolderOpen)(
|
STDMETHOD(FolderOpen)(
|
||||||
const wchar_t *aFileName,
|
const wchar_t *aFileName,
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ static CIDLangPair kIDLangPairs[] =
|
|||||||
|
|
||||||
{ IDM_VIEW_REFRESH, 0x03000440 },
|
{ IDM_VIEW_REFRESH, 0x03000440 },
|
||||||
|
|
||||||
|
{ IDM_VIEW_FLAT_VIEW, 0x03000449 },
|
||||||
{ IDM_VIEW_TWO_PANELS, 0x03000450 },
|
{ IDM_VIEW_TWO_PANELS, 0x03000450 },
|
||||||
{ IDM_VIEW_ARCHIVE_TOOLBAR, 0x03000460 },
|
{ IDM_VIEW_ARCHIVE_TOOLBAR, 0x03000460 },
|
||||||
{ IDM_VIEW_STANDARD_TOOLBAR, 0x03000461 },
|
{ IDM_VIEW_STANDARD_TOOLBAR, 0x03000461 },
|
||||||
@@ -331,6 +332,8 @@ void OnMenuActivating(HWND hWnd, HMENU hMenu, int position)
|
|||||||
IDM_VIEW_LARGE_ICONS + g_App.GetListViewMode(), MF_BYCOMMAND);
|
IDM_VIEW_LARGE_ICONS + g_App.GetListViewMode(), MF_BYCOMMAND);
|
||||||
menu.CheckItem(IDM_VIEW_TWO_PANELS, MF_BYCOMMAND |
|
menu.CheckItem(IDM_VIEW_TWO_PANELS, MF_BYCOMMAND |
|
||||||
((g_App.NumPanels == 2) ? MF_CHECKED : MF_UNCHECKED));
|
((g_App.NumPanels == 2) ? MF_CHECKED : MF_UNCHECKED));
|
||||||
|
menu.CheckItem(IDM_VIEW_FLAT_VIEW, MF_BYCOMMAND |
|
||||||
|
((g_App.GetFlatMode()) ? MF_CHECKED : MF_UNCHECKED));
|
||||||
menu.CheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, MF_BYCOMMAND |
|
menu.CheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, MF_BYCOMMAND |
|
||||||
(g_App.ShowArchiveToolbar ? MF_CHECKED : MF_UNCHECKED));
|
(g_App.ShowArchiveToolbar ? MF_CHECKED : MF_UNCHECKED));
|
||||||
menu.CheckItem(IDM_VIEW_STANDARD_TOOLBAR, MF_BYCOMMAND |
|
menu.CheckItem(IDM_VIEW_STANDARD_TOOLBAR, MF_BYCOMMAND |
|
||||||
@@ -635,10 +638,12 @@ bool OnMenuCommand(HWND hWnd, int id)
|
|||||||
case IDM_VIEW_REFRESH:
|
case IDM_VIEW_REFRESH:
|
||||||
g_App.RefreshView();
|
g_App.RefreshView();
|
||||||
break;
|
break;
|
||||||
|
case IDM_VIEW_FLAT_VIEW:
|
||||||
|
g_App.ChangeFlatMode();
|
||||||
|
break;
|
||||||
case IDM_VIEW_TWO_PANELS:
|
case IDM_VIEW_TWO_PANELS:
|
||||||
g_App.SwitchOnOffOnePanel();
|
g_App.SwitchOnOffOnePanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_VIEW_STANDARD_TOOLBAR:
|
case IDM_VIEW_STANDARD_TOOLBAR:
|
||||||
g_App.SwitchStandardToolbar();
|
g_App.SwitchStandardToolbar();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ LRESULT CPanel::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
OnShiftSelectMessage();
|
OnShiftSelectMessage();
|
||||||
return 0;
|
return 0;
|
||||||
case kReLoadMessage:
|
case kReLoadMessage:
|
||||||
OnReload();
|
RefreshListCtrl(_selectedState);
|
||||||
return 0;
|
return 0;
|
||||||
case kSetFocusToListView:
|
case kSetFocusToListView:
|
||||||
_listView.SetFocus();
|
_listView.SetFocus();
|
||||||
@@ -736,6 +736,13 @@ void CPanel::SetListViewMode(UINT32 index)
|
|||||||
// RefreshListCtrlSaveFocused();
|
// RefreshListCtrlSaveFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPanel::ChangeFlatMode()
|
||||||
|
{
|
||||||
|
_flatMode = !_flatMode;
|
||||||
|
RefreshListCtrlSaveFocused();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CPanel::RefreshStatusBar()
|
void CPanel::RefreshStatusBar()
|
||||||
{
|
{
|
||||||
PostMessage(kRefreshStatusBar);
|
PostMessage(kRefreshStatusBar);
|
||||||
@@ -759,7 +766,7 @@ void CPanel::AddToArchive()
|
|||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
{
|
{
|
||||||
int index = indices[i];
|
int index = indices[i];
|
||||||
names.Add(_currentFolderPrefix + GetItemName(index));
|
names.Add(_currentFolderPrefix + GetItemRelPath(index));
|
||||||
}
|
}
|
||||||
const UString archiveName = CreateArchiveName(
|
const UString archiveName = CreateArchiveName(
|
||||||
names.Front(), (names.Size() > 1), false);
|
names.Front(), (names.Size() > 1), false);
|
||||||
@@ -791,7 +798,7 @@ void CPanel::ExtractArchives()
|
|||||||
MessageBox(kSelectOneFile);
|
MessageBox(kSelectOneFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
paths.Add(_currentFolderPrefix + GetItemName(index));
|
paths.Add(_currentFolderPrefix + GetItemRelPath(index));
|
||||||
}
|
}
|
||||||
::ExtractArchives(paths, _currentFolderPrefix, true);
|
::ExtractArchives(paths, _currentFolderPrefix, true);
|
||||||
}
|
}
|
||||||
@@ -819,7 +826,7 @@ void CPanel::TestArchives()
|
|||||||
MessageBox(kSelectOneFile);
|
MessageBox(kSelectOneFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
paths.Add(_currentFolderPrefix + GetItemName(index));
|
paths.Add(_currentFolderPrefix + GetItemRelPath(index));
|
||||||
}
|
}
|
||||||
::TestArchives(paths);
|
::TestArchives(paths);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public:
|
|||||||
bool _mySelectMode;
|
bool _mySelectMode;
|
||||||
CBoolVector _selectedStatusVector;
|
CBoolVector _selectedStatusVector;
|
||||||
|
|
||||||
UString _focusedName;
|
CSelectedState _selectedState;
|
||||||
|
|
||||||
UInt32 GetRealIndex(const LVITEMW &item) const
|
UInt32 GetRealIndex(const LVITEMW &item) const
|
||||||
{
|
{
|
||||||
@@ -257,6 +257,10 @@ public:
|
|||||||
UInt32 _ListViewMode;
|
UInt32 _ListViewMode;
|
||||||
int _xSize;
|
int _xSize;
|
||||||
|
|
||||||
|
bool _flatMode;
|
||||||
|
|
||||||
|
bool _dontShowMode;
|
||||||
|
|
||||||
|
|
||||||
UString _currentFolderPrefix;
|
UString _currentFolderPrefix;
|
||||||
|
|
||||||
@@ -273,6 +277,8 @@ public:
|
|||||||
void RefreshListCtrlSaveFocused();
|
void RefreshListCtrlSaveFocused();
|
||||||
|
|
||||||
UString GetItemName(int itemIndex) const;
|
UString GetItemName(int itemIndex) const;
|
||||||
|
UString GetItemPrefix(int itemIndex) const;
|
||||||
|
UString GetItemRelPath(int itemIndex) const;
|
||||||
bool IsItemFolder(int itemIndex) const;
|
bool IsItemFolder(int itemIndex) const;
|
||||||
UInt64 GetItemSize(int itemIndex) const;
|
UInt64 GetItemSize(int itemIndex) const;
|
||||||
|
|
||||||
@@ -316,10 +322,12 @@ public:
|
|||||||
_startGroupSelect(0),
|
_startGroupSelect(0),
|
||||||
_selectionIsDefined(false),
|
_selectionIsDefined(false),
|
||||||
_ListViewMode(3),
|
_ListViewMode(3),
|
||||||
|
_flatMode(false),
|
||||||
_xSize(300),
|
_xSize(300),
|
||||||
_mySelectMode(false),
|
_mySelectMode(false),
|
||||||
_enableItemChangeNotify(true)
|
_enableItemChangeNotify(true),
|
||||||
{}
|
_dontShowMode(false)
|
||||||
|
{}
|
||||||
|
|
||||||
void SetExtendedStyle()
|
void SetExtendedStyle()
|
||||||
{
|
{
|
||||||
@@ -471,6 +479,9 @@ public:
|
|||||||
void SetListViewMode(UInt32 index);
|
void SetListViewMode(UInt32 index);
|
||||||
UInt32 GetListViewMode() const { return _ListViewMode; };
|
UInt32 GetListViewMode() const { return _ListViewMode; };
|
||||||
|
|
||||||
|
void ChangeFlatMode();
|
||||||
|
bool GetFlatMode() const { return _flatMode; };
|
||||||
|
|
||||||
void RefreshStatusBar();
|
void RefreshStatusBar();
|
||||||
void OnRefreshStatusBar();
|
void OnRefreshStatusBar();
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ static const UInt32 kBufSize = (1 << 15);
|
|||||||
|
|
||||||
struct CDirEnumerator
|
struct CDirEnumerator
|
||||||
{
|
{
|
||||||
|
bool FlatMode;
|
||||||
UString BasePrefix;
|
UString BasePrefix;
|
||||||
UStringVector FileNames;
|
UStringVector FileNames;
|
||||||
|
|
||||||
@@ -38,6 +39,8 @@ struct CDirEnumerator
|
|||||||
int Index;
|
int Index;
|
||||||
bool GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &fullPath, DWORD &errorCode);
|
bool GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &fullPath, DWORD &errorCode);
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
CDirEnumerator(): FlatMode(false) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void CDirEnumerator::Init()
|
void CDirEnumerator::Init()
|
||||||
@@ -57,6 +60,10 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
|
|||||||
if (Index >= FileNames.Size())
|
if (Index >= FileNames.Size())
|
||||||
return true;
|
return true;
|
||||||
const UString &path = FileNames[Index];
|
const UString &path = FileNames[Index];
|
||||||
|
int pos = path.ReverseFind('\\');
|
||||||
|
resPath.Empty();
|
||||||
|
if (pos >= 0)
|
||||||
|
resPath = path.Left(pos + 1);
|
||||||
if (!NFind::FindFile(BasePrefix + path, fileInfo))
|
if (!NFind::FindFile(BasePrefix + path, fileInfo))
|
||||||
{
|
{
|
||||||
errorCode = ::GetLastError();
|
errorCode = ::GetLastError();
|
||||||
@@ -64,7 +71,6 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Index++;
|
Index++;
|
||||||
resPath.Empty();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bool found;
|
bool found;
|
||||||
@@ -83,7 +89,7 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
|
|||||||
Prefixes.DeleteBack();
|
Prefixes.DeleteBack();
|
||||||
}
|
}
|
||||||
resPath += fileInfo.Name;
|
resPath += fileInfo.Name;
|
||||||
if (fileInfo.IsDirectory())
|
if (!FlatMode && fileInfo.IsDirectory())
|
||||||
{
|
{
|
||||||
UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
|
UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
|
||||||
Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
|
Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
|
||||||
@@ -276,8 +282,9 @@ void CApp::CalculateCrc()
|
|||||||
|
|
||||||
CThreadCrc combiner;
|
CThreadCrc combiner;
|
||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
combiner.DirEnumerator.FileNames.Add(srcPanel.GetItemName(indices[i]));
|
combiner.DirEnumerator.FileNames.Add(srcPanel.GetItemRelPath(indices[i]));
|
||||||
combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix;
|
combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix;
|
||||||
|
combiner.DirEnumerator.FlatMode = GetFlatMode();
|
||||||
|
|
||||||
CProgressDialog progressDialog;
|
CProgressDialog progressDialog;
|
||||||
combiner.ProgressDialog = &progressDialog;
|
combiner.ProgressDialog = &progressDialog;
|
||||||
|
|||||||
@@ -319,7 +319,15 @@ void CPanel::OnDrag(LPNMLISTVIEW nmListView)
|
|||||||
{
|
{
|
||||||
UStringVector names;
|
UStringVector names;
|
||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
names.Add(dirPrefix + GetItemName(indices[i]));
|
{
|
||||||
|
UInt32 index = indices[i];
|
||||||
|
UString s;
|
||||||
|
if (isFSFolder)
|
||||||
|
s = GetItemRelPath(index);
|
||||||
|
else
|
||||||
|
s = GetItemName(index);
|
||||||
|
names.Add(dirPrefix + s);
|
||||||
|
}
|
||||||
if (!CopyNamesToHGlobal(dataObjectSpec->hGlobal, names))
|
if (!CopyNamesToHGlobal(dataObjectSpec->hGlobal, names))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name)
|
|||||||
HRESULT CPanel::OpenItemAsArchive(int index)
|
HRESULT CPanel::OpenItemAsArchive(int index)
|
||||||
{
|
{
|
||||||
CDisableTimerProcessing disableTimerProcessing1(*this);
|
CDisableTimerProcessing disableTimerProcessing1(*this);
|
||||||
RINOK(OpenItemAsArchive(GetItemName(index)));
|
RINOK(OpenItemAsArchive(GetItemRelPath(index)));
|
||||||
RefreshListCtrl();
|
RefreshListCtrl();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@@ -279,14 +279,14 @@ void CPanel::EditItem(int index)
|
|||||||
OpenItemInArchive(index, false, true, true);
|
OpenItemInArchive(index, false, true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HANDLE hProcess = StartEditApplication(_currentFolderPrefix + GetItemName(index), (HWND)*this);
|
HANDLE hProcess = StartEditApplication(_currentFolderPrefix + GetItemRelPath(index), (HWND)*this);
|
||||||
if (hProcess != 0)
|
if (hProcess != 0)
|
||||||
::CloseHandle(hProcess);
|
::CloseHandle(hProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPanel::OpenFolderExternal(int index)
|
void CPanel::OpenFolderExternal(int index)
|
||||||
{
|
{
|
||||||
HANDLE hProcess = StartApplication(GetFsPath() + GetItemName(index), (HWND)*this);
|
HANDLE hProcess = StartApplication(GetFsPath() + GetItemRelPath(index), (HWND)*this);
|
||||||
if (hProcess != 0)
|
if (hProcess != 0)
|
||||||
::CloseHandle(hProcess);
|
::CloseHandle(hProcess);
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
|
|||||||
OpenItemInArchive(index, tryInternal, tryExternal, false);
|
OpenItemInArchive(index, tryInternal, tryExternal, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UString name = GetItemName(index);
|
UString name = GetItemRelPath(index);
|
||||||
if (IsNameVirus(name))
|
if (IsNameVirus(name))
|
||||||
{
|
{
|
||||||
MessageBoxMyError(virusMessage);
|
MessageBoxMyError(virusMessage);
|
||||||
@@ -411,7 +411,7 @@ static DWORD WINAPI MyThreadFunction(void *param)
|
|||||||
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
|
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
|
||||||
bool editMode)
|
bool editMode)
|
||||||
{
|
{
|
||||||
UString name = GetItemName(index);
|
const UString name = GetItemName(index);
|
||||||
if (IsNameVirus(name))
|
if (IsNameVirus(name))
|
||||||
{
|
{
|
||||||
MessageBoxMyError(virusMessage);
|
MessageBoxMyError(virusMessage);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void CPanel::GetSelectedNames(UStringVector &selectedNames)
|
|||||||
GetSelectedItemsIndices(indices);
|
GetSelectedItemsIndices(indices);
|
||||||
selectedNames.Reserve(indices.Size());
|
selectedNames.Reserve(indices.Size());
|
||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
selectedNames.Add(GetItemName(indices[i]));
|
selectedNames.Add(GetItemRelPath(indices[i]));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < _listView.GetItemCount(); i++)
|
for (int i = 0; i < _listView.GetItemCount(); i++)
|
||||||
@@ -245,19 +245,12 @@ void CPanel::SaveSelectedState(CSelectedState &s)
|
|||||||
s.FocusedName.Empty();
|
s.FocusedName.Empty();
|
||||||
s.SelectedNames.Clear();
|
s.SelectedNames.Clear();
|
||||||
s.FocusedItem = _listView.GetFocusedItem();
|
s.FocusedItem = _listView.GetFocusedItem();
|
||||||
if (!_focusedName.IsEmpty())
|
|
||||||
{
|
|
||||||
s.FocusedName = _focusedName;
|
|
||||||
s.SelectFocused = true;
|
|
||||||
_focusedName.Empty();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (s.FocusedItem >= 0)
|
if (s.FocusedItem >= 0)
|
||||||
{
|
{
|
||||||
int realIndex = GetRealItemIndex(s.FocusedItem);
|
int realIndex = GetRealItemIndex(s.FocusedItem);
|
||||||
if (realIndex != kParentIndex)
|
if (realIndex != kParentIndex)
|
||||||
s.FocusedName = GetItemName(realIndex);
|
s.FocusedName = GetItemRelPath(realIndex);
|
||||||
/*
|
/*
|
||||||
const int kSize = 1024;
|
const int kSize = 1024;
|
||||||
WCHAR name[kSize + 1];
|
WCHAR name[kSize + 1];
|
||||||
@@ -307,6 +300,7 @@ void CPanel::SetFocusedSelectedItem(int index, bool select)
|
|||||||
void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
|
void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
|
||||||
const UStringVector &selectedNames)
|
const UStringVector &selectedNames)
|
||||||
{
|
{
|
||||||
|
_dontShowMode = false;
|
||||||
LoadFullPathAndShow();
|
LoadFullPathAndShow();
|
||||||
// OutputDebugStringA("=======\n");
|
// OutputDebugStringA("=======\n");
|
||||||
// OutputDebugStringA("s1 \n");
|
// OutputDebugStringA("s1 \n");
|
||||||
@@ -340,6 +334,11 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
|
|||||||
bool isRoot = IsRootFolder();
|
bool isRoot = IsRootFolder();
|
||||||
_headerToolBar.EnableButton(kParentFolderID, !IsRootFolder());
|
_headerToolBar.EnableButton(kParentFolderID, !IsRootFolder());
|
||||||
|
|
||||||
|
CMyComPtr<IFolderSetFlatMode> folderSetFlatMode;
|
||||||
|
_folder.QueryInterface(IID_IFolderSetFlatMode, &folderSetFlatMode);
|
||||||
|
if (folderSetFlatMode)
|
||||||
|
folderSetFlatMode->SetFlatMode(BoolToInt(_flatMode));
|
||||||
|
|
||||||
if (_folder->LoadItems() != S_OK)
|
if (_folder->LoadItems() != S_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -385,10 +384,11 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
|
|||||||
for(UInt32 i = 0; i < numItems; i++)
|
for(UInt32 i = 0; i < numItems; i++)
|
||||||
{
|
{
|
||||||
UString itemName = GetItemName(i);
|
UString itemName = GetItemName(i);
|
||||||
if (itemName.CompareNoCase(focusedName) == 0)
|
const UString relPath = GetItemRelPath(i);
|
||||||
|
if (relPath.CompareNoCase(focusedName) == 0)
|
||||||
cursorIndex = _listView.GetItemCount();
|
cursorIndex = _listView.GetItemCount();
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
if (selectedNames.FindInSorted(itemName) >= 0)
|
if (selectedNames.FindInSorted(relPath) >= 0)
|
||||||
selected = true;
|
selected = true;
|
||||||
_selectedStatusVector.Add(selected);
|
_selectedStatusVector.Add(selected);
|
||||||
|
|
||||||
@@ -623,6 +623,24 @@ UString CPanel::GetItemName(int itemIndex) const
|
|||||||
return (propVariant.bstrVal);
|
return (propVariant.bstrVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UString CPanel::GetItemPrefix(int itemIndex) const
|
||||||
|
{
|
||||||
|
if (itemIndex == kParentIndex)
|
||||||
|
return UString();
|
||||||
|
NCOM::CPropVariant propVariant;
|
||||||
|
if (_folder->GetProperty(itemIndex, kpidPrefix, &propVariant) != S_OK)
|
||||||
|
throw 2723400;
|
||||||
|
UString prefix;
|
||||||
|
if (propVariant.vt == VT_BSTR)
|
||||||
|
prefix = propVariant.bstrVal;
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
UString CPanel::GetItemRelPath(int itemIndex) const
|
||||||
|
{
|
||||||
|
return GetItemPrefix(itemIndex) + GetItemName(itemIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CPanel::IsItemFolder(int itemIndex) const
|
bool CPanel::IsItemFolder(int itemIndex) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ static UString ConvertSizeToString(UINT64 value)
|
|||||||
|
|
||||||
LRESULT CPanel::SetItemText(LVITEMW &item)
|
LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||||
{
|
{
|
||||||
|
if (_dontShowMode)
|
||||||
|
return 0;
|
||||||
|
|
||||||
UINT32 realIndex = GetRealIndex(item);
|
UINT32 realIndex = GetRealIndex(item);
|
||||||
/*
|
/*
|
||||||
if ((item.mask & LVIF_IMAGE) != 0)
|
if ((item.mask & LVIF_IMAGE) != 0)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ HRESULT CPanel::CreateShellContextMenu(
|
|||||||
for (int i = 0; i < operatedIndices.Size(); i++)
|
for (int i = 0; i < operatedIndices.Size(); i++)
|
||||||
{
|
{
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
UString fileName = GetItemName(operatedIndices[i]);
|
UString fileName = GetItemRelPath(operatedIndices[i]);
|
||||||
if (IsFSDrivesFolder())
|
if (IsFSDrivesFolder())
|
||||||
fileName += L'\\';
|
fileName += L'\\';
|
||||||
RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
|
RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
|
||||||
@@ -263,7 +263,7 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
|
|||||||
UStringVector names;
|
UStringVector names;
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < operatedIndices.Size(); i++)
|
for(i = 0; i < operatedIndices.Size(); i++)
|
||||||
names.Add(currentFolderUnicode + GetItemName(operatedIndices[i]));
|
names.Add(currentFolderUnicode + GetItemRelPath(operatedIndices[i]));
|
||||||
CRecordVector<const wchar_t *> namePointers;
|
CRecordVector<const wchar_t *> namePointers;
|
||||||
for(i = 0; i < operatedIndices.Size(); i++)
|
for(i = 0; i < operatedIndices.Size(); i++)
|
||||||
namePointers.Add(names[i]);
|
namePointers.Add(names[i]);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
|
|||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
{
|
{
|
||||||
const AString path = GetSystemString(GetFsPath() + GetItemName(indices[i]));
|
const AString path = GetSystemString(GetFsPath() + GetItemRelPath(indices[i]));
|
||||||
buffer.EnsureCapacity(size + path.Length() + 1);
|
buffer.EnsureCapacity(size + path.Length() + 1);
|
||||||
memmove(((CHAR *)buffer) + size, (const CHAR *)path, (path.Length() + 1) * sizeof(CHAR));
|
memmove(((CHAR *)buffer) + size, (const CHAR *)path, (path.Length() + 1) * sizeof(CHAR));
|
||||||
size += path.Length() + 1;
|
size += path.Length() + 1;
|
||||||
@@ -104,7 +104,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
|
|||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for (int i = 0; i < indices.Size(); i++)
|
for (int i = 0; i < indices.Size(); i++)
|
||||||
{
|
{
|
||||||
const UString path = GetFsPath() + GetItemName(indices[i]);
|
const UString path = GetFsPath() + GetItemRelPath(indices[i]);
|
||||||
buffer.EnsureCapacity(size + path.Length() + 1);
|
buffer.EnsureCapacity(size + path.Length() + 1);
|
||||||
memmove(((WCHAR *)buffer) + size, (const WCHAR *)path, (path.Length() + 1) * sizeof(WCHAR));
|
memmove(((WCHAR *)buffer) + size, (const WCHAR *)path, (path.Length() + 1) * sizeof(WCHAR));
|
||||||
size += path.Length() + 1;
|
size += path.Length() + 1;
|
||||||
@@ -159,7 +159,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
|
|||||||
if (indices.Size() == 1)
|
if (indices.Size() == 1)
|
||||||
{
|
{
|
||||||
int index = indices[0];
|
int index = indices[0];
|
||||||
const UString itemName = GetItemName(index);
|
const UString itemName = GetItemRelPath(index);
|
||||||
if (IsItemFolder(index))
|
if (IsItemFolder(index))
|
||||||
{
|
{
|
||||||
title = LangString(IDS_CONFIRM_FOLDER_DELETE, 0x03020211);
|
title = LangString(IDS_CONFIRM_FOLDER_DELETE, 0x03020211);
|
||||||
@@ -228,12 +228,15 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
|
|||||||
MessageBoxMyError(L"Renaming is not supported");
|
MessageBoxMyError(L"Renaming is not supported");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
UString newName = lpnmh->item.pszText;
|
const UString newName = lpnmh->item.pszText;
|
||||||
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
|
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
|
||||||
|
|
||||||
|
SaveSelectedState(_selectedState);
|
||||||
|
|
||||||
int realIndex = GetRealIndex(lpnmh->item);
|
int realIndex = GetRealIndex(lpnmh->item);
|
||||||
if (realIndex == kParentIndex)
|
if (realIndex == kParentIndex)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
const UString prefix = GetItemPrefix(realIndex);
|
||||||
HRESULT result = folderOperations->Rename(realIndex, newName, 0);
|
HRESULT result = folderOperations->Rename(realIndex, newName, 0);
|
||||||
if (result != S_OK)
|
if (result != S_OK)
|
||||||
{
|
{
|
||||||
@@ -242,11 +245,16 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
|
|||||||
}
|
}
|
||||||
// Can't use RefreshListCtrl here.
|
// Can't use RefreshListCtrl here.
|
||||||
// RefreshListCtrlSaveFocused();
|
// RefreshListCtrlSaveFocused();
|
||||||
_focusedName = newName;
|
_selectedState.FocusedName = prefix + newName;
|
||||||
|
_selectedState.SelectFocused = true;
|
||||||
|
|
||||||
// We need clear all items to disable GetText before Reload:
|
// We need clear all items to disable GetText before Reload:
|
||||||
// number of items can change.
|
// number of items can change.
|
||||||
_listView.DeleteAllItems();
|
// _listView.DeleteAllItems();
|
||||||
|
// But seems it can still call GetText (maybe for current item)
|
||||||
|
// so we can't delete items.
|
||||||
|
|
||||||
|
_dontShowMode = true;
|
||||||
|
|
||||||
PostMessage(kReLoadMessage);
|
PostMessage(kReLoadMessage);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -355,7 +363,7 @@ void CPanel::ChangeComment()
|
|||||||
else if (propVariant.vt != VT_EMPTY)
|
else if (propVariant.vt != VT_EMPTY)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UString name = GetItemName(realIndex);
|
UString name = GetItemRelPath(realIndex);
|
||||||
CComboDialog comboDialog;
|
CComboDialog comboDialog;
|
||||||
comboDialog.Title = name + L" " + LangString(IDS_COMMENT, 0x03020290);
|
comboDialog.Title = name + L" " + LangString(IDS_COMMENT, 0x03020290);
|
||||||
comboDialog.Value = comment;
|
comboDialog.Value = comment;
|
||||||
|
|||||||
@@ -29,9 +29,17 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
|
|||||||
// if (panel->_sortIndex == 0)
|
// if (panel->_sortIndex == 0)
|
||||||
case kpidName:
|
case kpidName:
|
||||||
{
|
{
|
||||||
UString &name1 = panel->GetItemName(lParam1);
|
const UString &name1 = panel->GetItemName(lParam1);
|
||||||
UString &name2 = panel->GetItemName(lParam2);
|
const UString &name2 = panel->GetItemName(lParam2);
|
||||||
return name1.CompareNoCase(name2);
|
int res = name1.CompareNoCase(name2);
|
||||||
|
/*
|
||||||
|
if (res != 0 || !panel->_flatMode)
|
||||||
|
return res;
|
||||||
|
const UString &prefix1 = panel->GetItemPrefix(lParam1);
|
||||||
|
const UString &prefix2 = panel->GetItemPrefix(lParam2);
|
||||||
|
return res = prefix1.CompareNoCase(prefix2);
|
||||||
|
*/
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
case kpidNoProperty:
|
case kpidNoProperty:
|
||||||
{
|
{
|
||||||
@@ -39,8 +47,8 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
|
|||||||
}
|
}
|
||||||
case kpidExtension:
|
case kpidExtension:
|
||||||
{
|
{
|
||||||
UString &ext1 = GetExtension(panel->GetItemName(lParam1));
|
const UString &ext1 = GetExtension(panel->GetItemName(lParam1));
|
||||||
UString &ext2 = GetExtension(panel->GetItemName(lParam2));
|
const UString &ext2 = GetExtension(panel->GetItemName(lParam2));
|
||||||
return ext1.CompareNoCase(ext2);
|
return ext1.CompareNoCase(ext2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ void CApp::Split()
|
|||||||
}
|
}
|
||||||
const UString itemName = srcPanel.GetItemName(index);
|
const UString itemName = srcPanel.GetItemName(index);
|
||||||
|
|
||||||
UString srcPath = srcPanel._currentFolderPrefix;
|
UString srcPath = srcPanel._currentFolderPrefix + srcPanel.GetItemPrefix(index);
|
||||||
UString path = srcPath;
|
UString path = srcPath;
|
||||||
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
|
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
|
||||||
CPanel &destPanel = Panels[destPanelIndex];
|
CPanel &destPanel = Panels[destPanelIndex];
|
||||||
@@ -212,7 +212,7 @@ void CApp::Split()
|
|||||||
if (destPanel.IsFSFolder())
|
if (destPanel.IsFSFolder())
|
||||||
path = destPanel._currentFolderPrefix;
|
path = destPanel._currentFolderPrefix;
|
||||||
CSplitDialog splitDialog;
|
CSplitDialog splitDialog;
|
||||||
splitDialog.FilePath = itemName;
|
splitDialog.FilePath = srcPanel.GetItemRelPath(index);
|
||||||
splitDialog.Path = path;
|
splitDialog.Path = path;
|
||||||
if (splitDialog.Create(srcPanel.GetParent()) == IDCANCEL)
|
if (splitDialog.Create(srcPanel.GetParent()) == IDCANCEL)
|
||||||
return;
|
return;
|
||||||
@@ -412,7 +412,7 @@ void CApp::Combine()
|
|||||||
}
|
}
|
||||||
const UString itemName = srcPanel.GetItemName(index);
|
const UString itemName = srcPanel.GetItemName(index);
|
||||||
|
|
||||||
UString srcPath = srcPanel._currentFolderPrefix;
|
UString srcPath = srcPanel._currentFolderPrefix + srcPanel.GetItemPrefix(index);
|
||||||
UString path = srcPath;
|
UString path = srcPath;
|
||||||
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
|
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
|
||||||
CPanel &destPanel = Panels[destPanelIndex];
|
CPanel &destPanel = Panels[destPanelIndex];
|
||||||
@@ -423,7 +423,7 @@ void CApp::Combine()
|
|||||||
copyDialog.Value = path;
|
copyDialog.Value = path;
|
||||||
copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
|
copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
|
||||||
copyDialog.Title += ' ';
|
copyDialog.Title += ' ';
|
||||||
copyDialog.Title += itemName;
|
copyDialog.Title += srcPanel.GetItemRelPath(index);
|
||||||
|
|
||||||
copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);;
|
copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);;
|
||||||
if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
|
if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ static CPropertyIDNamePair kPropertyIDNamePairs[] =
|
|||||||
{ kpidBlock, IDS_PROPERTY_BLOCK, 0x0200021B },
|
{ kpidBlock, IDS_PROPERTY_BLOCK, 0x0200021B },
|
||||||
{ kpidComment, IDS_PROPERTY_COMMENT, 0x0200021C },
|
{ kpidComment, IDS_PROPERTY_COMMENT, 0x0200021C },
|
||||||
{ kpidPosition, IDS_PROPERTY_POSITION, 0x0200021D },
|
{ kpidPosition, IDS_PROPERTY_POSITION, 0x0200021D },
|
||||||
|
{ kpidPrefix, IDS_PROPERTY_PREFIX, 0x0200021E },
|
||||||
|
|
||||||
{ kpidTotalSize, IDS_PROPERTY_TOTAL_SIZE, 0x03031100 },
|
{ kpidTotalSize, IDS_PROPERTY_TOTAL_SIZE, 0x03031100 },
|
||||||
{ kpidFreeSpace, IDS_PROPERTY_FREE_SPACE, 0x03031101 },
|
{ kpidFreeSpace, IDS_PROPERTY_FREE_SPACE, 0x03031101 },
|
||||||
|
|||||||
@@ -25,3 +25,4 @@
|
|||||||
#define IDS_PROPERTY_BLOCK 27
|
#define IDS_PROPERTY_BLOCK 27
|
||||||
#define IDS_PROPERTY_COMMENT 28
|
#define IDS_PROPERTY_COMMENT 28
|
||||||
#define IDS_PROPERTY_POSITION 29
|
#define IDS_PROPERTY_POSITION 29
|
||||||
|
#define IDS_PROPERTY_PREFIX 30
|
||||||
|
|||||||
@@ -31,4 +31,5 @@ BEGIN
|
|||||||
IDS_PROPERTY_BLOCK "Block"
|
IDS_PROPERTY_BLOCK "Block"
|
||||||
IDS_PROPERTY_COMMENT "Comment"
|
IDS_PROPERTY_COMMENT "Comment"
|
||||||
IDS_PROPERTY_POSITION "Position"
|
IDS_PROPERTY_POSITION "Position"
|
||||||
|
IDS_PROPERTY_PREFIX "Path Prefix"
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#define IDM_OPEN_PARENT_FOLDER 431
|
#define IDM_OPEN_PARENT_FOLDER 431
|
||||||
#define IDM_FOLDERS_HISTORY 432
|
#define IDM_FOLDERS_HISTORY 432
|
||||||
#define IDM_VIEW_REFRESH 440
|
#define IDM_VIEW_REFRESH 440
|
||||||
|
#define IDM_VIEW_FLAT_VIEW 449
|
||||||
#define IDM_VIEW_TWO_PANELS 450
|
#define IDM_VIEW_TWO_PANELS 450
|
||||||
#define IDM_VIEW_TOOLBARS 451
|
#define IDM_VIEW_TOOLBARS 451
|
||||||
#define IDM_VIEW_STANDARD_TOOLBAR 460
|
#define IDM_VIEW_STANDARD_TOOLBAR 460
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ BEGIN
|
|||||||
MENUITEM "Size\tCtrl+F6", IDM_VIEW_ARANGE_BY_SIZE
|
MENUITEM "Size\tCtrl+F6", IDM_VIEW_ARANGE_BY_SIZE
|
||||||
MENUITEM "Unsorted\tCtrl+F7", IDM_VIEW_ARANGE_NO_SORT
|
MENUITEM "Unsorted\tCtrl+F7", IDM_VIEW_ARANGE_NO_SORT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Flat View", IDM_VIEW_FLAT_VIEW
|
||||||
MENUITEM "&2 Panels\tF9", IDM_VIEW_TWO_PANELS
|
MENUITEM "&2 Panels\tF9", IDM_VIEW_TWO_PANELS
|
||||||
POPUP "Toolbars"
|
POPUP "Toolbars"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ A0 IOutArchive
|
|||||||
07 IFolderGetSystemIconIndex
|
07 IFolderGetSystemIconIndex
|
||||||
08 IFolderGetItemFullSize
|
08 IFolderGetItemFullSize
|
||||||
09 IFolderClone
|
09 IFolderClone
|
||||||
0A IFolderOpen //
|
0A IFolderSetFlatMode
|
||||||
|
|
||||||
000900000000} FolderInterface.h::IFolderManager
|
000900000000} FolderInterface.h::IFolderManager
|
||||||
000900010000} FolderInterface.h::IFolderManagerGetIconPath
|
000900010000} FolderInterface.h::IFolderManagerGetIconPath
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#define MY_VER_MAJOR 4
|
#define MY_VER_MAJOR 4
|
||||||
#define MY_VER_MINOR 36
|
#define MY_VER_MINOR 37
|
||||||
#define MY_VERSION "4.36 beta"
|
#define MY_VERSION "4.37 beta"
|
||||||
#define MY_7ZIP_VERSION "7-Zip 4.36 beta"
|
#define MY_7ZIP_VERSION "7-Zip 4.37 beta"
|
||||||
#define MY_DATE "2006-03-12"
|
#define MY_DATE "2006-03-18"
|
||||||
#define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov"
|
#define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov"
|
||||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ enum
|
|||||||
kpidBlock,
|
kpidBlock,
|
||||||
kpidComment,
|
kpidComment,
|
||||||
kpidPosition,
|
kpidPosition,
|
||||||
|
kpidPrefix,
|
||||||
|
|
||||||
kpidTotalSize = 0x1100,
|
kpidTotalSize = 0x1100,
|
||||||
kpidFreeSpace,
|
kpidFreeSpace,
|
||||||
|
|||||||
@@ -25,15 +25,40 @@ STDMETHODIMP CAgentFolder::GetAgentFolder(CAgentFolder **agentFolder)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAgentFolder::LoadFolder(CProxyFolder *folder)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CProxyItem item;
|
||||||
|
item.Folder = folder;
|
||||||
|
for (i = 0; i < folder->Folders.Size(); i++)
|
||||||
|
{
|
||||||
|
item.Index = i;
|
||||||
|
_items.Add(item);
|
||||||
|
LoadFolder(&folder->Folders[i]);
|
||||||
|
}
|
||||||
|
int start = folder->Folders.Size();
|
||||||
|
for (i = 0; i < folder->Files.Size(); i++)
|
||||||
|
{
|
||||||
|
item.Index = start + i;
|
||||||
|
_items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::LoadItems()
|
STDMETHODIMP CAgentFolder::LoadItems()
|
||||||
{
|
{
|
||||||
|
_items.Clear();
|
||||||
|
if (_flatMode)
|
||||||
|
LoadFolder(_proxyFolderItem);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::GetNumberOfItems(UINT32 *numItems)
|
STDMETHODIMP CAgentFolder::GetNumberOfItems(UINT32 *numItems)
|
||||||
{
|
{
|
||||||
*numItems = _proxyFolderItem->Folders.Size() +
|
if (_flatMode)
|
||||||
_proxyFolderItem->Files.Size();
|
*numItems = _items.Size();
|
||||||
|
else
|
||||||
|
*numItems = _proxyFolderItem->Folders.Size() +_proxyFolderItem->Files.Size();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,12 +70,75 @@ STDMETHODIMP CAgentFolder::GetNumberOfSubFolders(UINT32 *aNumSubFolders)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realIndex < (UINT32)folder->Folders.Size())
|
||||||
|
return folder->Folders[realIndex].Name;
|
||||||
|
return folder->Files[realIndex - folder->Folders.Size()].Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
UString CAgentFolder::GetPrefix(UInt32 index) const
|
||||||
|
{
|
||||||
|
if (!_flatMode)
|
||||||
|
return UString();
|
||||||
|
const CProxyItem &item = _items[index];
|
||||||
|
const CProxyFolder *folder = item.Folder;
|
||||||
|
UString path;
|
||||||
|
while(folder != _proxyFolderItem)
|
||||||
|
{
|
||||||
|
path = folder->Name + UString(L"\\") + path;
|
||||||
|
folder = folder->Parent;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
UString CAgentFolder::GetFullPathPrefixPlusPrefix(UInt32 index) const
|
||||||
|
{
|
||||||
|
return _proxyFolderItem->GetFullPathPrefix() + GetPrefix(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAgentFolder::GetPrefixIfAny(UInt32 index, NCOM::CPropVariant &propVariant) const
|
||||||
|
{
|
||||||
|
if (!_flatMode)
|
||||||
|
return;
|
||||||
|
propVariant = GetPrefix(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
|
STDMETHODIMP CAgentFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
|
||||||
{
|
{
|
||||||
NCOM::CPropVariant propVariant;
|
NCOM::CPropVariant propVariant;
|
||||||
if (itemIndex < (UINT32)_proxyFolderItem->Folders.Size())
|
const CProxyFolder *folder;
|
||||||
|
UInt32 realIndex;
|
||||||
|
if (_flatMode)
|
||||||
{
|
{
|
||||||
const CProxyFolder &item = _proxyFolderItem->Folders[itemIndex];
|
const CProxyItem &item = _items[itemIndex];
|
||||||
|
folder = item.Folder;
|
||||||
|
realIndex = item.Index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folder = _proxyFolderItem;
|
||||||
|
realIndex = itemIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realIndex < (UINT32)folder->Folders.Size())
|
||||||
|
{
|
||||||
|
const CProxyFolder &item = folder->Folders[realIndex];
|
||||||
switch(propID)
|
switch(propID)
|
||||||
{
|
{
|
||||||
case kpidIsFolder:
|
case kpidIsFolder:
|
||||||
@@ -59,6 +147,9 @@ STDMETHODIMP CAgentFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARI
|
|||||||
case kpidName:
|
case kpidName:
|
||||||
propVariant = item.Name;
|
propVariant = item.Name;
|
||||||
break;
|
break;
|
||||||
|
case kpidPrefix:
|
||||||
|
GetPrefixIfAny(itemIndex, propVariant);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (item.IsLeaf)
|
if (item.IsLeaf)
|
||||||
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
|
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
|
||||||
@@ -66,8 +157,8 @@ STDMETHODIMP CAgentFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemIndex -= _proxyFolderItem->Folders.Size();
|
realIndex -= folder->Folders.Size();
|
||||||
const CProxyFile &item = _proxyFolderItem->Files[itemIndex];
|
const CProxyFile &item = folder->Files[realIndex];
|
||||||
switch(propID)
|
switch(propID)
|
||||||
{
|
{
|
||||||
case kpidIsFolder:
|
case kpidIsFolder:
|
||||||
@@ -76,26 +167,53 @@ STDMETHODIMP CAgentFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARI
|
|||||||
case kpidName:
|
case kpidName:
|
||||||
propVariant = item.Name;
|
propVariant = item.Name;
|
||||||
break;
|
break;
|
||||||
|
case kpidPrefix:
|
||||||
|
GetPrefixIfAny(itemIndex, propVariant);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return _agentSpec->GetArchive()->GetProperty(item.Index,
|
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
|
||||||
propID, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
propVariant.Detach(value);
|
propVariant.Detach(value);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CAgentFolder::BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder)
|
||||||
|
{
|
||||||
|
CMyComPtr<IFolderFolder> parentFolder;
|
||||||
|
if (folder->Parent != _proxyFolderItem)
|
||||||
|
{
|
||||||
|
RINOK(BindToFolder(folder->Parent, &parentFolder));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parentFolder = this;
|
||||||
|
CAgentFolder *folderSpec = new CAgentFolder;
|
||||||
|
CMyComPtr<IFolderFolder> agentFolder = folderSpec;
|
||||||
|
folderSpec->Init(_proxyArchive, folder, parentFolder, _agentSpec);
|
||||||
|
*resultFolder = agentFolder.Detach();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
|
STDMETHODIMP CAgentFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
|
||||||
{
|
{
|
||||||
COM_TRY_BEGIN
|
COM_TRY_BEGIN
|
||||||
if (index >= (UINT32)_proxyFolderItem->Folders.Size())
|
|
||||||
|
CProxyFolder *folder;
|
||||||
|
UInt32 realIndex;
|
||||||
|
if (_flatMode)
|
||||||
|
{
|
||||||
|
const CProxyItem &item = _items[index];
|
||||||
|
folder = item.Folder;
|
||||||
|
realIndex = item.Index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folder = _proxyFolderItem;
|
||||||
|
realIndex = index;
|
||||||
|
}
|
||||||
|
if (realIndex >= (UINT32)folder->Folders.Size())
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
CAgentFolder *folderSpec = new CAgentFolder;
|
return BindToFolder(&folder->Folders[realIndex], resultFolder);
|
||||||
CMyComPtr<IFolderFolder> agentFolder = folderSpec;
|
|
||||||
folderSpec->Init(_proxyArchive, &_proxyFolderItem->Folders[index],
|
|
||||||
this, _agentSpec);
|
|
||||||
*resultFolder = agentFolder.Detach();
|
|
||||||
return S_OK;
|
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +256,10 @@ struct CArchiveItemPropertyTemp
|
|||||||
STDMETHODIMP CAgentFolder::GetNumberOfProperties(UINT32 *numProperties)
|
STDMETHODIMP CAgentFolder::GetNumberOfProperties(UINT32 *numProperties)
|
||||||
{
|
{
|
||||||
COM_TRY_BEGIN
|
COM_TRY_BEGIN
|
||||||
return _agentSpec->GetArchive()->GetNumberOfProperties(numProperties);
|
RINOK(_agentSpec->GetArchive()->GetNumberOfProperties(numProperties));
|
||||||
|
if (_flatMode)
|
||||||
|
(*numProperties)++;
|
||||||
|
return S_OK;
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,9 +267,20 @@ STDMETHODIMP CAgentFolder::GetPropertyInfo(UINT32 index,
|
|||||||
BSTR *name, PROPID *propID, VARTYPE *varType)
|
BSTR *name, PROPID *propID, VARTYPE *varType)
|
||||||
{
|
{
|
||||||
COM_TRY_BEGIN
|
COM_TRY_BEGIN
|
||||||
RINOK(_agentSpec->GetArchive()->GetPropertyInfo(index, name, propID, varType));
|
UINT32 numProperties;
|
||||||
if (*propID == kpidPath)
|
_agentSpec->GetArchive()->GetNumberOfProperties(&numProperties);
|
||||||
*propID = kpidName;
|
if (index < numProperties)
|
||||||
|
{
|
||||||
|
RINOK(_agentSpec->GetArchive()->GetPropertyInfo(index, name, propID, varType));
|
||||||
|
if (*propID == kpidPath)
|
||||||
|
*propID = kpidName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*name = NULL;
|
||||||
|
*propID = kpidPrefix;
|
||||||
|
*varType = VT_BSTR;
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
}
|
}
|
||||||
@@ -195,6 +327,25 @@ STDMETHODIMP CAgentFolder::GetPath(BSTR *path)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void CAgentFolder::GetRealIndices(const UINT32 *indices, UINT32 numItems, CUIntVector &realIndices) const
|
||||||
|
{
|
||||||
|
if (!_flatMode)
|
||||||
|
{
|
||||||
|
_proxyFolderItem->GetRealIndices(indices, numItems, realIndices);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
realIndices.Clear();
|
||||||
|
for(UINT32 i = 0; i < numItems; i++)
|
||||||
|
{
|
||||||
|
const CProxyItem &item = _items[indices[i]];
|
||||||
|
const CProxyFolder *folder = item.Folder;
|
||||||
|
UInt32 realIndex = item.Index;
|
||||||
|
if (realIndex < (UINT32)folder->Folders.Size())
|
||||||
|
continue;
|
||||||
|
realIndices.Add(folder->Files[realIndex - folder->Folders.Size()].Index);
|
||||||
|
}
|
||||||
|
realIndices.Sort();
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::Extract(const UINT32 *indices,
|
STDMETHODIMP CAgentFolder::Extract(const UINT32 *indices,
|
||||||
UINT32 numItems,
|
UINT32 numItems,
|
||||||
@@ -214,6 +365,12 @@ STDMETHODIMP CAgentFolder::Extract(const UINT32 *indices,
|
|||||||
pathParts.Insert(0, currentProxyFolder->Name);
|
pathParts.Insert(0, currentProxyFolder->Name);
|
||||||
currentProxyFolder = currentProxyFolder->Parent;
|
currentProxyFolder = currentProxyFolder->Parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (_flatMode)
|
||||||
|
pathMode = NExtract::NPathMode::kNoPathnames;
|
||||||
|
*/
|
||||||
|
|
||||||
extractCallbackSpec->Init(_agentSpec->GetArchive(),
|
extractCallbackSpec->Init(_agentSpec->GetArchive(),
|
||||||
extractCallback2,
|
extractCallback2,
|
||||||
false,
|
false,
|
||||||
@@ -227,12 +384,18 @@ STDMETHODIMP CAgentFolder::Extract(const UINT32 *indices,
|
|||||||
// ,_agentSpec->_srcDirectoryPrefix
|
// ,_agentSpec->_srcDirectoryPrefix
|
||||||
);
|
);
|
||||||
CUIntVector realIndices;
|
CUIntVector realIndices;
|
||||||
_proxyFolderItem->GetRealIndices(indices, numItems, realIndices);
|
GetRealIndices(indices, numItems, realIndices);
|
||||||
return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
|
return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
|
||||||
realIndices.Size(), testMode, extractCallback);
|
realIndices.Size(), testMode, extractCallback);
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP CAgentFolder::SetFlatMode(Int32 flatMode)
|
||||||
|
{
|
||||||
|
_flatMode = IntToBool(flatMode);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// CAgent
|
// CAgent
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ public:
|
|||||||
STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder) PURE;
|
STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder) PURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CProxyItem
|
||||||
|
{
|
||||||
|
CProxyFolder *Folder;
|
||||||
|
UInt32 Index;
|
||||||
|
};
|
||||||
|
|
||||||
class CAgent;
|
class CAgent;
|
||||||
|
|
||||||
class CAgentFolder:
|
class CAgentFolder:
|
||||||
@@ -43,6 +49,7 @@ class CAgentFolder:
|
|||||||
public IFolderGetTypeID,
|
public IFolderGetTypeID,
|
||||||
public IFolderGetPath,
|
public IFolderGetPath,
|
||||||
public IFolderOperations,
|
public IFolderOperations,
|
||||||
|
public IFolderSetFlatMode,
|
||||||
#endif
|
#endif
|
||||||
public CMyUnknownImp
|
public CMyUnknownImp
|
||||||
{
|
{
|
||||||
@@ -57,12 +64,17 @@ public:
|
|||||||
MY_QUERYINTERFACE_ENTRY(IFolderGetTypeID)
|
MY_QUERYINTERFACE_ENTRY(IFolderGetTypeID)
|
||||||
MY_QUERYINTERFACE_ENTRY(IFolderGetPath)
|
MY_QUERYINTERFACE_ENTRY(IFolderGetPath)
|
||||||
MY_QUERYINTERFACE_ENTRY(IFolderOperations)
|
MY_QUERYINTERFACE_ENTRY(IFolderOperations)
|
||||||
|
MY_QUERYINTERFACE_ENTRY(IFolderSetFlatMode)
|
||||||
#endif
|
#endif
|
||||||
MY_QUERYINTERFACE_END
|
MY_QUERYINTERFACE_END
|
||||||
MY_ADDREF_RELEASE
|
MY_ADDREF_RELEASE
|
||||||
|
|
||||||
// IFolderFolder
|
// IFolderFolder
|
||||||
|
|
||||||
|
void LoadFolder(CProxyFolder *folder);
|
||||||
|
HRESULT BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder);
|
||||||
|
void GetRealIndices(const UINT32 *indices, UINT32 numItems, CUIntVector &realIndices) const;
|
||||||
|
|
||||||
STDMETHOD(LoadItems)();
|
STDMETHOD(LoadItems)();
|
||||||
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
|
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
|
||||||
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
|
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
|
||||||
@@ -102,10 +114,10 @@ public:
|
|||||||
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress);
|
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress);
|
||||||
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
|
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
|
||||||
|
|
||||||
|
STDMETHOD(SetFlatMode)(Int32 flatMode);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
CAgentFolder(): _proxyFolderItem(NULL), _flatMode(0) {}
|
||||||
|
|
||||||
CAgentFolder(): _proxyFolderItem(NULL) {}
|
|
||||||
|
|
||||||
void Init(CProxyArchive *proxyHandler,
|
void Init(CProxyArchive *proxyHandler,
|
||||||
CProxyFolder *proxyFolderItem,
|
CProxyFolder *proxyFolderItem,
|
||||||
@@ -130,12 +142,20 @@ public:
|
|||||||
IFolderArchiveUpdateCallback *updateCallback100);
|
IFolderArchiveUpdateCallback *updateCallback100);
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
public:
|
||||||
CProxyArchive *_proxyArchive;
|
CProxyArchive *_proxyArchive;
|
||||||
CProxyFolder *_proxyFolderItem;
|
CProxyFolder *_proxyFolderItem;
|
||||||
CMyComPtr<IFolderFolder> _parentFolder;
|
CMyComPtr<IFolderFolder> _parentFolder;
|
||||||
CMyComPtr<IInFolderArchive> _agent;
|
CMyComPtr<IInFolderArchive> _agent;
|
||||||
CAgent *_agentSpec;
|
CAgent *_agentSpec;
|
||||||
|
|
||||||
|
CRecordVector<CProxyItem> _items;
|
||||||
|
bool _flatMode;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -252,7 +272,7 @@ public:
|
|||||||
UString _folderPrefix;
|
UString _folderPrefix;
|
||||||
|
|
||||||
UString _archiveNamePrefix;
|
UString _archiveNamePrefix;
|
||||||
CProxyFolder *_archiveFolderItem;
|
CAgentFolder *_agentFolder;
|
||||||
|
|
||||||
UString _archiveFilePath;
|
UString _archiveFilePath;
|
||||||
|
|
||||||
|
|||||||
@@ -36,25 +36,21 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
|
|||||||
_archiveNamePrefix.Empty();
|
_archiveNamePrefix.Empty();
|
||||||
if (folder == NULL)
|
if (folder == NULL)
|
||||||
{
|
{
|
||||||
_archiveFolderItem = NULL;
|
_agentFolder = NULL;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
// folder = m_RootFolder;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMyComPtr<IFolderFolder> archiveFolder = folder;
|
CMyComPtr<IFolderFolder> archiveFolder = folder;
|
||||||
CMyComPtr<IArchiveFolderInternal> archiveFolderInternal;
|
CMyComPtr<IArchiveFolderInternal> archiveFolderInternal;
|
||||||
RINOK(archiveFolder.QueryInterface(
|
RINOK(archiveFolder.QueryInterface(IID_IArchiveFolderInternal, &archiveFolderInternal));
|
||||||
IID_IArchiveFolderInternal, &archiveFolderInternal));
|
RINOK(archiveFolderInternal->GetAgentFolder(&_agentFolder));
|
||||||
CAgentFolder *agentFolder;
|
|
||||||
RINOK(archiveFolderInternal->GetAgentFolder(&agentFolder));
|
|
||||||
_archiveFolderItem = agentFolder->_proxyFolderItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UStringVector pathParts;
|
UStringVector pathParts;
|
||||||
pathParts.Clear();
|
pathParts.Clear();
|
||||||
CMyComPtr<IFolderFolder> folderItem = folder;
|
CMyComPtr<IFolderFolder> folderItem = folder;
|
||||||
if (_archiveFolderItem != NULL)
|
if (folderItem != NULL)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
CMyComPtr<IFolderFolder> newFolder;
|
CMyComPtr<IFolderFolder> newFolder;
|
||||||
@@ -353,7 +349,7 @@ STDMETHODIMP CAgent::DeleteItems(
|
|||||||
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
|
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
|
||||||
|
|
||||||
CUIntVector realIndices;
|
CUIntVector realIndices;
|
||||||
_archiveFolderItem->GetRealIndices(indices, numItems, realIndices);
|
_agentFolder->GetRealIndices(indices, numItems, realIndices);
|
||||||
CObjectVector<CUpdatePair2> updatePairs;
|
CObjectVector<CUpdatePair2> updatePairs;
|
||||||
int curIndex = 0;
|
int curIndex = 0;
|
||||||
UInt32 numItemsInArchive;
|
UInt32 numItemsInArchive;
|
||||||
@@ -420,7 +416,7 @@ HRESULT CAgent::CreateFolder(
|
|||||||
|
|
||||||
dirItem.Attributes = FILE_ATTRIBUTE_DIRECTORY;
|
dirItem.Attributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
dirItem.Size = 0;
|
dirItem.Size = 0;
|
||||||
dirItem.Name = _archiveFolderItem->GetFullPathPrefix() + folderName;
|
dirItem.Name = _agentFolder->_proxyFolderItem->GetFullPathPrefix() + folderName;
|
||||||
|
|
||||||
SYSTEMTIME systemTime;
|
SYSTEMTIME systemTime;
|
||||||
FILETIME fileTime;
|
FILETIME fileTime;
|
||||||
@@ -455,11 +451,10 @@ HRESULT CAgent::RenameItem(
|
|||||||
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
|
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
|
||||||
|
|
||||||
CUIntVector realIndices;
|
CUIntVector realIndices;
|
||||||
_archiveFolderItem->GetRealIndices(indices, numItems, realIndices);
|
_agentFolder->GetRealIndices(indices, numItems, realIndices);
|
||||||
|
|
||||||
UString fullPrefix = _archiveFolderItem->GetFullPathPrefix();
|
UString fullPrefix = _agentFolder->GetFullPathPrefixPlusPrefix(indices[0]);
|
||||||
UString oldItemPath = fullPrefix +
|
UString oldItemPath = fullPrefix + _agentFolder->GetName(indices[0]);
|
||||||
_archiveFolderItem->GetItemName(indices[0]);
|
|
||||||
UString newItemPath = fullPrefix + newItemName;
|
UString newItemPath = fullPrefix + newItemName;
|
||||||
|
|
||||||
CObjectVector<CUpdatePair2> updatePairs;
|
CObjectVector<CUpdatePair2> updatePairs;
|
||||||
|
|||||||
@@ -41,11 +41,15 @@ STDMETHODIMP CAgentFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
|
|||||||
IID_IFolderArchiveExtractCallback, &extractCallback2));
|
IID_IFolderArchiveExtractCallback, &extractCallback2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NExtract::NPathMode::EEnum pathMode = _flatMode ?
|
||||||
|
NExtract::NPathMode::kNoPathnames :
|
||||||
|
NExtract::NPathMode::kCurrentPathnames;
|
||||||
|
|
||||||
extractCallbackSpec->Init(_agentSpec->GetArchive(),
|
extractCallbackSpec->Init(_agentSpec->GetArchive(),
|
||||||
extractCallback2,
|
extractCallback2,
|
||||||
false,
|
false,
|
||||||
path,
|
path,
|
||||||
NExtract::NPathMode::kCurrentPathnames,
|
pathMode,
|
||||||
NExtract::NOverwriteMode::kAskBefore,
|
NExtract::NOverwriteMode::kAskBefore,
|
||||||
pathParts,
|
pathParts,
|
||||||
_agentSpec->DefaultName,
|
_agentSpec->DefaultName,
|
||||||
@@ -54,7 +58,7 @@ STDMETHODIMP CAgentFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
|
|||||||
// ,_agentSpec->_srcDirectoryPrefix
|
// ,_agentSpec->_srcDirectoryPrefix
|
||||||
);
|
);
|
||||||
CUIntVector realIndices;
|
CUIntVector realIndices;
|
||||||
_proxyFolderItem->GetRealIndices(indices, numItems, realIndices);
|
GetRealIndices(indices, numItems, realIndices);
|
||||||
return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
|
return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
|
||||||
realIndices.Size(), BoolToInt(false), extractCallback);
|
realIndices.Size(), BoolToInt(false), extractCallback);
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
|
|||||||
@@ -180,18 +180,15 @@ STDMETHODIMP CAgentFolder::CreateFolder(const wchar_t *name, IProgress *progress
|
|||||||
if (progress != 0)
|
if (progress != 0)
|
||||||
{
|
{
|
||||||
CMyComPtr<IProgress> progressWrapper = progress;
|
CMyComPtr<IProgress> progressWrapper = progress;
|
||||||
RINOK(progressWrapper.QueryInterface(
|
RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
|
||||||
IID_IFolderArchiveUpdateCallback, &updateCallback100));
|
|
||||||
}
|
}
|
||||||
return CommonUpdateOperation(false, true, false, name, NULL, NULL,
|
return CommonUpdateOperation(false, true, false, name, NULL, NULL, 0, updateCallback100);
|
||||||
0, updateCallback100);
|
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgress *progress)
|
STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgress *progress)
|
||||||
{
|
{
|
||||||
COM_TRY_BEGIN
|
COM_TRY_BEGIN
|
||||||
CUIntVector realIndices;
|
|
||||||
CUIntVector indices;
|
CUIntVector indices;
|
||||||
indices.Add(index);
|
indices.Add(index);
|
||||||
RINOK(_agentSpec->SetFolder(this));
|
RINOK(_agentSpec->SetFolder(this));
|
||||||
@@ -199,8 +196,7 @@ STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgres
|
|||||||
if (progress != 0)
|
if (progress != 0)
|
||||||
{
|
{
|
||||||
CMyComPtr<IProgress> progressWrapper = progress;
|
CMyComPtr<IProgress> progressWrapper = progress;
|
||||||
RINOK(progressWrapper.QueryInterface(
|
RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
|
||||||
IID_IFolderArchiveUpdateCallback, &updateCallback100));
|
|
||||||
}
|
}
|
||||||
return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
|
return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
|
||||||
indices.Size(), updateCallback100);
|
indices.Size(), updateCallback100);
|
||||||
|
|||||||
@@ -837,6 +837,8 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
|
|||||||
ConvertToLongNames(archiveWildcardCensor);
|
ConvertToLongNames(archiveWildcardCensor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
archiveWildcardCensor.ExtendExclude();
|
||||||
|
|
||||||
CObjectVector<CDirItem> dirItems;
|
CObjectVector<CDirItem> dirItems;
|
||||||
{
|
{
|
||||||
UStringVector errorPaths;
|
UStringVector errorPaths;
|
||||||
@@ -960,4 +962,5 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw kUserErrorMessage;
|
throw kUserErrorMessage;
|
||||||
|
options.WildcardCensor.ExtendExclude();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,6 +346,19 @@ void CCensorNode::AddItem2(bool include, const UString &path, bool recursive)
|
|||||||
AddItem(include, path2, recursive, forFile, forFolder);
|
AddItem(include, path2, recursive, forFile, forFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCensorNode::ExtendExclude(const CCensorNode &fromNodes)
|
||||||
|
{
|
||||||
|
ExcludeItems += fromNodes.ExcludeItems;
|
||||||
|
for (int i = 0; i < fromNodes.SubNodes.Size(); i++)
|
||||||
|
{
|
||||||
|
const CCensorNode &node = fromNodes.SubNodes[i];
|
||||||
|
int subNodeIndex = FindSubNode(node.Name);
|
||||||
|
if (subNodeIndex < 0)
|
||||||
|
subNodeIndex = SubNodes.Add(CCensorNode(node.Name, this));
|
||||||
|
SubNodes[subNodeIndex].ExtendExclude(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CCensor::FindPrefix(const UString &prefix) const
|
int CCensor::FindPrefix(const UString &prefix) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Pairs.Size(); i++)
|
for (int i = 0; i < Pairs.Size(); i++)
|
||||||
@@ -426,6 +439,20 @@ bool CCensor::CheckPath(const UString &path, bool isFile) const
|
|||||||
return finded;
|
return finded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCensor::ExtendExclude()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < Pairs.Size(); i++)
|
||||||
|
if (Pairs[i].Prefix.IsEmpty())
|
||||||
|
break;
|
||||||
|
if (i == Pairs.Size())
|
||||||
|
return;
|
||||||
|
int index = i;
|
||||||
|
for (i = 0; i < Pairs.Size(); i++)
|
||||||
|
if (index != i)
|
||||||
|
Pairs[i].Head.ExtendExclude(Pairs[index].Head);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreTheFileNamesDirDelimiterEqual(const UString &name1, const UString &name2)
|
bool AreTheFileNamesDirDelimiterEqual(const UString &name1, const UString &name2)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
bool CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const;
|
bool CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const;
|
||||||
// bool CheckPathToRoot(const UString &path, bool isFile, bool include) const;
|
// bool CheckPathToRoot(const UString &path, bool isFile, bool include) const;
|
||||||
|
void ExtendExclude(const CCensorNode &fromNodes);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CPair
|
struct CPair
|
||||||
@@ -69,6 +70,7 @@ public:
|
|||||||
{ return (Pairs.Size() == 1 && Pairs.Front().Prefix.IsEmpty()); }
|
{ return (Pairs.Size() == 1 && Pairs.Front().Prefix.IsEmpty()); }
|
||||||
void AddItem(bool include, const UString &path, bool recursive);
|
void AddItem(bool include, const UString &path, bool recursive);
|
||||||
bool CheckPath(const UString &path, bool isFile) const;
|
bool CheckPath(const UString &path, bool isFile) const;
|
||||||
|
void ExtendExclude();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
;Defines
|
;Defines
|
||||||
|
|
||||||
!define VERSION_MAJOR 4
|
!define VERSION_MAJOR 4
|
||||||
!define VERSION_MINOR 36
|
!define VERSION_MINOR 37
|
||||||
!define VERSION_POSTFIX_FULL " beta"
|
!define VERSION_POSTFIX_FULL " beta"
|
||||||
!ifdef WIN64
|
!ifdef WIN64
|
||||||
!ifdef IA64
|
!ifdef IA64
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
LZMA SDK 4.35
|
LZMA SDK 4.37
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
LZMA SDK Copyright (C) 1999-2006 Igor Pavlov
|
LZMA SDK Copyright (C) 1999-2006 Igor Pavlov
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
7-Zip 4.36 Sources
|
7-Zip 4.37 Sources
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
|
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
|
||||||
|
|||||||
Reference in New Issue
Block a user