Files
PowerToys/doc/devdocs/settingsv2/settings-utilities.md
Alekhya 18eb6b4ffd Dev documentation of SettingsV2 (#7335)
* created a folder for settings and added an overview, hotkey information

* basic structure for communication between settings and runner

* Added information about the IPC communication between settings and runner

* Added information about the communication between the settings process and modules

* Added details on backward compatibility

* brief overview on settings utils

* added an overview of the viewmodels and anomalies

* minor modifications

* Settings v2 dev docs (#7334)

* Added settings architecture and tech stack dev docs

* Added telemetry and updated architecture docs for settings v2

* Fix image link in ui_architecture markdown

* Added table of contents for settings v2

* Correct file path for ui architecture image

* nit fix in table of contents heading

* Add doc for xaml island tweaks

Co-authored-by: Divyansh Srivastava <somm14divi@gmail.com>
2020-10-20 14:28:06 -07:00

1.3 KiB

Settings Utilities

  • Abstractions for each of the file/folder related operations are present in SettingsUtils.cs.
  • To reduce contention between the settings process and runner while trying to access the settings.json file of any powertoy, the settings process tries to access the file only when it needs to load the information for the first time. However, there is still no mechanism in place which ensures that both the settings and runner processes do not access the information simultaneously leading to IOExceptions.

Utilities

GetSettings<T>(powertoy, filename)

  • The GetSettings function tries to read the file in the powertoy settings folder and creates a new file with default configurations if it does not exist.
  • Ideally this function should only be called by the SettingsRepository which would be accessed only when a powertoy settings object is being loaded for the first time.
  • The reason behind ensuring that it is not accessed elsewhere is to avoid contention with the runner during file access.
  • Each of the objects which are deserialized using this function must implement the ISettingsConfig interface.