mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 12:24:08 -06:00
4.27 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
31e7b924e8
commit
d66cf2fcf3
@@ -154,7 +154,8 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
if (!CanUpdate())
|
||||
return E_NOTIMPL;
|
||||
NUpdateArchive::CActionSet actionSet;
|
||||
for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
|
||||
int i;
|
||||
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
|
||||
actionSet.StateActions[i] = (NUpdateArchive::NPairAction::EEnum)stateActions[i];
|
||||
|
||||
CObjectVector<CDirItem> dirItems;
|
||||
@@ -242,7 +243,7 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
}
|
||||
|
||||
CMyComPtr<ISetProperties> setProperties;
|
||||
if (outArchive->QueryInterface(&setProperties) == S_OK)
|
||||
if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
|
||||
{
|
||||
if (m_PropNames.Size() == 0)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,8 @@ void CProxyFolder::AddRealIndices(CUIntVector &realIndices) const
|
||||
{
|
||||
if (IsLeaf)
|
||||
realIndices.Add(Index);
|
||||
for(int i = 0; i < Folders.Size(); i++)
|
||||
int i;
|
||||
for(i = 0; i < Folders.Size(); i++)
|
||||
Folders[i].AddRealIndices(realIndices);
|
||||
for(i = 0; i < Files.Size(); i++)
|
||||
realIndices.Add(Files[i].Index);
|
||||
|
||||
@@ -57,9 +57,12 @@ STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
|
||||
UString typesStrings;
|
||||
for(int i = 0; i < _formats.Size(); i++)
|
||||
{
|
||||
const CArchiverInfo &ai = _formats[i];
|
||||
if (!ai.Associate)
|
||||
continue;
|
||||
if (i != 0)
|
||||
typesStrings += L' ';
|
||||
typesStrings += _formats[i].Name;
|
||||
typesStrings += ai.Name;
|
||||
}
|
||||
CMyComBSTR valueTemp = typesStrings;
|
||||
*types = valueTemp.Detach();
|
||||
@@ -72,8 +75,7 @@ STDMETHODIMP CArchiveFolderManager::GetExtension(const wchar_t *type, BSTR *exte
|
||||
int formatIndex = FindFormat(type);
|
||||
if (formatIndex < 0)
|
||||
return E_INVALIDARG;
|
||||
// CMyComBSTR valueTemp = _formats[formatIndex].GetAllExtensions();
|
||||
CMyComBSTR valueTemp = _formats[formatIndex].Extensions[0].Extension;
|
||||
CMyComBSTR valueTemp = _formats[formatIndex].Extensions[0].Ext;
|
||||
*extension = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
@@ -93,6 +95,3 @@ STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t *type, const
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "Windows/PropVariantConversions.h"
|
||||
#include "Windows/DLL.h"
|
||||
|
||||
// {23170F69-40C1-278A-1000-000110050000}
|
||||
// {23170F69-40C1-278A-1000-000110070000}
|
||||
DEFINE_GUID(CLSID_CFormat7z,
|
||||
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00);
|
||||
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
||||
|
||||
typedef UINT32 (WINAPI * CreateObjectFunc)(
|
||||
const GUID *clsID,
|
||||
|
||||
@@ -691,7 +691,7 @@ static void SetArchiveType(const UString &archiveType,
|
||||
|
||||
CArchiveCommandLineParser::CArchiveCommandLineParser(): parser(kNumSwitches) {}
|
||||
|
||||
void CArchiveCommandLineParser::Parse1(UStringVector commandStrings,
|
||||
void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
|
||||
CArchiveCommandLineOptions &options)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -77,7 +77,7 @@ class CArchiveCommandLineParser
|
||||
NCommandLineParser::CParser parser;
|
||||
public:
|
||||
CArchiveCommandLineParser();
|
||||
void Parse1(const UStringVector commandStrings, CArchiveCommandLineOptions &options);
|
||||
void Parse1(const UStringVector &commandStrings, CArchiveCommandLineOptions &options);
|
||||
void Parse2(CArchiveCommandLineOptions &options);
|
||||
};
|
||||
|
||||
|
||||
@@ -53,15 +53,6 @@ static void SplitString(const UString &srcString, UStringVector &destStrings)
|
||||
typedef UInt32 (WINAPI * GetHandlerPropertyFunc)(
|
||||
PROPID propID, PROPVARIANT *value);
|
||||
|
||||
/*
|
||||
UString GetCurrentModulePath()
|
||||
{
|
||||
TCHAR fullPath[MAX_PATH + 1];
|
||||
::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
|
||||
return fullPath;
|
||||
}
|
||||
*/
|
||||
|
||||
static UString GetModuleFolderPrefix()
|
||||
{
|
||||
UString path;
|
||||
@@ -132,7 +123,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"7z";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"7z"));
|
||||
#ifndef _SFX
|
||||
@@ -163,7 +153,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"GZip";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"gz"));
|
||||
item.Extensions.Add(CArchiverExtInfo(L"tgz", L".tar"));
|
||||
@@ -190,7 +179,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"Tar";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"tar"));
|
||||
archivers.Add(item);
|
||||
@@ -201,7 +189,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"Zip";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"zip"));
|
||||
#ifndef _SFX
|
||||
@@ -215,7 +202,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
#ifdef FORMAT_CPIO
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Cpio";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"cpio"));
|
||||
archivers.Add(item);
|
||||
@@ -225,7 +211,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
#ifdef FORMAT_RPM
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Rpm";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"rpm", L".cpio.gz"));
|
||||
archivers.Add(item);
|
||||
@@ -235,7 +220,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
#ifdef FORMAT_ARJ
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Arj";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"arj"));
|
||||
#ifndef _SFX
|
||||
@@ -249,7 +233,6 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
#ifdef FORMAT_Z
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Z";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"Z"));
|
||||
#ifndef _SFX
|
||||
@@ -309,11 +292,10 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
continue;
|
||||
|
||||
UString ext = prop.bstrVal;
|
||||
// item.Extension = prop.bstrVal;
|
||||
prop.Clear();
|
||||
|
||||
UString addExt;
|
||||
|
||||
prop.Clear();
|
||||
|
||||
if (getHandlerProperty(NArchive::kAddExtension, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt == VT_BSTR)
|
||||
@@ -332,11 +314,11 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
for (int i = 0; i < exts.Size(); i++)
|
||||
{
|
||||
CArchiverExtInfo extInfo;
|
||||
extInfo.Extension = exts[i];
|
||||
extInfo.Ext = exts[i];
|
||||
if (addExts.Size() > 0)
|
||||
extInfo.AddExtension = addExts[i];
|
||||
if (extInfo.AddExtension == L"*")
|
||||
extInfo.AddExtension.Empty();
|
||||
extInfo.AddExt = addExts[i];
|
||||
if (extInfo.AddExt == L"*")
|
||||
extInfo.AddExt.Empty();
|
||||
item.Extensions.Add(extInfo);
|
||||
}
|
||||
|
||||
@@ -364,6 +346,12 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
}
|
||||
prop.Clear();
|
||||
|
||||
if (getHandlerProperty(NArchive::kAssociate, &prop) == S_OK)
|
||||
if (prop.vt == VT_BOOL)
|
||||
item.Associate = VARIANT_BOOLToBool(prop.boolVal);
|
||||
prop.Clear();
|
||||
|
||||
|
||||
archivers.Add(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
|
||||
struct CArchiverExtInfo
|
||||
{
|
||||
UString Extension;
|
||||
UString AddExtension;
|
||||
UString Ext;
|
||||
UString AddExt;
|
||||
CArchiverExtInfo() {}
|
||||
CArchiverExtInfo(const UString &extension):
|
||||
Extension(extension) {}
|
||||
CArchiverExtInfo(const UString &extension, const UString &addExtension):
|
||||
Extension(extension), AddExtension(addExtension) {}
|
||||
CArchiverExtInfo(const UString &ext): Ext(ext) {}
|
||||
CArchiverExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
|
||||
};
|
||||
|
||||
struct CArchiverInfo
|
||||
@@ -29,11 +27,12 @@ struct CArchiverInfo
|
||||
#ifndef _SFX
|
||||
CByteBuffer StartSignature;
|
||||
CByteBuffer FinishSignature;
|
||||
bool Associate;
|
||||
#endif
|
||||
int FindExtension(const UString &ext) const
|
||||
{
|
||||
for (int i = 0; i < Extensions.Size(); i++)
|
||||
if (ext.CollateNoCase(Extensions[i].Extension) == 0)
|
||||
if (ext.CollateNoCase(Extensions[i].Ext) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
@@ -44,16 +43,22 @@ struct CArchiverInfo
|
||||
{
|
||||
if (i > 0)
|
||||
s += ' ';
|
||||
s += Extensions[i].Extension;
|
||||
s += Extensions[i].Ext;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
const UString &GetMainExtension() const
|
||||
{
|
||||
return Extensions[0].Extension;
|
||||
return Extensions[0].Ext;
|
||||
}
|
||||
bool UpdateEnabled;
|
||||
bool KeepName;
|
||||
|
||||
CArchiverInfo(): UpdateEnabled(false), KeepName(false)
|
||||
#ifndef _SFX
|
||||
,Associate(true)
|
||||
#endif
|
||||
{}
|
||||
};
|
||||
|
||||
void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers);
|
||||
|
||||
@@ -226,8 +226,11 @@ static HRESULT EnumerateDirItems(
|
||||
bool enterToSubFolders2 = enterToSubFolders;
|
||||
UStringVector addArchivePrefixNew = addArchivePrefix;
|
||||
addArchivePrefixNew.Add(name);
|
||||
if (curNode.CheckPathToRoot(false, UStringVector(addArchivePrefixNew), !fileInfo.IsDirectory()))
|
||||
continue;
|
||||
{
|
||||
UStringVector addArchivePrefixNewTemp(addArchivePrefixNew);
|
||||
if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fileInfo.IsDirectory()))
|
||||
continue;
|
||||
}
|
||||
if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fileInfo.IsDirectory()))
|
||||
{
|
||||
AddDirFileInfo(archivePrefix, diskPrefix + name, fileInfo, dirItems);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "Windows/FileFind.h"
|
||||
|
||||
#include "../../Archive/IArchive.h"
|
||||
#include "../Common/ZipRegistry.h"
|
||||
|
||||
#include "ArchiveExtractCallback.h"
|
||||
#include "ArchiveOpenCallback.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../Common/FileStreams.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
@@ -179,7 +180,7 @@ HRESULT OpenArchive(
|
||||
Byte *buffer = byteBuffer;
|
||||
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
|
||||
UInt32 processedSize;
|
||||
RINOK(inStream->Read(buffer, kBufferSize, &processedSize));
|
||||
RINOK(ReadStream(inStream, buffer, kBufferSize, &processedSize));
|
||||
int numFinded = 0;
|
||||
for (int pos = (int)processedSize; pos >= 0 ; pos--)
|
||||
{
|
||||
@@ -281,8 +282,8 @@ HRESULT OpenArchive(
|
||||
if (subExtIndex < 0)
|
||||
subExtIndex = 0;
|
||||
defaultItemName = GetDefaultName2(fileName,
|
||||
archiverInfo.Extensions[subExtIndex].Extension,
|
||||
archiverInfo.Extensions[subExtIndex].AddExtension);
|
||||
archiverInfo.Extensions[subExtIndex].Ext,
|
||||
archiverInfo.Extensions[subExtIndex].AddExt);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -4,29 +4,22 @@
|
||||
|
||||
#include "SortUtils.h"
|
||||
|
||||
static int __cdecl CompareStrings(const void *a1, const void *a2)
|
||||
static int CompareStrings(const int *p1, const int *p2, void *param)
|
||||
{
|
||||
const UString &s1 = *(*(*((const UString ***)a1)));
|
||||
const UString &s2 = *(*(*((const UString ***)a2)));
|
||||
const UStringVector &strings = *(const UStringVector *)param;
|
||||
const UString &s1 = strings[*p1];
|
||||
const UString &s2 = strings[*p2];
|
||||
return s1.CompareNoCase(s2);
|
||||
}
|
||||
|
||||
void SortStringsToIndices(const UStringVector &strings, CIntVector &indices)
|
||||
{
|
||||
indices.Clear();
|
||||
if (strings.IsEmpty())
|
||||
return;
|
||||
int numItems = strings.Size();
|
||||
CPointerVector pointers;
|
||||
pointers.Reserve(numItems);
|
||||
indices.Reserve(numItems);
|
||||
int i;
|
||||
for(i = 0; i < numItems; i++)
|
||||
pointers.Add((void *)&strings.CPointerVector::operator[](i));
|
||||
void **stringsBase = (void **)pointers[0];
|
||||
qsort(&pointers[0], numItems, sizeof(void *), CompareStrings);
|
||||
for(i = 0; i < numItems; i++)
|
||||
indices.Add((int)((void **)pointers[i] - stringsBase));
|
||||
for(int i = 0; i < numItems; i++)
|
||||
indices.Add(i);
|
||||
indices.Sort(CompareStrings, (void *)&strings);
|
||||
}
|
||||
|
||||
void SortStrings(const UStringVector &src, UStringVector &dest)
|
||||
|
||||
@@ -129,7 +129,6 @@ public:
|
||||
MY_UNKNOWN_IMP1(IOutStream)
|
||||
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
|
||||
STDMETHOD(SetSize)(Int64 newSize);
|
||||
};
|
||||
@@ -207,17 +206,13 @@ STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *pr
|
||||
_streamIndex++;
|
||||
_offsetPos = 0;
|
||||
}
|
||||
if (realProcessed != curSize)
|
||||
if (realProcessed == 0 && curSize != 0)
|
||||
return E_FAIL;
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP COutMultiVolStream::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Write(data, size, processedSize);
|
||||
}
|
||||
|
||||
STDMETHODIMP COutMultiVolStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
|
||||
{
|
||||
if(seekOrigin >= 3)
|
||||
|
||||
@@ -618,6 +618,14 @@ SOURCE=..\..\Common\FileStreams.cpp
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ static const char *kHelpString =
|
||||
" -si: read data from stdin\n"
|
||||
" -so: write data to stdout\n"
|
||||
" -t{Type}: Set type of archive\n"
|
||||
" -v{Size}}[b|k|m|g]: Create volumes\n"
|
||||
" -v{Size}[b|k|m|g]: Create volumes\n"
|
||||
" -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options\n"
|
||||
" -w[{path}]: assign Work directory. Empty path means a temporary directory\n"
|
||||
" -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames\n"
|
||||
@@ -232,6 +232,8 @@ int Main2(
|
||||
if (ecs->NumFileErrors != 0)
|
||||
stdStream << "Sub items Errors: " << ecs->NumFileErrors << endl;
|
||||
}
|
||||
if (result != S_OK)
|
||||
throw CSystemException(result);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
if (result != S_OK)
|
||||
|
||||
@@ -42,6 +42,7 @@ WIN_OBJS = \
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveCommandLine.obj \
|
||||
|
||||
@@ -583,6 +583,7 @@ struct CThreadCompressMain
|
||||
};
|
||||
*/
|
||||
|
||||
#ifndef _WIN64
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
@@ -591,6 +592,7 @@ static bool IsItWindowsNT()
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
#endif
|
||||
|
||||
static UString GetProgramCommand()
|
||||
{
|
||||
@@ -598,11 +600,12 @@ static UString GetProgramCommand()
|
||||
UString folder;
|
||||
if (GetProgramFolderPath(folder))
|
||||
path += folder;
|
||||
path += L"7zFM";
|
||||
#ifndef _WIN64
|
||||
if (IsItWindowsNT())
|
||||
path += L"7zFMn.exe";
|
||||
else
|
||||
path += L"7zFM.exe";
|
||||
path += L"\"";
|
||||
path += L"n";
|
||||
#endif
|
||||
path += L".exe\"";
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -744,6 +744,14 @@ SOURCE=..\..\Common\FileStreams.cpp
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ WIN_CTRL_OBJS = \
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
|
||||
@@ -548,6 +548,14 @@ SOURCE=..\..\Common\FileStreams.cpp
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
||||
@@ -63,6 +63,7 @@ enum EEnum
|
||||
kExtractOwerwritePrompt,
|
||||
kExtractOwerwriteSkip,
|
||||
kExtractOwerwriteAutoRename,
|
||||
kExtractOwerwriteAutoRenameExisting,
|
||||
|
||||
kExtractFilesMode,
|
||||
kExtractFilesSelected,
|
||||
|
||||
+19
-44
@@ -112,19 +112,22 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
|
||||
const int kPathModeRadioIndex = 4;
|
||||
const int kOverwriteModeRadioIndex = kPathModeRadioIndex + 4;
|
||||
const int kFilesModeIndex = kOverwriteModeRadioIndex + 5;
|
||||
const int kYSize = 18;
|
||||
const int kNumOverwriteOptions = 6;
|
||||
const int kFilesModeIndex = kOverwriteModeRadioIndex + kNumOverwriteOptions;
|
||||
const int kXSize = 76;
|
||||
const int kYSize = 19;
|
||||
const int kPasswordYPos = 12;
|
||||
|
||||
const int kXMid = 38;
|
||||
const int kXMid = kXSize / 2;
|
||||
|
||||
AString oemPassword = UnicodeStringToMultiByte(password, CP_OEMCP);
|
||||
|
||||
struct CInitDialogItem initItems[]={
|
||||
{ DI_DOUBLEBOX, 3, 1, 72, kYSize - 2, false, false, 0, false, NMessageID::kExtractTitle, NULL, NULL },
|
||||
{ DI_DOUBLEBOX, 3, 1, kXSize - 4, kYSize - 2, false, false, 0, false, NMessageID::kExtractTitle, NULL, NULL },
|
||||
{ DI_TEXT, 5, 2, 0, 0, false, false, 0, false, NMessageID::kExtractTo, NULL, NULL },
|
||||
|
||||
{ DI_EDIT, 5, 3, 70, 3, true, false, DIF_HISTORY, false, -1, destPath, kExractPathHistoryName},
|
||||
// { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, destPath, NULL},
|
||||
{ DI_EDIT, 5, 3, kXSize - 6, 3, true, false, DIF_HISTORY, false, -1, destPath, kExractPathHistoryName},
|
||||
// { DI_EDIT, 5, 3, kXSize - 6, 3, true, false, 0, false, -1, destPath, NULL},
|
||||
|
||||
{ DI_SINGLEBOX, 4, 5, kXMid - 2, 5 + 4, false, false, 0, false, NMessageID::kExtractPathMode, NULL, NULL },
|
||||
{ DI_RADIOBUTTON, 6, 6, 0, 0, false,
|
||||
@@ -137,7 +140,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames,
|
||||
false, 0, NMessageID::kExtractPathNo, NULL, NULL },
|
||||
|
||||
{ DI_SINGLEBOX, kXMid, 5, 70, 5 + 5, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL },
|
||||
{ DI_SINGLEBOX, kXMid, 5, kXSize - 6, 5 + kNumOverwriteOptions, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL },
|
||||
{ DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false,
|
||||
extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore,
|
||||
DIF_GROUP, false, NMessageID::kExtractOwerwriteAsk, NULL, NULL },
|
||||
@@ -150,13 +153,16 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
{ DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false,
|
||||
extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename,
|
||||
0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL },
|
||||
{ DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false,
|
||||
extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting,
|
||||
0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL },
|
||||
|
||||
{ DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL },
|
||||
{ DI_RADIOBUTTON, 6, 11, 0, 0, false, true, DIF_GROUP, false, NMessageID::kExtractFilesSelected, NULL, NULL },
|
||||
{ DI_RADIOBUTTON, 6, 12, 0, 0, false, false, 0, false, NMessageID::kExtractFilesAll, NULL, NULL },
|
||||
|
||||
{ DI_SINGLEBOX, kXMid, 11, 70, 11 + 2, false, false, 0, false, NMessageID::kExtractPassword, NULL, NULL },
|
||||
{ DI_PSWEDIT, kXMid + 2, 12, 70 - 2, 12, false, false, 0, false, -1, oemPassword, NULL},
|
||||
{ DI_SINGLEBOX, kXMid, kPasswordYPos, kXSize - 6, kPasswordYPos + 2, false, false, 0, false, NMessageID::kExtractPassword, NULL, NULL },
|
||||
{ DI_PSWEDIT, kXMid + 2, kPasswordYPos + 1, kXSize - 8, 12, false, false, 0, false, -1, oemPassword, NULL},
|
||||
|
||||
{ DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
|
||||
|
||||
@@ -173,7 +179,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
|
||||
while(true)
|
||||
{
|
||||
int askCode = g_StartupInfo.ShowDialog(76, kYSize,
|
||||
int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
|
||||
kHelpTopicExtrFromSevenZip, dialogItems, kNumDialogItems);
|
||||
if (askCode != kOkButtonIndex)
|
||||
return NFileOperationReturnCode::kInterruptedByUser;
|
||||
@@ -211,6 +217,8 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkipExisting;
|
||||
else if (dialogItems[kOverwriteModeRadioIndex + 3].Selected)
|
||||
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRename;
|
||||
else if (dialogItems[kOverwriteModeRadioIndex + 4].Selected)
|
||||
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRenameExisting;
|
||||
else
|
||||
throw 31806;
|
||||
|
||||
@@ -247,41 +255,8 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
for (int i = 0; i < itemsNumber; i++)
|
||||
indices.Add(panelItems[i].UserData);
|
||||
|
||||
NExtract::NPathMode::EEnum pathMode;
|
||||
NExtract::NOverwriteMode::EEnum overwriteMode;
|
||||
switch (extractionInfo.OverwriteMode)
|
||||
{
|
||||
case NExtract::NOverwriteMode::kAskBefore:
|
||||
overwriteMode = NExtract::NOverwriteMode::kAskBefore;
|
||||
break;
|
||||
case NExtract::NOverwriteMode::kWithoutPrompt:
|
||||
overwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
|
||||
break;
|
||||
case NExtract::NOverwriteMode::kSkipExisting:
|
||||
overwriteMode = NExtract::NOverwriteMode::kSkipExisting;
|
||||
break;
|
||||
case NExtract::NOverwriteMode::kAutoRename:
|
||||
overwriteMode = NExtract::NOverwriteMode::kAutoRename;
|
||||
break;
|
||||
default:
|
||||
throw 12334454;
|
||||
}
|
||||
switch (extractionInfo.PathMode)
|
||||
{
|
||||
case NExtract::NPathMode::kFullPathnames:
|
||||
pathMode = NExtract::NPathMode::kFullPathnames;
|
||||
break;
|
||||
case NExtract::NPathMode::kCurrentPathnames:
|
||||
pathMode = NExtract::NPathMode::kCurrentPathnames;
|
||||
break;
|
||||
case NExtract::NPathMode::kNoPathnames:
|
||||
pathMode = NExtract::NPathMode::kNoPathnames;
|
||||
break;
|
||||
default:
|
||||
throw 12334455;
|
||||
}
|
||||
HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber,
|
||||
!showBox, pathMode, overwriteMode,
|
||||
!showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode,
|
||||
MultiByteToUnicodeString(destPath, CP_OEMCP),
|
||||
passwordIsDefined, password);
|
||||
// HRESULT result = ExtractFiles(decompressAllItems, realIndices, !showBox,
|
||||
|
||||
@@ -40,7 +40,7 @@ static UINT32 g_MethodMap[] = { 0, 1, 3, 5, 7, 9 };
|
||||
static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method)
|
||||
{
|
||||
CMyComPtr<ISetProperties> setProperties;
|
||||
if (outArchive->QueryInterface(&setProperties) == S_OK)
|
||||
if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
|
||||
{
|
||||
UStringVector realNames;
|
||||
realNames.Add(UString(L"x"));
|
||||
|
||||
@@ -42,6 +42,7 @@ WIN_OBJS = \
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
|
||||
@@ -509,20 +509,8 @@ void CCompressDialog::OnOK()
|
||||
_passwordControl.GetText(Info.Password);
|
||||
|
||||
SaveOptionsInMem();
|
||||
int currentItem = m_ArchivePath.GetCurSel();
|
||||
UString s;
|
||||
if(currentItem == CB_ERR)
|
||||
{
|
||||
m_ArchivePath.GetText(s);
|
||||
if(m_ArchivePath.GetCount() >= kHistorySize)
|
||||
currentItem = m_ArchivePath.GetCount() - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CSysString sTemp;
|
||||
m_ArchivePath.GetLBText(currentItem, sTemp);
|
||||
s = GetUnicodeString(sTemp);
|
||||
}
|
||||
m_ArchivePath.GetText(s);
|
||||
s.Trim();
|
||||
m_RegistryInfo.HistoryArchives.Clear();
|
||||
AddUniqueString(m_RegistryInfo.HistoryArchives, GetSystemString(s));
|
||||
@@ -555,13 +543,14 @@ void CCompressDialog::OnOK()
|
||||
}
|
||||
|
||||
for(int i = 0; i < m_ArchivePath.GetCount(); i++)
|
||||
if(i != currentItem)
|
||||
{
|
||||
CSysString sTemp;
|
||||
m_ArchivePath.GetLBText(i, sTemp);
|
||||
sTemp.Trim();
|
||||
AddUniqueString(m_RegistryInfo.HistoryArchives, sTemp);
|
||||
}
|
||||
{
|
||||
CSysString sTemp;
|
||||
m_ArchivePath.GetLBText(i, sTemp);
|
||||
sTemp.Trim();
|
||||
AddUniqueString(m_RegistryInfo.HistoryArchives, sTemp);
|
||||
}
|
||||
if (m_RegistryInfo.HistoryArchives.Size() > kHistorySize)
|
||||
m_RegistryInfo.HistoryArchives.DeleteBack();
|
||||
|
||||
////////////////////
|
||||
// Method
|
||||
|
||||
@@ -847,6 +847,14 @@ SOURCE=..\..\Common\FileStreams.cpp
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ WIN_CTRL_OBJS = \
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveCommandLine.obj \
|
||||
|
||||
Reference in New Issue
Block a user