mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 11:14:58 -06:00
Update to 7-Zip 17.00 Beta
This commit is contained in:
@@ -30,24 +30,24 @@ using namespace NWindows;
|
||||
#define MY_TRY_FINISH_VOID } \
|
||||
catch(...) { ErrorMessageHRESULT(E_FAIL); }
|
||||
|
||||
static const char *k7zGui = "7zG.exe";
|
||||
#define k7zGui "7zG.exe"
|
||||
|
||||
static const char *kShowDialogSwitch = " -ad";
|
||||
static const char *kEmailSwitch = " -seml.";
|
||||
static const char *kIncludeSwitch = " -i";
|
||||
static const char *kArchiveTypeSwitch = " -t";
|
||||
static const char *kArcIncludeSwitches = " -an -ai";
|
||||
static const char *kHashIncludeSwitches = " -i";
|
||||
static const char *kStopSwitchParsing = " --";
|
||||
static const char *kLargePagesDisable = " -slp-";
|
||||
#define kShowDialogSwitch " -ad"
|
||||
#define kEmailSwitch " -seml."
|
||||
#define kIncludeSwitch " -i"
|
||||
#define kArchiveTypeSwitch " -t"
|
||||
#define kArcIncludeSwitches " -an -ai"
|
||||
#define kHashIncludeSwitches " -i"
|
||||
#define kStopSwitchParsing " --"
|
||||
#define kLargePagesDisable " -slp-"
|
||||
|
||||
extern HWND g_HWND;
|
||||
|
||||
UString GetQuotedString(const UString &s)
|
||||
{
|
||||
UString s2 = L'\"';
|
||||
UString s2 ('\"');
|
||||
s2 += s;
|
||||
s2 += L'\"';
|
||||
s2 += '\"';
|
||||
return s2;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ static HRESULT Call7zGui(const UString ¶ms,
|
||||
NSynchronization::CBaseEvent *event)
|
||||
{
|
||||
UString imageName = fs2us(NWindows::NDLL::GetModuleDirPrefix());
|
||||
imageName.AddAscii(k7zGui);
|
||||
imageName += k7zGui;
|
||||
|
||||
CProcess process;
|
||||
WRes res = process.Create(imageName, params, NULL); // curDir);
|
||||
@@ -95,7 +95,7 @@ static HRESULT Call7zGui(const UString ¶ms,
|
||||
static void AddLagePagesSwitch(UString ¶ms)
|
||||
{
|
||||
if (!ReadLockMemoryEnable())
|
||||
params.AddAscii(kLargePagesDisable);
|
||||
params += kLargePagesDisable;
|
||||
}
|
||||
|
||||
class CRandNameGenerator
|
||||
@@ -105,10 +105,8 @@ public:
|
||||
CRandNameGenerator() { _random.Init(); }
|
||||
void GenerateName(UString &s, const char *prefix)
|
||||
{
|
||||
s.AddAscii(prefix);
|
||||
char temp[16];
|
||||
ConvertUInt32ToString((UInt32)(unsigned)_random.Generate(), temp);
|
||||
s.AddAscii(temp);
|
||||
s += prefix;
|
||||
s.Add_UInt32((UInt32)(unsigned)_random.Generate());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -150,14 +148,14 @@ static HRESULT CreateMap(const UStringVector &names,
|
||||
event.Close();
|
||||
}
|
||||
|
||||
params += L'#';
|
||||
params += '#';
|
||||
params += mappingName;
|
||||
params += L':';
|
||||
params += ':';
|
||||
char temp[32];
|
||||
ConvertUInt64ToString(totalSize, temp);
|
||||
params.AddAscii(temp);
|
||||
params += temp;
|
||||
|
||||
params += L':';
|
||||
params += ':';
|
||||
params += eventName;
|
||||
|
||||
LPVOID data = fileMapping.Map(FILE_MAP_WRITE, 0, totalSize);
|
||||
@@ -187,36 +185,36 @@ HRESULT CompressFiles(
|
||||
bool email, bool showDialog, bool waitFinish)
|
||||
{
|
||||
MY_TRY_BEGIN
|
||||
UString params = L'a';
|
||||
UString params ('a');
|
||||
|
||||
CFileMapping fileMapping;
|
||||
NSynchronization::CManualResetEvent event;
|
||||
params.AddAscii(kIncludeSwitch);
|
||||
params += kIncludeSwitch;
|
||||
RINOK(CreateMap(names, fileMapping, event, params));
|
||||
|
||||
if (!arcType.IsEmpty())
|
||||
{
|
||||
params.AddAscii(kArchiveTypeSwitch);
|
||||
params += kArchiveTypeSwitch;
|
||||
params += arcType;
|
||||
}
|
||||
|
||||
if (email)
|
||||
params.AddAscii(kEmailSwitch);
|
||||
params += kEmailSwitch;
|
||||
|
||||
if (showDialog)
|
||||
params.AddAscii(kShowDialogSwitch);
|
||||
params += kShowDialogSwitch;
|
||||
|
||||
AddLagePagesSwitch(params);
|
||||
|
||||
if (arcName.IsEmpty())
|
||||
params.AddAscii(" -an");
|
||||
params += " -an";
|
||||
|
||||
if (addExtension)
|
||||
params.AddAscii(" -saa");
|
||||
params += " -saa";
|
||||
else
|
||||
params.AddAscii(" -sae");
|
||||
params += " -sae";
|
||||
|
||||
params.AddAscii(kStopSwitchParsing);
|
||||
params += kStopSwitchParsing;
|
||||
params.Add_Space();
|
||||
|
||||
if (!arcName.IsEmpty())
|
||||
@@ -237,7 +235,7 @@ HRESULT CompressFiles(
|
||||
static void ExtractGroupCommand(const UStringVector &arcPaths, UString ¶ms, bool isHash)
|
||||
{
|
||||
AddLagePagesSwitch(params);
|
||||
params.AddAscii(isHash ? kHashIncludeSwitches : kArcIncludeSwitches);
|
||||
params += (isHash ? kHashIncludeSwitches : kArcIncludeSwitches);
|
||||
CFileMapping fileMapping;
|
||||
NSynchronization::CManualResetEvent event;
|
||||
HRESULT result = CreateMap(arcPaths, fileMapping, event, params);
|
||||
@@ -250,16 +248,16 @@ static void ExtractGroupCommand(const UStringVector &arcPaths, UString ¶ms,
|
||||
void ExtractArchives(const UStringVector &arcPaths, const UString &outFolder, bool showDialog, bool elimDup)
|
||||
{
|
||||
MY_TRY_BEGIN
|
||||
UString params = L'x';
|
||||
UString params ('x');
|
||||
if (!outFolder.IsEmpty())
|
||||
{
|
||||
params.AddAscii(" -o");
|
||||
params += " -o";
|
||||
params += GetQuotedString(outFolder);
|
||||
}
|
||||
if (elimDup)
|
||||
params.AddAscii(" -spe");
|
||||
params += " -spe";
|
||||
if (showDialog)
|
||||
params.AddAscii(kShowDialogSwitch);
|
||||
params += kShowDialogSwitch;
|
||||
ExtractGroupCommand(arcPaths, params, false);
|
||||
MY_TRY_FINISH_VOID
|
||||
}
|
||||
@@ -267,7 +265,7 @@ void ExtractArchives(const UStringVector &arcPaths, const UString &outFolder, bo
|
||||
void TestArchives(const UStringVector &arcPaths)
|
||||
{
|
||||
MY_TRY_BEGIN
|
||||
UString params = L't';
|
||||
UString params ('t');
|
||||
ExtractGroupCommand(arcPaths, params, false);
|
||||
MY_TRY_FINISH_VOID
|
||||
}
|
||||
@@ -275,10 +273,10 @@ void TestArchives(const UStringVector &arcPaths)
|
||||
void CalcChecksum(const UStringVector &paths, const UString &methodName)
|
||||
{
|
||||
MY_TRY_BEGIN
|
||||
UString params = L'h';
|
||||
UString params ('h');
|
||||
if (!methodName.IsEmpty())
|
||||
{
|
||||
params.AddAscii(" -scrc");
|
||||
params += " -scrc";
|
||||
params += methodName;
|
||||
}
|
||||
ExtractGroupCommand(paths, params, true);
|
||||
@@ -288,7 +286,10 @@ void CalcChecksum(const UStringVector &paths, const UString &methodName)
|
||||
void Benchmark(bool totalMode)
|
||||
{
|
||||
MY_TRY_BEGIN
|
||||
HRESULT result = Call7zGui(totalMode ? L"b -mm=*" : L"b", false, NULL);
|
||||
UString params ('b');
|
||||
if (totalMode)
|
||||
params += " -mm=*";
|
||||
HRESULT result = Call7zGui(params, false, NULL);
|
||||
if (result != S_OK)
|
||||
ErrorMessageHRESULT(result);
|
||||
MY_TRY_FINISH_VOID
|
||||
|
||||
Reference in New Issue
Block a user