From bd8807e43fa09df3285aea74a5c3845d414f2bd4 Mon Sep 17 00:00:00 2001 From: Kaloyan Raev Date: Mon, 30 Sep 2019 07:07:37 -0600 Subject: [PATCH] Fix locale to "en-US" when parsing numbers (#3143) --- installer/windows/Storj/CustomAction.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/windows/Storj/CustomAction.cs b/installer/windows/Storj/CustomAction.cs index eea153e83..72e755731 100644 --- a/installer/windows/Storj/CustomAction.cs +++ b/installer/windows/Storj/CustomAction.cs @@ -1,5 +1,6 @@ using Microsoft.Deployment.WindowsInstaller; using System; +using System.Globalization; using System.IO; namespace Storj @@ -126,7 +127,7 @@ namespace Storj return ActionResult.Success; } - if (!double.TryParse(storageStr, out double storage)) + if (!double.TryParse(storageStr, NumberStyles.Number, CultureInfo.CreateSpecificCulture("en-US"), out double storage)) { session["STORJ_STORAGE_VALID"] = string.Format("'{0}' is not a valid number.", storageStr); return ActionResult.Success; @@ -165,7 +166,7 @@ namespace Storj return ActionResult.Success; } - if (!double.TryParse(bandwidthStr, out double bandwidth)) + if (!double.TryParse(bandwidthStr, NumberStyles.Number, CultureInfo.CreateSpecificCulture("en-US"), out double bandwidth)) { session["STORJ_BANDWIDTH_VALID"] = string.Format("'{0}' is not a valid number.", bandwidthStr); return ActionResult.Success;