[FancyZones] Refactor/improve saving JSON files (#8947)

* Divide SaveFancyZonesData into two functions

* Removed unused function, continued refactoring

* Use SaveAppZoneHistory in some places

* Revert "Use SaveAppZoneHistory in some places"

This reverts commit 74a4a1e467.

* Only save files if the contents are about to be changed

* Restore FileWatcher
This commit is contained in:
Ivan Stošić
2021-01-05 14:00:39 +01:00
committed by GitHub
parent d4a4203f95
commit 485d278b8c
5 changed files with 34 additions and 23 deletions

View File

@@ -67,11 +67,9 @@ namespace JSONHelpers
};
json::JsonObject GetPersistFancyZonesJSON(const std::wstring& zonesSettingsFileName, const std::wstring& appZoneHistoryFileName);
void SaveFancyZonesData(const std::wstring& zonesSettingsFileName,
const std::wstring& appZoneHistoryFileName,
const TDeviceInfoMap& deviceInfoMap,
const TCustomZoneSetsMap& customZoneSetsMap,
const TAppZoneHistoryMap& appZoneHistoryMap);
void SaveZoneSettings(const std::wstring& zonesSettingsFileName, const TDeviceInfoMap& deviceInfoMap, const TCustomZoneSetsMap& customZoneSetsMap);
void SaveAppZoneHistory(const std::wstring& appZoneHistoryFileName, const TAppZoneHistoryMap& appZoneHistoryMap);
TAppZoneHistoryMap ParseAppZoneHistory(const json::JsonObject& fancyZonesDataJSON);
json::JsonArray SerializeAppZoneHistory(const TAppZoneHistoryMap& appZoneHistoryMap);