/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/FileLocksmith/FileLocksmithLib/Settings.h
54 строки
1 KB
Stefan Markovic
[FileLocksmith][PowerRename]Fix regression by reloading module settings (#32192)
02 апр 2024, 23:18
Не верифицирован
02 апр 2024, 23:18
7b89482
Код
Авторство
О чём код?
#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(); RefreshEnabledState(); return settings.enabled; } inline bool GetShowInExtendedContextMenu() const { return settings.showInExtendedContextMenu; } inline void SetExtendedContextMenuOnly(bool extendedOnly) { settings.showInExtendedContextMenu = extendedOnly; } void Save(); void Load(); private: struct Settings { bool enabled{ true }; bool showInExtendedContextMenu{ false }; }; void RefreshEnabledState(); void Reload(); void ParseJson(); Settings settings; std::wstring generalJsonFilePath; std::wstring jsonFilePath; FILETIME lastLoadedTime{}; FILETIME lastLoadedGeneralSettingsTime{}; }; FileLocksmithSettings& FileLocksmithSettingsInstance();