mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
46 lines
897 B
C++
46 lines
897 B
C++
#pragma once
|
|
|
|
#include "pch.h"
|
|
#include <common/utils/gpo.h>
|
|
|
|
class FileLocksmithSettings
|
|
{
|
|
public:
|
|
FileLocksmithSettings();
|
|
|
|
inline bool GetEnabled()
|
|
{
|
|
auto gpoSetting = powertoys_gpo::getConfiguredFileLocksmithEnabledValue();
|
|
if (gpoSetting == powertoys_gpo::gpo_rule_configured_enabled)
|
|
return true;
|
|
if (gpoSetting == powertoys_gpo::gpo_rule_configured_disabled)
|
|
return false;
|
|
Reload();
|
|
return settings.enabled;
|
|
}
|
|
|
|
inline void SetEnabled(bool enabled)
|
|
{
|
|
settings.enabled = enabled;
|
|
Save();
|
|
}
|
|
|
|
void Save();
|
|
void Load();
|
|
|
|
private:
|
|
struct Settings
|
|
{
|
|
bool enabled{ true };
|
|
};
|
|
|
|
void Reload();
|
|
void ParseJson();
|
|
|
|
Settings settings;
|
|
std::wstring jsonFilePath;
|
|
FILETIME lastLoadedTime;
|
|
};
|
|
|
|
FileLocksmithSettings& FileLocksmithSettingsInstance();
|