Skip to content

Saving Settings Design

DamianSuess edited this page Jan 1, 2019 · 4 revisions

Design Proposals

We can go several routes for saving methods. We may also need a stronger GUID for our add-ins outside of the Mono.Addin's generated Id.

Candidate

We're going with Option 2 (for now) which uses a single JSON file ToolsHub.db.

Proposed Saving Methods

  1. Create a JSON file for each add-in, using the add-in's ID as the root file name.
    • PRO: This provides us the ability to separate into smaller chunks for quicker save/load times.
    • PRO: - Only that file will be modified when a page is saved.
    • CON: - Too many files to maintain - creation/cleanup/duplicates.
    • CON: - Needs a file naming strategy
  2. Have one massive JSON file for all with the following sub-items.
    • Subitems:
      • Id - Add-in's Id.
      • Key - Property name
      • Value - Property value
    • PRO: - Load once, it's in memory
    • CON: - How do you clean up dead items?
    • CON: - All items will be re-written constantly
[
  {
    "Id": "ShortcutsAddin",
    "Items": {
      "ShortcutItems": "W3siVGl0bGUiOiJDLURyaXZlIiwiVGFyZ2V0IjoiQzpcXCJ9LHsiVGl0bGUiOiJELURyaXZlIiwiVGFyZ2V0IjoiRDpcXCJ9XQ=="
    }
  },
  {
    "Id": "PomodoroTimer",
    "Items": {
      "Duration": "25",
      "BreakShort": "5",
      "BreakLong": "10"
    }
  }
]
  1. Use SQLite to manage everything in the same manner as the JSON file.
    • PRO: - Fast, clean, efficient!
    • CON: - Another dependency and project bloat
  2. Use an INI file where the Keys are you add-in id or GUID.
    • CON: Same issues as JSON files
    • CON: What's the data-cap and doesn't support multi-line data?