diff options
-rw-r--r-- | win/C#/Functions/CLI.cs | 8 | ||||
-rw-r--r-- | win/C#/Parsing/Parser.cs | 6 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 7 |
3 files changed, 14 insertions, 7 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs index 85d1c5569..c1502a462 100644 --- a/win/C#/Functions/CLI.cs +++ b/win/C#/Functions/CLI.cs @@ -3,12 +3,20 @@ using System.Collections.Generic; using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
+using System.Globalization;
namespace Handbrake.Functions
{
class CLI
{
+ /// <summary>
+ /// CLI output is based on en-US locale,
+ /// we use this CultureInfo as IFormatProvider to *.Parse() calls
+ /// </summary>
+ static readonly public CultureInfo Culture = new CultureInfo("en-US", false);
+
+
Process hbProc = new Process();
public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index ea2ae57fd..b3edc89d9 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -98,9 +98,9 @@ namespace Handbrake.Parsing {
int currentTask = int.Parse(m.Groups[1].Value);
int totalTasks = int.Parse(m.Groups[2].Value);
- float percent = float.Parse(m.Groups[3].Value);
- float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value);
- float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value);
+ float percent = float.Parse(m.Groups[3].Value, Functions.CLI.Culture);
+ float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value, Functions.CLI.Culture);
+ float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value, Functions.CLI.Culture);
TimeSpan remaining = TimeSpan.Zero;
if (m.Groups[7].Value != string.Empty)
{
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index 16c032edf..744e5b619 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -85,11 +85,11 @@ namespace Handbrake.Parsing }
}
- private string m_aspectRatio;
+ private float m_aspectRatio;
/// <summary>
/// The aspect ratio of this Title
/// </summary>
- public string AspectRatio
+ public float AspectRatio
{
get
{
@@ -192,8 +192,7 @@ namespace Handbrake.Parsing if (m.Success)
{
thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
- thisTitle.m_aspectRatio = m.Groups[3].ToString(); // Converted to a String from float. Caused issue on french systems
- // French system floats are 1,78 not 1.78 and the CLI always outputs a .
+ thisTitle.m_aspectRatio = float.Parse(m.Groups[3].Value, Functions.CLI.Culture);
}
}
catch (Exception exc)
|