summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs')
-rw-r--r--win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs b/win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs
new file mode 100644
index 000000000..97b44338e
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Converters/LongToIntConverter.cs
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="LongToIntConverter.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 FullPathToFileNameConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ public class LongToIntConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null && value is long && (long)value <= int.MaxValue)
+ {
+ long result = (long)value;
+ return (int)result;
+ }
+
+ return (int)0;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}