Initial Commit

This commit is contained in:
2026-09-28 16:55:31 +08:00
commit 14f8706198
128 changed files with 19860 additions and 0 deletions
+109
View File
@@ -0,0 +1,109 @@
namespace TuneBoss.Core.Models;
/// <summary>
/// Bike manufacturer and model registry.
/// To add a new make: add a new entry to Manufacturers.
/// To add a new model: add a new entry to the Models list for that make.
/// </summary>
public static class BikeRegistry
{
// ── Manufacturer codes ────────────────────────────────────────────────────
public const byte Yamaha = 1;
public const byte Honda = 2;
public const byte Modenas = 5;
public const byte Suzuki = 6;
// ── Registry ──────────────────────────────────────────────────────────────
private static readonly Dictionary<byte, (string Make, Dictionary<int, string> Models)> _registry
= new()
{
[Yamaha] = ("Yamaha", new()
{
[1] = "FZ150i (2008–2013)",
[2] = "Lagenda 115z EFi",
[3] = "FZ150i (2014)",
[4] = "YZF R15 (2008–2013)",
[5] = "YZF R15 (2014)",
[6] = "Y15ZR / Exciter 150 / MX King 150",
[7] = "FZ150i / YZF R15",
[8] = "FZ150i (2016)",
[9] = "MSLAZ 2015",
[10] = "YZF R25 2018",
[11] = "YZF R3 2015",
[13] = "YZF R15 2015",
[14] = "NMAX",
[15] = "NVX",
[16] = "Y15ZR 2019",
[17] = "Y16ZR",
[18] = "135LC Fi",
[19] = "XMAX",
[20] = "XMAX V2",
[21] = "R15M 2022",
[22] = "MT15 2022",
[23] = "EGO AVANTIZ",
[24] = "R125 2019",
[25] = "R25 2019",
[26] = "R3 2019",
[27] = "R125 2008",
[28] = "XMAX V3",
[29] = "NVX V1",
[30] = "PG1 / EZ115",
}),
[Honda] = ("Honda", new()
{
[1] = "Dream110 / Wave110 / Wave125 / MSX125",
[2] = "PCX",
[3] = "RS150R / Winner150",
[4] = "CBR250",
[5] = "CRF250L (2013)",
[6] = "CRF250L (2017)",
[7] = "EX5",
[8] = "RSX",
}),
[Modenas] = ("Modenas", new()
{
[1] = "VF3i",
}),
[Suzuki] = ("Suzuki", new()
{
[1] = "Raider R150",
}),
};
// ── Lookups ───────────────────────────────────────────────────────────────
/// <summary>Returns the manufacturer name, or empty string if unknown.</summary>
public static string GetMake(byte makeCode)
=> _registry.TryGetValue(makeCode, out var entry) ? entry.Make : string.Empty;
/// <summary>Returns the model name, or empty string if unknown.</summary>
public static string GetModel(byte makeCode, int modelCode)
{
if (!_registry.TryGetValue(makeCode, out var entry)) return string.Empty;
return entry.Models.TryGetValue(modelCode, out var name) ? name : string.Empty;
}
/// <summary>Returns "Make — Model" display string, e.g. "Yamaha — Y15ZR 2019".</summary>
public static string GetDisplayName(byte makeCode, int modelCode)
{
string make = GetMake(makeCode);
string model = GetModel(makeCode, modelCode);
if (string.IsNullOrEmpty(make)) return $"Unknown ({makeCode}/{modelCode})";
if (string.IsNullOrEmpty(model)) return $"{make} — Unknown model ({modelCode})";
return $"{make} — {model}";
}
/// <summary>All registered manufacturers.</summary>
public static IEnumerable<(byte Code, string Name)> AllMakes
=> _registry.Select(kv => (kv.Key, kv.Value.Make));
/// <summary>All models for a given manufacturer code.</summary>
public static IEnumerable<(int Code, string Name)> ModelsFor(byte makeCode)
=> _registry.TryGetValue(makeCode, out var entry)
? entry.Models.Select(kv => (kv.Key, kv.Value))
: Enumerable.Empty<(int, string)>();
}