Skip to content

Replace user.config with a JSON file next to the exe - #26

Open
danielchalmers wants to merge 1 commit into
masterfrom
v5/settings-file
Open

danielchalmers wants to merge 1 commit into
masterfrom
v5/settings-file

Conversation

@danielchalmers

@danielchalmers danielchalmers commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner
  • Settings are saved as JSON in a file next to the exe, named after it: Network-Monitor-x64.settings for the portable exe, Network Monitor.settings for the installed one. A portable copy keeps its settings when it's moved, and each copy has its own.
  • The first time a copy runs, it takes the newest .settings file beside it, so a download saved as Network-Monitor-x64 (1).exe carries on from the old one. Otherwise the installed copy gets its own 4.x settings and position back, and any other copy gets whatever 4.x saved last. 4.x's files are only read. The position is skipped while another copy is running.
  • A bad value only resets that setting, an out-of-range size is clamped, and a trailing comma is allowed. A file that can't be parsed is kept as .settings.bad before the defaults are saved over it. Saves go through a temp file.
  • If the file can't be written, such as in a folder that needs admin rights, it still starts and warns that changes won't be kept.
  • The user.config repair-and-restart is gone. Still a single exe with no libraries.
26

Release notes: settings now live in a .settings file beside the exe and are brought over from 4.x once. Uninstalling leaves Network Monitor.settings in %LOCALAPPDATA%\Network Monitor, and a portable copy doesn't pick up the installed copy's 5.0 settings.

@danielchalmers
danielchalmers marked this pull request as ready for review October 12, 2026 15:41
@danielchalmers danielchalmers changed the title Keep settings in a file next to the app Replace user.config with a JSON file next to the exe Oct 12, 2026
@danielchalmers
danielchalmers added this pull request to stack #33 October 12, 2026 16:28
Base automatically changed from v4.1/outage-clock to master October 12, 2026 18:09
- Save settings as JSON to <exe name>.settings beside the exe, a second after each change
- First run imports a sibling .settings file, else this copy's or the newest 4.x user.config
- Write through a temp file and MoveFileEx so a killed save can't leave a partial file
- Reset only bad values, allow a trailing comma, keep an unparsable file as .settings.bad
- Warn at startup when settings can't be saved; remove the user.config repair-and-restart
@github-actions github-actions Bot added the enhancement New feature or request label Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant