Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjorn committed Feb 15, 2017
1 parent b5c0015 commit aba47e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public async Task<IDataSourcePlugin> GetDataSourceDataAsync(NameValueCollection
data.FileVersion = items[0];
data.DateReading = GlimpDateStringToDateTime(items[1]);
data.RawGlucose = items[4];
data._glucose = Double.Parse(items[5], NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
data._glucose = Double.Parse(items[5], NumberStyles.Any, CultureInfo.InvariantCulture);
data.SensorId = items[7];
//}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FloatingGlucose.Classes.Utils;
using FloatingGlucose.Classes.Extensions;
using FloatingGlucose.Classes.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
Expand Down Expand Up @@ -30,15 +31,15 @@ internal class NightscoutPebbleEndpoint : IDataSourcePlugin

public double RoundedRawDelta() => Math.Round(this.RawDelta, 1);

public static CultureInfo Culture = new CultureInfo("en-US");
//public static CultureInfo Culture = new CultureInfo("en-US");

public double CalculateRawGlucose(Cal cal, Bg bg, double actualGlucose)
{
double number;
double curBG = actualGlucose;
int specialValue = 0;

if (this.IsMmol)
if (this.UserWantsMmolUnits())
{
if ((actualGlucose < 2.2) || (actualGlucose > 22.2))
{
Expand Down Expand Up @@ -67,7 +68,7 @@ public double CalculateRawGlucose(Cal cal, Bg bg, double actualGlucose)
number = cal.scale * (bg.unfiltered - cal.intercept) / cal.slope / number;
}

if (this.IsMmol)
if (this.UserWantsMmolUnits())
{
number = number / 18.01559;
}
Expand All @@ -80,7 +81,7 @@ public double PreviousGlucose
get
{
var bgs = this.NsData.bgs.Skip(1).First();
return Double.Parse(bgs.sgv, NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
return Double.Parse(bgs.sgv, NumberStyles.Any, CultureInfo.InvariantCulture);
}
}

Expand Down Expand Up @@ -119,7 +120,7 @@ public double RawGlucose
}

public DateTime LocalDate => this.Date.ToLocalTime();
public bool IsMmol => Default.GlucoseUnits == "mmol";

public virtual string DataSourceShortName => "Nightscout URL";

public virtual void OnPluginSelected(FormGlucoseSettings form)
Expand Down Expand Up @@ -153,9 +154,9 @@ public virtual async Task<IDataSourcePlugin> GetDataSourceDataAsync(NameValueCol
{
bgs = parsed.bgs.First();
this.Direction = bgs.direction;
this.Glucose = Double.Parse(bgs.sgv, NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
this.Glucose = Double.Parse(bgs.sgv, NumberStyles.Any, CultureInfo.InvariantCulture);
this.Date = DateTimeOffset.FromUnixTimeMilliseconds(bgs.datetime).DateTime;
this.Delta = Double.Parse(bgs.bgdelta, NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
this.Delta = Double.Parse(bgs.bgdelta, NumberStyles.Any, CultureInfo.InvariantCulture);
}
catch (InvalidOperationException ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public override async Task<IDataSourcePlugin> GetDataSourceDataAsync(NameValueCo

bgs = parsed.bgs.First();
this.Direction = bgs.direction;
this.Glucose = Double.Parse(bgs.sgv, NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
this.Glucose = Double.Parse(bgs.sgv, NumberStyles.Any, CultureInfo.InvariantCulture);
this.Date = DateTimeOffset.FromUnixTimeMilliseconds(bgs.datetime).DateTime;
this.Delta = Double.Parse(bgs.bgdelta, NumberStyles.Any, NightscoutPebbleFileEndpoint.Culture);
this.Delta = Double.Parse(bgs.bgdelta, NumberStyles.Any, CultureInfo.InvariantCulture);

return this;
}
Expand Down
1 change: 1 addition & 0 deletions FloatingGlucose/FloatingGlucose.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<Compile Include="Classes\DataSources\Exceptions\NoPluginChosenException.cs" />
<Compile Include="Classes\DataSources\Exceptions\NoSuchPluginException.cs" />
<Compile Include="Classes\DataSources\Exceptions\ConfigValidationException.cs" />
<Compile Include="Classes\DataSources\Plugins\YrWeatherServiceEndpoint.cs" />
<Compile Include="Classes\DataSources\Plugins\GlimpFileEndpoint.cs" />
<Compile Include="Classes\DataSources\Plugins\NightscoutPebbleFileEndpoint.cs" />
<Compile Include="Classes\DataSources\PluginLoader.cs" />
Expand Down

0 comments on commit aba47e2

Please sign in to comment.