refactor: decompose LauncherApp, centralize magic strings/constants, configurable colors

- Extract InputController from AppHost (key handling + ReloadGameEntries)
- Centralize hardcoded values as code constants (non-configurable):
  FavoritesRootName, DefaultFileName, DefaultTitle, scroll fractions,
  AvailableLines helper, removed redundant ArgsTemplate fallback
- Make color scheme configurable via 'Colors' section in launcher.config.json
  with Enum.TryParse + default fallback; MenuRenderer uses constructor injection
- Clean up MenuRenderer: remove dead maxRow logic, unify cache sizing via EnsureCache
- Document intentional error swallowing in FavoritesService.Save/UIErrorService
- Update README + AGENTS.md with configurable color docs
- Remove redundant ArgsTemplate fallback (config is single source of truth)
This commit is contained in:
2026-08-11 01:33:33 +02:00
parent 7dca82baa8
commit 62968dbcd1
13 changed files with 551 additions and 319 deletions
+13 -1
View File
@@ -6,6 +6,14 @@ namespace MarcerGameDvdLauncher
// Manages loading, saving and querying favorite ZIP paths.
public class FavoritesService
{
// Virtual folder name displayed at the root when favorites exist.
// Not configurable — fixed UI element.
public const string FavoritesRootName = "Favorites";
// Filename used for persisting favorites to disk.
// Not configurable — fixed persistence file.
public const string DefaultFileName = "favorites.txt";
private readonly string _filePath;
// Use a SortedSet so favorites are kept in sorted order in memory.
private SortedSet<string> _favorites = new(StringComparer.OrdinalIgnoreCase);
@@ -87,7 +95,11 @@ namespace MarcerGameDvdLauncher
}
catch
{
// Let callers surface errors (we swallow here to avoid throwing on write failures during UI operations)
// Swallowed intentionally ("bewusst still"): a persistence failure
// (e.g. disk full, read-only directory) must not crash or interrupt
// the UI. The in-memory state is still updated so the user sees
// immediate feedback; only the on-disk write is lost. On next
// application start the favorites reflect the last successful save.
}
}
}