Skip to content

Commit

Permalink
🔢 Use InvariantCulture double parsing
Browse files Browse the repository at this point in the history
Fixes #111.
  • Loading branch information
database64128 committed Apr 30, 2022
1 parent 6571725 commit 549e300
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions YoutubeDl.Wpf/Models/BackendInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reactive.Concurrency;
using System.Text;
Expand Down Expand Up @@ -81,11 +82,10 @@ private void ParseDlOutput(string output)
var parsedStringArray = output.Split(outputSeparators, StringSplitOptions.RemoveEmptyEntries);
if (parsedStringArray.Length == 4) // valid [download] line
{
var percentageString = parsedStringArray[0];
if (percentageString.EndsWith('%')) // actual percentage
ReadOnlySpan<char> percentageString = parsedStringArray[0];
if (percentageString.Length >= 2 && percentageString.EndsWith("%")) // actual percentage
{
var percentageNumberString = percentageString.TrimEnd('%');
if (double.TryParse(percentageNumberString, out var percentageNumber))
if (double.TryParse(percentageString[..^1], NumberStyles.None, CultureInfo.InvariantCulture, out var percentageNumber))
{
DownloadProgressPercentage = percentageNumber / 100;
StatusIndeterminate = false;
Expand Down

0 comments on commit 549e300

Please sign in to comment.