diff --git a/Application/FileConverter/ConversionPreset/ConversionPreset.cs b/Application/FileConverter/ConversionPreset/ConversionPreset.cs
index 0d2a83f..d69b324 100644
--- a/Application/FileConverter/ConversionPreset/ConversionPreset.cs
+++ b/Application/FileConverter/ConversionPreset/ConversionPreset.cs
@@ -70,6 +70,7 @@ namespace FileConverter
this.outputType = value;
this.InitializeDefaultSettings(this.outputType);
this.OnPropertyChanged();
+ this.CoerceInputTypes();
}
}
@@ -88,7 +89,7 @@ namespace FileConverter
{
this.inputTypes[index] = this.inputTypes[index].ToLowerInvariant();
}
-
+
this.OnPropertyChanged();
}
}
@@ -241,6 +242,8 @@ namespace FileConverter
{
this.InputTypes[index] = this.InputTypes[index].ToLowerInvariant();
}
+
+ this.CoerceInputTypes();
}
public void AddInputType(string inputType)
@@ -328,6 +331,20 @@ namespace FileConverter
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
+ private void CoerceInputTypes()
+ {
+ for (int index = 0; index < this.inputTypes.Count; index++)
+ {
+ string inputType = this.inputTypes[index];
+ string inputCategory = PathHelpers.GetExtensionCategory(inputType);
+ if (!PathHelpers.IsOutputTypeCompatibleWithCategory(this.OutputType, inputCategory))
+ {
+ this.RemoveInputType(inputType);
+ index--;
+ }
+ }
+ }
+
private bool IsRelevantSetting(string settingsKey)
{
switch (this.OutputType)
diff --git a/Application/FileConverter/FileConverter.csproj b/Application/FileConverter/FileConverter.csproj
index 138a8fe..339dd73 100644
--- a/Application/FileConverter/FileConverter.csproj
+++ b/Application/FileConverter/FileConverter.csproj
@@ -103,6 +103,7 @@
+
diff --git a/Application/FileConverter/ValueConverters/IsOutputTypeCompatibleWithCategoryConverter.cs b/Application/FileConverter/ValueConverters/IsOutputTypeCompatibleWithCategoryConverter.cs
new file mode 100644
index 0000000..66e86e9
--- /dev/null
+++ b/Application/FileConverter/ValueConverters/IsOutputTypeCompatibleWithCategoryConverter.cs
@@ -0,0 +1,56 @@
+// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+
+namespace FileConverter.ValueConverters
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ public class IsOutputTypeCompatibleWithCategoryConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values == null || values.Length != 2)
+ {
+ throw new ArgumentException("The values must contains the collection of elements and the researched element.");
+ }
+
+ if (!(values[0] is OutputType))
+ {
+ return false;
+ }
+
+ OutputType outputType = (OutputType)values[0];
+
+ string category = null;
+
+ string input = values[1] as string;
+ if (input == null)
+ {
+ return false;
+ }
+
+ string stringParameter = parameter as string;
+ if (stringParameter != null && stringParameter == "InputType")
+ {
+ category = PathHelpers.GetExtensionCategory(input);
+ }
+ else if (stringParameter != null && stringParameter == "Category")
+ {
+ category = input;
+ }
+
+ if (category == null)
+ {
+ return false;
+ }
+
+ return PathHelpers.IsOutputTypeCompatibleWithCategory(outputType, category);
+ }
+
+ public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Application/FileConverter/Windows/SettingsWindow.xaml b/Application/FileConverter/Windows/SettingsWindow.xaml
index c1f3723..d19861f 100644
--- a/Application/FileConverter/Windows/SettingsWindow.xaml
+++ b/Application/FileConverter/Windows/SettingsWindow.xaml
@@ -17,6 +17,7 @@
+
@@ -247,6 +248,12 @@
+
+
+
+
+
+
@@ -257,6 +264,12 @@
+
+
+
+
+
+
@@ -268,7 +281,14 @@