mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[ImageResizer] Migrate settings from registry to JSON. (#2604)
* Migrate ImageResizer settings from registry to JSON. * Update last loaded time read/write IO operations. * Rename registry helper functions.
This commit is contained in:
@@ -3,14 +3,36 @@
|
||||
class CSettings
|
||||
{
|
||||
public:
|
||||
static bool GetEnabled();
|
||||
static bool SetEnabled(_In_ bool enabled);
|
||||
CSettings();
|
||||
|
||||
inline bool GetEnabled()
|
||||
{
|
||||
Reload();
|
||||
return settings.enabled;
|
||||
}
|
||||
|
||||
inline void SetEnabled(bool enabled)
|
||||
{
|
||||
settings.enabled = enabled;
|
||||
Save();
|
||||
}
|
||||
|
||||
void Save();
|
||||
void Load();
|
||||
|
||||
private:
|
||||
static bool GetRegBoolValue(_In_ PCWSTR valueName, _In_ bool defaultValue);
|
||||
static bool SetRegBoolValue(_In_ PCWSTR valueName, _In_ bool value);
|
||||
static bool SetRegDWORDValue(_In_ PCWSTR valueName, _In_ DWORD value);
|
||||
static DWORD GetRegDWORDValue(_In_ PCWSTR valueName, _In_ DWORD defaultValue);
|
||||
static bool SetRegStringValue(_In_ PCWSTR valueName, _In_ PCWSTR value);
|
||||
static bool GetRegStringValue(_In_ PCWSTR valueName, __out_ecount(cchBuf) PWSTR value, DWORD cchBuf);
|
||||
};
|
||||
struct Settings
|
||||
{
|
||||
bool enabled{ true };
|
||||
};
|
||||
|
||||
void Reload();
|
||||
void MigrateFromRegistry();
|
||||
void ParseJson();
|
||||
|
||||
Settings settings;
|
||||
std::wstring jsonFilePath;
|
||||
FILETIME lastLoadedTime;
|
||||
};
|
||||
|
||||
CSettings& CSettingsInstance();
|
||||
Reference in New Issue
Block a user