Skip to content

Commit

Permalink
Made double.parse culture invariant (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyvorld authored Jul 2, 2020
1 parent 8e9e604 commit 681ac30
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion LGSTrayBattery/PowerModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -44,7 +45,10 @@ public PowerModel(UInt16 WPID)

var temp = dischargeCurveNode.Value.Trim('\n', ' ').Split(new char[] { '\n', }, StringSplitOptions.RemoveEmptyEntries);

_dischargeCurve = temp.ToList().ConvertAll(x => Array.ConvertAll(x.Split(','), Double.Parse));
_dischargeCurve = Array.ConvertAll(temp,
x => Array.ConvertAll(x.Split(','),
new Converter<string, double>(y =>
Double.Parse(y, NumberStyles.Any, CultureInfo.InvariantCulture)))).ToList();

if (_dischargeCurve[0][LUTCol.Volt] > _dischargeCurve[1][LUTCol.Volt])
{
Expand Down

0 comments on commit 681ac30

Please # to comment.