Skip to content

Commit 8fb3285

Browse files
authored
Merge pull request #1161 from cesarBLG/fix-script-ini
Fix string trim in .ini files
2 parents dcc1764 + 6cfe4e2 commit 8fb3285

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Source/Orts.Simulation/Common/Scripting/PowerSupply/LocomotivePowerSupply.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ protected T LoadParameter<T>(string sectionName, string keyName, T defaultValue)
606606

607607
if (length > 0)
608608
{
609-
buffer.Trim();
609+
buffer = buffer.Trim('\0').Trim();
610610
return (T)Convert.ChangeType(buffer, typeof(T), System.Globalization.CultureInfo.InvariantCulture);
611611
}
612612
}

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/TrainControlSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ private T LoadParameter<T>(string sectionName, string keyName, T defaultValue)
920920

921921
if (length > 0)
922922
{
923-
buffer.Trim();
923+
buffer = buffer.Trim('\0').Trim();
924924
return (T)Convert.ChangeType(buffer, typeof(T), System.Globalization.CultureInfo.InvariantCulture);
925925
}
926926
}
@@ -932,7 +932,7 @@ private T LoadParameter<T>(string sectionName, string keyName, T defaultValue)
932932

933933
if (length > 0)
934934
{
935-
buffer.Trim();
935+
buffer = buffer.Trim('\0').Trim();
936936
return (T)Convert.ChangeType(buffer, typeof(T), System.Globalization.CultureInfo.InvariantCulture);
937937
}
938938
}

0 commit comments

Comments
 (0)