mirror of
https://github.com/skoelle/marcer-gamedvd-launcher.git
synced 2026-09-17 18:50:25 +00:00
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:
@@ -4,6 +4,25 @@
|
||||
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; }
|
||||
@@ -16,5 +35,9 @@ namespace MarcerGameDvdLauncher
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user