mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 20:11:35 -06:00
4.30 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bcd1db2f5a
commit
e18587ba51
@@ -10,9 +10,10 @@ using namespace NRegistry;
|
||||
|
||||
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
|
||||
static const TCHAR *kCU_FMPath = TEXT("Software\\7-ZIP\\FM");
|
||||
static const TCHAR *kLM_Path = TEXT("Software\\7-ZIP\\FM");
|
||||
|
||||
static const TCHAR *kLangValueName = TEXT("Lang");
|
||||
static const TCHAR *kEditor = TEXT("Editor");
|
||||
static const WCHAR *kLangValueName = L"Lang";
|
||||
static const WCHAR *kEditor = L"Editor";
|
||||
static const TCHAR *kShowDots = TEXT("ShowDots");
|
||||
static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons");
|
||||
static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
|
||||
@@ -20,58 +21,96 @@ static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
|
||||
static const TCHAR *kFullRow = TEXT("FullRow");
|
||||
static const TCHAR *kShowGrid = TEXT("ShowGrid");
|
||||
static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection");
|
||||
static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd");
|
||||
static const TCHAR *kLargePagesEnable = TEXT("LargePages");
|
||||
// static const TCHAR *kSingleClick = TEXT("SingleClick");
|
||||
// static const TCHAR *kUnderline = TEXT("Underline");
|
||||
|
||||
void SaveRegLang(const CSysString &langFile)
|
||||
void SaveRegLang(const UString &langFile)
|
||||
{
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCUBasePath);
|
||||
cuKey.SetValue(kLangValueName, langFile);
|
||||
CKey key;
|
||||
key.Create(HKEY_CURRENT_USER, kCUBasePath);
|
||||
key.SetValue(kLangValueName, langFile);
|
||||
}
|
||||
|
||||
void ReadRegLang(CSysString &langFile)
|
||||
void ReadRegLang(UString &langFile)
|
||||
{
|
||||
langFile.Empty();
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCUBasePath);
|
||||
cuKey.QueryValue(kLangValueName, langFile);
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
|
||||
key.QueryValue(kLangValueName, langFile);
|
||||
}
|
||||
|
||||
void SaveRegEditor(const CSysString &editorPath)
|
||||
void SaveRegEditor(const UString &editorPath)
|
||||
{
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
cuKey.SetValue(kEditor, editorPath);
|
||||
CKey key;
|
||||
key.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
key.SetValue(kEditor, editorPath);
|
||||
}
|
||||
|
||||
void ReadRegEditor(CSysString &editorPath)
|
||||
void ReadRegEditor(UString &editorPath)
|
||||
{
|
||||
editorPath.Empty();
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
cuKey.QueryValue(kEditor, editorPath);
|
||||
/*
|
||||
if (editorPath.IsEmpty())
|
||||
editorPath = TEXT("notepad.exe");
|
||||
*/
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
|
||||
key.QueryValue(kEditor, editorPath);
|
||||
}
|
||||
|
||||
static void Save7ZipOption(const TCHAR *value, bool enabled)
|
||||
{
|
||||
CKey key;
|
||||
key.Create(HKEY_CURRENT_USER, kCUBasePath);
|
||||
key.SetValue(value, enabled);
|
||||
}
|
||||
|
||||
static void SaveOption(const TCHAR *value, bool enabled)
|
||||
{
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
cuKey.SetValue(value, enabled);
|
||||
CKey key;
|
||||
key.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
key.SetValue(value, enabled);
|
||||
}
|
||||
|
||||
static bool Read7ZipOption(const TCHAR *value, bool defaultValue)
|
||||
{
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
bool enabled;
|
||||
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
|
||||
return enabled;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
static bool ReadOption(const TCHAR *value, bool defaultValue)
|
||||
{
|
||||
CKey cuKey;
|
||||
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
|
||||
bool enabled;
|
||||
if (cuKey.QueryValue(value, enabled) != ERROR_SUCCESS)
|
||||
return defaultValue;
|
||||
return enabled;
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
bool enabled;
|
||||
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
|
||||
return enabled;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
static void SaveLmOption(const TCHAR *value, bool enabled)
|
||||
{
|
||||
CKey key;
|
||||
key.Create(HKEY_LOCAL_MACHINE, kLM_Path);
|
||||
key.SetValue(value, enabled);
|
||||
}
|
||||
|
||||
static bool ReadLmOption(const TCHAR *value, bool defaultValue)
|
||||
{
|
||||
CKey key;
|
||||
if (key.Open(HKEY_LOCAL_MACHINE, kLM_Path, KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
bool enabled;
|
||||
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
|
||||
return enabled;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
void SaveShowDots(bool showDots) { SaveOption(kShowDots, showDots); }
|
||||
@@ -98,4 +137,12 @@ bool ReadSingleClick(){ return ReadOption(kSingleClick, false); }
|
||||
|
||||
void SaveUnderline(bool enable) { SaveOption(kUnderline, enable); }
|
||||
bool ReadUnderline(){ return ReadOption(kUnderline, false); }
|
||||
*/
|
||||
*/
|
||||
|
||||
// void SaveLockMemoryAdd(bool enable) { SaveLmOption(kLockMemoryAdd, enable); }
|
||||
// bool ReadLockMemoryAdd() { return ReadLmOption(kLockMemoryAdd, true); }
|
||||
|
||||
void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePagesEnable, enable); }
|
||||
bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user