Skip to content

Commit

Permalink
Fixed parsing of floats in ConfFile
Browse files Browse the repository at this point in the history
  • Loading branch information
exectails committed Aug 7, 2023
1 parent bec0a74 commit f3bed1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Yggdrasil/Configuration/ConfFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public float GetFloat(string option, float defaultValue = 0)
return defaultValue;
}

if (float.TryParse(value, out var ret))
if (float.TryParse(value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var ret))
return ret;

return defaultValue;
Expand All @@ -233,7 +233,7 @@ public float GetFloat(string option, float defaultValue = 0)
/// <param name="option"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public DateTime GetDateTime(string option, DateTime defaultValue = default(DateTime))
public DateTime GetDateTime(string option, DateTime defaultValue = default)
{
string value;
lock (_options)
Expand All @@ -257,7 +257,7 @@ public float GetFloat(string option, float defaultValue = 0)
/// <param name="option"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public T GetEnum<T>(string option, T defaultValue = default(T)) where T : struct
public T GetEnum<T>(string option, T defaultValue = default) where T : struct
{
var type = typeof(T);

Expand Down

0 comments on commit f3bed1a

Please sign in to comment.