mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 11:14:58 -06:00
new feature: use CompressDialog settings for "Add to xyz.7z"
- the standard 7-Zip will always use LZMA2 Level 5 - my version used always: ZStandard Level 3 - but now, it uses: the registry settings from the last CompressDialog
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "../FileManager/RegistryUtils.h"
|
#include "../FileManager/RegistryUtils.h"
|
||||||
|
|
||||||
|
#include "ZipRegistry.h"
|
||||||
#include "CompressCall.h"
|
#include "CompressCall.h"
|
||||||
|
|
||||||
using namespace NWindows;
|
using namespace NWindows;
|
||||||
@@ -41,6 +42,7 @@ using namespace NWindows;
|
|||||||
#define kStopSwitchParsing " --"
|
#define kStopSwitchParsing " --"
|
||||||
#define kLargePagesDisable " -slp-"
|
#define kLargePagesDisable " -slp-"
|
||||||
|
|
||||||
|
static NCompression::CInfo m_RegistryInfo;
|
||||||
extern HWND g_HWND;
|
extern HWND g_HWND;
|
||||||
|
|
||||||
UString GetQuotedString(const UString &s)
|
UString GetQuotedString(const UString &s)
|
||||||
@@ -176,6 +178,29 @@ static HRESULT CreateMap(const UStringVector &names,
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FindRegistryFormat(const UString &name)
|
||||||
|
{
|
||||||
|
FOR_VECTOR (i, m_RegistryInfo.Formats)
|
||||||
|
{
|
||||||
|
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[i];
|
||||||
|
if (name.IsEqualTo_NoCase(GetUnicodeString(fo.FormatID)))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FindRegistryFormatAlways(const UString &name)
|
||||||
|
{
|
||||||
|
int index = FindRegistryFormat(name);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
NCompression::CFormatOptions fo;
|
||||||
|
fo.FormatID = GetSystemString(name);
|
||||||
|
index = m_RegistryInfo.Formats.Add(fo);
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CompressFiles(
|
HRESULT CompressFiles(
|
||||||
const UString &arcPathPrefix,
|
const UString &arcPathPrefix,
|
||||||
const UString &arcName,
|
const UString &arcName,
|
||||||
@@ -194,9 +219,30 @@ HRESULT CompressFiles(
|
|||||||
|
|
||||||
if (!arcType.IsEmpty())
|
if (!arcType.IsEmpty())
|
||||||
{
|
{
|
||||||
|
int index;
|
||||||
params += kArchiveTypeSwitch;
|
params += kArchiveTypeSwitch;
|
||||||
params += arcType;
|
params += arcType;
|
||||||
|
m_RegistryInfo.Load();
|
||||||
|
index = FindRegistryFormatAlways(arcType);
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
char temp[32];
|
||||||
|
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
|
||||||
|
params += " -m0=";
|
||||||
|
params += fo.Method;
|
||||||
|
params += " -mx";
|
||||||
|
ConvertUInt64ToString(fo.Level, temp);
|
||||||
|
params += temp;
|
||||||
|
if (fo.NumThreads)
|
||||||
|
{
|
||||||
|
params += " -mmt";
|
||||||
|
ConvertUInt64ToString(fo.NumThreads, temp);
|
||||||
|
params += temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// for testing current params, /TR 2017-05-18
|
||||||
|
// ErrorMessage(params);
|
||||||
|
|
||||||
if (email)
|
if (email)
|
||||||
params += kEmailSwitch;
|
params += kEmailSwitch;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
using namespace NWindows;
|
using namespace NWindows;
|
||||||
using namespace NRegistry;
|
using namespace NRegistry;
|
||||||
|
|
||||||
#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
|
#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip-ZStandard") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
|
||||||
|
|
||||||
static LPCTSTR const kCUBasePath = REG_PATH_FM;
|
static LPCTSTR const kCUBasePath = REG_PATH_FM;
|
||||||
static LPCTSTR const kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
|
static LPCTSTR const kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
|
||||||
|
|||||||
Reference in New Issue
Block a user