fix converter.cs

This commit is contained in:
Jeddunk 2022-01-30 16:46:19 +01:00
parent 20955420f0
commit 2b984cd5a1

View File

@ -20,13 +20,18 @@ namespace SteamStorefrontAPI.Classes
{
if (reader.TokenType == JsonToken.Null) return null;
var value = reader.Value.ToString();
double result;
var style = System.Globalization.NumberStyles.AllowDecimalPoint;
var provider = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
if (value.Length < 2)
{
return double.Parse($".{value}");
double.TryParse($".{value}", style, provider, out result);
} else {
double.TryParse(value.Insert(value.Length - 2, "."), style, provider, out result);
}
return double.Parse(value.Insert(value.Length - 2, "."));
return result;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)