Cut the comments from the refactored code

Three survive: why AppServices is hand-wired, the cp1250 registration trap, and
the IsDieselEngine note carried over from Physics.cs.
This commit is contained in:
maj00r
2026-09-04 22:24:54 +02:00
parent 7849ef9729
commit df21ec104f
60 changed files with 3 additions and 875 deletions

View File

@@ -7,18 +7,8 @@ using StarterNG.Domain.Settings;
namespace StarterNG.Infrastructure.Settings;
/// <summary>
/// Finds and vets the simulator executable the starter will launch.
/// </summary>
/// <remarks>
/// Installations ship the binary under several names (eu07.exe, eu07,
/// eu07-vulkan, ...), and a folder shared between platforms may hold both a PE
/// and an ELF build. So a candidate is not just found by name: it is checked for
/// the execute bit and for a magic number matching the platform we are on.
/// </remarks>
public sealed class ExecutableLocator
{
/// <summary>Extensions that are never the simulator, whatever they are named.</summary>
private static readonly string[] NeverExecutable =
{
".ini", ".log", ".txt", ".cfg", ".config", ".json", ".dll", ".so", ".dat", ".bak", ".csv", ".xml"
@@ -37,13 +27,8 @@ public sealed class ExecutableLocator
_log = log;
}
/// <summary>The canonical name for the platform, used when nothing is found.</summary>
public string CanonicalName => _environment.IsWindows ? "eu07.exe" : "eu07";
/// <summary>
/// The executable to launch for these settings, along with what is wrong with
/// it. A path is always returned so the UI can show what it was looking for.
/// </summary>
public string Resolve(SimulatorSettings settings, out ExeProblem problem)
{
if (!settings.SelectExeAutomatically && !string.IsNullOrWhiteSpace(settings.ExecutablePath))
@@ -55,7 +40,6 @@ public sealed class ExecutableLocator
string? fallback = null;
try
{
// Prefer the canonical name, then the shortest: "eu07" over "eu07-dev".
var candidates = _files.GetFiles(_paths.Root, "eu07*")
.Where(IsCandidate)
.OrderBy(path => string.Equals(Path.GetFileName(path), CanonicalName,
@@ -87,7 +71,6 @@ public sealed class ExecutableLocator
return CanonicalName;
}
/// <summary>Executables the user can pick from, most recently built first.</summary>
public List<string> ListCandidates(string? directory = null)
{
try
@@ -122,11 +105,6 @@ public sealed class ExecutableLocator
}
}
/// <summary>
/// Reads the file's magic number: "MZ" for a Windows binary, 0x7F "ELF" for a
/// Linux one. A file we cannot read four bytes from is given the benefit of
/// the doubt.
/// </summary>
private bool MatchesPlatform(string path)
{
byte[] head = new byte[4];