summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Converters
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-03-05 22:02:26 +0000
committersr55 <[email protected]>2017-03-05 22:02:26 +0000
commit8e5455063adb16ca65ffb501b1737ae97b918e56 (patch)
tree6894035bfc29ef08f63d0f3d05471119da101bf4 /win/CS/HandBrakeWPF/Converters
parent5d2c3cc85cae38c365ffdefa40054563d45b1506 (diff)
WinGui: Remove disk space warning from browser and allow the low level to be configurable in options. Resolves #590
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters')
-rw-r--r--win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs
new file mode 100644
index 000000000..219fdf3a6
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs
@@ -0,0 +1,39 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FileSizeConverter.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Defines the LogLevelConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Options
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ public class FileSizeConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ return (long)value / 1000 / 1000 / 1000;
+ }
+
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ long size;
+ if (value != null && long.TryParse(value.ToString(), out size))
+ {
+ return size * 1000 * 1000 * 1000;
+ }
+
+ return null;
+ }
+ }
+}