diff options
author | sr55 <[email protected]> | 2018-07-13 22:19:52 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-07-13 22:20:05 +0100 |
commit | 4756b8508d9322da84282421983714e2578d8227 (patch) | |
tree | 962bc53d6028cb432cd002b5431c63c4077c9fe6 /win/CS | |
parent | 9b44cc7808d3d1e185a0ed517ac7d485e92cca93 (diff) |
WinGui: Few small updates to the EncodeTaskImportFactory
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/Extensions/StringExtensions.cs | 13 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs | 15 |
2 files changed, 16 insertions, 12 deletions
diff --git a/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs b/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs index d3324a913..cf7e507aa 100644 --- a/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs +++ b/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs @@ -24,8 +24,17 @@ namespace HandBrakeWPF.Extensions public static string ToTitleCase(this string input)
{
TextInfo textInfo = new CultureInfo(CultureInfo.CurrentCulture.Name, false).TextInfo;
- return textInfo.ToTitleCase(input.ToLower());
-
+ return textInfo.ToTitleCase(input.ToLower());
+ }
+
+ public static int ToInt(this string input)
+ {
+ if (int.TryParse(input, out int value))
+ {
+ return value;
+ }
+
+ return 0;
}
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs index 52ccf4222..ea19c367e 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskImportFactory.cs @@ -10,23 +10,18 @@ namespace HandBrakeWPF.Services.Encode.Factories { using System; - using System.Collections.Generic; using System.Diagnostics; using System.Linq; - using System.Windows.Forms.VisualStyles; using HandBrake.Interop.Interop; using HandBrake.Interop.Interop.HbLib; using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Model.Encoding; using HandBrake.Interop.Model; - + using HandBrakeWPF.Extensions; using HandBrakeWPF.Services.Encode.Model.Models; using HandBrakeWPF.Services.Encode.Model.Models.Video; using HandBrakeWPF.Utilities; - using HandBrakeWPF.ViewModels.Interfaces; - - using Newtonsoft.Json.Linq; using AudioEncoder = Model.Models.AudioEncoder; using AudioEncoderRateType = Model.Models.AudioEncoderRateType; @@ -48,7 +43,7 @@ namespace HandBrakeWPF.Services.Encode.Factories * TODO * 1. Reconstruct the Config * 2. Reconstruct Queue State - * 3. Filters + * 3. Update JSON API. See #1481 */ internal static EncodeTask Create(JsonEncodeObject job) @@ -314,8 +309,8 @@ namespace HandBrakeWPF.Services.Encode.Factories if (rotationFilter != null) { var filterSettings = rotationFilter.Settings; - task.Rotation = filterSettings.Value<int>("angle"); // TODO split the string. - task.FlipVideo = filterSettings.Value<bool>("hflip"); + task.Rotation = filterSettings.Value<int>("angle"); + task.FlipVideo = filterSettings.Value<string>("hflip") == "1"; } // Deblock @@ -323,7 +318,7 @@ namespace HandBrakeWPF.Services.Encode.Factories if (deblockFilter != null) { var filterSettings = deblockFilter.Settings; - task.Deblock = filterSettings.Value<int>("qp"); // TODO Split the string + task.Deblock = filterSettings.Value<string>("qp").ToInt(); } // Sharpen |