mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-16 13:04:09 +01:00
Compare commits
28 Commits
fix/screen
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c9b578e6b | |||
| 952618be13 | |||
| 156af3fdd1 | |||
| 49b76aa66c | |||
| 9b1523ef78 | |||
| 1d5b0ea1f4 | |||
|
|
8baf2149ea | ||
|
|
aebfaf34ac | ||
|
|
5bc5da3fbf | ||
|
|
e4d092ab3e | ||
|
|
632e1003ee | ||
|
|
34ee131d61 | ||
|
|
38802845c7 | ||
|
|
bba9e3ef48 | ||
|
|
f29ce10f5c | ||
|
|
6e2dbf9eac | ||
|
|
91c496ab48 | ||
|
|
7cd3ef8f1a | ||
|
|
1b41ef752a | ||
|
|
42f702a096 | ||
|
|
7f57160aae | ||
|
|
2efae83b57 | ||
|
|
34f2ce99e8 | ||
|
|
52408a9931 | ||
|
|
290b753f40 | ||
|
|
6279228a7d | ||
|
|
d4975796a8 | ||
|
|
48af11b4b2 |
@@ -185,6 +185,9 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
|||||||
["EventHornMissed"] = "W6: NO HORN",
|
["EventHornMissed"] = "W6: NO HORN",
|
||||||
["EventCab"] = "Cab {0} of {1}",
|
["EventCab"] = "Cab {0} of {1}",
|
||||||
["EventSecurityBraking"] = "BRAKING BY {0}",
|
["EventSecurityBraking"] = "BRAKING BY {0}",
|
||||||
|
["EventSecurityAlarm"] = "{0} buzzer",
|
||||||
|
["EventSecurityAlarmAcknowledged"] = "{0} buzzer, acknowledged after {1:0.0} s",
|
||||||
|
["EventSecurityAlarmMissed"] = "{0} buzzer, not acknowledged",
|
||||||
["EventTimetable"] = "Timetable {0}, {1}",
|
["EventTimetable"] = "Timetable {0}, {1}",
|
||||||
["CabSpeed"] = "Speed",
|
["CabSpeed"] = "Speed",
|
||||||
["CabAiTarget"] = "AI {0:0} km/h",
|
["CabAiTarget"] = "AI {0:0} km/h",
|
||||||
@@ -460,6 +463,9 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
|||||||
["EventHornMissed"] = "W6: BEZ TRĄBIENIA",
|
["EventHornMissed"] = "W6: BEZ TRĄBIENIA",
|
||||||
["EventCab"] = "Kabina {0} w {1}",
|
["EventCab"] = "Kabina {0} w {1}",
|
||||||
["EventSecurityBraking"] = "HAMOWANIE PRZEZ {0}",
|
["EventSecurityBraking"] = "HAMOWANIE PRZEZ {0}",
|
||||||
|
["EventSecurityAlarm"] = "Brzęczyk {0}",
|
||||||
|
["EventSecurityAlarmAcknowledged"] = "Brzęczyk {0}, potwierdzony po {1:0.0} s",
|
||||||
|
["EventSecurityAlarmMissed"] = "Brzęczyk {0}, bez potwierdzenia",
|
||||||
["EventTimetable"] = "Rozkład {0}, {1}",
|
["EventTimetable"] = "Rozkład {0}, {1}",
|
||||||
["CabSpeed"] = "Prędkość",
|
["CabSpeed"] = "Prędkość",
|
||||||
["CabAiTarget"] = "AI {0:0} km/h",
|
["CabAiTarget"] = "AI {0:0} km/h",
|
||||||
@@ -564,7 +570,11 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
|||||||
["FileFilter"] = "Czarna skrzynka"
|
["FileFilter"] = "Czarna skrzynka"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>The key of the text of a simulator's command: <see cref="CommandPrefix"/> and its name.</summary>
|
||||||
|
public const string CommandPrefix = "Cmd.";
|
||||||
|
|
||||||
private readonly Dictionary<string, string> _texts;
|
private readonly Dictionary<string, string> _texts;
|
||||||
|
private readonly string _languageCode;
|
||||||
|
|
||||||
public DefaultBlackBoxStrings() : this(CultureInfo.CurrentUICulture)
|
public DefaultBlackBoxStrings() : this(CultureInfo.CurrentUICulture)
|
||||||
{
|
{
|
||||||
@@ -577,11 +587,15 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
|||||||
/// <summary>Polish for "pl", English for any other language.</summary>
|
/// <summary>Polish for "pl", English for any other language.</summary>
|
||||||
public DefaultBlackBoxStrings(string languageCode)
|
public DefaultBlackBoxStrings(string languageCode)
|
||||||
{
|
{
|
||||||
|
_languageCode = languageCode;
|
||||||
_texts = languageCode == "pl" ? Polish : English;
|
_texts = languageCode == "pl" ? Polish : English;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The keys there are texts for, for a translation to give them all.</summary>
|
/// <summary>The keys there are texts for, for a translation to give them all.</summary>
|
||||||
public static IEnumerable<string> Keys => English.Keys;
|
public static IEnumerable<string> Keys => English.Keys;
|
||||||
|
|
||||||
public string this[string key] => _texts.TryGetValue(key, out var text) ? text : English.GetValueOrDefault(key, key);
|
/// <summary>A key of <see cref="CommandPrefix"/> gives what the command does (<see cref="CommandTexts"/>).</summary>
|
||||||
|
public string this[string key] =>
|
||||||
|
key.StartsWith(CommandPrefix, System.StringComparison.Ordinal) ? CommandTexts.Of(key[CommandPrefix.Length..], _languageCode)
|
||||||
|
: _texts.TryGetValue(key, out var text) ? text : English.GetValueOrDefault(key, key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -660,12 +660,12 @@ public sealed class CabPanel : Control
|
|||||||
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
||||||
{
|
{
|
||||||
// A recording which tells them apart.
|
// A recording which tells them apart.
|
||||||
safety.Add((Strings["DevVigilance"], Security(SecurityFlags.VigilanceBeeping, Palette.LampAlarm) ?? Security(SecurityFlags.Vigilance, Palette.Vigilance)));
|
safety.Add((Strings["DevVigilance"], s.VigilanceBuzzer ? Palette.Buzzer : Security(SecurityFlags.Vigilance, Palette.Vigilance)));
|
||||||
safety.Add((Strings["DevCabSignal"], Security(SecurityFlags.CabSignalBeeping, Palette.LampAlarm) ?? Security(SecurityFlags.CabSignal, Palette.CabSignal)));
|
safety.Add((Strings["DevCabSignal"], s.CabSignalBuzzer ? Palette.Buzzer : Security(SecurityFlags.CabSignal, Palette.CabSignal)));
|
||||||
safety.Add((Strings["DevSecurityBraking"], Security(SecurityFlags.Braking, Palette.LampAlarm)));
|
safety.Add((Strings["DevSecurityBraking"], s.ProtectionBraking ? Palette.LampAlarm : null));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
safety.Add((Strings["DevAlerter"], (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.LampAlarm
|
safety.Add((Strings["DevAlerter"], (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.Buzzer
|
||||||
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.LampWarning : null));
|
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.LampWarning : null));
|
||||||
safety.Add(Flag("DevWheelSlip", CabFlags.WheelSlip, Palette.LampAlarm));
|
safety.Add(Flag("DevWheelSlip", CabFlags.WheelSlip, Palette.LampAlarm));
|
||||||
safety.Add(On("DevOverloadRelay", CabDevices.OverloadRelay, Palette.LampAlarm));
|
safety.Add(On("DevOverloadRelay", CabDevices.OverloadRelay, Palette.LampAlarm));
|
||||||
|
|||||||
378
Eu07.BlackBox.Views/CommandTexts.cs
Normal file
378
Eu07.BlackBox.Views/CommandTexts.cs
Normal file
@@ -0,0 +1,378 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Eu07.BlackBox.Views;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What the simulator's commands of a vehicle do, as the black box names them (input/command.cpp): Polish
|
||||||
|
/// and English. Those with a key carry the texts of the key file (eu07_input-keyboard.ini) and of the starter's
|
||||||
|
/// English; the rest, worked by the mouse in the cab or by scripts, are written here.
|
||||||
|
/// </summary>
|
||||||
|
public static class CommandTexts
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<string, (string Polish, string English)> Texts = new()
|
||||||
|
{
|
||||||
|
["aidriverenable"] = ("Aktywacja automechanika", "Engage the AI driver"),
|
||||||
|
["aidriverdisable"] = ("Dezaktywacja automechanika", "Disengage the AI driver"),
|
||||||
|
["jointcontrollerset"] = ("Ustawienie nastawnika zespolonego", "Set the combined controller"),
|
||||||
|
["mastercontrollerincrease"] = ("Zwiększenie nastawnika głównego", "Master controller up"),
|
||||||
|
["mastercontrollerincreasefast"] = ("Szybkie zwiększenie nastawnika głównego", "Master controller up, fast"),
|
||||||
|
["mastercontrollerdecrease"] = ("Zmniejszenie nastawnika głównego", "Master controller down"),
|
||||||
|
["mastercontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawnika głównego", "Master controller down, fast"),
|
||||||
|
["mastercontrollerset"] = ("Ustawienie nastawnika głównego", "Set the master controller"),
|
||||||
|
["dynamicbrakecontrollerincrease"] = ("Zwiększenie nastawy hamulca elektrodynamicznego", "Increase the dynamic brake"),
|
||||||
|
["dynamicbrakecontrollerdecrease"] = ("Zmniejszenie nastawy hamulca elektrodynamicznego", "Decrease the dynamic brake"),
|
||||||
|
["dynamicbrakecontrollerset"] = ("Ustawienie hamulca elektrodynamicznego", "Set the dynamic brake"),
|
||||||
|
["dynamicbrakecontrollerincreasefast"] = ("Szybkie zwiększenie nastawy hamulca elektrodynamicznego", "Increase the dynamic brake fast"),
|
||||||
|
["dynamicbrakecontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawy hamulca elektrodynamicznego", "Decrease the dynamic brake fast"),
|
||||||
|
["secondcontrollerincrease"] = ("Zwiększenie nastawnika boczników", "Shunt controller up"),
|
||||||
|
["secondcontrollerincreasefast"] = ("Szybkie zwiększenie nastawnika boczników", "Shunt controller up, fast"),
|
||||||
|
["secondcontrollerdecrease"] = ("Zmniejszenie nastawnika boczników", "Shunt controller down"),
|
||||||
|
["secondcontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawnika boczników", "Shunt controller down, fast"),
|
||||||
|
["secondcontrollerset"] = ("Ustawienie nastawnika boczników", "Set the shunt controller"),
|
||||||
|
["mucurrentindicatorothersourceactivate"] = ("Zmiana członu dla wskaźnika prądu", "Switch the current gauge to the other unit"),
|
||||||
|
["independentbrakeincrease"] = ("Zwiększenie nastawy hamulca lokomotywy", "Apply more locomotive brake"),
|
||||||
|
["independentbrakeincreasefast"] = ("Szybkie zwiększenie nastawy hamulca lokomotywy", "Apply more locomotive brake, fast"),
|
||||||
|
["independentbrakedecrease"] = ("Zmniejszenie nastawy hamulca lokomotywy", "Release locomotive brake"),
|
||||||
|
["independentbrakedecreasefast"] = ("Szybkie zmniejszenie nastawy hamulca lokomotywy", "Release locomotive brake, fast"),
|
||||||
|
["independentbrakeset"] = ("Ustawienie hamulca lokomotywy", "Set the locomotive brake"),
|
||||||
|
["independentbrakebailoff"] = ("Odluźniacz", "Bail off the locomotive brake"),
|
||||||
|
["universalbrakebutton1"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 1", "Universal brake button 1"),
|
||||||
|
["universalbrakebutton2"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 2", "Universal brake button 2"),
|
||||||
|
["universalbrakebutton3"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 3", "Universal brake button 3"),
|
||||||
|
["trainbrakeincrease"] = ("Zwiększenie stopnia hamowania zaworu maszynisty", "Train brake valve: more braking"),
|
||||||
|
["trainbrakedecrease"] = ("Zmniejszenie stopnia hamowania zaworu maszynisty", "Train brake valve: less braking"),
|
||||||
|
["trainbrakeset"] = ("Ustawienie hamulca zespolonego", "Set the train brake"),
|
||||||
|
["trainbrakecharging"] = ("Napełnianie uderzeniowe przewodu głównego", "Train brake valve: overcharge the brake pipe"),
|
||||||
|
["trainbrakerelease"] = ("Ustawienie zaworu maszynisty w pozycji jazdy", "Train brake valve: running position"),
|
||||||
|
["trainbrakefirstservice"] = ("Pozycja pierwszego stopnia hamowania", "Train brake valve: first braking step"),
|
||||||
|
["trainbrakeservice"] = ("Pozycja hamowania służbowego", "Train brake valve: service braking"),
|
||||||
|
["trainbrakefullservice"] = ("Pozycja hamowania pełnego", "Train brake valve: full service"),
|
||||||
|
["trainbrakehandleoff"] = ("Pozycja odcięcia", "Train brake valve: lap position"),
|
||||||
|
["trainbrakeemergency"] = ("Hamowanie nagłe", "Emergency braking"),
|
||||||
|
["trainbrakebasepressureincrease"] = ("Zwiększenie poziomu ciśnienia w przewodzie głównym", "Raise the brake pipe pressure level"),
|
||||||
|
["trainbrakebasepressuredecrease"] = ("Zmniejszenie poziomu ciśnienia w przewodzie głównym", "Lower the brake pipe pressure level"),
|
||||||
|
["trainbrakebasepressurereset"] = ("Domyślny poziom ciśnienia w przewodzie głównym", "Default brake pipe pressure level"),
|
||||||
|
["trainbrakeoperationtoggle"] = ("Przełączenie stanu hamulca pojazdu", "Toggle the vehicle's brake"),
|
||||||
|
["manualbrakeincrease"] = ("Zwiększenie nastawy hamulca ręcznego", "Apply more hand brake"),
|
||||||
|
["manualbrakedecrease"] = ("Zmniejszenie nastawy hamulca ręcznego", "Release hand brake"),
|
||||||
|
["alarmchaintoggle"] = ("Przełączenie stanu hamulca bezpieczeństwa", "Toggle the emergency brake"),
|
||||||
|
["alarmchainenable"] = ("Pociągnięcie hamulca bezpieczeństwa", "Pull the alarm chain"),
|
||||||
|
["alarmchaindisable"] = ("Zwolnienie hamulca bezpieczeństwa", "Release the alarm chain"),
|
||||||
|
["wheelspinbrakeactivate"] = ("Aktywacja podhamowania przeciwpoślizgowego", "Anti-slip brake"),
|
||||||
|
["sandboxactivate"] = ("Aktywacja piasecznicy", "Sander"),
|
||||||
|
["autosandboxtoggle"] = ("Przełączenie automatycznej piasecznicy", "Toggle the automatic sander"),
|
||||||
|
["autosandboxactivate"] = ("Włączenie automatycznej piasecznicy", "Turn the automatic sander on"),
|
||||||
|
["autosandboxdeactivate"] = ("Wyłączenie automatycznej piasecznicy", "Turn the automatic sander off"),
|
||||||
|
["reverserincrease"] = ("Zwiększenie pozycji nastawnika kierunku", "Reverser up"),
|
||||||
|
["reverserdecrease"] = ("Zmniejszenie pozycji nastawnika kierunku", "Reverser down"),
|
||||||
|
["reverserforwardhigh"] = ("Pozycja jazdy do przodu II nastawnika kierunku", "Reverser: forward II"),
|
||||||
|
["reverserforward"] = ("Pozycja jazdy do przodu nastawnika kierunku", "Reverser: forward"),
|
||||||
|
["reverserneutral"] = ("Pozycja neutralna nastawnika kierunku", "Reverser: neutral"),
|
||||||
|
["reverserbackward"] = ("Pozycja jazdy do tyłu nastawnika kierunku", "Reverser: backward"),
|
||||||
|
["waterpumpbreakertoggle"] = ("Przełączenie stanu wyłącznika samoczynnego pompy wody", "Toggle the water pump circuit breaker"),
|
||||||
|
["waterpumpbreakerclose"] = ("Załączenie wyłącznika pompy wody", "Close the water pump breaker"),
|
||||||
|
["waterpumpbreakeropen"] = ("Wyłączenie wyłącznika pompy wody", "Open the water pump breaker"),
|
||||||
|
["waterpumptoggle"] = ("Przełączenie stanu pompy wody", "Toggle the water pump"),
|
||||||
|
["waterpumpenable"] = ("Włączenie pompy wody", "Turn the water pump on"),
|
||||||
|
["waterpumpdisable"] = ("Wyłączenie pompy wody", "Turn the water pump off"),
|
||||||
|
["waterheaterbreakertoggle"] = ("Przełączenie stanu wyłącznika samoczynnego podgrzewacza wody", "Toggle the water heater circuit breaker"),
|
||||||
|
["waterheaterbreakerclose"] = ("Załączenie wyłącznika podgrzewacza wody", "Close the water heater breaker"),
|
||||||
|
["waterheaterbreakeropen"] = ("Wyłączenie wyłącznika podgrzewacza wody", "Open the water heater breaker"),
|
||||||
|
["waterheatertoggle"] = ("Przełączenie stanu podgrzewacza wody", "Toggle the water heater"),
|
||||||
|
["waterheaterenable"] = ("Włączenie podgrzewacza wody", "Turn the water heater on"),
|
||||||
|
["waterheaterdisable"] = ("Wyłączenie podgrzewacza wody", "Turn the water heater off"),
|
||||||
|
["watercircuitslinktoggle"] = ("Przełączenie stanu połączenia obiegów wody", "Toggle the link between the water circuits"),
|
||||||
|
["watercircuitslinkenable"] = ("Połączenie obiegów wody", "Link the water circuits"),
|
||||||
|
["watercircuitslinkdisable"] = ("Rozłączenie obiegów wody", "Unlink the water circuits"),
|
||||||
|
["fuelpumptoggle"] = ("Przełączenie stanu pompy paliwa", "Toggle the fuel pump"),
|
||||||
|
["fuelpumpenable"] = ("Włączenie pompy paliwa", "Turn the fuel pump on"),
|
||||||
|
["fuelpumpdisable"] = ("Wyłączenie pompy paliwa", "Turn the fuel pump off"),
|
||||||
|
["oilpumptoggle"] = ("Przełączenie stanu pompy oleju", "Toggle the oil pump"),
|
||||||
|
["oilpumpenable"] = ("Włączenie pompy oleju", "Turn the oil pump on"),
|
||||||
|
["oilpumpdisable"] = ("Wyłączenie pompy oleju", "Turn the oil pump off"),
|
||||||
|
["linebreakertoggle"] = ("Przełączenie stanu wyłącznika szybkiego", "Toggle the line breaker"),
|
||||||
|
["linebreakeropen"] = ("Wyłączenie wyłącznika szybkiego", "Open the line breaker"),
|
||||||
|
["linebreakerclose"] = ("Załączenie wyłącznika szybkiego", "Close the line breaker"),
|
||||||
|
["convertertoggle"] = ("Przełączenie stanu przetwornicy", "Toggle the converter"),
|
||||||
|
["converterenable"] = ("Włączenie przetwornicy", "Turn the converter on"),
|
||||||
|
["converterdisable"] = ("Wyłączenie przetwornicy", "Turn the converter off"),
|
||||||
|
["convertertogglelocal"] = ("Przełączenie stanu przetwornicy w obsadzonym członie", "Toggle the converter in the occupied unit"),
|
||||||
|
["converteroverloadrelayreset"] = ("Odblokowanie przekaźnika nadmiarowego przetwornicy", "Reset the converter overload relay"),
|
||||||
|
["compressortoggle"] = ("Przełączenie stanu sprężarki", "Toggle the compressor"),
|
||||||
|
["compressorenable"] = ("Włączenie sprężarki", "Turn the compressor on"),
|
||||||
|
["compressordisable"] = ("Wyłączenie sprężarki", "Turn the compressor off"),
|
||||||
|
["compressortogglelocal"] = ("Przełączenie stanu sprężarki w obsadzonym członie", "Toggle the compressor in the occupied unit"),
|
||||||
|
["compressorpresetactivatenext"] = ("Następny tryb pracy sprężarek", "Next compressor mode"),
|
||||||
|
["compressorpresetactivateprevious"] = ("Poprzedni tryb pracy sprężarek", "Previous compressor mode"),
|
||||||
|
["compressorpresetactivatedefault"] = ("Domyślny tryb pracy sprężarek", "Default compressor mode"),
|
||||||
|
["motoroverloadrelaythresholdtoggle"] = ("Przełączenie rozruchu niskiego/wysokiego", "Switch between low and high starting current"),
|
||||||
|
["motoroverloadrelaythresholdsetlow"] = ("Niski próg przekaźnika nadmiarowego silników", "Motor overload relay threshold low"),
|
||||||
|
["motoroverloadrelaythresholdsethigh"] = ("Wysoki próg przekaźnika nadmiarowego silników", "Motor overload relay threshold high"),
|
||||||
|
["motoroverloadrelayreset"] = ("Odblokowanie przekaźnika nadmiarowego silników", "Reset the traction motor overload relay"),
|
||||||
|
["universalrelayreset1"] = ("Odblokowanie zdefiniowanych przekaźników nr 1", "Reset the defined relays, set 1"),
|
||||||
|
["universalrelayreset2"] = ("Odblokowanie zdefiniowanych przekaźników nr 2", "Reset the defined relays, set 2"),
|
||||||
|
["universalrelayreset3"] = ("Odblokowanie zdefiniowanych przekaźników nr 3", "Reset the defined relays, set 3"),
|
||||||
|
["notchingrelaytoggle"] = ("Przełączenie stanu przekaźnika samoczynnego rozruchu", "Toggle the automatic notching relay"),
|
||||||
|
["epbrakecontroltoggle"] = ("Przełączenie stanu hamulca elektropneumatycznego", "Toggle the electro-pneumatic brake"),
|
||||||
|
["epbrakecontrolenable"] = ("Włączenie hamulca elektropneumatycznego", "Turn the electro-pneumatic brake on"),
|
||||||
|
["epbrakecontroldisable"] = ("Wyłączenie hamulca elektropneumatycznego", "Turn the electro-pneumatic brake off"),
|
||||||
|
["trainbrakeoperationmodeincrease"] = ("Zmiana trybu pracy hamulca na bardziej efektywny", "Brake operation mode: more effective"),
|
||||||
|
["trainbrakeoperationmodedecrease"] = ("Zmiana trybu pracy hamulca na prostszy", "Brake operation mode: simpler"),
|
||||||
|
["brakeactingspeedincrease"] = ("Wybór szybszego trybu działania hamulca pociągu", "Faster train brake acting speed"),
|
||||||
|
["brakeactingspeeddecrease"] = ("Wybór wolniejszego trybu działania hamulca pociągu", "Slower train brake acting speed"),
|
||||||
|
["brakeactingspeedsetcargo"] = ("Wybór trybu hamulca dla pociągu towarowego", "Brake acting speed for a freight train"),
|
||||||
|
["brakeactingspeedsetpassenger"] = ("Wybór trybu hamulca dla pociągu osobowego", "Brake acting speed for a passenger train"),
|
||||||
|
["brakeactingspeedsetrapid"] = ("Wybór trybu hamulca dla pociągu pospiesznego", "Brake acting speed for an express train"),
|
||||||
|
["brakeloadcompensationincrease"] = ("Wybór wyższego przełożenia hamulca", "Higher brake load setting"),
|
||||||
|
["brakeloadcompensationdecrease"] = ("Wybór niższego przełożenia hamulca", "Lower brake load setting"),
|
||||||
|
["mubrakingindicatortoggle"] = ("Przełączenie stanu wskaźnika hamowania członów EZT", "Toggle the EMU unit braking indicator"),
|
||||||
|
["alerteracknowledge"] = ("Wygaszenie czuwaka i SHP", "Acknowledge the vigilance device and cab signalling"),
|
||||||
|
["cabsignalacknowledge"] = ("Wygaszenie SHP", "Acknowledge the cab signalling"),
|
||||||
|
["hornlowactivate"] = ("Aktywacja syreny niskotonowej", "Low-tone horn"),
|
||||||
|
["hornhighactivate"] = ("Aktywacja syreny wysokotonowej", "High-tone horn"),
|
||||||
|
["whistleactivate"] = ("Aktywacja gwizdka", "Whistle"),
|
||||||
|
["radiotoggle"] = ("Przełączenie stanu radiotelefonu", "Toggle the radio"),
|
||||||
|
["radioenable"] = ("Włączenie radiotelefonu", "Turn the radio on"),
|
||||||
|
["radiodisable"] = ("Wyłączenie radiotelefonu", "Turn the radio off"),
|
||||||
|
["radiochannelincrease"] = ("Wybór kolejnego kanału radia", "Next radio channel"),
|
||||||
|
["radiochanneldecrease"] = ("Wybór poprzedniego kanału radia", "Previous radio channel"),
|
||||||
|
["radiochannelset"] = ("Ustawienie kanału radiotelefonu", "Set the radio channel"),
|
||||||
|
["radiostopsend"] = ("Emisja radiostopu", "Send radio-stop"),
|
||||||
|
["radiostopenable"] = ("Włączenie sygnału Radio-Stop", "Send Radio-Stop"),
|
||||||
|
["radiostopdisable"] = ("Wyłączenie sygnału Radio-Stop", "Stop sending Radio-Stop"),
|
||||||
|
["radiostoptest"] = ("Lokalny test radiostopu", "Local radio-stop test"),
|
||||||
|
["radiocall1send"] = ("Wywołanie radiowe 1", "Radio call 1"),
|
||||||
|
["radiocall3send"] = ("Emisja sygnału zew3", "Send the call-3 signal"),
|
||||||
|
["radiovolumeincrease"] = ("Zwiększenie głośności radia", "Radio volume up"),
|
||||||
|
["radiovolumedecrease"] = ("Zmniejszenie głośności radia", "Radio volume down"),
|
||||||
|
["radiovolumeset"] = ("Ustawienie głośności radiotelefonu", "Set the radio volume"),
|
||||||
|
["radiofusetoggle"] = ("Przełączenie bezpiecznika radiotelefonu", "Toggle the radio fuse"),
|
||||||
|
["radiofuseenable"] = ("Załączenie bezpiecznika radiotelefonu", "Close the radio fuse"),
|
||||||
|
["radiofusedisable"] = ("Wyłączenie bezpiecznika radiotelefonu", "Open the radio fuse"),
|
||||||
|
["cabchangeforward"] = ("Przejście do sąsiedniego pomieszczenia w kierunku czoła pociągu", "Move to the next compartment towards the front"),
|
||||||
|
["cabchangebackward"] = ("Przejście do sąsiedniego pomieszczenia w kierunku tyłu pociągu", "Move to the next compartment towards the rear"),
|
||||||
|
["modernlightdimmerdecrease"] = ("Przyciemnienie oświetlenia", "Dim the lights"),
|
||||||
|
["modernlightdimmerincrease"] = ("Rozjaśnienie oświetlenia", "Brighten the lights"),
|
||||||
|
["nearestcarcouplingincrease"] = ("Łączenie sprzęgów", "Couple"),
|
||||||
|
["nearestcarcouplingdisconnect"] = ("Rozłączenie sprzęgów", "Uncouple"),
|
||||||
|
["nearestcarcoupleradapterattach"] = ("Nałożenie półsprzęgu", "Attach the coupler adapter"),
|
||||||
|
["nearestcarcoupleradapterremove"] = ("Demontaż półsprzęgu", "Remove the coupler adapter"),
|
||||||
|
["occupiedcarcouplingdisconnect"] = ("Rozłączenie sprzęgów po stronie obsadzonej kabiny", "Uncouple at the occupied cab's end"),
|
||||||
|
["occupiedcarcouplingdisconnectback"] = ("Rozłączenie sprzęgu z tyłu zajmowanego pojazdu", "Uncouple at the back of the occupied car"),
|
||||||
|
["doortoggleleft"] = ("Przełączenie stanu drzwi lewych", "Toggle the left doors"),
|
||||||
|
["doortoggleright"] = ("Przełączenie stanu drzwi prawych", "Toggle the right doors"),
|
||||||
|
["doorpermitleft"] = ("Zezwolenie na otwarcie drzwi lewych", "Permit opening the left doors"),
|
||||||
|
["doorpermitright"] = ("Zezwolenie na otwarcie drzwi prawych", "Permit opening the right doors"),
|
||||||
|
["doorpermitpresetactivatenext"] = ("Aktywacja kolejnej konfiguracji zezwolenia na otwarcie drzwi", "Next door permit preset"),
|
||||||
|
["doorpermitpresetactivateprevious"] = ("Aktywacja poprzedniej konfiguracji zezwolenia na otwarcie drzwi", "Previous door permit preset"),
|
||||||
|
["dooropenleft"] = ("Otwarcie drzwi z lewej", "Open the left doors"),
|
||||||
|
["dooropenright"] = ("Otwarcie drzwi z prawej", "Open the right doors"),
|
||||||
|
["dooropenall"] = ("Otwarcie drzwi z zezwoleniem", "Open the permitted doors"),
|
||||||
|
["doorcloseleft"] = ("Zamknięcie drzwi lewych", "Close the left doors"),
|
||||||
|
["doorcloseright"] = ("Zamknięcie drzwi prawych", "Close the right doors"),
|
||||||
|
["doorcloseall"] = ("Zamknięcie wszystkich drzwi", "Close all doors"),
|
||||||
|
["doorsteptoggle"] = ("Przełączenie stanu stopnia drzwi", "Toggle the door steps"),
|
||||||
|
["doormodetoggle"] = ("Przełączenie trybu działania drzwi", "Toggle the door operation mode"),
|
||||||
|
["mirrorstoggle"] = ("Złożenie lub rozłożenie lusterek", "Fold or unfold the mirrors"),
|
||||||
|
["departureannounce"] = ("Sygnał odjazdu", "Departure signal"),
|
||||||
|
["doorlocktoggle"] = ("Przełączenie stanu blokady drzwi", "Toggle the door lock"),
|
||||||
|
["pantographcompressorvalvetoggle"] = ("Przełączenie stanu kurka trójdrogowego", "Toggle the three-way pantograph valve"),
|
||||||
|
["pantographcompressorvalveenable"] = ("Otwarcie zaworu sprężarki pantografów", "Open the pantograph compressor valve"),
|
||||||
|
["pantographcompressorvalvedisable"] = ("Zamknięcie zaworu sprężarki pantografów", "Close the pantograph compressor valve"),
|
||||||
|
["pantographcompressoractivate"] = ("Aktywacja sprężarki pomocniczej", "Auxiliary pantograph compressor"),
|
||||||
|
["pantographtogglefront"] = ("Przełączenie stanu pantografu przedniego", "Toggle the front pantograph"),
|
||||||
|
["pantographtogglerear"] = ("Przełączenie stanu pantografu tylnego", "Toggle the rear pantograph"),
|
||||||
|
["pantographraisefront"] = ("Podniesienie przedniego pantografu", "Raise the front pantograph"),
|
||||||
|
["pantographraiserear"] = ("Podniesienie tylnego pantografu", "Raise the rear pantograph"),
|
||||||
|
["pantographlowerfront"] = ("Opuszczenie przedniego pantografu", "Lower the front pantograph"),
|
||||||
|
["pantographlowerrear"] = ("Opuszczenie tylnego pantografu", "Lower the rear pantograph"),
|
||||||
|
["pantographlowerall"] = ("Opuszczenie wszystkich pantografów", "Lower all pantographs"),
|
||||||
|
["pantographselectnext"] = ("Aktywacja kolejnej konfiguracji wyboru pantografów", "Next pantograph selection preset"),
|
||||||
|
["pantographselectprevious"] = ("Aktywacja poprzedniej konfiguracji wyboru pantografów", "Previous pantograph selection preset"),
|
||||||
|
["pantographtoggleselected"] = ("Przełączenie stanu wybranych pantografów", "Toggle the selected pantographs"),
|
||||||
|
["pantographraiseselected"] = ("Podniesienie wybranych pantografów", "Raise the selected pantographs"),
|
||||||
|
["pantographlowerselected"] = ("Opuszczenie wybranych pantografów", "Lower the selected pantographs"),
|
||||||
|
["pantographvalvesupdate"] = ("Ustawienie zaworów pantografów", "Set the pantograph valves"),
|
||||||
|
["pantographvalvesoff"] = ("Zamknięcie zaworów pantografów", "Close the pantograph valves"),
|
||||||
|
["heatingtoggle"] = ("Przełączenie stanu ogrzewania pociągu", "Toggle train heating"),
|
||||||
|
["heatingenable"] = ("Włączenie ogrzewania pociągu", "Turn the train heating on"),
|
||||||
|
["heatingdisable"] = ("Wyłączenie ogrzewania pociągu", "Turn the train heating off"),
|
||||||
|
["lightspresetactivatenext"] = ("Aktywacja kolejnej konfiguracji reflektorów", "Next headlight preset"),
|
||||||
|
["lightspresetactivateprevious"] = ("Aktywacja poprzedniej konfiguracji reflektorów", "Previous headlight preset"),
|
||||||
|
["headlighttoggleleft"] = ("Przełączenie stanu lewego reflektora", "Toggle the left headlight"),
|
||||||
|
["headlightenableleft"] = ("Włączenie lewego reflektora z przodu", "Turn the front left headlight on"),
|
||||||
|
["headlightdisableleft"] = ("Wyłączenie lewego reflektora z przodu", "Turn the front left headlight off"),
|
||||||
|
["headlighttoggleright"] = ("Przełączenie stanu prawego reflektora", "Toggle the right headlight"),
|
||||||
|
["headlightenableright"] = ("Włączenie prawego reflektora z przodu", "Turn the front right headlight on"),
|
||||||
|
["headlightdisableright"] = ("Wyłączenie prawego reflektora z przodu", "Turn the front right headlight off"),
|
||||||
|
["headlighttoggleupper"] = ("Przełączenie stanu górnego reflektora", "Toggle the upper headlight"),
|
||||||
|
["headlightenableupper"] = ("Włączenie górnego reflektora z przodu", "Turn the front upper headlight on"),
|
||||||
|
["headlightdisableupper"] = ("Wyłączenie górnego reflektora z przodu", "Turn the front upper headlight off"),
|
||||||
|
["redmarkertoggleleft"] = ("Przełączenie lewego światła czerwonego", "Toggle the left red marker"),
|
||||||
|
["redmarkerenableleft"] = ("Włączenie lewego sygnału końcowego z przodu", "Turn the front left red marker on"),
|
||||||
|
["redmarkerdisableleft"] = ("Wyłączenie lewego sygnału końcowego z przodu", "Turn the front left red marker off"),
|
||||||
|
["redmarkertoggleright"] = ("Przełączenie prawego światła czerwonego", "Toggle the right red marker"),
|
||||||
|
["redmarkerenableright"] = ("Włączenie prawego sygnału końcowego z przodu", "Turn the front right red marker on"),
|
||||||
|
["redmarkerdisableright"] = ("Wyłączenie prawego sygnału końcowego z przodu", "Turn the front right red marker off"),
|
||||||
|
["headlighttogglerearleft"] = ("Przełączenie stanu lewego tylnego reflektora", "Toggle the rear left headlight"),
|
||||||
|
["headlightenablerearleft"] = ("Włączenie lewego reflektora z tyłu", "Turn the rear left headlight on"),
|
||||||
|
["headlightdisablerearleft"] = ("Wyłączenie lewego reflektora z tyłu", "Turn the rear left headlight off"),
|
||||||
|
["headlighttogglerearright"] = ("Przełączenie stanu prawego tylnego reflektora", "Toggle the rear right headlight"),
|
||||||
|
["headlightenablerearright"] = ("Włączenie prawego reflektora z tyłu", "Turn the rear right headlight on"),
|
||||||
|
["headlightdisablerearright"] = ("Wyłączenie prawego reflektora z tyłu", "Turn the rear right headlight off"),
|
||||||
|
["headlighttogglerearupper"] = ("Przełączenie stanu górnego tylnego reflektora", "Toggle the rear upper headlight"),
|
||||||
|
["headlightenablerearupper"] = ("Włączenie górnego reflektora z tyłu", "Turn the rear upper headlight on"),
|
||||||
|
["headlightdisablerearupper"] = ("Wyłączenie górnego reflektora z tyłu", "Turn the rear upper headlight off"),
|
||||||
|
["redmarkertogglerearleft"] = ("Przełączenie lewego tylnego światła czerwonego", "Toggle the rear left red marker"),
|
||||||
|
["redmarkerenablerearleft"] = ("Włączenie lewego sygnału końcowego z tyłu", "Turn the rear left red marker on"),
|
||||||
|
["redmarkerdisablerearleft"] = ("Wyłączenie lewego sygnału końcowego z tyłu", "Turn the rear left red marker off"),
|
||||||
|
["redmarkertogglerearright"] = ("Przełączenie prawego tylnego światła czerwonego", "Toggle the rear right red marker"),
|
||||||
|
["redmarkerenablerearright"] = ("Włączenie prawego sygnału końcowego z tyłu", "Turn the rear right red marker on"),
|
||||||
|
["redmarkerdisablerearright"] = ("Wyłączenie prawego sygnału końcowego z tyłu", "Turn the rear right red marker off"),
|
||||||
|
["redmarkerstoggle"] = ("Przełączenie świateł końca pociągu", "Toggle the end-of-train lights"),
|
||||||
|
["endsignalstoggle"] = ("Przełączenie tabliczek końca pociągu", "Toggle the end-of-train plates"),
|
||||||
|
["headlightsdimtoggle"] = ("Przełączenie przyciemnienia reflektorów", "Toggle headlight dimming"),
|
||||||
|
["headlightsdimenable"] = ("Przyciemnienie reflektorów", "Dim the headlights"),
|
||||||
|
["headlightsdimdisable"] = ("Pełne światło reflektorów", "Headlights at full"),
|
||||||
|
["motorconnectorsopen"] = ("Rozłączenie styczników liniowych", "Open the line contactors"),
|
||||||
|
["motorconnectorsclose"] = ("Załączenie styczników liniowych", "Close the line contactors"),
|
||||||
|
["motordisconnect"] = ("Odłączenie uszkodzonych silników", "Cut out the damaged motors"),
|
||||||
|
["interiorlighttoggle"] = ("Przełączenie stanu oświetlenia kabiny", "Toggle the cab light"),
|
||||||
|
["interiorlightenable"] = ("Włączenie oświetlenia kabiny", "Turn the cab light on"),
|
||||||
|
["interiorlightdisable"] = ("Wyłączenie oświetlenia kabiny", "Turn the cab light off"),
|
||||||
|
["interiorlightdimtoggle"] = ("Przełączenie przyciemnienia oświetlenia kabiny", "Toggle cab light dimming"),
|
||||||
|
["interiorlightdimenable"] = ("Przyciemnienie oświetlenia kabiny", "Dim the cab light"),
|
||||||
|
["interiorlightdimdisable"] = ("Pełne oświetlenie kabiny", "Cab light at full"),
|
||||||
|
["compartmentlightstoggle"] = ("Przełączenie stanu oświetlenia przedziałów", "Toggle the compartment lights"),
|
||||||
|
["compartmentlightsenable"] = ("Włączenie oświetlenia przedziałów", "Turn the compartment lights on"),
|
||||||
|
["compartmentlightsdisable"] = ("Wyłączenie oświetlenia przedziałów", "Turn the compartment lights off"),
|
||||||
|
["instrumentlighttoggle"] = ("Przełączenie stanu oświetlenia przyrządów", "Toggle the instrument lights"),
|
||||||
|
["instrumentlightenable"] = ("Włączenie oświetlenia przyrządów", "Turn the instrument lights on"),
|
||||||
|
["instrumentlightdisable"] = ("Wyłączenie oświetlenia przyrządów", "Turn the instrument lights off"),
|
||||||
|
["dashboardlighttoggle"] = ("Przełączenie stanu oświetlenia pulpitu", "Toggle the dashboard light"),
|
||||||
|
["dashboardlightenable"] = ("Włączenie oświetlenia pulpitu", "Turn the dashboard light on"),
|
||||||
|
["dashboardlightdisable"] = ("Wyłączenie oświetlenia pulpitu", "Turn the dashboard light off"),
|
||||||
|
["timetablelighttoggle"] = ("Przełączenie stanu oświetlenia rozkładu jazdy", "Toggle the timetable light"),
|
||||||
|
["timetablelightenable"] = ("Włączenie oświetlenia rozkładu jazdy", "Turn the timetable light on"),
|
||||||
|
["timetablelightdisable"] = ("Wyłączenie oświetlenia rozkładu jazdy", "Turn the timetable light off"),
|
||||||
|
["generictoggle0"] = ("Przełączenie elementu uniwersalnego nr 0", "Generic switch 0"),
|
||||||
|
["generictoggle1"] = ("Przełączenie elementu uniwersalnego nr 1", "Generic switch 1"),
|
||||||
|
["generictoggle2"] = ("Przełączenie elementu uniwersalnego nr 2", "Generic switch 2"),
|
||||||
|
["generictoggle3"] = ("Przełączenie elementu uniwersalnego nr 3", "Generic switch 3"),
|
||||||
|
["generictoggle4"] = ("Przełączenie elementu uniwersalnego nr 4", "Generic switch 4"),
|
||||||
|
["generictoggle5"] = ("Przełączenie elementu uniwersalnego nr 5", "Generic switch 5"),
|
||||||
|
["generictoggle6"] = ("Przełączenie elementu uniwersalnego nr 6", "Generic switch 6"),
|
||||||
|
["generictoggle7"] = ("Przełączenie elementu uniwersalnego nr 7", "Generic switch 7"),
|
||||||
|
["generictoggle8"] = ("Przełączenie elementu uniwersalnego nr 8", "Generic switch 8"),
|
||||||
|
["generictoggle9"] = ("Przełączenie elementu uniwersalnego nr 9", "Generic switch 9"),
|
||||||
|
["generictoggle10"] = ("Przełączenie elementu uniwersalnego nr 10", "Generic switch 10"),
|
||||||
|
["generictoggle11"] = ("Przełączenie elementu uniwersalnego nr 11", "Generic switch 11"),
|
||||||
|
["generictoggle12"] = ("Przełączenie elementu uniwersalnego nr 12", "Generic switch 12"),
|
||||||
|
["generictoggle13"] = ("Przełączenie elementu uniwersalnego nr 13", "Generic switch 13"),
|
||||||
|
["generictoggle14"] = ("Przełączenie elementu uniwersalnego nr 14", "Generic switch 14"),
|
||||||
|
["generictoggle15"] = ("Przełączenie elementu uniwersalnego nr 15", "Generic switch 15"),
|
||||||
|
["generictoggle16"] = ("Przełączenie elementu uniwersalnego nr 16", "Generic switch 16"),
|
||||||
|
["generictoggle17"] = ("Przełączenie elementu uniwersalnego nr 17", "Generic switch 17"),
|
||||||
|
["generictoggle18"] = ("Przełączenie elementu uniwersalnego nr 18", "Generic switch 18"),
|
||||||
|
["generictoggle19"] = ("Przełączenie elementu uniwersalnego nr 19", "Generic switch 19"),
|
||||||
|
["generictoggle20"] = ("Przełączenie elementu uniwersalnego nr 20", "Generic switch 20"),
|
||||||
|
["generictoggle21"] = ("Przełączenie elementu uniwersalnego nr 21", "Generic switch 21"),
|
||||||
|
["generictoggle22"] = ("Przełączenie elementu uniwersalnego nr 22", "Generic switch 22"),
|
||||||
|
["generictoggle23"] = ("Przełączenie elementu uniwersalnego nr 23", "Generic switch 23"),
|
||||||
|
["generictoggle24"] = ("Przełączenie elementu uniwersalnego nr 24", "Generic switch 24"),
|
||||||
|
["generictoggle25"] = ("Przełączenie elementu uniwersalnego nr 25", "Generic switch 25"),
|
||||||
|
["generictoggle26"] = ("Przełączenie elementu uniwersalnego nr 26", "Generic switch 26"),
|
||||||
|
["generictoggle27"] = ("Przełączenie elementu uniwersalnego nr 27", "Generic switch 27"),
|
||||||
|
["generictoggle28"] = ("Przełączenie elementu uniwersalnego nr 28", "Generic switch 28"),
|
||||||
|
["generictoggle29"] = ("Przełączenie elementu uniwersalnego nr 29", "Generic switch 29"),
|
||||||
|
["batterytoggle"] = ("Przełączenie stanu akumulatorów", "Toggle the batteries"),
|
||||||
|
["batteryenable"] = ("Włączenie baterii", "Turn the battery on"),
|
||||||
|
["batterydisable"] = ("Wyłączenie baterii", "Turn the battery off"),
|
||||||
|
["cabactivationtoggle"] = ("Przełączenie stanu aktywacji kabiny", "Toggle cab activation"),
|
||||||
|
["cabactivationenable"] = ("Aktywacja kabiny", "Activate the cab"),
|
||||||
|
["cabactivationdisable"] = ("Dezaktywacja kabiny", "Deactivate the cab"),
|
||||||
|
["motorblowerstogglefront"] = ("Przełączenie stanu wentylatorów przednich silników trakcyjnych", "Toggle the front traction motor blowers"),
|
||||||
|
["motorblowerstogglerear"] = ("Przełączenie stanu wentylatorów tylnych silników trakcyjnych", "Toggle the rear traction motor blowers"),
|
||||||
|
["motorblowersdisableall"] = ("Wyłączenie wszystkich wentylatorów silników trakcyjnych", "Switch off all traction motor blowers"),
|
||||||
|
["coolingfanstoggle"] = ("Przełączenie stanu wentylatorów oporów rozruchowych", "Toggle the starting resistor fans"),
|
||||||
|
["tempomattoggle"] = ("Przełączenie stanu tempomatu", "Toggle the cruise control"),
|
||||||
|
["springbraketoggle"] = ("Przełączenie stanu hamulca sprężynowego", "Toggle the spring brake"),
|
||||||
|
["springbrakeenable"] = ("Załączenie hamulca sprężynowego", "Apply the spring brake"),
|
||||||
|
["springbrakedisable"] = ("Zwolnienie hamulca sprężynowego", "Release the spring brake"),
|
||||||
|
["springbrakeshutofftoggle"] = ("Przełączenie stanu kurka odcinającego hamulca sprężynowego", "Toggle the spring brake shut-off cock"),
|
||||||
|
["springbrakeshutoffenable"] = ("Odcięcie hamulca sprężynowego", "Cut the spring brake off"),
|
||||||
|
["springbrakeshutoffdisable"] = ("Przywrócenie hamulca sprężynowego", "Cut the spring brake back in"),
|
||||||
|
["springbrakerelease"] = ("Luzowanie hamulca sprężynowego", "Release the spring brake"),
|
||||||
|
["distancecounteractivate"] = ("Załączenie miernika przejechanego dystansu", "Start the distance counter"),
|
||||||
|
["speedcontrolincrease"] = ("Zwiększenie prędkości utrzymywanej przez tempomat", "Cruise control speed up"),
|
||||||
|
["speedcontroldecrease"] = ("Zmniejszenie prędkości utrzymywanej przez tempomat", "Cruise control speed down"),
|
||||||
|
["speedcontrolpowerincrease"] = ("Zwiększenie maksymalnego poziomu mocy dostępnej dla tempomatu", "More power for the cruise control"),
|
||||||
|
["speedcontrolpowerdecrease"] = ("Zmniejszenie maksymalnego poziomu mocy dostępnej dla tempomatu", "Less power for the cruise control"),
|
||||||
|
["speedcontrolbutton0"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 0", "Cruise control preset speed 0"),
|
||||||
|
["speedcontrolbutton1"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 1", "Cruise control preset speed 1"),
|
||||||
|
["speedcontrolbutton2"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 2", "Cruise control preset speed 2"),
|
||||||
|
["speedcontrolbutton3"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 3", "Cruise control preset speed 3"),
|
||||||
|
["speedcontrolbutton4"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 4", "Cruise control preset speed 4"),
|
||||||
|
["speedcontrolbutton5"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 5", "Cruise control preset speed 5"),
|
||||||
|
["speedcontrolbutton6"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 6", "Cruise control preset speed 6"),
|
||||||
|
["speedcontrolbutton7"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 7", "Cruise control preset speed 7"),
|
||||||
|
["speedcontrolbutton8"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 8", "Cruise control preset speed 8"),
|
||||||
|
["speedcontrolbutton9"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 9", "Cruise control preset speed 9"),
|
||||||
|
["inverterenable1"] = ("Włączenie falownika 1", "Turn inverter 1 on"),
|
||||||
|
["inverterenable2"] = ("Włączenie falownika 2", "Turn inverter 2 on"),
|
||||||
|
["inverterenable3"] = ("Włączenie falownika 3", "Turn inverter 3 on"),
|
||||||
|
["inverterenable4"] = ("Włączenie falownika 4", "Turn inverter 4 on"),
|
||||||
|
["inverterenable5"] = ("Włączenie falownika 5", "Turn inverter 5 on"),
|
||||||
|
["inverterenable6"] = ("Włączenie falownika 6", "Turn inverter 6 on"),
|
||||||
|
["inverterenable7"] = ("Włączenie falownika 7", "Turn inverter 7 on"),
|
||||||
|
["inverterenable8"] = ("Włączenie falownika 8", "Turn inverter 8 on"),
|
||||||
|
["inverterenable9"] = ("Włączenie falownika 9", "Turn inverter 9 on"),
|
||||||
|
["inverterenable10"] = ("Włączenie falownika 10", "Turn inverter 10 on"),
|
||||||
|
["inverterenable11"] = ("Włączenie falownika 11", "Turn inverter 11 on"),
|
||||||
|
["inverterenable12"] = ("Włączenie falownika 12", "Turn inverter 12 on"),
|
||||||
|
["inverterdisable1"] = ("Wyłączenie falownika 1", "Turn inverter 1 off"),
|
||||||
|
["inverterdisable2"] = ("Wyłączenie falownika 2", "Turn inverter 2 off"),
|
||||||
|
["inverterdisable3"] = ("Wyłączenie falownika 3", "Turn inverter 3 off"),
|
||||||
|
["inverterdisable4"] = ("Wyłączenie falownika 4", "Turn inverter 4 off"),
|
||||||
|
["inverterdisable5"] = ("Wyłączenie falownika 5", "Turn inverter 5 off"),
|
||||||
|
["inverterdisable6"] = ("Wyłączenie falownika 6", "Turn inverter 6 off"),
|
||||||
|
["inverterdisable7"] = ("Wyłączenie falownika 7", "Turn inverter 7 off"),
|
||||||
|
["inverterdisable8"] = ("Wyłączenie falownika 8", "Turn inverter 8 off"),
|
||||||
|
["inverterdisable9"] = ("Wyłączenie falownika 9", "Turn inverter 9 off"),
|
||||||
|
["inverterdisable10"] = ("Wyłączenie falownika 10", "Turn inverter 10 off"),
|
||||||
|
["inverterdisable11"] = ("Wyłączenie falownika 11", "Turn inverter 11 off"),
|
||||||
|
["inverterdisable12"] = ("Wyłączenie falownika 12", "Turn inverter 12 off"),
|
||||||
|
["invertertoggle1"] = ("Przełączenie falownika 1", "Toggle inverter 1"),
|
||||||
|
["invertertoggle2"] = ("Przełączenie falownika 2", "Toggle inverter 2"),
|
||||||
|
["invertertoggle3"] = ("Przełączenie falownika 3", "Toggle inverter 3"),
|
||||||
|
["invertertoggle4"] = ("Przełączenie falownika 4", "Toggle inverter 4"),
|
||||||
|
["invertertoggle5"] = ("Przełączenie falownika 5", "Toggle inverter 5"),
|
||||||
|
["invertertoggle6"] = ("Przełączenie falownika 6", "Toggle inverter 6"),
|
||||||
|
["invertertoggle7"] = ("Przełączenie falownika 7", "Toggle inverter 7"),
|
||||||
|
["invertertoggle8"] = ("Przełączenie falownika 8", "Toggle inverter 8"),
|
||||||
|
["invertertoggle9"] = ("Przełączenie falownika 9", "Toggle inverter 9"),
|
||||||
|
["invertertoggle10"] = ("Przełączenie falownika 10", "Toggle inverter 10"),
|
||||||
|
["invertertoggle11"] = ("Przełączenie falownika 11", "Toggle inverter 11"),
|
||||||
|
["invertertoggle12"] = ("Przełączenie falownika 12", "Toggle inverter 12"),
|
||||||
|
["vehiclemoveforwards"] = ("Przesunięcie pojazdu do przodu", "Move the vehicle forwards"),
|
||||||
|
["vehiclemovebackwards"] = ("Przesunięcie pojazdu do tyłu", "Move the vehicle backwards"),
|
||||||
|
["vehicleboost"] = ("Przyspieszenie pojazdu", "Boost the vehicle"),
|
||||||
|
["wiperswitchincrease"] = ("Szybsza praca wycieraczek", "Wipers faster"),
|
||||||
|
["wiperswitchdecrease"] = ("Wolniejsza praca wycieraczek", "Wipers slower"),
|
||||||
|
["lightsset"] = ("Ustawienie świateł", "Set the lights"),
|
||||||
|
["oilfuelpumptoggle"] = ("Przełączenie pomp oleju i paliwa", "Toggle the oil and fuel pumps"),
|
||||||
|
["linebreakertoggleb"] = ("Przełączenie wyłącznika szybkiego B", "Toggle line breaker B"),
|
||||||
|
["linebreakeropenb"] = ("Wyłączenie wyłącznika szybkiego B", "Open line breaker B"),
|
||||||
|
["linebreakercloseb"] = ("Załączenie wyłącznika szybkiego B", "Close line breaker B"),
|
||||||
|
["linebreakertogglec"] = ("Przełączenie wyłącznika szybkiego C", "Toggle line breaker C"),
|
||||||
|
["linebreakeropenc"] = ("Wyłączenie wyłącznika szybkiego C", "Open line breaker C"),
|
||||||
|
["linebreakerclosec"] = ("Załączenie wyłącznika szybkiego C", "Close line breaker C"),
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>The text of <paramref name="command"/>, Polish for "pl", else English; its name when unknown.</summary>
|
||||||
|
public static string Of(string command, string languageCode) =>
|
||||||
|
Texts.TryGetValue(command, out var text) ? languageCode == "pl" ? text.Polish : text.English : command;
|
||||||
|
|
||||||
|
/// <summary>The commands there are texts for.</summary>
|
||||||
|
public static IEnumerable<string> Commands => Texts.Keys;
|
||||||
|
}
|
||||||
@@ -155,7 +155,9 @@ public sealed class EventList : ListBox
|
|||||||
var culture = CultureInfo.CurrentCulture;
|
var culture = CultureInfo.CurrentCulture;
|
||||||
var events = new List<BlackBoxEvent>();
|
var events = new List<BlackBoxEvent>();
|
||||||
foreach (var c in recording.UserCommands())
|
foreach (var c in recording.UserCommands())
|
||||||
events.Add(new BlackBoxEvent(c.Time, string.Format(culture, strings["EventCommand"], c.Name), Palette.Command, false));
|
events.Add(new BlackBoxEvent(c.Time, string.Format(culture, strings["EventCommand"],
|
||||||
|
strings[DefaultBlackBoxStrings.CommandPrefix + c.Name]),
|
||||||
|
Palette.Command, false));
|
||||||
foreach (var d in recording.DriverChanges)
|
foreach (var d in recording.DriverChanges)
|
||||||
{
|
{
|
||||||
if (recording.CabAt(d.Time + 0.5) is not { } s || s.Vehicle != d.Vehicle)
|
if (recording.CabAt(d.Time + 0.5) is not { } s || s.Vehicle != d.Vehicle)
|
||||||
@@ -176,14 +178,7 @@ public sealed class EventList : ListBox
|
|||||||
foreach (var horn in recording.UserHornChecks())
|
foreach (var horn in recording.UserHornChecks())
|
||||||
events.Add(new BlackBoxEvent(horn.Request.Time, strings[horn.Sounded ? "EventHornSounded" : "EventHornMissed"],
|
events.Add(new BlackBoxEvent(horn.Request.Time, strings[horn.Sounded ? "EventHornSounded" : "EventHornMissed"],
|
||||||
horn.Sounded ? Palette.HornPoint : Palette.Bad, !horn.Sounded));
|
horn.Sounded ? Palette.HornPoint : Palette.Bad, !horn.Sounded));
|
||||||
foreach (var span in recording.SecurityBrakings())
|
AddSecurity(recording, strings, events, culture);
|
||||||
{
|
|
||||||
// Which of them was not acknowledged: the lamps blinking when it braked.
|
|
||||||
string who = recording.CabAt(span.Start) is { } s
|
|
||||||
? s.Has(SecurityFlags.CabSignal) && s.Has(SecurityFlags.Vigilance) ? "CA/SHP" : s.Has(SecurityFlags.CabSignal) ? "SHP" : "CA"
|
|
||||||
: "CA";
|
|
||||||
events.Add(new BlackBoxEvent(span.Start, string.Format(culture, strings["EventSecurityBraking"], who), Palette.Bad, true));
|
|
||||||
}
|
|
||||||
AddCameras(recording, strings, events, culture);
|
AddCameras(recording, strings, events, culture);
|
||||||
AddCouplings(recording, strings, events, culture);
|
AddCouplings(recording, strings, events, culture);
|
||||||
AddCabChanges(recording, strings, events, culture);
|
AddCabChanges(recording, strings, events, culture);
|
||||||
@@ -196,6 +191,45 @@ public sealed class EventList : ListBox
|
|||||||
return events.OrderBy(e => e.Time).ToList();
|
return events.OrderBy(e => e.Time).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The train protection: its buzzer, acknowledged or not, and the braking apart. A lamp acknowledged before the
|
||||||
|
/// buzzer is the driving as usual, not told.
|
||||||
|
/// </summary>
|
||||||
|
private static void AddSecurity(Recording recording, IBlackBoxStrings strings, List<BlackBoxEvent> events, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var brakings = recording.SecurityBrakings();
|
||||||
|
foreach (var span in recording.SecurityAlarms())
|
||||||
|
{
|
||||||
|
// The lamps of all its buzzing samples: one buzzer for both, the other may join it before it's acknowledged.
|
||||||
|
var lamps = recording.Cab.Where(c => c.Time >= span.Start && c.Time <= span.End && (c.VigilanceBuzzer || c.CabSignalBuzzer))
|
||||||
|
.Aggregate(SecurityFlags.None, (all, c) => all | c.Security);
|
||||||
|
string who = ProtectionName(lamps);
|
||||||
|
var before = recording.CabAt(span.Start);
|
||||||
|
string text = brakings.Any(b => b.Start >= span.Start && b.Start <= span.End)
|
||||||
|
? string.Format(culture, strings["EventSecurityAlarmMissed"], who)
|
||||||
|
// Acknowledged when the sample it ended at buzzes no more and doesn't brake, in the same vehicle: not
|
||||||
|
// the end of the recording or a gap in it, nor the power cut or the protection switched off.
|
||||||
|
: recording.CabAt(span.End) is { } after && !after.VigilanceBuzzer && !after.CabSignalBuzzer
|
||||||
|
&& !after.Has(SecurityFlags.Braking) && after.Vehicle == before?.Vehicle
|
||||||
|
? string.Format(culture, strings["EventSecurityAlarmAcknowledged"], who, span.End - span.Start)
|
||||||
|
: string.Format(culture, strings["EventSecurityAlarm"], who);
|
||||||
|
events.Add(new BlackBoxEvent(span.Start, text, Palette.Buzzer, false));
|
||||||
|
}
|
||||||
|
foreach (var span in brakings)
|
||||||
|
events.Add(new BlackBoxEvent(span.Start, string.Format(culture, strings["EventSecurityBraking"],
|
||||||
|
ProtectionName(recording.CabAt(span.Start)?.Security ?? SecurityFlags.None)),
|
||||||
|
Palette.Bad, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Which of them it was: the lamps blinking.</summary>
|
||||||
|
private static string ProtectionName(SecurityFlags lamps) =>
|
||||||
|
(lamps & (SecurityFlags.CabSignal | SecurityFlags.Vigilance)) switch
|
||||||
|
{
|
||||||
|
SecurityFlags.CabSignal | SecurityFlags.Vigilance => "CA/SHP",
|
||||||
|
SecurityFlags.CabSignal => "SHP",
|
||||||
|
_ => "CA"
|
||||||
|
};
|
||||||
|
|
||||||
private static void AddUserVehicles(Recording recording, IBlackBoxStrings strings, List<BlackBoxEvent> events, CultureInfo culture)
|
private static void AddUserVehicles(Recording recording, IBlackBoxStrings strings, List<BlackBoxEvent> events, CultureInfo culture)
|
||||||
{
|
{
|
||||||
UserVehicleChange? before = null;
|
UserVehicleChange? before = null;
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public static class Palette
|
|||||||
public static readonly IBrush LampOn = Brush("#4cc46e");
|
public static readonly IBrush LampOn = Brush("#4cc46e");
|
||||||
public static readonly IBrush LampWarning = Brush("#e8c547");
|
public static readonly IBrush LampWarning = Brush("#e8c547");
|
||||||
public static readonly IBrush LampAlarm = Brush("#f0584a");
|
public static readonly IBrush LampAlarm = Brush("#f0584a");
|
||||||
|
/// <summary>The train protection's buzzer: still to be acknowledged, not braking yet.</summary>
|
||||||
|
public static readonly IBrush Buzzer = Brush("#c77dff");
|
||||||
public static readonly IBrush LightWhite = Brush("#fff6d8");
|
public static readonly IBrush LightWhite = Brush("#fff6d8");
|
||||||
public static readonly IBrush LightRed = Brush("#ff3b30");
|
public static readonly IBrush LightRed = Brush("#ff3b30");
|
||||||
public static readonly IBrush Command = Brush("#8b96a3");
|
public static readonly IBrush Command = Brush("#8b96a3");
|
||||||
|
|||||||
@@ -309,16 +309,16 @@ public sealed class TimelineView : Control
|
|||||||
rows[2].Add(x0, x1, s.BrakeCylinder > 0.2f ? BrakeShade(s.BrakeCylinder) : null, BandHeight);
|
rows[2].Add(x0, x1, s.BrakeCylinder > 0.2f ? BrakeShade(s.BrakeCylinder) : null, BandHeight);
|
||||||
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
||||||
{
|
{
|
||||||
// The alerter and the cab signalling apart, red when not acknowledged in time.
|
// The alerter and the cab signalling apart: the lamp, then its buzzer, red when it braked.
|
||||||
rows[3].Add(x0, x1, s.Has(SecurityFlags.VigilanceBeeping) ? Palette.LampAlarm
|
rows[3].Add(x0, x1, s.VigilanceBuzzer ? Palette.Buzzer
|
||||||
: s.Has(SecurityFlags.Vigilance) ? Palette.Vigilance : null, BandHeight);
|
: s.Has(SecurityFlags.Vigilance) ? Palette.Vigilance : null, BandHeight);
|
||||||
rows[4].Add(x0, x1, s.Has(SecurityFlags.CabSignalBeeping) ? Palette.LampAlarm
|
rows[4].Add(x0, x1, s.CabSignalBuzzer ? Palette.Buzzer
|
||||||
: s.Has(SecurityFlags.CabSignal) ? Palette.CabSignal : null, BandHeight);
|
: s.Has(SecurityFlags.CabSignal) ? Palette.CabSignal : null, BandHeight);
|
||||||
if (s.Has(SecurityFlags.Braking))
|
if (s.ProtectionBraking)
|
||||||
rows[s.Has(SecurityFlags.CabSignal) && !s.Has(SecurityFlags.Vigilance) ? 4 : 3].Add(x0, x1, Palette.Bad, BandHeight);
|
rows[s.Has(SecurityFlags.CabSignal) && !s.Has(SecurityFlags.Vigilance) ? 4 : 3].Add(x0, x1, Palette.Bad, BandHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rows[3].Add(x0, x1, (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.LampAlarm
|
rows[3].Add(x0, x1, (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.Buzzer
|
||||||
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.Vigilance : null, BandHeight);
|
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.Vigilance : null, BandHeight);
|
||||||
// Where the user looked from: the samples go on in time, and so does the camera.
|
// Where the user looked from: the samples go on in time, and so does the camera.
|
||||||
while (camera + 1 < cameras.Count && cameras[camera + 1].Time <= s.Time)
|
while (camera + 1 < cameras.Count && cameras[camera + 1].Time <= s.Time)
|
||||||
@@ -590,7 +590,8 @@ public sealed class TimelineView : Control
|
|||||||
foreach (var d in recording.DriverChanges)
|
foreach (var d in recording.DriverChanges)
|
||||||
Consider(d.Time, () => Strings[d.Driving == Driver.Ai ? "TlAutopilotOn" : "TlAutopilotOff"]);
|
Consider(d.Time, () => Strings[d.Driving == Driver.Ai ? "TlAutopilotOn" : "TlAutopilotOff"]);
|
||||||
foreach (var c in recording.UserCommands())
|
foreach (var c in recording.UserCommands())
|
||||||
Consider(c.Time, () => string.Format(culture, Strings["TlCommand"], c.Name));
|
Consider(c.Time, () => string.Format(culture, Strings["TlCommand"],
|
||||||
|
Strings[DefaultBlackBoxStrings.CommandPrefix + c.Name]));
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -520,7 +520,13 @@ public sealed class Recording
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>When the train protection braked the user's train: the alerter or the cab signalling not acknowledged.</summary>
|
/// <summary>When the train protection braked the user's train: the alerter or the cab signalling not acknowledged.</summary>
|
||||||
public IReadOnlyList<TimeSpanRange> SecurityBrakings() => CabSpans(s => s.Has(SecurityFlags.Braking));
|
public IReadOnlyList<TimeSpanRange> SecurityBrakings() => CabSpans(s => s.ProtectionBraking);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the train protection's buzzer sounded in the user's cab: a lamp not acknowledged in time, the braking to
|
||||||
|
/// follow unless acknowledged on. Until it ends, braking included.
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<TimeSpanRange> SecurityAlarms() => CabSpans(s => s.VigilanceBuzzer || s.CabSignalBuzzer);
|
||||||
|
|
||||||
/// <summary>The commands the user gave in a vehicle, presses only.</summary>
|
/// <summary>The commands the user gave in a vehicle, presses only.</summary>
|
||||||
public IEnumerable<CommandEntry> UserCommands() => _commands.Where(c => c.Pressed && c.Vehicle != 0);
|
public IEnumerable<CommandEntry> UserCommands() => _commands.Where(c => c.Pressed && c.Vehicle != 0);
|
||||||
|
|||||||
@@ -371,6 +371,21 @@ public readonly record struct CabSample(double Time, int Vehicle, Position Posit
|
|||||||
public bool Has(CabDevices device) => (Devices & device) == device;
|
public bool Has(CabDevices device) => (Devices & device) == device;
|
||||||
public bool Has(SecurityFlags flag) => (Security & flag) == flag;
|
public bool Has(SecurityFlags flag) => (Security & flag) == flag;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The alerter's buzzer: its lamp not acknowledged in time. A protection with one acknowledgement for both tells
|
||||||
|
/// the cab signalling's buzzer as the alerter's too, so the alerter's lamp has to blink with it.
|
||||||
|
/// </summary>
|
||||||
|
public bool VigilanceBuzzer => Has(SecurityFlags.VigilanceBeeping) && Has(SecurityFlags.Vigilance);
|
||||||
|
|
||||||
|
/// <summary>The cab signalling's buzzer: its lamp not acknowledged in time.</summary>
|
||||||
|
public bool CabSignalBuzzer => Has(SecurityFlags.CabSignalBeeping);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The train protection braking for an alarm not acknowledged, its lamp blinking. Braking with no lamp is the
|
||||||
|
/// protection with no power (TSecuritySystem::is_braking), a cab not started or a power cut: no driver's fault.
|
||||||
|
/// </summary>
|
||||||
|
public bool ProtectionBraking => Has(SecurityFlags.Braking) && (Has(SecurityFlags.Vigilance) || Has(SecurityFlags.CabSignal));
|
||||||
|
|
||||||
public bool AiValid => (Flags & CabFlags.AiValid) != 0;
|
public bool AiValid => (Flags & CabFlags.AiValid) != 0;
|
||||||
public bool InCab => (Flags & CabFlags.InCab) != 0;
|
public bool InCab => (Flags & CabFlags.InCab) != 0;
|
||||||
public float AbsSpeedKmh => Math.Abs(SpeedKmh);
|
public float AbsSpeedKmh => Math.Abs(SpeedKmh);
|
||||||
|
|||||||
43
StarterNG.Tests/BlackBox/EventTextsTests.cs
Normal file
43
StarterNG.Tests/BlackBox/EventTextsTests.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using Eu07.BlackBox;
|
||||||
|
using Eu07.BlackBox.Views;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests.BlackBox;
|
||||||
|
|
||||||
|
public class EventTextsTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("pl", "aidriverenable", "Aktywacja automechanika")]
|
||||||
|
[InlineData("en", "aidriverenable", "Engage the AI driver")]
|
||||||
|
[InlineData("pl", "mastercontrollerset", "Ustawienie nastawnika głównego")]
|
||||||
|
[InlineData("pl", "headlightenablerearleft", "Włączenie lewego reflektora z tyłu")]
|
||||||
|
[InlineData("cz", "batteryenable", "Turn the battery on")]
|
||||||
|
public void A_command_is_told_by_what_it_does(string language, string command, string text) =>
|
||||||
|
Assert.Equal(text, new DefaultBlackBoxStrings(language)[DefaultBlackBoxStrings.CommandPrefix + command]);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_command_with_no_text_keeps_its_name() =>
|
||||||
|
Assert.Equal("somethingnew", new DefaultBlackBoxStrings("pl")[DefaultBlackBoxStrings.CommandPrefix + "somethingnew"]);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Every_command_has_both_texts_starting_with_a_capital()
|
||||||
|
{
|
||||||
|
foreach (string command in CommandTexts.Commands)
|
||||||
|
foreach (string language in new[] { "pl", "en" })
|
||||||
|
{
|
||||||
|
string text = CommandTexts.Of(command, language);
|
||||||
|
Assert.NotEqual(command, text);
|
||||||
|
Assert.True(char.IsUpper(text[0]), $"{command} ({language}): {text}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_events_name_the_commands_by_what_they_do()
|
||||||
|
{
|
||||||
|
var recording = BlackBoxReader.Read(new BlackBoxFile().Info()
|
||||||
|
.Vehicle(1, "EP07-424").User(0, 1, true).Command(12.0, 1, true, "batteryenable").Stream());
|
||||||
|
|
||||||
|
var events = EventList.Collect(recording, new DefaultBlackBoxStrings("pl"));
|
||||||
|
|
||||||
|
Assert.Contains(events, e => e.Text == "Włączenie baterii");
|
||||||
|
}
|
||||||
|
}
|
||||||
88
StarterNG.Tests/BlackBox/SecurityBrakingTests.cs
Normal file
88
StarterNG.Tests/BlackBox/SecurityBrakingTests.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using Eu07.BlackBox;
|
||||||
|
using Eu07.BlackBox.Views;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests.BlackBox;
|
||||||
|
|
||||||
|
public class SecurityBrakingTests
|
||||||
|
{
|
||||||
|
// as the simulator writes them: one acknowledgement for both, so the cab signalling's buzzer is the alerter's too
|
||||||
|
private const byte CabSignal = 0x02, CabSignalBuzzing = 0x0e, CabSignalBraking = 0x1e, NoPower = 0x10;
|
||||||
|
|
||||||
|
private static Recording Drive(System.Func<double, byte> security)
|
||||||
|
{
|
||||||
|
var file = new BlackBoxFile().Info().Vehicle(1, "EP07-424").User(0, 1, true);
|
||||||
|
for (double t = 0; t <= 20; t += 0.5)
|
||||||
|
file.Cab(t, 1, 100, 0, security: security(t));
|
||||||
|
return BlackBoxReader.Read(file.Stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<string> Events(Recording recording)
|
||||||
|
{
|
||||||
|
var culture = CultureInfo.CurrentCulture;
|
||||||
|
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return EventList.Collect(recording, new DefaultBlackBoxStrings("pl")).Select(e => e.Text).ToList();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
CultureInfo.CurrentCulture = culture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_protection_braking_with_no_power_is_not_the_drivers_fault()
|
||||||
|
{
|
||||||
|
// no power for the first seconds, then the cab signalling not acknowledged
|
||||||
|
var recording = Drive(t => t < 5 ? NoPower : t is >= 10 and < 12 ? (byte)0x1a : (byte)0);
|
||||||
|
|
||||||
|
var braking = Assert.Single(recording.SecurityBrakings());
|
||||||
|
Assert.Equal(10, braking.Start, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_buzzer_acknowledged_in_time_is_told_apart_from_braking()
|
||||||
|
{
|
||||||
|
var recording = Drive(t => t is >= 2 and < 4 ? CabSignal : t is >= 4 and < 5.5 ? CabSignalBuzzing : (byte)0);
|
||||||
|
|
||||||
|
var events = Events(recording);
|
||||||
|
|
||||||
|
Assert.Contains("Brzęczyk SHP, potwierdzony po 1.5 s", events);
|
||||||
|
Assert.DoesNotContain(events, e => e.StartsWith("HAMOWANIE", System.StringComparison.Ordinal));
|
||||||
|
Assert.Empty(recording.SecurityBrakings());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_buzzer_cut_by_the_power_is_not_acknowledged()
|
||||||
|
{
|
||||||
|
var recording = Drive(t => t is >= 2 and < 4 ? CabSignalBuzzing : t is >= 4 and < 8 ? NoPower : (byte)0);
|
||||||
|
|
||||||
|
var events = Events(recording);
|
||||||
|
|
||||||
|
Assert.Contains("Brzęczyk SHP", events);
|
||||||
|
Assert.DoesNotContain(events, e => e.Contains("potwierdzony", System.StringComparison.Ordinal));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_buzzer_the_other_joins_is_named_by_both()
|
||||||
|
{
|
||||||
|
// the alerter's buzzer, then a magnet passed before it's acknowledged
|
||||||
|
var recording = Drive(t => t is >= 2 and < 4 ? (byte)0x05 : t is >= 4 and < 5 ? (byte)0x0f : (byte)0);
|
||||||
|
|
||||||
|
Assert.Contains("Brzęczyk CA/SHP, potwierdzony po 3.0 s", Events(recording));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_buzzer_not_acknowledged_is_followed_by_the_braking()
|
||||||
|
{
|
||||||
|
// the cab signalling at the start: the buzzer at once, braking when not acknowledged
|
||||||
|
var recording = Drive(t => t < 3 ? CabSignalBuzzing : t < 6 ? CabSignalBraking : (byte)0);
|
||||||
|
|
||||||
|
var events = Events(recording);
|
||||||
|
|
||||||
|
Assert.Equal(["Brzęczyk SHP, bez potwierdzenia", "HAMOWANIE PRZEZ SHP"],
|
||||||
|
events.Where(e => e.Contains("SHP", System.StringComparison.Ordinal)));
|
||||||
|
Assert.DoesNotContain(events, e => e.Contains("CA", System.StringComparison.Ordinal));
|
||||||
|
}
|
||||||
|
}
|
||||||
119
StarterNG.Tests/CaseInsensitivePathsTests.cs
Normal file
119
StarterNG.Tests/CaseInsensitivePathsTests.cs
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
using StarterNG.Infrastructure;
|
||||||
|
using StarterNG.Tests.Fakes;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class CaseInsensitivePathsTests
|
||||||
|
{
|
||||||
|
private static InMemoryFileSystem Disk() => new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile("game/scenery/Braniewo/Base.ctr", "")
|
||||||
|
.WithFile("game/scenery/Braniewo/rozklady/TGS3657.txt", "")
|
||||||
|
.WithDirectory("game/textures/mini");
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("braniewo/base.ctr", "Braniewo/Base.ctr")]
|
||||||
|
[InlineData(@"BRANIEWO\Rozklady\tgs3657.TXT", "Braniewo/rozklady/TGS3657.txt")]
|
||||||
|
[InlineData("Braniewo/Base.ctr", "Braniewo/Base.ctr")]
|
||||||
|
[InlineData("braniewo//base.ctr", "Braniewo/Base.ctr")]
|
||||||
|
[InlineData("/braniewo/base.ctr", "Braniewo/Base.ctr")]
|
||||||
|
[InlineData(@"\Braniewo\Base.ctr", "Braniewo/Base.ctr")]
|
||||||
|
public void A_name_in_any_case_is_given_as_it_is_on_disk(string name, string onDisk) =>
|
||||||
|
Assert.Equal(onDisk, new CaseInsensitivePaths(Disk()).Resolve("game/scenery", name));
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("braniewo/brak.ctr")]
|
||||||
|
[InlineData("brak/base.ctr")]
|
||||||
|
[InlineData("")]
|
||||||
|
public void A_name_nothing_answers_to_is_not_found(string name) =>
|
||||||
|
Assert.Null(new CaseInsensitivePaths(Disk()).Resolve("game/scenery", name));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_folder_is_found_only_when_one_is_asked_for()
|
||||||
|
{
|
||||||
|
var names = new CaseInsensitivePaths(Disk());
|
||||||
|
|
||||||
|
Assert.Equal("Braniewo/rozklady", names.Resolve("game/scenery", "braniewo/ROZKLADY", directory: true));
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/ROZKLADY"));
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/base.ctr", directory: true));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_name_written_as_on_disk_wins_over_one_in_other_case()
|
||||||
|
{
|
||||||
|
var files = Disk().WithFile("game/scenery/braniewo/base.ctr", "");
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
|
||||||
|
Assert.Equal("braniewo/base.ctr", names.Resolve("game/scenery", "braniewo/base.ctr"));
|
||||||
|
Assert.Equal("Braniewo/Base.ctr", names.Resolve("game/scenery", "Braniewo/base.CTR"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Of_folders_named_alike_the_one_holding_the_file_is_taken()
|
||||||
|
{
|
||||||
|
var files = Disk().WithFile("game/scenery/braniewo/tory.scm", "");
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
|
||||||
|
Assert.Equal("Braniewo/Base.ctr", names.Resolve("game/scenery", "braniewo/base.ctr"));
|
||||||
|
Assert.Equal("braniewo/tory.scm", names.Resolve("game/scenery", "Braniewo/Tory.scm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_full_path_joins_the_folder_and_the_name_on_disk() =>
|
||||||
|
Assert.Equal(Path.Combine("game/scenery", "Braniewo", "Base.ctr"),
|
||||||
|
new CaseInsensitivePaths(Disk()).Find("game/scenery", "BRANIEWO/BASE.CTR"));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_full_path_is_found_from_its_own_root()
|
||||||
|
{
|
||||||
|
string scenery = Path.GetFullPath(Path.Combine("game", "scenery"));
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(Path.Combine(scenery, "Braniewo", "Base.ctr"), "");
|
||||||
|
|
||||||
|
Assert.Equal(Path.Combine(scenery, "Braniewo", "Base.ctr"),
|
||||||
|
new CaseInsensitivePaths(files).Find("elsewhere", Path.Combine(scenery, "BRANIEWO", "base.CTR")));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_disk_that_ignores_case_gives_the_name_back_as_written()
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem().WithFile("game/scenery/Braniewo/Base.ctr", "");
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
|
||||||
|
Assert.Equal("BRANIEWO/base.CTR", names.Resolve("game/scenery", "BRANIEWO/base.CTR"));
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/brak.ctr"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Kept_listings_hold_until_forgotten()
|
||||||
|
{
|
||||||
|
var files = Disk();
|
||||||
|
var names = new CaseInsensitivePaths(files, keepListings: true);
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/nowy.scm"));
|
||||||
|
|
||||||
|
files.WithFile("game/scenery/Braniewo/Nowy.scm", "");
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/nowy.scm"));
|
||||||
|
|
||||||
|
names.Forget();
|
||||||
|
Assert.Equal("Braniewo/Nowy.scm", names.Resolve("game/scenery", "braniewo/nowy.scm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Listings_not_kept_see_a_file_added_since()
|
||||||
|
{
|
||||||
|
var files = Disk();
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
Assert.Null(names.Resolve("game/scenery", "braniewo/nowy.scm"));
|
||||||
|
|
||||||
|
files.WithFile("game/scenery/Braniewo/Nowy.scm", "");
|
||||||
|
|
||||||
|
Assert.Equal("Braniewo/Nowy.scm", names.Resolve("game/scenery", "braniewo/nowy.scm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_folder_that_cannot_be_listed_holds_nothing_to_find()
|
||||||
|
{
|
||||||
|
var files = Disk().DenyListing("game/scenery");
|
||||||
|
|
||||||
|
Assert.Null(new CaseInsensitivePaths(files).Resolve("game/scenery", "braniewo/base.ctr"));
|
||||||
|
}
|
||||||
|
}
|
||||||
53
StarterNG.Tests/ExecutableListTests.cs
Normal file
53
StarterNG.Tests/ExecutableListTests.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using StarterNG.Views;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class ExecutableListTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void A_build_copied_in_joins_the_list_and_the_choice_stays()
|
||||||
|
{
|
||||||
|
var (entries, chosen) = ExecutableList.Refreshed(["eu07_new.exe", "eu07.exe"], "eu07.exe");
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "eu07_new.exe", "eu07.exe" }, entries);
|
||||||
|
Assert.Equal(1, chosen);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Automatic_stays_automatic()
|
||||||
|
{
|
||||||
|
var (entries, chosen) = ExecutableList.Refreshed(["eu07_new.exe", "eu07.exe"], null);
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "eu07_new.exe", "eu07.exe" }, entries);
|
||||||
|
Assert.Equal(-1, chosen);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_simulator_picked_from_elsewhere_stays_on_the_list_and_chosen()
|
||||||
|
{
|
||||||
|
const string picked = @"D:\build\eu07.exe";
|
||||||
|
|
||||||
|
var (entries, chosen) = ExecutableList.Refreshed(["eu07.exe"], picked);
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "eu07.exe", picked }, entries);
|
||||||
|
Assert.Equal(1, chosen);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_chosen_file_since_removed_stays_chosen_rather_than_switch_silently()
|
||||||
|
{
|
||||||
|
var (entries, chosen) = ExecutableList.Refreshed(["eu07.exe"], "eu07_old.exe");
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "eu07.exe", "eu07_old.exe" }, entries);
|
||||||
|
Assert.Equal(1, chosen);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_choice_is_found_whatever_the_case_of_its_name()
|
||||||
|
{
|
||||||
|
var (entries, chosen) = ExecutableList.Refreshed(["EU07.exe"], "eu07.exe");
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "EU07.exe" }, entries);
|
||||||
|
Assert.Equal(0, chosen);
|
||||||
|
}
|
||||||
|
}
|
||||||
82
StarterNG.Tests/ExecutableNoAvx2Tests.cs
Normal file
82
StarterNG.Tests/ExecutableNoAvx2Tests.cs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
using StarterNG.Domain.Settings;
|
||||||
|
using StarterNG.Infrastructure.Settings;
|
||||||
|
using StarterNG.Tests.Fakes;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class ExecutableNoAvx2Tests
|
||||||
|
{
|
||||||
|
private const string Elf = "\u007fELF binary";
|
||||||
|
private static readonly DateTime Older = new(2026, 11, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
private static readonly DateTime Newer = new(2026, 11, 15, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
private static InMemoryFileSystem With(params string[] names)
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem();
|
||||||
|
foreach (string name in names)
|
||||||
|
files.WithExecutable(TestInstallation.At(name), Elf);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string Automatic(InMemoryFileSystem files, bool lacksAvx2) =>
|
||||||
|
Path.GetFileName(new TestInstallation(files, lacksAvx2: lacksAvx2).Executables
|
||||||
|
.Resolve(new SimulatorSettings(), out _));
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("eu07_noavx2", true)]
|
||||||
|
[InlineData("eu07-x64_2026-11-15_abc1234_noavx2.exe", true)]
|
||||||
|
[InlineData("EU07_NOAVX2.EXE", true)]
|
||||||
|
[InlineData("eu07", false)]
|
||||||
|
[InlineData("eu07-x64_2026-11-15_abc1234.exe", false)]
|
||||||
|
[InlineData("eu07_noavx2_old.exe", false)]
|
||||||
|
public void A_build_without_avx2_is_known_by_the_end_of_its_name(string name, bool noAvx2) =>
|
||||||
|
Assert.Equal(noAvx2, ExecutableLocator.IsNoAvx2(name));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Without_avx2_the_build_without_it_is_chosen_over_the_canonical_one() =>
|
||||||
|
Assert.Equal("eu07_noavx2", Automatic(With("eu07", "eu07_noavx2"), lacksAvx2: true));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void With_avx2_the_build_made_for_it_stays_first() =>
|
||||||
|
Assert.Equal("eu07", Automatic(With("eu07", "eu07_noavx2"), lacksAvx2: false));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void With_avx2_a_build_without_it_is_used_when_it_is_the_only_one() =>
|
||||||
|
Assert.Equal("eu07_noavx2", Automatic(With("eu07_noavx2"), lacksAvx2: false));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Without_avx2_the_newest_build_without_it_is_chosen()
|
||||||
|
{
|
||||||
|
var files = With("eu07_2026-11-01_aaa_noavx2", "eu07_2026-11-15_bbb_noavx2")
|
||||||
|
.WrittenAt(TestInstallation.At("eu07_2026-11-01_aaa_noavx2"), Older)
|
||||||
|
.WrittenAt(TestInstallation.At("eu07_2026-11-15_bbb_noavx2"), Newer);
|
||||||
|
|
||||||
|
Assert.Equal("eu07_2026-11-15_bbb_noavx2", Automatic(files, lacksAvx2: true));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Without_avx2_and_no_build_without_it_the_usual_choice_stands() =>
|
||||||
|
Assert.Equal("eu07", Automatic(With("eu07-dev", "eu07"), lacksAvx2: true));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Only_a_build_with_avx2_on_a_processor_without_it_will_not_run()
|
||||||
|
{
|
||||||
|
var lacking = new TestInstallation(lacksAvx2: true).Executables;
|
||||||
|
var able = new TestInstallation(lacksAvx2: false).Executables;
|
||||||
|
|
||||||
|
Assert.True(lacking.WillNotRunHere("eu07.exe"));
|
||||||
|
Assert.False(lacking.WillNotRunHere("eu07-x64_noavx2.exe"));
|
||||||
|
Assert.False(able.WillNotRunHere("eu07.exe"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_newest_build_without_avx2_is_offered_by_name()
|
||||||
|
{
|
||||||
|
var files = With("eu07", "eu07_2026-11-01_aaa_noavx2", "eu07_2026-11-15_bbb_noavx2")
|
||||||
|
.WrittenAt(TestInstallation.At("eu07_2026-11-01_aaa_noavx2"), Older)
|
||||||
|
.WrittenAt(TestInstallation.At("eu07_2026-11-15_bbb_noavx2"), Newer);
|
||||||
|
|
||||||
|
Assert.Equal("eu07_2026-11-15_bbb_noavx2", new TestInstallation(files).Executables.NewestNoAvx2());
|
||||||
|
Assert.Null(new TestInstallation(With("eu07")).Executables.NewestNoAvx2());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -97,6 +97,8 @@ public sealed class InMemoryFileSystem : IFileSystem
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IgnoresCase => _comparison == StringComparison.OrdinalIgnoreCase;
|
||||||
|
|
||||||
public bool FileExists(string path) => _files.ContainsKey(Normalize(path));
|
public bool FileExists(string path) => _files.ContainsKey(Normalize(path));
|
||||||
|
|
||||||
/// <summary>A link counts as the directory it points at, as the disk has it.</summary>
|
/// <summary>A link counts as the directory it points at, as the disk has it.</summary>
|
||||||
@@ -273,6 +275,9 @@ public sealed class InMemoryFileSystem : IFileSystem
|
|||||||
return;
|
return;
|
||||||
slash = key.LastIndexOf('/');
|
slash = key.LastIndexOf('/');
|
||||||
}
|
}
|
||||||
|
// An absolute Unix path's parent is the root, "/", which normalises to "".
|
||||||
|
if (slash == 0)
|
||||||
|
_directories.Add("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Normalize(string path) =>
|
private static string Normalize(string path) =>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public sealed class TestInstallation
|
|||||||
{
|
{
|
||||||
public const string Root = "game";
|
public const string Root = "game";
|
||||||
|
|
||||||
public TestInstallation(InMemoryFileSystem? files = null, DateTime? now = null)
|
public TestInstallation(InMemoryFileSystem? files = null, DateTime? now = null, bool lacksAvx2 = false)
|
||||||
{
|
{
|
||||||
Files = files ?? new InMemoryFileSystem();
|
Files = files ?? new InMemoryFileSystem();
|
||||||
Paths = new GamePaths(Root);
|
Paths = new GamePaths(Root);
|
||||||
@@ -35,7 +35,8 @@ public sealed class TestInstallation
|
|||||||
SettingsPaths.VehicleCacheDirectory());
|
SettingsPaths.VehicleCacheDirectory());
|
||||||
Library = new GameLibrary(VehicleCache, Sceneries, MiniTextures, Physics, Log);
|
Library = new GameLibrary(VehicleCache, Sceneries, MiniTextures, Physics, Log);
|
||||||
|
|
||||||
Executables = new ExecutableLocator(Files, Paths, Environment, Log);
|
// The processor of the machine running the tests is not the one tested.
|
||||||
|
Executables = new ExecutableLocator(Files, Paths, Environment, Log, lacksAvx2);
|
||||||
SettingsStore = new SettingsStore(Files, Clock, Log, SettingsPaths, new SettingsSerializer(), Executables);
|
SettingsStore = new SettingsStore(Files, Clock, Log, SettingsPaths, new SettingsSerializer(), Executables);
|
||||||
Tapes = new HaslerTapes(Files, Paths, Log, Clock, new TimetableLocator(Files), () => SimulatorRunning);
|
Tapes = new HaslerTapes(Files, Paths, Log, Clock, new TimetableLocator(Files), () => SimulatorRunning);
|
||||||
}
|
}
|
||||||
|
|||||||
28
StarterNG.Tests/LoadingScreenLogoTests.cs
Normal file
28
StarterNG.Tests/LoadingScreenLogoTests.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using StarterNG.Infrastructure;
|
||||||
|
using StarterNG.Tests.Fakes;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class LoadingScreenLogoTests
|
||||||
|
{
|
||||||
|
private static InMemoryFileSystem Logos() => new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile("game/Textures/Logo/EP09_Logo.PNG", "png")
|
||||||
|
.WithFile("game/Textures/Logo/Braniewo.JPG", "jpg")
|
||||||
|
.WithFile("game/Textures/Logo/Logo1.BMP", "bmp")
|
||||||
|
.WithFile("game/Textures/Logo/notes.txt", "");
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("ep09_logo", null, "EP09_Logo.PNG")]
|
||||||
|
[InlineData("ep09_logo.bmp", "braniewo", "EP09_Logo.PNG")]
|
||||||
|
[InlineData(null, "braniewo", "Braniewo.JPG")]
|
||||||
|
[InlineData("brak", "brak", "Logo1.BMP")]
|
||||||
|
public void The_logo_is_found_whatever_the_case_of_its_name_and_extension(string? logo, string? scenery,
|
||||||
|
string onDisk) =>
|
||||||
|
Assert.Equal(Path.GetFullPath(Path.Combine("game", "Textures", "Logo", onDisk)),
|
||||||
|
Path.GetFullPath(LoadingScreen.FindSource(Logos(), "game", logo, scenery, new Random(1))!));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void With_no_logo_folder_there_is_no_logo() =>
|
||||||
|
Assert.Null(LoadingScreen.FindSource(new InMemoryFileSystem(caseSensitive: true), "game", "x", "y",
|
||||||
|
new Random(1)));
|
||||||
|
}
|
||||||
@@ -21,6 +21,20 @@ public sealed class PhysicalFileSystemTests : IDisposable
|
|||||||
Assert.Equal(new[] { path }, Directory.GetFiles(_root));
|
Assert.Equal(new[] { path }, Directory.GetFiles(_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_pattern_lists_names_in_any_letter_case()
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.Combine(_root, "PKP", "EP09"));
|
||||||
|
foreach (string name in new[] { "Braniewo.SCN", "kato.scn", "notes.txt", Path.Combine("PKP", "EP09", "EP09.FIZ"),
|
||||||
|
Path.Combine("PKP", "EP09", "ep09dumb.fiz") })
|
||||||
|
File.WriteAllText(Path.Combine(_root, name), "");
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "Braniewo.SCN", "kato.scn" },
|
||||||
|
_files.GetFiles(_root, "*.scn").Select(Path.GetFileName).Order(StringComparer.Ordinal));
|
||||||
|
Assert.Equal(new[] { "EP09.FIZ", "ep09dumb.fiz" },
|
||||||
|
_files.GetFilesRecursive(_root, "*.fiz").Select(Path.GetFileName).Order(StringComparer.Ordinal));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void An_atomic_write_that_cannot_finish_leaves_what_stood_there()
|
public void An_atomic_write_that_cannot_finish_leaves_what_stood_there()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,6 +65,19 @@ public class PhysicsAndAssetsTests
|
|||||||
Assert.Equal(125, physics.VMax);
|
Assert.Equal(125, physics.VMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void An_include_named_in_other_case_is_followed()
|
||||||
|
{
|
||||||
|
var installation = new TestInstallation(new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(Fiz("pkp", "ep07", "ep07"), "include Common.FIZ 84000 end")
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "pkp", "ep07", "common.fiz"), "Param: M=(1) Vmax=125"));
|
||||||
|
|
||||||
|
var physics = installation.Physics.For("pkp/ep07/", "ep07")!;
|
||||||
|
|
||||||
|
Assert.Equal(84000, physics.Mass);
|
||||||
|
Assert.Equal(125, physics.VMax);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void A_dot_in_the_model_name_is_part_of_the_name()
|
public void A_dot_in_the_model_name_is_part_of_the_name()
|
||||||
{
|
{
|
||||||
@@ -202,4 +215,31 @@ public class PhysicsAndAssetsTests
|
|||||||
|
|
||||||
Assert.Empty(installation.MissingAssets.Scan(installation.Library.Vehicles));
|
Assert.Empty(installation.MissingAssets.Scan(installation.Library.Vehicles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_livery_with_no_folder_is_looked_for_in_dynamic_itself()
|
||||||
|
{
|
||||||
|
var installation = new TestInstallation(new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "EP09.bmp"), "bitmap")
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "ep09.e3d"), "model"));
|
||||||
|
var catalog = new StarterNG.Domain.Vehicles.VehicleCatalog(installation.MiniTextures);
|
||||||
|
catalog.Textures.Add(new StarterNG.Domain.Vehicles.VehicleTexture { Directory = "", Skinfile = "ep09", Model = "EP09" });
|
||||||
|
|
||||||
|
Assert.Empty(installation.MissingAssets.Scan(catalog));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_skin_and_model_on_disk_in_other_case_are_not_reported()
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "PKP", "EP09", "textures.txt"),
|
||||||
|
"EP09-014.mat=ep09.e3d,ep09")
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "PKP", "EP09", "ep09-014.BMP"), "bitmap")
|
||||||
|
.WithFile(TestInstallation.At("dynamic", "PKP", "EP09", "EP09.E3D"), "model");
|
||||||
|
var installation = new TestInstallation(files);
|
||||||
|
installation.Vehicles.Load(installation.Library.Vehicles);
|
||||||
|
Assert.NotEmpty(installation.Library.Vehicles.Textures);
|
||||||
|
|
||||||
|
Assert.Empty(installation.MissingAssets.Scan(installation.Library.Vehicles));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,20 @@ public class TimetableLocatorTests
|
|||||||
Assert.NotNull(new TimetableLocator(files).Resolve(scenery, "r1.txt"));
|
Assert.NotNull(new TimetableLocator(files).Resolve(scenery, "r1.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(@"rozklady\tgs3657")]
|
||||||
|
[InlineData("ROZKLADY/TGS3657.TXT")]
|
||||||
|
public void A_timetable_named_in_other_case_or_with_backslashes_is_found_as_on_disk(string name)
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("scenery", "Braniewo.scn"), "//$n Braniewo")
|
||||||
|
.WithFile(TestInstallation.At("scenery", "Rozklady", "TGS3657.txt"), "rozkład");
|
||||||
|
var scenery = Assert.Single(new TestInstallation(files).Sceneries.LoadAll());
|
||||||
|
|
||||||
|
Assert.Equal(TestInstallation.At("scenery", "Rozklady", "TGS3657.txt"),
|
||||||
|
new TimetableLocator(files).Resolve(scenery, name));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void The_formats_none_and_a_missing_file_both_resolve_to_nothing()
|
public void The_formats_none_and_a_missing_file_both_resolve_to_nothing()
|
||||||
{
|
{
|
||||||
@@ -195,3 +209,26 @@ public class TimetableLocatorTests
|
|||||||
Assert.Null(locator.Resolve(scenery, null));
|
Assert.Null(locator.Resolve(scenery, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AttachmentLocatorTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData(@"scenery\Braniewo\opis.PDF")]
|
||||||
|
[InlineData("SCENERY/braniewo/Opis.pdf")]
|
||||||
|
public void An_attachment_named_in_other_case_is_found_as_on_disk(string named)
|
||||||
|
{
|
||||||
|
var installation = new TestInstallation(new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("scenery", "Braniewo", "Opis.pdf"), "%PDF"));
|
||||||
|
|
||||||
|
Assert.Equal(TestInstallation.At("scenery", "Braniewo", "Opis.pdf"),
|
||||||
|
new AttachmentLocator(installation.Files, installation.Paths)
|
||||||
|
.Resolve(new SceneryAttachment { FilePath = named }));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("scenery/brak.pdf")]
|
||||||
|
[InlineData("")]
|
||||||
|
public void An_attachment_that_is_not_there_is_not_found(string named) =>
|
||||||
|
Assert.Null(new AttachmentLocator(new InMemoryFileSystem(caseSensitive: true), new TestInstallation().Paths)
|
||||||
|
.Resolve(new SceneryAttachment { FilePath = named }));
|
||||||
|
}
|
||||||
|
|||||||
@@ -89,6 +89,23 @@ public class SceneryRepositoryTests
|
|||||||
Assert.Equal(Path.Combine("game", "scenery", "images", "kato.jpg"), image);
|
Assert.Equal(Path.Combine("game", "scenery", "images", "kato.jpg"), image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("calkowo_v2_kopalniaA.jpg", "game/scenery/images/calkowo_v2_kopalniaA.jpg")]
|
||||||
|
[InlineData(@"Images\Calkowo_V2_KopalniaA.JPG", "game/scenery/images/calkowo_v2_kopalniaA.jpg")]
|
||||||
|
[InlineData("CALKOWO_V2.JPG", "game/scenery/Calkowo_v2.jpg")]
|
||||||
|
public void The_preview_image_is_found_whatever_the_case_it_is_named_in(string named, string onDisk)
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile("game/scenery/calkowo.scn", "//$i " + named)
|
||||||
|
.WithFile("game/scenery/images/calkowo_v2_kopalniaA.jpg", "binary")
|
||||||
|
.WithFile("game/scenery/Calkowo_v2.jpg", "binary");
|
||||||
|
var scenery = Assert.Single(Build(files, out _).LoadAll());
|
||||||
|
|
||||||
|
string? image = new SceneryImageLocator(files).Resolve(scenery);
|
||||||
|
|
||||||
|
Assert.Equal(Path.GetFullPath(onDisk), Path.GetFullPath(image!));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void A_scenery_without_an_image_directive_resolves_to_nothing()
|
public void A_scenery_without_an_image_directive_resolves_to_nothing()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ public class ScenerySyntaxTests
|
|||||||
include koniec.scm
|
include koniec.scm
|
||||||
""";
|
""";
|
||||||
|
|
||||||
var scenery = TestScenery.Parser().Parse("scenery/x.scn", scn, _ => new IncludeLookup(true));
|
var scenery = TestScenery.Parser().Parse("scenery/x.scn", scn, _ => true);
|
||||||
|
|
||||||
Assert.Empty(scenery.Faults);
|
Assert.Empty(scenery.Faults);
|
||||||
Assert.Equal("td/rozklad", Assert.Single(scenery.Trainsets).Name);
|
Assert.Equal("td/rozklad", Assert.Single(scenery.Trainsets).Name);
|
||||||
@@ -326,7 +326,7 @@ public class ScenerySyntaxTests
|
|||||||
endoptional
|
endoptional
|
||||||
""";
|
""";
|
||||||
|
|
||||||
var faults = TestScenery.Parser().Parse("scenery/x.scn", scn, name => new IncludeLookup(name is "tory.scm" or "budynek.inc")).Faults;
|
var faults = TestScenery.Parser().Parse("scenery/x.scn", scn, name => name is "tory.scm" or "budynek.inc").Faults;
|
||||||
|
|
||||||
Assert.Equal((SceneryFaultKind.MissingInclude, "x.scn", 2, null, "brak.scm"), Seen(Assert.Single(faults)));
|
Assert.Equal((SceneryFaultKind.MissingInclude, "x.scn", 2, null, "brak.scm"), Seen(Assert.Single(faults)));
|
||||||
}
|
}
|
||||||
@@ -347,9 +347,9 @@ public class ScenerySyntaxTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void An_include_on_disk_only_in_other_letter_case_is_what_linux_misses()
|
public void An_include_on_disk_in_other_letter_case_is_no_fault()
|
||||||
{
|
{
|
||||||
// The simulator folds the name to lower case and opens it so.
|
// The simulator finds the file whatever the case of its letters, on Linux too.
|
||||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
.WithLegacyFile("game/scenery/braniewo_szeroki.scn",
|
.WithLegacyFile("game/scenery/braniewo_szeroki.scn",
|
||||||
"include braniewo/base.ctr end\ninclude Braniewo/Tory.SCM end\n")
|
"include braniewo/base.ctr end\ninclude Braniewo/Tory.SCM end\n")
|
||||||
@@ -357,21 +357,20 @@ public class ScenerySyntaxTests
|
|||||||
.WithFile("game/scenery/braniewo/tory.scm", "");
|
.WithFile("game/scenery/braniewo/tory.scm", "");
|
||||||
var repository = TestScenery.Repository(files);
|
var repository = TestScenery.Repository(files);
|
||||||
|
|
||||||
var faults = repository.Load("game/scenery/braniewo_szeroki.scn")!.Faults;
|
Assert.Empty(repository.Load("game/scenery/braniewo_szeroki.scn")!.Faults);
|
||||||
|
|
||||||
Assert.Equal((SceneryFaultKind.IncludeLetterCase, "braniewo_szeroki.scn", 1, "Braniewo/Base.ctr", "braniewo/base.ctr"),
|
|
||||||
Seen(Assert.Single(faults)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(true)]
|
[InlineData(null)]
|
||||||
[InlineData(false)]
|
[InlineData("lk2_sandbox.sbt")]
|
||||||
public void A_missing_terrain_file_is_no_fault_while_the_scenery_has_its_own_sbt(bool sbt)
|
[InlineData("Lk2_Sandbox.SBT")]
|
||||||
|
public void A_missing_terrain_file_is_no_fault_while_the_scenery_has_its_own_sbt(string? sbtOnDisk)
|
||||||
{
|
{
|
||||||
|
bool sbt = sbtOnDisk is not null;
|
||||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
.WithLegacyFile("game/scenery/Lk2_Sandbox.scn", "include nmt/nmt100_mazowieckie_ter.scm end\nFirstInit\n");
|
.WithLegacyFile("game/scenery/Lk2_Sandbox.scn", "include nmt/nmt100_mazowieckie_ter.scm end\nFirstInit\n");
|
||||||
if (sbt)
|
if (sbt)
|
||||||
files.WithFile("game/scenery/lk2_sandbox.sbt", "EU07");
|
files.WithFile("game/scenery/" + sbtOnDisk, "EU07");
|
||||||
var repository = TestScenery.Repository(files);
|
var repository = TestScenery.Repository(files);
|
||||||
|
|
||||||
var scenery = repository.Load("game/scenery/Lk2_Sandbox.scn")!;
|
var scenery = repository.Load("game/scenery/Lk2_Sandbox.scn")!;
|
||||||
|
|||||||
@@ -39,6 +39,24 @@ public class SceneryTranslationsTests
|
|||||||
Assert.Equal("Polski", scenery.LocalizedDescription(translations));
|
Assert.Equal("Polski", scenery.LocalizedDescription(translations));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_tables_are_found_whatever_the_case_of_their_names()
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("scenery", "Braniewo.scn"), "//$d @brief")
|
||||||
|
.WithFile(Path.Combine(Path.GetFullPath(TestInstallation.At("scenery")), "I18N", "braniewo_en.json"),
|
||||||
|
"""{ "brief": "English" }""")
|
||||||
|
.WithFile(Path.Combine(Path.GetFullPath(TestInstallation.At("scenery")), "I18N", "BRANIEWO_PL.json"),
|
||||||
|
"""{ "brief": "Polski" }""");
|
||||||
|
var installation = new TestInstallation(files);
|
||||||
|
var scenery = Assert.Single(installation.Sceneries.LoadAll());
|
||||||
|
var translations = new SceneryTranslations(files, installation.Log);
|
||||||
|
|
||||||
|
translations.LoadFor(scenery, "Polski");
|
||||||
|
|
||||||
|
Assert.Equal("Polski", scenery.LocalizedDescription(translations));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Literal_text_and_unknown_keys_are_left_alone()
|
public void Literal_text_and_unknown_keys_are_left_alone()
|
||||||
{
|
{
|
||||||
|
|||||||
45
StarterNG.Tests/SoftwareRenderTests.cs
Normal file
45
StarterNG.Tests/SoftwareRenderTests.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using StarterNG.Infrastructure;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class SoftwareRenderTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("--software-render")]
|
||||||
|
[InlineData("--Software-Render")]
|
||||||
|
public void The_switch_asks_for_it_in_any_case(string arg)
|
||||||
|
{
|
||||||
|
Assert.True(SoftwareRender.AskedIn(new[] { "--other", arg }));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Without_the_switch_the_graphics_card_draws()
|
||||||
|
{
|
||||||
|
Assert.False(SoftwareRender.AskedIn(Array.Empty<string>()));
|
||||||
|
Assert.False(SoftwareRender.AskedIn(new[] { "--software" }));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Windows_draws_on_the_processor_into_a_plain_window_surface()
|
||||||
|
{
|
||||||
|
var options = SoftwareRender.Win32Options;
|
||||||
|
|
||||||
|
Assert.Equal(new[] { Win32RenderingMode.Software }, options.RenderingMode);
|
||||||
|
Assert.Equal(new[] { Win32CompositionMode.RedirectionSurface }, options.CompositionMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void X11_draws_on_the_processor()
|
||||||
|
{
|
||||||
|
Assert.Equal(new[] { X11RenderingMode.Software }, SoftwareRender.X11Options.RenderingMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Both_platforms_options_go_to_the_same_builder()
|
||||||
|
{
|
||||||
|
var builder = AppBuilder.Configure<Avalonia.Application>();
|
||||||
|
|
||||||
|
Assert.Same(builder, SoftwareRender.ApplyTo(builder));
|
||||||
|
}
|
||||||
|
}
|
||||||
98
StarterNG.Tests/SystemGraphicsLibrariesTests.cs
Normal file
98
StarterNG.Tests/SystemGraphicsLibrariesTests.cs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
using StarterNG.Infrastructure;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class SystemGraphicsLibrariesTests
|
||||||
|
{
|
||||||
|
private const string System32 = @"C:\Windows\System32";
|
||||||
|
private const string Game = @"E:\SteamLibrary\steamapps\common\MaSzyna";
|
||||||
|
|
||||||
|
private static readonly IntPtr Dxgi = new(0x1000);
|
||||||
|
private static readonly IntPtr D3d11 = new(0x2000);
|
||||||
|
|
||||||
|
private static SystemGraphicsLibraries Take(Func<string, bool> beside, Dictionary<string, IntPtr> system)
|
||||||
|
{
|
||||||
|
return SystemGraphicsLibraries.Take(System32, Game, beside, Load);
|
||||||
|
|
||||||
|
bool Load(string path, out IntPtr handle)
|
||||||
|
{
|
||||||
|
handle = system.GetValueOrDefault(Path.GetFileName(path));
|
||||||
|
return handle != IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SystemGraphicsLibraries WithDxgiAndD3d11(Func<string, bool> beside) =>
|
||||||
|
Take(beside, new Dictionary<string, IntPtr> { ["dxgi.dll"] = Dxgi, ["d3d11.dll"] = D3d11 });
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void An_import_by_name_gets_the_system_library_with_or_without_its_extension()
|
||||||
|
{
|
||||||
|
var taken = WithDxgiAndD3d11(_ => false);
|
||||||
|
|
||||||
|
Assert.Equal(Dxgi, taken.Resolve("dxgi"));
|
||||||
|
Assert.Equal(Dxgi, taken.Resolve("dxgi.dll"));
|
||||||
|
Assert.Equal(D3d11, taken.Resolve("D3D11.DLL"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Other_libraries_and_ones_the_system_lacks_are_left_to_the_usual_search()
|
||||||
|
{
|
||||||
|
var taken = WithDxgiAndD3d11(_ => false);
|
||||||
|
|
||||||
|
Assert.Equal(IntPtr.Zero, taken.Resolve("user32.dll"));
|
||||||
|
Assert.Equal(IntPtr.Zero, taken.Resolve("opengl32"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void They_are_loaded_from_the_system_folder_dxgi_first()
|
||||||
|
{
|
||||||
|
var asked = new List<string>();
|
||||||
|
SystemGraphicsLibraries.Take(System32, Game, _ => false, Load);
|
||||||
|
|
||||||
|
Assert.Equal(SystemGraphicsLibraries.Names.Select(n => Path.Combine(System32, n + ".dll")), asked);
|
||||||
|
Assert.Equal("dxgi", SystemGraphicsLibraries.Names[0]);
|
||||||
|
|
||||||
|
bool Load(string path, out IntPtr handle)
|
||||||
|
{
|
||||||
|
asked.Add(path);
|
||||||
|
handle = IntPtr.Zero;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void A_wrapper_beside_the_starter_is_noted()
|
||||||
|
{
|
||||||
|
var taken = WithDxgiAndD3d11(path => path == Path.Combine(Game, "dxgi.dll"));
|
||||||
|
|
||||||
|
Assert.Equal(new[] { "dxgi.dll" }, taken.Shadowed);
|
||||||
|
Assert.Contains("dxgi.dll", taken.Note);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void With_nothing_beside_the_starter_there_is_nothing_to_note()
|
||||||
|
{
|
||||||
|
var taken = WithDxgiAndD3d11(_ => false);
|
||||||
|
|
||||||
|
Assert.Empty(taken.Shadowed);
|
||||||
|
Assert.Null(taken.Note);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Only_windows_has_system_libraries_to_take()
|
||||||
|
{
|
||||||
|
var taken = SystemGraphicsLibraries.TakeOnWindows();
|
||||||
|
|
||||||
|
Assert.Equal(OperatingSystem.IsWindows(), taken is not null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void An_assembly_with_a_resolver_of_its_own_keeps_it()
|
||||||
|
{
|
||||||
|
var taken = WithDxgiAndD3d11(_ => false);
|
||||||
|
var assembly = typeof(SystemGraphicsLibrariesTests).Assembly;
|
||||||
|
|
||||||
|
Assert.True(taken.ServeTo(assembly));
|
||||||
|
Assert.False(taken.ServeTo(assembly));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -130,6 +130,17 @@ public class TapeLaunchTests
|
|||||||
Assert.Null(new StarterNG.Infrastructure.Sceneries.TimetableLocator(new InMemoryFileSystem())
|
Assert.Null(new StarterNG.Infrastructure.Sceneries.TimetableLocator(new InMemoryFileSystem())
|
||||||
.TrainNumber(new StarterNG.Domain.Sceneries.Scenery(TestInstallation.At("scenery", "td.scn"), ""), name));
|
.TrainNumber(new StarterNG.Domain.Sceneries.Scenery(TestInstallation.At("scenery", "td.scn"), ""), name));
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_train_number_comes_from_a_timetable_named_in_other_case_with_backslashes()
|
||||||
|
{
|
||||||
|
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile(TestInstallation.At("scenery", "Baltyk", "EIE1531.txt"), "[ Rodzaj i numer pociagu | EIE1531 ]\r\n");
|
||||||
|
|
||||||
|
Assert.Equal("EIE1531", new StarterNG.Infrastructure.Sceneries.TimetableLocator(files)
|
||||||
|
.TrainNumber(new StarterNG.Domain.Sceneries.Scenery(TestInstallation.At("scenery", "td.scn"), ""),
|
||||||
|
@"baltyk\eie1531"));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void A_timetable_that_is_not_there_gives_no_train_number() =>
|
public void A_timetable_that_is_not_there_gives_no_train_number() =>
|
||||||
Assert.Null(new StarterNG.Infrastructure.Sceneries.TimetableLocator(new InMemoryFileSystem())
|
Assert.Null(new StarterNG.Infrastructure.Sceneries.TimetableLocator(new InMemoryFileSystem())
|
||||||
|
|||||||
22
StarterNG.Tests/TextureFolderTests.cs
Normal file
22
StarterNG.Tests/TextureFolderTests.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using StarterNG.Domain.Vehicles;
|
||||||
|
using StarterNG.Infrastructure.Vehicles;
|
||||||
|
using StarterNG.Tests.Fakes;
|
||||||
|
|
||||||
|
namespace StarterNG.Tests;
|
||||||
|
|
||||||
|
public class TextureFolderTests
|
||||||
|
{
|
||||||
|
private static readonly TestInstallation Installation = new(new InMemoryFileSystem(caseSensitive: true)
|
||||||
|
.WithFile("game/dynamic/PKP/EP09_v1/textures.txt", "")
|
||||||
|
.WithDirectory("game/Other/Folder"));
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("pkp/ep09_v1/", "dynamic/PKP/EP09_v1")]
|
||||||
|
[InlineData(@"PKP\EP09_V1", "dynamic/PKP/EP09_v1")]
|
||||||
|
[InlineData("other/folder/", "Other/Folder")]
|
||||||
|
[InlineData("pkp/brak/", "pkp/brak")]
|
||||||
|
public void A_liverys_folder_is_found_as_it_is_named_on_disk(string named, string onDisk) =>
|
||||||
|
Assert.Equal(Path.GetFullPath(Path.Combine("game", onDisk)),
|
||||||
|
Path.GetFullPath(TextureFolder.Of(Installation.Files, Installation.Paths,
|
||||||
|
new VehicleTexture { Directory = named })));
|
||||||
|
}
|
||||||
@@ -207,8 +207,12 @@ public partial class App : Avalonia.Application
|
|||||||
if (check.ExecutableMissing())
|
if (check.ExecutableMissing())
|
||||||
await main.OfferExecutablePickAsync();
|
await main.OfferExecutablePickAsync();
|
||||||
|
|
||||||
if (CpuFeatures.LacksAvx2 && AppServices.Current.Settings.CpuNotice)
|
// A build without AVX2 in the folder is started instead, and needs no notice.
|
||||||
await main.ShowCpuNoticeAsync();
|
var services = AppServices.Current;
|
||||||
|
if (services.Settings.CpuNotice
|
||||||
|
&& services.Executables.Resolve(services.Settings, out _) is var executable
|
||||||
|
&& services.Executables.WillNotRunHere(executable))
|
||||||
|
await main.ShowCpuNoticeAsync(executable);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ namespace StarterNG.Application.Abstractions;
|
|||||||
|
|
||||||
public interface IFileSystem
|
public interface IFileSystem
|
||||||
{
|
{
|
||||||
|
/// <summary>Whether a name finds its file whatever the case of its letters, as on Windows and macOS.</summary>
|
||||||
|
bool IgnoresCase { get; }
|
||||||
|
|
||||||
bool FileExists(string path);
|
bool FileExists(string path);
|
||||||
|
|
||||||
bool DirectoryExists(string path);
|
bool DirectoryExists(string path);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public sealed class AppServices
|
|||||||
var missingAssets = new MissingAssetScanner(files, paths);
|
var missingAssets = new MissingAssetScanner(files, paths);
|
||||||
SceneryTexts = new SceneryTranslations(files, log);
|
SceneryTexts = new SceneryTranslations(files, log);
|
||||||
Timetables = new TimetableLocator(files);
|
Timetables = new TimetableLocator(files);
|
||||||
|
Attachments = new AttachmentLocator(files, paths);
|
||||||
LoadWeights = new LoadWeightsRepository(files, paths, log);
|
LoadWeights = new LoadWeightsRepository(files, paths, log);
|
||||||
Library = new GameLibrary(Vehicles, Sceneries, MiniTextures, Physics, log);
|
Library = new GameLibrary(Vehicles, Sceneries, MiniTextures, Physics, log);
|
||||||
State = new AppState();
|
State = new AppState();
|
||||||
@@ -122,6 +123,8 @@ public sealed class AppServices
|
|||||||
|
|
||||||
public TimetableLocator Timetables { get; }
|
public TimetableLocator Timetables { get; }
|
||||||
|
|
||||||
|
public AttachmentLocator Attachments { get; }
|
||||||
|
|
||||||
public LoadWeightsRepository LoadWeights { get; }
|
public LoadWeightsRepository LoadWeights { get; }
|
||||||
|
|
||||||
public GameLibrary Library { get; }
|
public GameLibrary Library { get; }
|
||||||
|
|||||||
@@ -61,13 +61,6 @@ public enum SceneryFaultKind
|
|||||||
/// <summary>An include whose file is not there; <see cref="SceneryFault.Token"/> names it.</summary>
|
/// <summary>An include whose file is not there; <see cref="SceneryFault.Token"/> names it.</summary>
|
||||||
MissingInclude,
|
MissingInclude,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// An include whose file is there only under a name in other letter case: the
|
|
||||||
/// simulator looks for it in lower case, which on Linux misses it. The
|
|
||||||
/// <see cref="SceneryFault.Subject"/> holds the name on disk.
|
|
||||||
/// </summary>
|
|
||||||
IncludeLetterCase,
|
|
||||||
|
|
||||||
/// <summary>An include with no <c>end</c>, which swallows what follows it.</summary>
|
/// <summary>An include with no <c>end</c>, which swallows what follows it.</summary>
|
||||||
IncludeNotClosed,
|
IncludeNotClosed,
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,6 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace StarterNG.Domain.Sceneries;
|
namespace StarterNG.Domain.Sceneries;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// What the simulator makes of an include: whether it opens the file - and when
|
|
||||||
/// it does not, the file that is there under a name differing only in letter case.
|
|
||||||
/// </summary>
|
|
||||||
public readonly record struct IncludeLookup(bool Opens, string? OnDisk = null);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Goes through a scenery's text for the parts the starter reads - trainsets,
|
/// Goes through a scenery's text for the parts the starter reads - trainsets,
|
||||||
/// vehicles, includes - finding where each trainset and loose vehicle is, and
|
/// vehicles, includes - finding where each trainset and loose vehicle is, and
|
||||||
@@ -35,17 +29,17 @@ public static class ScenerySyntax
|
|||||||
|
|
||||||
/// <param name="text">The scenery's text, its includes put in place.</param>
|
/// <param name="text">The scenery's text, its includes put in place.</param>
|
||||||
/// <param name="file">The scenery's file name, for faults in its own text.</param>
|
/// <param name="file">The scenery's file name, for faults in its own text.</param>
|
||||||
/// <param name="findInclude">
|
/// <param name="opensInclude">
|
||||||
/// What the simulator makes of an include, named as the include names it; null
|
/// Whether the simulator opens an include, named as the include names it; null
|
||||||
/// leaves includes unchecked.
|
/// leaves includes unchecked.
|
||||||
/// </param>
|
/// </param>
|
||||||
public static Result Scan(string text, string file, Func<string, IncludeLookup>? findInclude = null)
|
public static Result Scan(string text, string file, Func<string, bool>? opensInclude = null)
|
||||||
{
|
{
|
||||||
string code = SceneryCode.Mask(text, out int unclosed);
|
string code = SceneryCode.Mask(text, out int unclosed);
|
||||||
var tokens = SceneryCode.Tokens(code);
|
var tokens = SceneryCode.Tokens(code);
|
||||||
var lines = new SceneryLines(text, file);
|
var lines = new SceneryLines(text, file);
|
||||||
|
|
||||||
var simulator = new Reading(tokens, lines, findInclude, asSimulator: true);
|
var simulator = new Reading(tokens, lines, opensInclude, asSimulator: true);
|
||||||
simulator.Run();
|
simulator.Run();
|
||||||
var author = new Reading(tokens, lines, null, asSimulator: false);
|
var author = new Reading(tokens, lines, null, asSimulator: false);
|
||||||
author.Run();
|
author.Run();
|
||||||
@@ -116,7 +110,7 @@ public static class ScenerySyntax
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sealed class Reading(
|
private sealed class Reading(
|
||||||
List<SceneryCode.Token> tokens, SceneryLines lines, Func<string, IncludeLookup>? findInclude, bool asSimulator)
|
List<SceneryCode.Token> tokens, SceneryLines lines, Func<string, bool>? opensInclude, bool asSimulator)
|
||||||
{
|
{
|
||||||
public readonly List<(int Start, int End, string Name)> Trainsets = new();
|
public readonly List<(int Start, int End, string Name)> Trainsets = new();
|
||||||
public readonly List<(int, int)> Loose = new();
|
public readonly List<(int, int)> Loose = new();
|
||||||
@@ -375,13 +369,8 @@ public static class ScenerySyntax
|
|||||||
return stop < tokens.Count && tokens[stop].Is("end") ? stop : stop - 1;
|
return stop < tokens.Count && tokens[stop].Is("end") ? stop : stop - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (findInclude is not null && Plain(name) && findInclude(name) is { Opens: false } lookup)
|
if (opensInclude is not null && Plain(name) && !opensInclude(name))
|
||||||
{
|
Fault(SceneryFaultKind.MissingInclude, token.Index, token: name);
|
||||||
if (lookup.OnDisk is { } onDisk)
|
|
||||||
Fault(SceneryFaultKind.IncludeLetterCase, token.Index, onDisk, name);
|
|
||||||
else
|
|
||||||
Fault(SceneryFaultKind.MissingInclude, token.Index, token: name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The simulator takes its parameters up to the word "end", written just so,
|
// The simulator takes its parameters up to the word "end", written just so,
|
||||||
// whatever comes before it.
|
// whatever comes before it.
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ public sealed class PhysicalFileSystem : IFileSystem
|
|||||||
{
|
{
|
||||||
public const string TempSuffix = ".starter.tmp";
|
public const string TempSuffix = ".starter.tmp";
|
||||||
|
|
||||||
|
// Their disks as they come; a Linux one tells case apart.
|
||||||
|
public bool IgnoresCase { get; } = OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();
|
||||||
|
|
||||||
public bool FileExists(string path) => File.Exists(path);
|
public bool FileExists(string path) => File.Exists(path);
|
||||||
|
|
||||||
public bool DirectoryExists(string path) => Directory.Exists(path);
|
public bool DirectoryExists(string path) => Directory.Exists(path);
|
||||||
@@ -88,8 +91,18 @@ public sealed class PhysicalFileSystem : IFileSystem
|
|||||||
public void CopyFile(string sourcePath, string destinationPath, bool overwrite) =>
|
public void CopyFile(string sourcePath, string destinationPath, bool overwrite) =>
|
||||||
File.Copy(sourcePath, destinationPath, overwrite);
|
File.Copy(sourcePath, destinationPath, overwrite);
|
||||||
|
|
||||||
|
// The pattern matches names in any letter case, as on Windows: the game's data,
|
||||||
|
// made there, has X.SCN as well as x.scn.
|
||||||
public IReadOnlyList<string> GetFiles(string path, string searchPattern = "*") =>
|
public IReadOnlyList<string> GetFiles(string path, string searchPattern = "*") =>
|
||||||
Directory.Exists(path) ? Directory.GetFiles(path, searchPattern) : Array.Empty<string>();
|
Directory.Exists(path)
|
||||||
|
? Directory.GetFiles(path, searchPattern, new EnumerationOptions
|
||||||
|
{
|
||||||
|
IgnoreInaccessible = false,
|
||||||
|
AttributesToSkip = 0,
|
||||||
|
MatchType = MatchType.Win32,
|
||||||
|
MatchCasing = MatchCasing.CaseInsensitive
|
||||||
|
})
|
||||||
|
: Array.Empty<string>();
|
||||||
|
|
||||||
// A folder it may not enter costs what is in it, not the whole listing.
|
// A folder it may not enter costs what is in it, not the whole listing.
|
||||||
public IReadOnlyList<string> GetFilesRecursive(string path, string searchPattern) =>
|
public IReadOnlyList<string> GetFilesRecursive(string path, string searchPattern) =>
|
||||||
@@ -99,7 +112,8 @@ public sealed class PhysicalFileSystem : IFileSystem
|
|||||||
RecurseSubdirectories = true,
|
RecurseSubdirectories = true,
|
||||||
IgnoreInaccessible = true,
|
IgnoreInaccessible = true,
|
||||||
AttributesToSkip = 0,
|
AttributesToSkip = 0,
|
||||||
MatchType = MatchType.Win32
|
MatchType = MatchType.Win32,
|
||||||
|
MatchCasing = MatchCasing.CaseInsensitive
|
||||||
})
|
})
|
||||||
: Array.Empty<string>();
|
: Array.Empty<string>();
|
||||||
|
|
||||||
|
|||||||
132
StarterNG/Infrastructure/CaseInsensitivePaths.cs
Normal file
132
StarterNG/Infrastructure/CaseInsensitivePaths.cs
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using StarterNG.Application.Abstractions;
|
||||||
|
|
||||||
|
namespace StarterNG.Infrastructure;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds a file or folder of the game's data by a name whose letters may stand in
|
||||||
|
/// another case than on disk, as Windows, Wine and the simulator find it, and gives
|
||||||
|
/// the name as the disk has it. The data is made on Windows: its names and the
|
||||||
|
/// names written in it seldom agree letter for letter, which on Linux matters.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class CaseInsensitivePaths
|
||||||
|
{
|
||||||
|
private readonly IFileSystem _files;
|
||||||
|
private readonly Func<(string Folder, bool Files), ILookup<string, string>> _list;
|
||||||
|
|
||||||
|
/// <summary>Each folder's files and folders by name, listed once until <see cref="Forget"/>; null lists every time.</summary>
|
||||||
|
private readonly ConcurrentDictionary<(string Folder, bool Files), ILookup<string, string>>? _listings;
|
||||||
|
|
||||||
|
/// <param name="keepListings">
|
||||||
|
/// Lists each folder once, for many names looked up in data that stays as it is
|
||||||
|
/// meanwhile, until <see cref="Forget"/>.
|
||||||
|
/// </param>
|
||||||
|
public CaseInsensitivePaths(IFileSystem files, bool keepListings = false)
|
||||||
|
{
|
||||||
|
_files = files;
|
||||||
|
_list = List;
|
||||||
|
if (keepListings)
|
||||||
|
_listings = new ConcurrentDictionary<(string, bool), ILookup<string, string>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Lets the next lookups list the folders again.</summary>
|
||||||
|
public void Forget() => _listings?.Clear();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The file named so under <paramref name="folder"/> as it is named on disk, relative
|
||||||
|
/// to the folder with forward slashes; null when nothing there answers to it. A name
|
||||||
|
/// written with its letters as on disk wins over one differing only in their case;
|
||||||
|
/// a disk that does not tell case apart gives it back as written.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">
|
||||||
|
/// A name under the folder, with either slash, joined to it as the simulator joins
|
||||||
|
/// it: a slash ahead of it counts for nothing.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="directory">Looks for a folder instead of a file.</param>
|
||||||
|
public string? Resolve(string folder, string name, bool directory = false)
|
||||||
|
{
|
||||||
|
string[] parts = name.Replace('\\', '/').Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (parts.Length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
string exact = string.Join('/', parts);
|
||||||
|
string whole = Path.Combine(folder, exact);
|
||||||
|
if (directory ? _files.DirectoryExists(whole) : _files.FileExists(whole))
|
||||||
|
return exact;
|
||||||
|
// Where case does not matter, missed as written is missed in any case.
|
||||||
|
if (_files.IgnoresCase)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var found = new string[parts.Length];
|
||||||
|
return Walk(folder, parts, 0, directory, found) ? string.Join('/', found) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The full path of the file named so, its letters as on disk; null when there is
|
||||||
|
/// none. A name given in full is looked up from its own root, any other under
|
||||||
|
/// <paramref name="folder"/> as <see cref="Resolve"/> does.
|
||||||
|
/// </summary>
|
||||||
|
public string? Find(string folder, string name, bool directory = false)
|
||||||
|
{
|
||||||
|
if (Path.IsPathFullyQualified(name))
|
||||||
|
{
|
||||||
|
folder = Path.GetPathRoot(name)!;
|
||||||
|
name = name[folder.Length..];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Resolve(folder, name, directory) is { } found
|
||||||
|
? Path.Combine(folder, found.Replace('/', Path.DirectorySeparatorChar))
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the parts from <paramref name="at"/> on under <paramref name="current"/>. Of
|
||||||
|
/// folders named alike in other case - two copies of the data on Linux - each is
|
||||||
|
/// tried, the one written as on disk first.
|
||||||
|
/// </summary>
|
||||||
|
private bool Walk(string current, string[] parts, int at, bool directory, string[] found)
|
||||||
|
{
|
||||||
|
if (at == parts.Length)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
string part = parts[at];
|
||||||
|
if (part is "." or "..")
|
||||||
|
{
|
||||||
|
found[at] = part;
|
||||||
|
return Walk(Path.Combine(current, part), parts, at + 1, directory, found);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool last = at == parts.Length - 1;
|
||||||
|
var matches = Listing(current, files: last && !directory)[part]
|
||||||
|
.OrderBy(entry => string.Equals(Path.GetFileName(entry), part, StringComparison.Ordinal) ? 0 : 1);
|
||||||
|
foreach (string match in matches)
|
||||||
|
{
|
||||||
|
found[at] = Path.GetFileName(match);
|
||||||
|
if (Walk(match, parts, at + 1, directory, found))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ILookup<string, string> Listing(string folder, bool files) =>
|
||||||
|
_listings is null ? List((folder, files)) : _listings.GetOrAdd((folder, files), _list);
|
||||||
|
|
||||||
|
// A folder that cannot be listed holds nothing to be found.
|
||||||
|
private ILookup<string, string> List((string Folder, bool Files) key)
|
||||||
|
{
|
||||||
|
var entries = Array.Empty<string>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_files.DirectoryExists(key.Folder))
|
||||||
|
entries = (key.Files ? _files.GetFiles(key.Folder) : _files.GetDirectories(key.Folder)).ToArray();
|
||||||
|
}
|
||||||
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
// Nothing listed, nothing found.
|
||||||
|
}
|
||||||
|
return entries.ToLookup(entry => Path.GetFileName(entry), StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,16 +5,21 @@ using System.Runtime.InteropServices;
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
|
using StarterNG.Application.Abstractions;
|
||||||
|
using StarterNG.Infrastructure.Adapters;
|
||||||
|
|
||||||
namespace StarterNG.Infrastructure;
|
namespace StarterNG.Infrastructure;
|
||||||
|
|
||||||
public static class LoadingScreen
|
public static class LoadingScreen
|
||||||
{
|
{
|
||||||
|
private static readonly string[] Extensions = { ".bmp", ".jpg", ".jpeg", ".png" };
|
||||||
|
|
||||||
public static void Prepare(string? logoKey, string? sceneryName = null)
|
public static void Prepare(string? logoKey, string? sceneryName = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string? src = ResolveSource(logoKey) ?? ResolveSource(sceneryName) ?? PickRandom();
|
string? src = FindSource(new PhysicalFileSystem(), Directory.GetCurrentDirectory(), logoKey, sceneryName,
|
||||||
|
Random.Shared);
|
||||||
if (src is null) return;
|
if (src is null) return;
|
||||||
|
|
||||||
string destDir = Path.Combine(Directory.GetCurrentDirectory(), "textures");
|
string destDir = Path.Combine(Directory.GetCurrentDirectory(), "textures");
|
||||||
@@ -35,32 +40,36 @@ public static class LoadingScreen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? ResolveSource(string? key)
|
/// <summary>
|
||||||
|
/// The picture of textures/logo under <paramref name="root"/> to show: the trainset's,
|
||||||
|
/// else the scenery's, else one of logo*.* at random; its name and extension in any
|
||||||
|
/// letter case. Null when there is none.
|
||||||
|
/// </summary>
|
||||||
|
public static string? FindSource(IFileSystem files, string root, string? logoKey, string? sceneryName,
|
||||||
|
Random random)
|
||||||
|
{
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
if (names.Find(root, "textures/logo", directory: true) is not { } dir)
|
||||||
|
return null;
|
||||||
|
return Named(names, dir, logoKey) ?? Named(names, dir, sceneryName) ?? PickRandom(files, dir, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? Named(CaseInsensitivePaths names, string dir, string? key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(key)) return null;
|
if (string.IsNullOrWhiteSpace(key)) return null;
|
||||||
key = Path.GetFileNameWithoutExtension(key.Trim());
|
key = Path.GetFileNameWithoutExtension(key.Trim());
|
||||||
string dir = Path.Combine(Directory.GetCurrentDirectory(), "textures", "logo");
|
if (key.Length == 0) return null;
|
||||||
foreach (string ext in new[] { ".bmp", ".jpg", ".jpeg", ".png" })
|
return Extensions.Select(ext => names.Find(dir, key + ext)).FirstOrDefault(path => path is not null);
|
||||||
{
|
|
||||||
string path = Path.Combine(dir, key + ext);
|
|
||||||
if (File.Exists(path)) return path;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? PickRandom()
|
private static string? PickRandom(IFileSystem files, string dir, Random random)
|
||||||
{
|
{
|
||||||
string dir = Path.Combine(Directory.GetCurrentDirectory(), "textures", "logo");
|
var logos = files.GetFiles(dir, "logo*.*")
|
||||||
if (!Directory.Exists(dir)) return null;
|
.Where(f => Extensions.Contains(Path.GetExtension(f), StringComparer.OrdinalIgnoreCase))
|
||||||
var files = Directory.GetFiles(dir, "logo*.*")
|
.Order(StringComparer.Ordinal)
|
||||||
.Where(f =>
|
|
||||||
{
|
|
||||||
string e = Path.GetExtension(f).ToLowerInvariant();
|
|
||||||
return e is ".bmp" or ".jpg" or ".jpeg" or ".png";
|
|
||||||
})
|
|
||||||
.ToArray();
|
.ToArray();
|
||||||
if (files.Length == 0) return null;
|
if (logos.Length == 0) return null;
|
||||||
return files[Random.Shared.Next(files.Length)];
|
return logos[random.Next(logos.Length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteBmp(string sourcePath, string destPath)
|
private static void WriteBmp(string sourcePath, string destPath)
|
||||||
|
|||||||
24
StarterNG/Infrastructure/Sceneries/AttachmentLocator.cs
Normal file
24
StarterNG/Infrastructure/Sceneries/AttachmentLocator.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using StarterNG.Application.Abstractions;
|
||||||
|
using StarterNG.Domain.Sceneries;
|
||||||
|
|
||||||
|
namespace StarterNG.Infrastructure.Sceneries;
|
||||||
|
|
||||||
|
/// <summary>Where the file a scenery attaches (<c>//$f</c>) is on disk.</summary>
|
||||||
|
public sealed class AttachmentLocator
|
||||||
|
{
|
||||||
|
private readonly IGamePaths _paths;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
|
|
||||||
|
public AttachmentLocator(IFileSystem files, IGamePaths paths)
|
||||||
|
{
|
||||||
|
_paths = paths;
|
||||||
|
_names = new CaseInsensitivePaths(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attachment's file, named from the game's folder or in full, with its letters
|
||||||
|
/// as on disk; null when it is not there.
|
||||||
|
/// </summary>
|
||||||
|
public string? Resolve(SceneryAttachment attachment) =>
|
||||||
|
string.IsNullOrWhiteSpace(attachment.FilePath) ? null : _names.Find(_paths.Root, attachment.FilePath.Trim());
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using StarterNG.Application.Abstractions;
|
using StarterNG.Application.Abstractions;
|
||||||
using StarterNG.Domain.Sceneries;
|
using StarterNG.Domain.Sceneries;
|
||||||
|
|
||||||
@@ -8,11 +9,13 @@ namespace StarterNG.Infrastructure.Sceneries;
|
|||||||
public sealed class SceneryImageLocator
|
public sealed class SceneryImageLocator
|
||||||
{
|
{
|
||||||
private readonly IFileSystem _files;
|
private readonly IFileSystem _files;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
private readonly Dictionary<string, string?> _cache = new();
|
private readonly Dictionary<string, string?> _cache = new();
|
||||||
|
|
||||||
public SceneryImageLocator(IFileSystem files)
|
public SceneryImageLocator(IFileSystem files)
|
||||||
{
|
{
|
||||||
_files = files;
|
_files = files;
|
||||||
|
_names = new CaseInsensitivePaths(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string? Resolve(Scenery scenery)
|
public string? Resolve(Scenery scenery)
|
||||||
@@ -34,22 +37,23 @@ public sealed class SceneryImageLocator
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
string name = scenery.ImageName.Replace('\\', '/').Trim();
|
string name = scenery.ImageName.Replace('\\', '/').Trim();
|
||||||
|
if (Path.IsPathFullyQualified(name))
|
||||||
|
return _names.Find("", name);
|
||||||
|
if (_files.FileExists(name))
|
||||||
|
return name;
|
||||||
|
|
||||||
string sceneryDir = Path.GetDirectoryName(scenery.Path) ?? ".";
|
string sceneryDir = Path.GetDirectoryName(scenery.Path) ?? ".";
|
||||||
string root = Path.GetDirectoryName(sceneryDir) ?? ".";
|
string root = Path.GetDirectoryName(sceneryDir) ?? ".";
|
||||||
|
|
||||||
string[] candidates =
|
(string Folder, string Name)[] candidates =
|
||||||
{
|
{
|
||||||
name,
|
(root, name),
|
||||||
Path.Combine(root, name),
|
(sceneryDir, name),
|
||||||
Path.Combine(sceneryDir, name),
|
(sceneryDir, "images/" + name),
|
||||||
Path.Combine(sceneryDir, "images", name),
|
(root, "scenery/images/" + name)
|
||||||
Path.Combine(root, "scenery", "images", name)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (string candidate in candidates)
|
return candidates.Select(candidate => _names.Find(candidate.Folder, candidate.Name))
|
||||||
if (_files.FileExists(candidate))
|
.FirstOrDefault(found => found is not null);
|
||||||
return candidate;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ public sealed class SceneryParser
|
|||||||
_random = random;
|
_random = random;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <param name="findInclude">
|
/// <param name="opensInclude">
|
||||||
/// What the simulator makes of an include, as the include names it; null leaves
|
/// Whether the simulator opens an include, as the include names it; null leaves
|
||||||
/// includes unchecked.
|
/// includes unchecked.
|
||||||
/// </param>
|
/// </param>
|
||||||
public Scenery Parse(string path, string content, Func<string, IncludeLookup>? findInclude = null)
|
public Scenery Parse(string path, string content, Func<string, bool>? opensInclude = null)
|
||||||
{
|
{
|
||||||
string original = content;
|
string original = content;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public sealed class SceneryParser
|
|||||||
|
|
||||||
// Read from the text with its optional includes blanked, which keeps every
|
// Read from the text with its optional includes blanked, which keeps every
|
||||||
// place where it was, so a fault's line is the line in the file.
|
// place where it was, so a fault's line is the line in the file.
|
||||||
var syntax = ScenerySyntax.Scan(content, System.IO.Path.GetFileName(path), findInclude);
|
var syntax = ScenerySyntax.Scan(content, System.IO.Path.GetFileName(path), opensInclude);
|
||||||
var faults = syntax.Faults.ToList();
|
var faults = syntax.Faults.ToList();
|
||||||
var inlined = SceneryIncludes.Ranges(content);
|
var inlined = SceneryIncludes.Ranges(content);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
private readonly SceneryParser _parser;
|
private readonly SceneryParser _parser;
|
||||||
|
|
||||||
/// <summary>The scenery folders' files and folders, listed once per load of them all.</summary>
|
/// <summary>The scenery folders' files and folders, listed once per load of them all.</summary>
|
||||||
private readonly ConcurrentDictionary<(string, bool), IReadOnlyList<string>> _listings = new();
|
private readonly CaseInsensitivePaths _names;
|
||||||
|
|
||||||
public SceneryRepository(IFileSystem files, IGamePaths paths, IDiagnosticsLog log, SceneryParser parser)
|
public SceneryRepository(IFileSystem files, IGamePaths paths, IDiagnosticsLog log, SceneryParser parser)
|
||||||
{
|
{
|
||||||
@@ -31,11 +31,12 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
_paths = paths;
|
_paths = paths;
|
||||||
_log = log;
|
_log = log;
|
||||||
_parser = parser;
|
_parser = parser;
|
||||||
|
_names = new CaseInsensitivePaths(files, keepListings: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReadOnlyList<Scenery> LoadAll(IProgress<SceneryLoadProgress>? progress = null)
|
public IReadOnlyList<Scenery> LoadAll(IProgress<SceneryLoadProgress>? progress = null)
|
||||||
{
|
{
|
||||||
_listings.Clear();
|
_names.Forget();
|
||||||
var files = SceneryFiles().ToList();
|
var files = SceneryFiles().ToList();
|
||||||
var loaded = new ConcurrentBag<Scenery>();
|
var loaded = new ConcurrentBag<Scenery>();
|
||||||
int total = Math.Max(1, files.Count);
|
int total = Math.Max(1, files.Count);
|
||||||
@@ -58,7 +59,7 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
|
|
||||||
public Scenery? Load(string path)
|
public Scenery? Load(string path)
|
||||||
{
|
{
|
||||||
_listings.Clear();
|
_names.Forget();
|
||||||
return LoadOne(path);
|
return LoadOne(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +80,8 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
// With its own .sbt the scenery's terrain comes from it, and the simulator
|
// With its own .sbt the scenery's terrain comes from it, and the simulator
|
||||||
// passes its terrain includes over without opening them.
|
// passes its terrain includes over without opening them.
|
||||||
bool binaryTerrain = Opens(Path.GetFileNameWithoutExtension(path) + ".sbt");
|
bool binaryTerrain = Opens(Path.GetFileNameWithoutExtension(path) + ".sbt");
|
||||||
IncludeLookup FindInclude(string name) =>
|
bool OpensInclude(string name) =>
|
||||||
Opens(name) || (binaryTerrain && SimulatorNames.Lower(name).Contains("_ter.scm"))
|
Opens(name) || (binaryTerrain && SimulatorNames.Lower(name).Contains("_ter.scm"));
|
||||||
? new IncludeLookup(true)
|
|
||||||
: new IncludeLookup(false, ResolveInclude(name));
|
|
||||||
|
|
||||||
(string File, string Text)? ReadInclude(string name)
|
(string File, string Text)? ReadInclude(string name)
|
||||||
{
|
{
|
||||||
@@ -99,7 +98,7 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
|
|
||||||
string own = LegacyText.Decode(_files.ReadAllBytes(path), out var ownEncoding);
|
string own = LegacyText.Decode(_files.ReadAllBytes(path), out var ownEncoding);
|
||||||
string text = SceneryIncludes.Inline(own, ReadInclude);
|
string text = SceneryIncludes.Inline(own, ReadInclude);
|
||||||
var scenery = _parser.Parse(path, text, FindInclude);
|
var scenery = _parser.Parse(path, text, OpensInclude);
|
||||||
scenery.HasCompanionTimetable = binaryTerrain;
|
scenery.HasCompanionTimetable = binaryTerrain;
|
||||||
scenery.Sources = sources;
|
scenery.Sources = sources;
|
||||||
scenery.TextEncoding = ownEncoding;
|
scenery.TextEncoding = ownEncoding;
|
||||||
@@ -114,11 +113,11 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the simulator opens a file of the scenery folder named so: by the
|
/// Whether the simulator opens a file of the scenery folder named so: whatever the
|
||||||
/// name in lower case, which on Linux has to be how it is named on disk.
|
/// case of its letters, on Linux too. A shade more lenient than eu07 there, which
|
||||||
|
/// folds only the letters A to Z and of two folders named alike takes the first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool Opens(string name) =>
|
private bool Opens(string name) => ResolveInclude(name) is not null;
|
||||||
_files.FileExists(Path.Combine(_paths.Scenery, SimulatorNames.Lower(name.Replace('\\', '/'))));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An include's file as it is named on disk, from the scenery folder, whatever
|
/// An include's file as it is named on disk, from the scenery folder, whatever
|
||||||
@@ -126,44 +125,7 @@ public sealed class SceneryRepository : ISceneryRepository
|
|||||||
/// copy written for a start carries in place of the include, so they come along
|
/// copy written for a start carries in place of the include, so they come along
|
||||||
/// on Linux too.
|
/// on Linux too.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string? ResolveInclude(string name)
|
private string? ResolveInclude(string name) => _names.Resolve(_paths.Scenery, name);
|
||||||
{
|
|
||||||
string relative = name.Replace('\\', '/');
|
|
||||||
if (_files.FileExists(Path.Combine(_paths.Scenery, relative)))
|
|
||||||
return relative;
|
|
||||||
|
|
||||||
string[] parts = relative.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
string directory = _paths.Scenery;
|
|
||||||
var found = new List<string>();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
{
|
|
||||||
if (parts[i] is "." or "..")
|
|
||||||
{
|
|
||||||
directory = Path.Combine(directory, parts[i]);
|
|
||||||
found.Add(parts[i]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool last = i == parts.Length - 1;
|
|
||||||
string? match = Listing(directory, last)
|
|
||||||
.FirstOrDefault(entry => string.Equals(Path.GetFileName(entry), parts[i],
|
|
||||||
StringComparison.OrdinalIgnoreCase));
|
|
||||||
if (match is null)
|
|
||||||
return null;
|
|
||||||
directory = match;
|
|
||||||
found.Add(Path.GetFileName(match));
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Join('/', found);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IReadOnlyList<string> Listing(string directory, bool files) =>
|
|
||||||
_listings.GetOrAdd((directory, files), key =>
|
|
||||||
{
|
|
||||||
if (!_files.DirectoryExists(key.Item1))
|
|
||||||
return Array.Empty<string>();
|
|
||||||
return key.Item2 ? _files.GetFiles(key.Item1) : _files.GetDirectories(key.Item1);
|
|
||||||
});
|
|
||||||
|
|
||||||
private IEnumerable<string> SceneryFiles() =>
|
private IEnumerable<string> SceneryFiles() =>
|
||||||
_files.GetFiles(_paths.Scenery, "*.scn")
|
_files.GetFiles(_paths.Scenery, "*.scn")
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ public sealed class SceneryTranslations : ISceneryTranslations
|
|||||||
private const string BaseLanguage = "en";
|
private const string BaseLanguage = "en";
|
||||||
|
|
||||||
private readonly IFileSystem _files;
|
private readonly IFileSystem _files;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
private readonly IDiagnosticsLog _log;
|
private readonly IDiagnosticsLog _log;
|
||||||
private readonly Dictionary<string, string> _map = new(StringComparer.OrdinalIgnoreCase);
|
private readonly Dictionary<string, string> _map = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
public SceneryTranslations(IFileSystem files, IDiagnosticsLog log)
|
public SceneryTranslations(IFileSystem files, IDiagnosticsLog log)
|
||||||
{
|
{
|
||||||
_files = files;
|
_files = files;
|
||||||
|
_names = new CaseInsensitivePaths(files);
|
||||||
_log = log;
|
_log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,12 +31,11 @@ public sealed class SceneryTranslations : ISceneryTranslations
|
|||||||
|
|
||||||
string sceneryDir = Path.GetDirectoryName(Path.GetFullPath(scenery.Path)) ?? "scenery";
|
string sceneryDir = Path.GetDirectoryName(Path.GetFullPath(scenery.Path)) ?? "scenery";
|
||||||
string id = Path.GetFileNameWithoutExtension(scenery.Path);
|
string id = Path.GetFileNameWithoutExtension(scenery.Path);
|
||||||
string i18nDir = Path.Combine(sceneryDir, "i18n");
|
|
||||||
string language = NormalizeLanguage(langCode);
|
string language = NormalizeLanguage(langCode);
|
||||||
|
|
||||||
TryLoad(Path.Combine(i18nDir, $"{id}_{BaseLanguage}.json"));
|
TryLoad(_names.Find(sceneryDir, $"i18n/{id}_{BaseLanguage}.json"));
|
||||||
if (!string.Equals(language, BaseLanguage, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(language, BaseLanguage, StringComparison.OrdinalIgnoreCase))
|
||||||
TryLoad(Path.Combine(i18nDir, $"{id}_{language}.json"));
|
TryLoad(_names.Find(sceneryDir, $"i18n/{id}_{language}.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Translate(string? text)
|
public string Translate(string? text)
|
||||||
@@ -50,9 +51,9 @@ public sealed class SceneryTranslations : ISceneryTranslations
|
|||||||
return _map.TryGetValue(key, out string? translated) ? translated : text;
|
return _map.TryGetValue(key, out string? translated) ? translated : text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryLoad(string path)
|
private void TryLoad(string? path)
|
||||||
{
|
{
|
||||||
if (!_files.FileExists(path))
|
if (path is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ public sealed class TimetableLocator
|
|||||||
RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
private readonly IFileSystem _files;
|
private readonly IFileSystem _files;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
|
|
||||||
public TimetableLocator(IFileSystem files)
|
public TimetableLocator(IFileSystem files)
|
||||||
{
|
{
|
||||||
_files = files;
|
_files = files;
|
||||||
|
_names = new CaseInsensitivePaths(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string? Resolve(Scenery scenery, string? name)
|
public string? Resolve(Scenery scenery, string? name)
|
||||||
@@ -30,17 +32,19 @@ public sealed class TimetableLocator
|
|||||||
|
|
||||||
string sceneryDir = Path.GetDirectoryName(scenery.Path) ?? ".";
|
string sceneryDir = Path.GetDirectoryName(scenery.Path) ?? ".";
|
||||||
string root = Path.GetDirectoryName(sceneryDir) ?? ".";
|
string root = Path.GetDirectoryName(sceneryDir) ?? ".";
|
||||||
|
name = name.Replace('\\', '/');
|
||||||
|
|
||||||
string[] candidates =
|
(string Folder, string Name)[] candidates =
|
||||||
{
|
{
|
||||||
Path.Combine(root, "timetables", name + ".txt"),
|
(root, "timetables/" + name + ".txt"),
|
||||||
Path.Combine(sceneryDir, name + ".txt"),
|
(sceneryDir, name + ".txt"),
|
||||||
Path.Combine(root, "scenario", name + ".txt"),
|
(root, "scenario/" + name + ".txt"),
|
||||||
Path.Combine(root, "timetables", name),
|
(root, "timetables/" + name),
|
||||||
Path.Combine(sceneryDir, name)
|
(sceneryDir, name)
|
||||||
};
|
};
|
||||||
|
|
||||||
return candidates.FirstOrDefault(_files.FileExists);
|
return candidates.Select(candidate => _names.Find(candidate.Folder, candidate.Name))
|
||||||
|
.FirstOrDefault(found => found is not null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The number the timetable gives its train; null with no timetable or no such heading in it.</summary>
|
/// <summary>The number the timetable gives its train; null with no timetable or no such heading in it.</summary>
|
||||||
|
|||||||
@@ -22,15 +22,37 @@ public sealed class ExecutableLocator
|
|||||||
private string? _wine;
|
private string? _wine;
|
||||||
private bool _wineLookedUp;
|
private bool _wineLookedUp;
|
||||||
private string? _missingPickLogged;
|
private string? _missingPickLogged;
|
||||||
|
private readonly bool _lacksAvx2;
|
||||||
|
|
||||||
public ExecutableLocator(IFileSystem files, IGamePaths paths, IEnvironment environment, IDiagnosticsLog log)
|
/// <param name="lacksAvx2">Whether this processor runs no AVX2; asked of it when left out.</param>
|
||||||
|
public ExecutableLocator(IFileSystem files, IGamePaths paths, IEnvironment environment, IDiagnosticsLog log,
|
||||||
|
bool? lacksAvx2 = null)
|
||||||
{
|
{
|
||||||
_files = files;
|
_files = files;
|
||||||
_paths = paths;
|
_paths = paths;
|
||||||
_environment = environment;
|
_environment = environment;
|
||||||
_log = log;
|
_log = log;
|
||||||
|
_lacksAvx2 = lacksAvx2 ?? CpuFeatures.LacksAvx2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The end of the name of a simulator built without AVX2, last before any extension:
|
||||||
|
/// eu07-x64_2026-11-15_abc1234_noavx2.exe, eu07_noavx2. It runs on any x86-64 processor.
|
||||||
|
/// </summary>
|
||||||
|
public const string NoAvx2Suffix = "_noavx2";
|
||||||
|
|
||||||
|
public static bool IsNoAvx2(string path) =>
|
||||||
|
Path.GetFileNameWithoutExtension(path).EndsWith(NoAvx2Suffix, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether <paramref name="executable"/> stops at its first instruction here: a build
|
||||||
|
/// with AVX2 on a processor without it. Such a processor is told so before a start.
|
||||||
|
/// </summary>
|
||||||
|
public bool WillNotRunHere(string executable) => _lacksAvx2 && !IsNoAvx2(executable);
|
||||||
|
|
||||||
|
/// <summary>The newest build without AVX2 in the installation, or null where there is none.</summary>
|
||||||
|
public string? NewestNoAvx2() => ListCandidates().FirstOrDefault(IsNoAvx2);
|
||||||
|
|
||||||
public string CanonicalName => _environment.IsWindows ? "eu07.exe" : "eu07";
|
public string CanonicalName => _environment.IsWindows ? "eu07.exe" : "eu07";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,7 +93,8 @@ public sealed class ExecutableLocator
|
|||||||
{
|
{
|
||||||
var candidates = _files.GetFiles(_paths.Root, "eu07*")
|
var candidates = _files.GetFiles(_paths.Root, "eu07*")
|
||||||
.Where(IsCandidate)
|
.Where(IsCandidate)
|
||||||
.OrderBy(path => IsExeOnLinux(path) ? 1 : 0)
|
.OrderBy(Rank)
|
||||||
|
.ThenByDescending(path => _lacksAvx2 && IsNoAvx2(path) ? _files.GetLastWriteTimeUtc(path) : DateTime.MinValue)
|
||||||
.ThenBy(path => string.Equals(Path.GetFileName(path), CanonicalName,
|
.ThenBy(path => string.Equals(Path.GetFileName(path), CanonicalName,
|
||||||
StringComparison.OrdinalIgnoreCase) ? 0 : 1)
|
StringComparison.OrdinalIgnoreCase) ? 0 : 1)
|
||||||
.ThenBy(path => Path.GetFileName(path).Length);
|
.ThenBy(path => Path.GetFileName(path).Length);
|
||||||
@@ -101,6 +124,18 @@ public sealed class ExecutableLocator
|
|||||||
return CanonicalName;
|
return CanonicalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The order of the search. Without AVX2 a build without it comes first, the newest of
|
||||||
|
/// them, even through Wine: the others stop at once. With AVX2 one is the last resort,
|
||||||
|
/// as the build made for the processor runs faster; native before Wine either way.
|
||||||
|
/// </summary>
|
||||||
|
private int Rank(string path)
|
||||||
|
{
|
||||||
|
int wine = IsExeOnLinux(path) ? 1 : 0;
|
||||||
|
int noAvx2 = IsNoAvx2(path) ? 1 : 0;
|
||||||
|
return _lacksAvx2 ? (1 - noAvx2) * 2 + wine : wine * 2 + noAvx2;
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> ListCandidates(string? directory = null)
|
public List<string> ListCandidates(string? directory = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
32
StarterNG/Infrastructure/SoftwareRender.cs
Normal file
32
StarterNG/Infrastructure/SoftwareRender.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Avalonia;
|
||||||
|
|
||||||
|
namespace StarterNG.Infrastructure;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Drawn by the processor instead of the graphics card, for a machine on which the
|
||||||
|
/// window comes up empty. Each platform reads only its own options, so both are given.
|
||||||
|
/// </summary>
|
||||||
|
public static class SoftwareRender
|
||||||
|
{
|
||||||
|
public const string Switch = "--software-render";
|
||||||
|
|
||||||
|
public static bool AskedIn(IEnumerable<string> args) =>
|
||||||
|
args.Any(a => string.Equals(a, Switch, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
public static Win32PlatformOptions Win32Options => new()
|
||||||
|
{
|
||||||
|
RenderingMode = new[] { Win32RenderingMode.Software },
|
||||||
|
CompositionMode = new[] { Win32CompositionMode.RedirectionSurface }
|
||||||
|
};
|
||||||
|
|
||||||
|
public static X11PlatformOptions X11Options => new()
|
||||||
|
{
|
||||||
|
RenderingMode = new[] { X11RenderingMode.Software }
|
||||||
|
};
|
||||||
|
|
||||||
|
public static AppBuilder ApplyTo(AppBuilder builder) =>
|
||||||
|
builder.With(Win32Options).With(X11Options);
|
||||||
|
}
|
||||||
90
StarterNG/Infrastructure/SystemGraphicsLibraries.cs
Normal file
90
StarterNG/Infrastructure/SystemGraphicsLibraries.cs
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace StarterNG.Infrastructure;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The starter sits in the simulator's folder, and so do the graphics wrappers a player
|
||||||
|
/// puts there for the simulator - ReShade and the like, named after the system library
|
||||||
|
/// they stand in for. Windows looks in the program's own folder first, so the starter's
|
||||||
|
/// window drew through them too, and with some of them it drew nothing at all.
|
||||||
|
/// Loaded from System32 by full path before anything asks for them, these names are
|
||||||
|
/// taken: a native library that asks by name gets the system one. .NET looks beside the
|
||||||
|
/// program by full path before it asks by name, so the window code's own imports are
|
||||||
|
/// handed the same libraries. The simulator is a process of its own and still finds its
|
||||||
|
/// wrappers.
|
||||||
|
/// Elsewhere there is nothing of the kind to keep out. Under Wine or Proton the system
|
||||||
|
/// folder is the prefix's, so what is taken there is what would have been taken anyway.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SystemGraphicsLibraries
|
||||||
|
{
|
||||||
|
public delegate bool Loader(string path, out IntPtr handle);
|
||||||
|
|
||||||
|
// dxgi ahead of d3d11, which asks for it.
|
||||||
|
public static readonly IReadOnlyList<string> Names = new[] { "dxgi", "d3d11", "d3d9", "opengl32" };
|
||||||
|
|
||||||
|
private readonly Dictionary<string, IntPtr> _loaded = new(StringComparer.OrdinalIgnoreCase);
|
||||||
|
private readonly List<string> _shadowed = new();
|
||||||
|
|
||||||
|
private SystemGraphicsLibraries()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The files of these names that lay beside the starter.</summary>
|
||||||
|
public IReadOnlyList<string> Shadowed => _shadowed;
|
||||||
|
|
||||||
|
/// <summary>What goes to the log about them, or null when none lay there.</summary>
|
||||||
|
public string? Note => _shadowed.Count > 0
|
||||||
|
? $"Graphics libraries beside the starter, left to the simulator: {string.Join(", ", _shadowed)}"
|
||||||
|
: null;
|
||||||
|
|
||||||
|
/// <summary>The libraries of this Windows, or null on any other system.</summary>
|
||||||
|
public static SystemGraphicsLibraries? TakeOnWindows() =>
|
||||||
|
OperatingSystem.IsWindows()
|
||||||
|
? Take(Environment.SystemDirectory, AppContext.BaseDirectory, File.Exists, NativeLibrary.TryLoad)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
public static SystemGraphicsLibraries Take(string systemDirectory, string ownDirectory,
|
||||||
|
Func<string, bool> exists, Loader load)
|
||||||
|
{
|
||||||
|
var taken = new SystemGraphicsLibraries();
|
||||||
|
foreach (string name in Names)
|
||||||
|
{
|
||||||
|
string file = name + ".dll";
|
||||||
|
if (exists(Path.Combine(ownDirectory, file)))
|
||||||
|
taken._shadowed.Add(file);
|
||||||
|
if (load(Path.Combine(systemDirectory, file), out IntPtr handle))
|
||||||
|
taken._loaded[name] = handle;
|
||||||
|
}
|
||||||
|
return taken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The system library for an import of one of these names; zero leaves it to the usual search.</summary>
|
||||||
|
public IntPtr Resolve(string libraryName)
|
||||||
|
{
|
||||||
|
string name = libraryName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)
|
||||||
|
? libraryName[..^4]
|
||||||
|
: libraryName;
|
||||||
|
return _loaded.TryGetValue(name, out IntPtr handle) ? handle : IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The assembly's imports of these names get the system libraries. False when it
|
||||||
|
/// has a resolver of its own already; that one decides.
|
||||||
|
/// </summary>
|
||||||
|
public bool ServeTo(Assembly importer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NativeLibrary.SetDllImportResolver(importer, (name, _, _) => Resolve(name));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ public sealed class FizPhysicsRepository : IPhysicsRepository
|
|||||||
};
|
};
|
||||||
|
|
||||||
private readonly IFileSystem _files;
|
private readonly IFileSystem _files;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
private readonly IGamePaths _paths;
|
private readonly IGamePaths _paths;
|
||||||
private readonly IDiagnosticsLog _log;
|
private readonly IDiagnosticsLog _log;
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ public sealed class FizPhysicsRepository : IPhysicsRepository
|
|||||||
public FizPhysicsRepository(IFileSystem files, IGamePaths paths, IDiagnosticsLog log)
|
public FizPhysicsRepository(IFileSystem files, IGamePaths paths, IDiagnosticsLog log)
|
||||||
{
|
{
|
||||||
_files = files;
|
_files = files;
|
||||||
|
_names = new CaseInsensitivePaths(files);
|
||||||
_paths = paths;
|
_paths = paths;
|
||||||
_log = log;
|
_log = log;
|
||||||
}
|
}
|
||||||
@@ -165,8 +167,9 @@ public sealed class FizPhysicsRepository : IPhysicsRepository
|
|||||||
while (i < tokens.Count && !tokens[i].Equals("end", StringComparison.OrdinalIgnoreCase))
|
while (i < tokens.Count && !tokens[i].Equals("end", StringComparison.OrdinalIgnoreCase))
|
||||||
includeParameters.Add(Resolve(tokens[i++], parameters));
|
includeParameters.Add(Resolve(tokens[i++], parameters));
|
||||||
|
|
||||||
Parse(physics, Path.Combine(directory, includeFile), directory, includeParameters.ToArray(),
|
// Named in the letter case of whoever wrote the include, not always that of the file.
|
||||||
depth + 1);
|
string included = _names.Find(directory, includeFile) ?? Path.Combine(directory, includeFile);
|
||||||
|
Parse(physics, included, directory, includeParameters.ToArray(), depth + 1);
|
||||||
pendingKey = null;
|
pendingKey = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,44 +10,53 @@ public sealed class MissingAssetScanner
|
|||||||
private static readonly string[] TextureExtensions = { ".mat", ".bmp" };
|
private static readonly string[] TextureExtensions = { ".mat", ".bmp" };
|
||||||
private static readonly string[] ModelExtensions = { ".t3d", ".e3d" };
|
private static readonly string[] ModelExtensions = { ".t3d", ".e3d" };
|
||||||
|
|
||||||
private readonly IFileSystem _files;
|
|
||||||
private readonly IGamePaths _paths;
|
private readonly IGamePaths _paths;
|
||||||
|
private readonly CaseInsensitivePaths _names;
|
||||||
|
|
||||||
public MissingAssetScanner(IFileSystem files, IGamePaths paths)
|
public MissingAssetScanner(IFileSystem files, IGamePaths paths)
|
||||||
{
|
{
|
||||||
_files = files;
|
|
||||||
_paths = paths;
|
_paths = paths;
|
||||||
|
_names = new CaseInsensitivePaths(files, keepListings: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> Scan(VehicleCatalog catalog)
|
public List<string> Scan(VehicleCatalog catalog)
|
||||||
{
|
{
|
||||||
var lines = new List<string>();
|
var lines = new List<string>();
|
||||||
|
try
|
||||||
foreach (var texture in catalog.Textures)
|
|
||||||
{
|
{
|
||||||
string directory = Path.Combine(
|
foreach (var texture in catalog.Textures)
|
||||||
_paths.Dynamic,
|
{
|
||||||
texture.Directory.Replace('/', Path.DirectorySeparatorChar).TrimEnd('\\', '/'));
|
string directory = texture.Directory.Replace('\\', '/').TrimEnd('/');
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(texture.Skinfile) &&
|
if (!string.IsNullOrEmpty(texture.Skinfile) &&
|
||||||
!ExistsWithAnyExtension(Path.Combine(directory, texture.Skinfile), TextureExtensions))
|
!ExistsWithAnyExtension(Under(directory, texture.Skinfile), TextureExtensions))
|
||||||
lines.Add($"# no file: {texture.Directory}{texture.Skinfile}");
|
lines.Add($"# no file: {texture.Directory}{texture.Skinfile}");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(texture.Model) &&
|
if (!string.IsNullOrEmpty(texture.Model) &&
|
||||||
!ExistsWithAnyExtension(Path.Combine(directory, texture.Model), ModelExtensions))
|
!ExistsWithAnyExtension(Under(directory, texture.Model), ModelExtensions))
|
||||||
lines.Add($"# no model: {texture.Directory}{texture.Model}");
|
lines.Add($"# no model: {texture.Directory}{texture.Model}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// The folders are listed once for the whole catalog, and not kept past it.
|
||||||
|
_names.Forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ExistsWithAnyExtension(string path, string[] extensions)
|
private static string Under(string directory, string name) =>
|
||||||
|
directory.Length == 0 ? name : directory + "/" + name;
|
||||||
|
|
||||||
|
/// <summary>Whether the file is under dynamic as named, or with one of the extensions, in any letter case.</summary>
|
||||||
|
private bool ExistsWithAnyExtension(string name, string[] extensions)
|
||||||
{
|
{
|
||||||
if (_files.FileExists(path))
|
if (_names.Resolve(_paths.Dynamic, name) is not null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (string extension in extensions)
|
foreach (string extension in extensions)
|
||||||
if (_files.FileExists(Path.ChangeExtension(path, extension)))
|
if (_names.Resolve(_paths.Dynamic, Path.ChangeExtension(name, extension)) is not null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
24
StarterNG/Infrastructure/Vehicles/TextureFolder.cs
Normal file
24
StarterNG/Infrastructure/Vehicles/TextureFolder.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.IO;
|
||||||
|
using StarterNG.Application.Abstractions;
|
||||||
|
using StarterNG.Domain.Vehicles;
|
||||||
|
|
||||||
|
namespace StarterNG.Infrastructure.Vehicles;
|
||||||
|
|
||||||
|
public static class TextureFolder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A livery's folder as it is named on disk: under dynamic, or from the game's folder
|
||||||
|
/// when its name starts there, in any letter case. Where it would be when it is not there.
|
||||||
|
/// </summary>
|
||||||
|
public static string Of(IFileSystem files, IGamePaths paths, VehicleTexture texture)
|
||||||
|
{
|
||||||
|
string directory = texture.Directory.Replace('\\', '/').TrimEnd('/');
|
||||||
|
if (directory.Length == 0)
|
||||||
|
return paths.Dynamic;
|
||||||
|
|
||||||
|
var names = new CaseInsensitivePaths(files);
|
||||||
|
return names.Find(paths.Dynamic, directory, directory: true) ??
|
||||||
|
names.Find(paths.Root, directory, directory: true) ??
|
||||||
|
Path.Combine(paths.Root, directory.Replace('/', Path.DirectorySeparatorChar));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -110,7 +110,13 @@ public partial class MainWindow : Window
|
|||||||
_sceneryFilesTimer.Start();
|
_sceneryFilesTimer.Start();
|
||||||
FollowLastRun();
|
FollowLastRun();
|
||||||
};
|
};
|
||||||
Activated += (_, _) => CheckExternalSettings();
|
Activated += (_, _) =>
|
||||||
|
{
|
||||||
|
CheckExternalSettings();
|
||||||
|
// Back from a build or a download: a new simulator is on the list already.
|
||||||
|
if (SettingsView.IsVisible)
|
||||||
|
SettingsView.RefreshExecutables();
|
||||||
|
};
|
||||||
_sceneryFilesTimer.Tick += async (_, _) => await LookAtSceneryFilesAsync();
|
_sceneryFilesTimer.Tick += async (_, _) => await LookAtSceneryFilesAsync();
|
||||||
Closed += (_, _) => _sceneryFilesTimer.Stop();
|
Closed += (_, _) => _sceneryFilesTimer.Stop();
|
||||||
}
|
}
|
||||||
@@ -521,11 +527,34 @@ public partial class MainWindow : Window
|
|||||||
private const string SimulatorBuildGuide = "https://github.com/MaSzyna-EU07/maszyna#getting-started";
|
private const string SimulatorBuildGuide = "https://github.com/MaSzyna-EU07/maszyna#getting-started";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tells a user whose processor lacks AVX2 that the published simulator will
|
/// Tells a user whose processor lacks AVX2 that the simulator that would start will
|
||||||
/// not run, and where the instructions for a build of their own are.
|
/// not run. With a build without AVX2 in the folder, chosen away from by hand, the
|
||||||
|
/// notice offers to go back to the automatic choice, which takes it; with none, it
|
||||||
|
/// says what such a build is called and where the instructions for one's own are.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task ShowCpuNoticeAsync()
|
public async Task ShowCpuNoticeAsync(string executable)
|
||||||
{
|
{
|
||||||
|
var services = AppServices.Current;
|
||||||
|
if (services.Executables.NewestNoAvx2() is { } noAvx2)
|
||||||
|
{
|
||||||
|
var (useIt, quiet) = await MessageBox.ShowNotice(
|
||||||
|
this, string.Format(App.Loc["CpuNoAvx2Chosen"], Path.GetFileName(executable), noAvx2),
|
||||||
|
App.Loc["CpuNoAvx2Title"], App.Loc["CpuNoAvx2UseIt"], App.Loc["DontShowAgain"]);
|
||||||
|
if (useIt)
|
||||||
|
{
|
||||||
|
services.Settings.SelectExeAutomatically = true;
|
||||||
|
services.SettingsStore.Save();
|
||||||
|
SettingsView.ReloadFromSettings();
|
||||||
|
UpdateStartButton();
|
||||||
|
}
|
||||||
|
if (quiet)
|
||||||
|
{
|
||||||
|
services.Settings.CpuNotice = false;
|
||||||
|
services.SettingsStore.Save();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var (open, silence) = await MessageBox.ShowNotice(
|
var (open, silence) = await MessageBox.ShowNotice(
|
||||||
this, string.Format(App.Loc["CpuNoAvx2"], SimulatorBuildGuide), App.Loc["CpuNoAvx2Title"],
|
this, string.Format(App.Loc["CpuNoAvx2"], SimulatorBuildGuide), App.Loc["CpuNoAvx2Title"],
|
||||||
App.Loc["CpuNoAvx2Open"], App.Loc["DontShowAgain"]);
|
App.Loc["CpuNoAvx2Open"], App.Loc["DontShowAgain"]);
|
||||||
|
|||||||
@@ -10,12 +10,22 @@ namespace StarterNG;
|
|||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static bool _softwareRender;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// Ahead of everything that could draw: what lies beside the starter is the simulator's.
|
||||||
|
var graphics = SystemGraphicsLibraries.TakeOnWindows();
|
||||||
|
graphics?.ServeTo(typeof(Win32PlatformOptions).Assembly);
|
||||||
|
|
||||||
|
_softwareRender = SoftwareRender.AskedIn(args);
|
||||||
|
|
||||||
// Composition root first: everything below, including the crash handlers,
|
// Composition root first: everything below, including the crash handlers,
|
||||||
// resolves its collaborators from this graph.
|
// resolves its collaborators from this graph.
|
||||||
AppServices.Initialize();
|
AppServices.Initialize();
|
||||||
|
if (graphics?.Note is { } note)
|
||||||
|
Diagnostics.Log(note);
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||||
{
|
{
|
||||||
@@ -63,9 +73,13 @@ static class Program
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static AppBuilder WithSoftwareRenderIfAsked(this AppBuilder builder) =>
|
||||||
|
_softwareRender ? SoftwareRender.ApplyTo(builder) : builder;
|
||||||
|
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
=> AppBuilder.Configure<App>()
|
=> AppBuilder.Configure<App>()
|
||||||
.UsePlatformDetect()
|
.UsePlatformDetect()
|
||||||
|
.WithSoftwareRenderIfAsked()
|
||||||
.WithInterFont()
|
.WithInterFont()
|
||||||
.WithDiagnosticsLogging()
|
.WithDiagnosticsLogging()
|
||||||
.AfterSetup(_ => LogUiExceptions());
|
.AfterSetup(_ => LogUiExceptions());
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
<!-- Major and minor only: CI adds the patch, the number of commits, so every
|
<!-- Major and minor only: CI adds the patch, the number of commits, so every
|
||||||
build of main is a higher version without anyone bumping it. -->
|
build of main is a higher version without anyone bumping it. -->
|
||||||
<VersionPrefix>1.5</VersionPrefix>
|
<VersionPrefix>1.6</VersionPrefix>
|
||||||
<AssemblyName>Starter</AssemblyName>
|
<AssemblyName>Starter</AssemblyName>
|
||||||
<Company>eu07.pl</Company>
|
<Company>eu07.pl</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input.Platform;
|
using Avalonia.Input.Platform;
|
||||||
|
using StarterNG.Application;
|
||||||
using StarterNG.Domain;
|
using StarterNG.Domain;
|
||||||
using StarterNG.Domain.Vehicles;
|
using StarterNG.Domain.Vehicles;
|
||||||
|
using StarterNG.Infrastructure.Vehicles;
|
||||||
|
|
||||||
namespace StarterNG.Views;
|
namespace StarterNG.Views;
|
||||||
|
|
||||||
@@ -17,13 +19,7 @@ internal static class TextureMenuItems
|
|||||||
if (TopLevel.GetTopLevel(owner)?.Clipboard is { } clipboard)
|
if (TopLevel.GetTopLevel(owner)?.Clipboard is { } clipboard)
|
||||||
await clipboard.SetTextAsync(Consist.Base(texture.Skinfile));
|
await clipboard.SetTextAsync(Consist.Base(texture.Skinfile));
|
||||||
});
|
});
|
||||||
menu.AddItem(App.Loc["OpenTextureFolder"], () => Infrastructure.Diagnostics.OpenOrReport(FolderOf(texture)));
|
menu.AddItem(App.Loc["OpenTextureFolder"], () => Infrastructure.Diagnostics.OpenOrReport(
|
||||||
}
|
Path.GetFullPath(TextureFolder.Of(AppServices.Current.Files, AppServices.Current.Paths, texture))));
|
||||||
|
|
||||||
private static string FolderOf(VehicleTexture texture)
|
|
||||||
{
|
|
||||||
string dir = Path.Combine(Directory.GetCurrentDirectory(), "dynamic",
|
|
||||||
texture.Directory.Replace('/', Path.DirectorySeparatorChar).TrimEnd('\\', '/'));
|
|
||||||
return Directory.Exists(dir) ? dir : Path.Combine(Directory.GetCurrentDirectory(), texture.Directory);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
StarterNG/Views/ExecutableList.cs
Normal file
31
StarterNG/Views/ExecutableList.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace StarterNG.Views;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The simulators offered in the settings after the folder was looked at again: a build
|
||||||
|
/// copied in while the starter runs joins the list, and what was chosen stays chosen, even
|
||||||
|
/// a file picked from elsewhere or one since removed - looking again never changes the choice.
|
||||||
|
/// </summary>
|
||||||
|
public static class ExecutableList
|
||||||
|
{
|
||||||
|
/// <summary>The entries that follow "automatic", and the place of <paramref name="chosen"/> among them.</summary>
|
||||||
|
/// <param name="found">The simulators in the folder now, newest first.</param>
|
||||||
|
/// <param name="chosen">The entry chosen, or null for "automatic" or nothing chosen yet.</param>
|
||||||
|
/// <returns>Entries, and the index of the chosen one in them, -1 when <paramref name="chosen"/> is null.</returns>
|
||||||
|
public static (IReadOnlyList<string> Entries, int Chosen) Refreshed(IReadOnlyList<string> found, string? chosen)
|
||||||
|
{
|
||||||
|
var entries = found.ToList();
|
||||||
|
if (chosen is null)
|
||||||
|
return (entries, -1);
|
||||||
|
|
||||||
|
int at = entries.FindIndex(entry => string.Equals(entry, chosen, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (at >= 0)
|
||||||
|
return (entries, at);
|
||||||
|
|
||||||
|
entries.Add(chosen);
|
||||||
|
return (entries, entries.Count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -496,20 +496,18 @@ public partial class Scenarios : UserControl
|
|||||||
btn.Classes.Add("Flat");
|
btn.Classes.Add("Flat");
|
||||||
ToolTip.SetTip(btn, att.FilePath);
|
ToolTip.SetTip(btn, att.FilePath);
|
||||||
// A button that does nothing is no way to say the file is not there.
|
// A button that does nothing is no way to say the file is not there.
|
||||||
btn.IsEnabled = File.Exists(Path.GetFullPath(att.FilePath));
|
btn.IsEnabled = AppServices.Current.Attachments.Resolve(att) is not null;
|
||||||
ToolTip.SetShowOnDisabled(btn, true);
|
ToolTip.SetShowOnDisabled(btn, true);
|
||||||
btn.Click += (_, _) => OpenAttachment(att.FilePath);
|
btn.Click += (_, _) => OpenAttachment(att);
|
||||||
attachmentsPanel.Children.Add(btn);
|
attachmentsPanel.Children.Add(btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OpenAttachment(string relativePath)
|
private static void OpenAttachment(SceneryAttachment attachment)
|
||||||
{
|
{
|
||||||
string full = Path.GetFullPath(relativePath);
|
if (AppServices.Current.Attachments.Resolve(attachment) is not { } found)
|
||||||
if (!File.Exists(full))
|
|
||||||
full = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), relativePath));
|
|
||||||
if (!File.Exists(full))
|
|
||||||
return;
|
return;
|
||||||
|
string full = Path.GetFullPath(found);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(full) { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(full) { UseShellExecute = true });
|
||||||
|
|||||||
@@ -105,6 +105,13 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
|
|
||||||
FeedbackCb.SelectionChanged += FeedbackCb_OnSelectionChanged;
|
FeedbackCb.SelectionChanged += FeedbackCb_OnSelectionChanged;
|
||||||
SelectExeCb.SelectionChanged += (_, _) => UpdateIdleNotes();
|
SelectExeCb.SelectionChanged += (_, _) => UpdateIdleNotes();
|
||||||
|
// Coming to the page or to the list is when a new build is looked for.
|
||||||
|
SelectExeCb.GotFocus += (_, _) => RefreshExecutables();
|
||||||
|
PropertyChanged += (_, e) =>
|
||||||
|
{
|
||||||
|
if (e.Property == IsVisibleProperty && IsVisible)
|
||||||
|
RefreshExecutables();
|
||||||
|
};
|
||||||
FullscreenWindowedCb.IsCheckedChanged += (_, _) => UpdateIdleNotes();
|
FullscreenWindowedCb.IsCheckedChanged += (_, _) => UpdateIdleNotes();
|
||||||
App.Loc.LanguageChanged += UpdateIdleNotes;
|
App.Loc.LanguageChanged += UpdateIdleNotes;
|
||||||
App.Loc.LanguageChanged += UpdateGpuNote;
|
App.Loc.LanguageChanged += UpdateGpuNote;
|
||||||
@@ -246,16 +253,33 @@ public partial class Settings : UserControl, ISettingsCapture
|
|||||||
|
|
||||||
private void PopulateExeCombo()
|
private void PopulateExeCombo()
|
||||||
{
|
{
|
||||||
string? current = (SelectExeCb.SelectedItem as ComboBoxItem)?.Content?.ToString();
|
int index = SelectExeCb.SelectedIndex;
|
||||||
|
string? chosen = index > 0 ? (SelectExeCb.SelectedItem as ComboBoxItem)?.Content?.ToString() : null;
|
||||||
|
var (entries, at) = ExecutableList.Refreshed(AppServices.Current.Executables.ListCandidates(), chosen);
|
||||||
|
|
||||||
|
// The same files as shown: left alone, so a reader on the list hears nothing change.
|
||||||
|
var shown = SelectExeCb.Items.Skip(1).Select(item => (item as ComboBoxItem)?.Content?.ToString() ?? "");
|
||||||
|
if (SelectExeCb.Items.Count > 0 && shown.SequenceEqual(entries, StringComparer.Ordinal))
|
||||||
|
return;
|
||||||
|
|
||||||
SelectExeCb.Items.Clear();
|
SelectExeCb.Items.Clear();
|
||||||
SelectExeCb.Items.Add(new ComboBoxItem { Content = App.Loc["SelectEXEAuto"] });
|
SelectExeCb.Items.Add(new ComboBoxItem { Content = App.Loc["SelectEXEAuto"] });
|
||||||
foreach (string exe in AppServices.Current.Executables.ListCandidates())
|
foreach (string exe in entries)
|
||||||
SelectExeCb.Items.Add(new ComboBoxItem { Content = exe });
|
SelectExeCb.Items.Add(new ComboBoxItem { Content = exe });
|
||||||
if (current is not null)
|
if (index >= 0)
|
||||||
{
|
SelectExeCb.SelectedIndex = at >= 0 ? at + 1 : 0;
|
||||||
int idx = FindComboIndexByContent(SelectExeCb, current);
|
}
|
||||||
SelectExeCb.SelectedIndex = idx >= 0 ? idx : 0;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Looks at the simulator folder again, so a build copied in while the starter runs is
|
||||||
|
/// on the list without reopening anything. The choice stays as it was and is no edit:
|
||||||
|
/// nothing waits for Save after it. Not while the list is open under the user's hand.
|
||||||
|
/// </summary>
|
||||||
|
public void RefreshExecutables()
|
||||||
|
{
|
||||||
|
if (SelectExeCb.IsDropDownOpen)
|
||||||
|
return;
|
||||||
|
WhileLoading(PopulateExeCombo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BrowseExeButton_OnClick(object? sender, RoutedEventArgs e) =>
|
private async void BrowseExeButton_OnClick(object? sender, RoutedEventArgs e) =>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using Eu07.BlackBox.Views;
|
using Eu07.BlackBox.Views;
|
||||||
|
|
||||||
namespace StarterNG.Views.Tapes;
|
namespace StarterNG.Views.Tapes;
|
||||||
@@ -15,7 +17,14 @@ internal sealed class StarterBlackBoxStrings : IBlackBoxStrings
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
string text = App.Loc.Opt("BlackBox" + key);
|
string text = App.Loc.Opt("BlackBox" + key);
|
||||||
return text.Length > 0 ? text : _own[key];
|
if (text.Length > 0)
|
||||||
|
return text;
|
||||||
|
// The commands in a language of the old starter's key descriptions, as the keys tab names them; in Polish
|
||||||
|
// and English the window's own.
|
||||||
|
if (key.StartsWith(DefaultBlackBoxStrings.CommandPrefix, StringComparison.Ordinal) && App.Loc.CurrentLangCode is not ("pl" or "en")
|
||||||
|
&& App.Loc.Opt(key) is { Length: > 0 } described)
|
||||||
|
return char.ToUpper(described[0], CultureInfo.CurrentCulture) + described[1..];
|
||||||
|
return _own[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,8 +633,10 @@
|
|||||||
<String key="About">O programu</String>
|
<String key="About">O programu</String>
|
||||||
<String key="Close">Zavřít</String>
|
<String key="Close">Zavřít</String>
|
||||||
<String key="CpuNoAvx2Title">Procesor bez AVX2</String>
|
<String key="CpuNoAvx2Title">Procesor bez AVX2</String>
|
||||||
<String key="CpuNoAvx2">Tento procesor nemá AVX2 a oficiální simulátor ho vyžaduje: nespustí se. Simulátor lze sestavit bez AVX2 (CMake -DENABLE_AVX2=OFF). Návod: {0}</String>
|
<String key="CpuNoAvx2">Tento procesor nemá AVX2 a oficiální simulátor ho vyžaduje: nespustí se. Existuje verze simulátoru bez AVX2 - název jejího souboru končí na _noavx2. Vložte ji do složky hry a starter ji sám použije. Simulátor lze také sestavit sám (CMake -DENABLE_AVX2=OFF). Návod: {0}</String>
|
||||||
<String key="CpuNoAvx2Open">Otevřít návod</String>
|
<String key="CpuNoAvx2Open">Otevřít návod</String>
|
||||||
|
<String key="CpuNoAvx2Chosen">Tento procesor nemá AVX2 a zvolený simulátor {0} ho vyžaduje: nespustí se. Ve složce hry je verze bez AVX2: {1}. Automatická volba vezme právě ji.</String>
|
||||||
|
<String key="CpuNoAvx2UseIt">Volit automaticky</String>
|
||||||
<String key="DontShowAgain">Znovu nezobrazovat</String>
|
<String key="DontShowAgain">Znovu nezobrazovat</String>
|
||||||
<String key="SettingsPath">Nastavení načteno z:</String>
|
<String key="SettingsPath">Nastavení načteno z:</String>
|
||||||
|
|
||||||
@@ -783,7 +785,6 @@
|
|||||||
<String key="SyntaxVehicleOutsideTrainset">Vozidlo {0} stojí mimo soupravu: chybí záhlaví trainset?</String>
|
<String key="SyntaxVehicleOutsideTrainset">Vozidlo {0} stojí mimo soupravu: chybí záhlaví trainset?</String>
|
||||||
<String key="SyntaxNotANumber">{0}: „{1}“ místo čísla</String>
|
<String key="SyntaxNotANumber">{0}: „{1}“ místo čísla</String>
|
||||||
<String key="SyntaxMissingInclude">Soubor {1} nenalezen (include)</String>
|
<String key="SyntaxMissingInclude">Soubor {1} nenalezen (include)</String>
|
||||||
<String key="SyntaxIncludeLetterCase">Soubor {1} je na disku jako {0}: linuxový eu07 ho nenačte</String>
|
|
||||||
<String key="SyntaxIncludeNotClosed">include {1} bez end</String>
|
<String key="SyntaxIncludeNotClosed">include {1} bez end</String>
|
||||||
<String key="SyntaxTrainsetUnreadable">Soupravu {0} se nepodařilo načíst</String>
|
<String key="SyntaxTrainsetUnreadable">Soupravu {0} se nepodařilo načíst</String>
|
||||||
<String key="SyntaxVehicleUnreadable">Vozidlo {0} se nepodařilo načíst</String>
|
<String key="SyntaxVehicleUnreadable">Vozidlo {0} se nepodařilo načíst</String>
|
||||||
|
|||||||
@@ -659,8 +659,10 @@
|
|||||||
<String key="About">About</String>
|
<String key="About">About</String>
|
||||||
<String key="Close">Close</String>
|
<String key="Close">Close</String>
|
||||||
<String key="CpuNoAvx2Title">Processor without AVX2</String>
|
<String key="CpuNoAvx2Title">Processor without AVX2</String>
|
||||||
<String key="CpuNoAvx2">This processor has no AVX2 and the official simulator needs it: it will not start. You can build the simulator without AVX2 (CMake -DENABLE_AVX2=OFF). Instructions: {0}</String>
|
<String key="CpuNoAvx2">This processor has no AVX2 and the official simulator needs it: it will not start. There is a simulator build without AVX2 - its file name ends in _noavx2. Put it in the game folder and the starter will use it. You can also build the simulator yourself (CMake -DENABLE_AVX2=OFF). Instructions: {0}</String>
|
||||||
<String key="CpuNoAvx2Open">Open the instructions</String>
|
<String key="CpuNoAvx2Open">Open the instructions</String>
|
||||||
|
<String key="CpuNoAvx2Chosen">This processor has no AVX2 and the chosen simulator {0} needs it: it will not start. The game folder has a build without AVX2: {1}. The automatic choice takes that one.</String>
|
||||||
|
<String key="CpuNoAvx2UseIt">Choose automatically</String>
|
||||||
<String key="DontShowAgain">Don't show again</String>
|
<String key="DontShowAgain">Don't show again</String>
|
||||||
<String key="SettingsPath">Settings loaded from:</String>
|
<String key="SettingsPath">Settings loaded from:</String>
|
||||||
|
|
||||||
@@ -813,7 +815,6 @@
|
|||||||
<String key="SyntaxVehicleOutsideTrainset">Vehicle {0} stands outside a trainset: header missing?</String>
|
<String key="SyntaxVehicleOutsideTrainset">Vehicle {0} stands outside a trainset: header missing?</String>
|
||||||
<String key="SyntaxNotANumber">{0}: “{1}” instead of a number</String>
|
<String key="SyntaxNotANumber">{0}: “{1}” instead of a number</String>
|
||||||
<String key="SyntaxMissingInclude">File {1} not found (include)</String>
|
<String key="SyntaxMissingInclude">File {1} not found (include)</String>
|
||||||
<String key="SyntaxIncludeLetterCase">File {1} is on disk as {0}: the Linux eu07 will not load it</String>
|
|
||||||
<String key="SyntaxIncludeNotClosed">include {1} without end</String>
|
<String key="SyntaxIncludeNotClosed">include {1} without end</String>
|
||||||
<String key="SyntaxTrainsetUnreadable">Trainset {0} could not be read</String>
|
<String key="SyntaxTrainsetUnreadable">Trainset {0} could not be read</String>
|
||||||
<String key="SyntaxVehicleUnreadable">Vehicle {0} could not be read</String>
|
<String key="SyntaxVehicleUnreadable">Vehicle {0} could not be read</String>
|
||||||
@@ -900,8 +901,8 @@
|
|||||||
<String key="Cmd.trainbrakecharging">train brake valve: overcharge the brake pipe</String>
|
<String key="Cmd.trainbrakecharging">train brake valve: overcharge the brake pipe</String>
|
||||||
<String key="Cmd.trainbrakerelease">train brake valve: running position</String>
|
<String key="Cmd.trainbrakerelease">train brake valve: running position</String>
|
||||||
<String key="Cmd.trainbrakefirstservice">train brake valve: first braking step</String>
|
<String key="Cmd.trainbrakefirstservice">train brake valve: first braking step</String>
|
||||||
<String key="Cmd.trainbrakeservice">train brake valve: full service</String>
|
<String key="Cmd.trainbrakeservice">train brake valve: service braking</String>
|
||||||
<String key="Cmd.trainbrakefullservice">train brake valve: supplementary braking</String>
|
<String key="Cmd.trainbrakefullservice">train brake valve: full service</String>
|
||||||
<String key="Cmd.trainbrakehandleoff">train brake valve: lap position</String>
|
<String key="Cmd.trainbrakehandleoff">train brake valve: lap position</String>
|
||||||
<String key="Cmd.trainbrakeemergency">emergency braking</String>
|
<String key="Cmd.trainbrakeemergency">emergency braking</String>
|
||||||
<String key="Cmd.trainbrakebasepressureincrease">raise the brake pipe pressure level</String>
|
<String key="Cmd.trainbrakebasepressureincrease">raise the brake pipe pressure level</String>
|
||||||
@@ -1011,7 +1012,7 @@
|
|||||||
<String key="Cmd.interiorlightdimtoggle">toggle cab light dimming</String>
|
<String key="Cmd.interiorlightdimtoggle">toggle cab light dimming</String>
|
||||||
<String key="Cmd.compartmentlightstoggle">toggle the compartment lights</String>
|
<String key="Cmd.compartmentlightstoggle">toggle the compartment lights</String>
|
||||||
<String key="Cmd.instrumentlighttoggle">toggle the instrument lights</String>
|
<String key="Cmd.instrumentlighttoggle">toggle the instrument lights</String>
|
||||||
<String key="Cmd.dashboardlighttoggle">toggle the desk lights</String>
|
<String key="Cmd.dashboardlighttoggle">toggle the dashboard light</String>
|
||||||
<String key="Cmd.timetablelighttoggle">toggle the timetable light</String>
|
<String key="Cmd.timetablelighttoggle">toggle the timetable light</String>
|
||||||
<String key="Cmd.generictoggle0">generic switch 0</String>
|
<String key="Cmd.generictoggle0">generic switch 0</String>
|
||||||
<String key="Cmd.generictoggle1">generic switch 1</String>
|
<String key="Cmd.generictoggle1">generic switch 1</String>
|
||||||
|
|||||||
@@ -633,8 +633,10 @@
|
|||||||
<String key="About">Névjegy</String>
|
<String key="About">Névjegy</String>
|
||||||
<String key="Close">Bezárás</String>
|
<String key="Close">Bezárás</String>
|
||||||
<String key="CpuNoAvx2Title">AVX2 nélküli processzor</String>
|
<String key="CpuNoAvx2Title">AVX2 nélküli processzor</String>
|
||||||
<String key="CpuNoAvx2">Ez a processzor nem tudja az AVX2-t, a hivatalos szimulátornak pedig kell: nem indul el. A szimulátor lefordítható AVX2 nélkül (CMake -DENABLE_AVX2=OFF). Útmutató: {0}</String>
|
<String key="CpuNoAvx2">Ez a processzor nem tudja az AVX2-t, a hivatalos szimulátornak pedig kell: nem indul el. Van AVX2 nélküli szimulátor-változat - a fájl neve _noavx2-re végződik. Tegye a játék mappájába, és az indító magától azt használja. A szimulátor saját maga is lefordítható (CMake -DENABLE_AVX2=OFF). Útmutató: {0}</String>
|
||||||
<String key="CpuNoAvx2Open">Útmutató megnyitása</String>
|
<String key="CpuNoAvx2Open">Útmutató megnyitása</String>
|
||||||
|
<String key="CpuNoAvx2Chosen">Ez a processzor nem tudja az AVX2-t, a kiválasztott {0} szimulátornak pedig kell: nem indul el. A játék mappájában van AVX2 nélküli változat: {1}. Az automatikus választás ezt veszi.</String>
|
||||||
|
<String key="CpuNoAvx2UseIt">Automatikus választás</String>
|
||||||
<String key="DontShowAgain">Ne mutasd többé</String>
|
<String key="DontShowAgain">Ne mutasd többé</String>
|
||||||
<String key="SettingsPath">Beállítások betöltve innen:</String>
|
<String key="SettingsPath">Beállítások betöltve innen:</String>
|
||||||
|
|
||||||
@@ -783,7 +785,6 @@
|
|||||||
<String key="SyntaxVehicleOutsideTrainset">A(z) {0} jármű szerelvényen kívül áll: hiányzik a trainset fejléc?</String>
|
<String key="SyntaxVehicleOutsideTrainset">A(z) {0} jármű szerelvényen kívül áll: hiányzik a trainset fejléc?</String>
|
||||||
<String key="SyntaxNotANumber">{0}: „{1}” szám helyett</String>
|
<String key="SyntaxNotANumber">{0}: „{1}” szám helyett</String>
|
||||||
<String key="SyntaxMissingInclude">A(z) {1} fájl nem található (include)</String>
|
<String key="SyntaxMissingInclude">A(z) {1} fájl nem található (include)</String>
|
||||||
<String key="SyntaxIncludeLetterCase">A(z) {1} fájl a lemezen {0} néven van: a linuxos eu07 nem tölti be</String>
|
|
||||||
<String key="SyntaxIncludeNotClosed">include {1} end nélkül</String>
|
<String key="SyntaxIncludeNotClosed">include {1} end nélkül</String>
|
||||||
<String key="SyntaxTrainsetUnreadable">A(z) {0} szerelvényt nem sikerült beolvasni</String>
|
<String key="SyntaxTrainsetUnreadable">A(z) {0} szerelvényt nem sikerült beolvasni</String>
|
||||||
<String key="SyntaxVehicleUnreadable">A(z) {0} járművet nem sikerült beolvasni</String>
|
<String key="SyntaxVehicleUnreadable">A(z) {0} járművet nem sikerült beolvasni</String>
|
||||||
|
|||||||
@@ -659,8 +659,10 @@
|
|||||||
<String key="About">O programie</String>
|
<String key="About">O programie</String>
|
||||||
<String key="Close">Zamknij</String>
|
<String key="Close">Zamknij</String>
|
||||||
<String key="CpuNoAvx2Title">Procesor bez AVX2</String>
|
<String key="CpuNoAvx2Title">Procesor bez AVX2</String>
|
||||||
<String key="CpuNoAvx2">Ten procesor nie ma AVX2, a oficjalny symulator go wymaga: nie uruchomi się. Można zbudować symulator bez AVX2 (CMake -DENABLE_AVX2=OFF). Instrukcja: {0}</String>
|
<String key="CpuNoAvx2">Ten procesor nie ma AVX2, a oficjalny symulator go wymaga: nie uruchomi się. Istnieje wersja symulatora bez AVX2 - nazwa jej pliku kończy się na _noavx2. Umieść ją w folderze gry, a starter sam jej użyje. Można też zbudować symulator samemu (CMake -DENABLE_AVX2=OFF). Instrukcja: {0}</String>
|
||||||
<String key="CpuNoAvx2Open">Otwórz instrukcję</String>
|
<String key="CpuNoAvx2Open">Otwórz instrukcję</String>
|
||||||
|
<String key="CpuNoAvx2Chosen">Ten procesor nie ma AVX2, a wybrany symulator {0} go wymaga: nie uruchomi się. W folderze gry jest wersja bez AVX2: {1}. Wybór automatyczny weźmie właśnie ją.</String>
|
||||||
|
<String key="CpuNoAvx2UseIt">Wybieraj automatycznie</String>
|
||||||
<String key="DontShowAgain">Nie pokazuj więcej</String>
|
<String key="DontShowAgain">Nie pokazuj więcej</String>
|
||||||
<String key="SettingsPath">Lokalizacja wczytanych ustawień:</String>
|
<String key="SettingsPath">Lokalizacja wczytanych ustawień:</String>
|
||||||
|
|
||||||
@@ -810,7 +812,6 @@
|
|||||||
<String key="SyntaxVehicleOutsideTrainset">Pojazd {0} stoi poza składem: brak nagłówka trainset?</String>
|
<String key="SyntaxVehicleOutsideTrainset">Pojazd {0} stoi poza składem: brak nagłówka trainset?</String>
|
||||||
<String key="SyntaxNotANumber">{0}: „{1}” zamiast liczby</String>
|
<String key="SyntaxNotANumber">{0}: „{1}” zamiast liczby</String>
|
||||||
<String key="SyntaxMissingInclude">Brak pliku {1} (include)</String>
|
<String key="SyntaxMissingInclude">Brak pliku {1} (include)</String>
|
||||||
<String key="SyntaxIncludeLetterCase">Plik {1} jest na dysku jako {0}: linuksowy eu07 go nie wczyta</String>
|
|
||||||
<String key="SyntaxIncludeNotClosed">include {1} bez end</String>
|
<String key="SyntaxIncludeNotClosed">include {1} bez end</String>
|
||||||
<String key="SyntaxTrainsetUnreadable">Nie udało się odczytać składu {0}</String>
|
<String key="SyntaxTrainsetUnreadable">Nie udało się odczytać składu {0}</String>
|
||||||
<String key="SyntaxVehicleUnreadable">Nie udało się odczytać pojazdu {0}</String>
|
<String key="SyntaxVehicleUnreadable">Nie udało się odczytać pojazdu {0}</String>
|
||||||
|
|||||||
@@ -633,8 +633,10 @@
|
|||||||
<String key="About">О программе</String>
|
<String key="About">О программе</String>
|
||||||
<String key="Close">Закрыть</String>
|
<String key="Close">Закрыть</String>
|
||||||
<String key="CpuNoAvx2Title">Процессор без AVX2</String>
|
<String key="CpuNoAvx2Title">Процессор без AVX2</String>
|
||||||
<String key="CpuNoAvx2">Этот процессор не поддерживает AVX2, а официальному симулятору он нужен: симулятор не запустится. Можно собрать симулятор без AVX2 (CMake -DENABLE_AVX2=OFF). Инструкция: {0}</String>
|
<String key="CpuNoAvx2">Этот процессор не поддерживает AVX2, а официальному симулятору он нужен: симулятор не запустится. Есть версия симулятора без AVX2 - имя её файла оканчивается на _noavx2. Положите её в папку игры, и стартер сам её использует. Симулятор можно также собрать самому (CMake -DENABLE_AVX2=OFF). Инструкция: {0}</String>
|
||||||
<String key="CpuNoAvx2Open">Открыть инструкцию</String>
|
<String key="CpuNoAvx2Open">Открыть инструкцию</String>
|
||||||
|
<String key="CpuNoAvx2Chosen">Этот процессор не поддерживает AVX2, а выбранному симулятору {0} он нужен: он не запустится. В папке игры есть версия без AVX2: {1}. Автоматический выбор возьмёт именно её.</String>
|
||||||
|
<String key="CpuNoAvx2UseIt">Выбирать автоматически</String>
|
||||||
<String key="DontShowAgain">Больше не показывать</String>
|
<String key="DontShowAgain">Больше не показывать</String>
|
||||||
<String key="SettingsPath">Настройки загружены из:</String>
|
<String key="SettingsPath">Настройки загружены из:</String>
|
||||||
|
|
||||||
@@ -783,7 +785,6 @@
|
|||||||
<String key="SyntaxVehicleOutsideTrainset">Транспорт {0} стоит вне состава: нет заголовка trainset?</String>
|
<String key="SyntaxVehicleOutsideTrainset">Транспорт {0} стоит вне состава: нет заголовка trainset?</String>
|
||||||
<String key="SyntaxNotANumber">{0}: «{1}» вместо числа</String>
|
<String key="SyntaxNotANumber">{0}: «{1}» вместо числа</String>
|
||||||
<String key="SyntaxMissingInclude">Файл {1} не найден (include)</String>
|
<String key="SyntaxMissingInclude">Файл {1} не найден (include)</String>
|
||||||
<String key="SyntaxIncludeLetterCase">Файл {1} на диске назван {0}: eu07 на Linux его не загрузит</String>
|
|
||||||
<String key="SyntaxIncludeNotClosed">include {1} без end</String>
|
<String key="SyntaxIncludeNotClosed">include {1} без end</String>
|
||||||
<String key="SyntaxTrainsetUnreadable">Не удалось прочитать состав {0}</String>
|
<String key="SyntaxTrainsetUnreadable">Не удалось прочитать состав {0}</String>
|
||||||
<String key="SyntaxVehicleUnreadable">Не удалось прочитать единицу {0}</String>
|
<String key="SyntaxVehicleUnreadable">Не удалось прочитать единицу {0}</String>
|
||||||
|
|||||||
Reference in New Issue
Block a user