Move rolling stock and physics into the domain

VehicleDatabase becomes VehicleCatalog, Physics becomes VehiclePhysics, and the
textures.txt and .fiz parsers move to Infrastructure. GameLibrary replaces the
GameData singleton.
This commit is contained in:
maj00r
2026-09-04 21:03:08 +02:00
parent 789f0dd1c9
commit 0444070e12
45 changed files with 1829 additions and 877 deletions

View File

@@ -51,5 +51,11 @@ public interface IFileSystem
/// <summary>Top-level directories, empty when the directory does not exist.</summary>
IReadOnlyList<string> GetDirectories(string path);
/// <summary>
/// Files matching the pattern anywhere below the path. Empty when the
/// directory does not exist.
/// </summary>
IReadOnlyList<string> GetFilesRecursive(string path, string searchPattern);
DateTime GetLastWriteTimeUtc(string path);
}

View File

@@ -0,0 +1,19 @@
namespace StarterNG.Application.Abstractions;
/// <summary>
/// The thumbnails in textures/mini, looked up by name. Backed by one directory
/// scan; a name with no bitmap falls back to the generic "other" thumbnail.
/// </summary>
public interface IMiniTextureIndex
{
/// <summary>Builds the index up front, off the UI thread.</summary>
void Preload();
bool Has(string? miniName);
/// <summary>Bitmap for the name, the fallback thumbnail, or null when neither exists.</summary>
string? PathFor(string? miniName);
/// <summary>The generic thumbnail shown for unknown stock.</summary>
string? FallbackPath { get; }
}

View File

@@ -0,0 +1,21 @@
using StarterNG.Domain.Vehicles;
namespace StarterNG.Application.Abstractions;
/// <summary>
/// Looks up the .fiz physics of a vehicle type by model name.
/// </summary>
public interface IPhysicsRepository
{
/// <summary>Indexes the installation's .fiz files up front, off the UI thread.</summary>
void Preload();
/// <summary>How many vehicle types were indexed; zero means a broken installation.</summary>
int IndexedCount { get; }
/// <summary>
/// Physics for a model name (with or without extension), or null when the
/// installation has no .fiz for it.
/// </summary>
VehiclePhysics? For(string? dataFolder, string? model);
}

View File

@@ -0,0 +1,17 @@
using StarterNG.Domain.Vehicles;
namespace StarterNG.Application.Abstractions;
/// <summary>
/// Reads the installation's rolling stock. The only route from the dynamic/
/// folder to a <see cref="VehicleCatalog"/>.
/// </summary>
public interface IVehicleRepository
{
/// <summary>
/// Fills the catalogue from every textures.txt under dynamic/. Returns the
/// number of liveries read, which the caller uses to spot an installation
/// with no rolling stock at all.
/// </summary>
int Load(VehicleCatalog catalog);
}