Files
marcer-gamedvd-launcher/src/MarcerGameDvdLauncher/AppConfiguration.cs
T
stefankoelle 62968dbcd1 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)
2026-08-11 01:33:33 +02:00

44 lines
1.9 KiB
C#

// Copyright (c) 2026 Stefan Koelle (https://stefankoelle.de)
// Licensed under the MIT License. See LICENSE file in project root for details.
namespace MarcerGameDvdLauncher
{
// Configuration POCOs separated into their own file for clarity
/// <summary>
/// Color configuration for the menu renderer.
/// All properties have default values matching the original hardcoded scheme,
/// so omitting any value (or the entire "Colors" section) preserves existing behaviour.
/// </summary>
public class AppColorConfig
{
public ConsoleColor FolderBoth { get; set; } = ConsoleColor.Yellow;
public ConsoleColor FolderPatchOnly { get; set; } = ConsoleColor.DarkYellow;
public ConsoleColor FolderRootOnly { get; set; } = ConsoleColor.Gray;
public ConsoleColor ZipBoth { get; set; } = ConsoleColor.Green;
public ConsoleColor ZipRootOnly { get; set; } = ConsoleColor.DarkGreen;
public ConsoleColor ZipPatchOnly { get; set; } = ConsoleColor.Magenta;
public ConsoleColor SelectedForeground { get; set; } = ConsoleColor.Black;
public ConsoleColor SelectedBackground { get; set; } = ConsoleColor.DarkCyan;
public ConsoleColor VirtualEntry { get; set; } = ConsoleColor.White;
}
public class AppHatariConfig
{
public string? Executable { get; set; }
public string? ConfigFile { get; set; }
public string? ArgsTemplate { get; set; }
}
public class AppConfig
{
public string? RootDirectory { get; set; }
public string? PatchDirectory { get; set; }
public AppHatariConfig? Hatari { get; set; }
// Ignored during JSON deserialization — parsed manually in LoadConfiguration so that
// invalid color strings fall back to defaults instead of throwing.
[System.Text.Json.Serialization.JsonIgnore]
public AppColorConfig? Colors { get; set; }
}
}