Skip to content

Commit

Permalink
FIX: Parse leak values as en-US format
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvanderbeck committed May 17, 2015
1 parent 60b4545 commit 000b4c3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 3 deletions.
Binary file modified GameData/TestFlight/Plugins/TestFlight.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightAPI.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightContracts.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightCore.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions TestFlightFailure_ResourceLeak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private float ParseValue(string rawValue)
if (rawValue.EndsWith("%t"))
{
trimmedValue = rawValue.Substring(0, index);
if (!float.TryParse(trimmedValue, out parsedValue))
if (!float.TryParse(trimmedValue, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.CreateSpecificCulture("en-US"), out parsedValue))
parsedValue = 0f;
// Calculate the % value based on the total capacity of the tank
calculateFromAmount = this.part.Resources.Get(leakingResourceID).maxAmount;
Expand All @@ -102,13 +102,13 @@ private float ParseValue(string rawValue)
else if (rawValue.EndsWith("%c"))
{
trimmedValue = rawValue.Substring(0, index);
if (!float.TryParse(trimmedValue, out parsedValue))
if (!float.TryParse(trimmedValue, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.CreateSpecificCulture("en-US"), out parsedValue))
parsedValue = 0f;
// Calculate the % value based on the current resource level of the tank
calculateFromAmount = this.part.Resources.Get(leakingResourceID).amount;
Log(String.Format("Calculating leak amount from current amount: {0:F2}", calculateFromAmount));
}

Log(String.Format("Base value was parsed as: {0:F2}", parsedValue));
parsedValue = parsedValue * (float)calculateFromAmount;
Log(String.Format("Calculated leak: {0:F2}", parsedValue));
}
Expand Down

0 comments on commit 000b4c3

Please sign in to comment.