diff options
author | elfmz <fenix1905@tut.by> | 2021-02-28 00:10:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 00:10:47 +0300 |
commit | 49698f752b4348df9b1e90e85bc355e3eeddc05e (patch) | |
tree | 40b1e9208f5891fe11a1a30b8000f413e9f64ba6 /filecase | |
parent | 7f6f3b70e8b742d6350947fd91168c0e1ceb812c (diff) |
far2l v2.3 - eliminate pseudo registry: totally migrate to ini files (#932)
* All far2l and plugings settings and history stuff that previously was located in pseudoregistry now moved to set of ini files in following directories :
* * far2l settings - into .config/far2l/settings/...
* * far2l history - into .config/far2l/history/...
* * plugins settings - .config/far2l/plugins/.../...
* Old far2l's registry-based settings are automatically imported form registry and registry will not be in use anymore
* Old plugins registry-based settings will be lost (reset to default). Anyway noting serious was there.
* Some old ini files will be moved to new locations, including NetRocks config directory: .config/far2l/NetRocks -> .config/far2l/plugins/NetRocks
Diffstat (limited to 'filecase')
-rw-r--r-- | filecase/src/FileCase.cpp | 26 | ||||
-rw-r--r-- | filecase/src/FileCase.hpp | 1 | ||||
-rw-r--r-- | filecase/src/filecvt.icpp | 13 |
3 files changed, 22 insertions, 18 deletions
diff --git a/filecase/src/FileCase.cpp b/filecase/src/FileCase.cpp index b56fb4ac..fc3f1be2 100644 --- a/filecase/src/FileCase.cpp +++ b/filecase/src/FileCase.cpp @@ -5,11 +5,17 @@ #include "FileLng.hpp"
#include "FileCase.hpp"
+#include <utils.h>
+#include <KeyFileHelper.h>
+
+#define INI_LOCATION InMyConfig("plugins/filecase/config.ini")
+#define INI_SECTION "Settings"
+
#include "FileMix.icpp"
-#include "../../etc/WrapReg.icpp"
#include "filecvt.icpp"
#include "ProcessName.icpp"
+
SHAREDSYMBOL int WINAPI EXP_NAME(GetMinFarVersion)()
{
return FARMANAGERVERSION;
@@ -18,19 +24,17 @@ SHAREDSYMBOL int WINAPI EXP_NAME(GetMinFarVersion)() SHAREDSYMBOL void WINAPI EXP_NAME(SetStartupInfo)(const struct PluginStartupInfo *Info)
{
- ::Info=*Info;
+ ::Info=*Info;
::FSF=*Info->FSF;
::Info.FSF=&::FSF;
- lstrcpy(PluginRootKey,Info->RootKey);
- lstrcat(PluginRootKey,_T("/CaseConvertion"));
-
- Opt.ConvertMode=GetRegKey(HKEY_CURRENT_USER,_T(""),_T("ConvertMode"),0);
- Opt.ConvertModeExt=GetRegKey(HKEY_CURRENT_USER,_T(""),_T("ConvertModeExt"),0);
- Opt.SkipMixedCase=GetRegKey(HKEY_CURRENT_USER,_T(""),_T("SkipMixedCase"),1);
- Opt.ProcessSubDir=GetRegKey(HKEY_CURRENT_USER,_T(""),_T("ProcessSubDir"),0);
- Opt.ProcessDir=GetRegKey(HKEY_CURRENT_USER,_T(""),_T("ProcessDir"),0);
- GetRegKey(HKEY_CURRENT_USER,_T(""),_T("WordDiv"),Opt.WordDiv,_T(" _"),ARRAYSIZE(Opt.WordDiv));
+ KeyFileReadSection kfh(INI_LOCATION, INI_SECTION);
+ Opt.ConvertMode=kfh.GetInt(("ConvertMode"),0);
+ Opt.ConvertModeExt=kfh.GetInt(("ConvertModeExt"),0);
+ Opt.SkipMixedCase=kfh.GetInt(("SkipMixedCase"),1);
+ Opt.ProcessSubDir=kfh.GetInt(("ProcessSubDir"),0);
+ Opt.ProcessDir=kfh.GetInt(("ProcessDir"),0);
+ kfh.GetChars(Opt.WordDiv, ARRAYSIZE(Opt.WordDiv), ("WordDiv"), L" _");
Opt.WordDivLen=lstrlen(Opt.WordDiv);
}
diff --git a/filecase/src/FileCase.hpp b/filecase/src/FileCase.hpp index 45c8f042..5e73ae25 100644 --- a/filecase/src/FileCase.hpp +++ b/filecase/src/FileCase.hpp @@ -38,4 +38,3 @@ void ProcessName(const TCHAR *OldFullName, DWORD FileAttributes); static struct PluginStartupInfo Info;
static struct FarStandardFunctions FSF;
-TCHAR PluginRootKey[80];
diff --git a/filecase/src/filecvt.icpp b/filecase/src/filecvt.icpp index e894d8ae..338de0b7 100644 --- a/filecase/src/filecvt.icpp +++ b/filecase/src/filecvt.icpp @@ -154,12 +154,13 @@ void CaseConvertion() if (!GetCheck(18))
{
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("WordDiv"),Opt.WordDiv);
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("ConvertMode"),Opt.ConvertMode);
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("ConvertModeExt"),Opt.ConvertModeExt);
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("SkipMixedCase"),Opt.SkipMixedCase);
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("ProcessSubDir"),Opt.ProcessSubDir);
- SetRegKey(HKEY_CURRENT_USER,_T(""),_T("ProcessDir"),Opt.ProcessDir);
+ KeyFileHelper kfh(INI_LOCATION);
+ kfh.SetString(INI_SECTION,("WordDiv"),Opt.WordDiv);
+ kfh.SetInt(INI_SECTION,("ConvertMode"),Opt.ConvertMode);
+ kfh.SetInt(INI_SECTION,("ConvertModeExt"),Opt.ConvertModeExt);
+ kfh.SetInt(INI_SECTION,("SkipMixedCase"),Opt.SkipMixedCase);
+ kfh.SetInt(INI_SECTION,("ProcessSubDir"),Opt.ProcessSubDir);
+ kfh.SetInt(INI_SECTION,("ProcessDir"),Opt.ProcessDir);
}
else
memcpy(&Opt,&Backup,sizeof(Opt));
|