using System.Collections.ObjectModel;\r
using System.ComponentModel;\r
using System.ComponentModel.DataAnnotations;\r
+ using System.Diagnostics;\r
using System.Linq;\r
using System.Reflection;\r
\r
}\r
}\r
\r
- throw new ArgumentOutOfRangeException("The Description for the enum was not recognized.");\r
+ Debug.WriteLine("EnumHelper.GetValue: The Description for the enum was not recognized: " + description);\r
+\r
+ return default(T);\r
}\r
\r
/// <summary>\r
if (parsed.FastDecode)\r
{\r
tune = tune == "none" ? "fastdecode" : tune + ",fastdecode";\r
- }
- AddEncodeElement(xmlWriter, "x264Tune", "string", tune);
- AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");
- AddEncodeElement(xmlWriter, "qsvPreset", "string", parsed.QsvPreset.ToString().ToLower());
-
- int videoQualityType = 0;
- if (parsed.VideoBitrate != null) videoQualityType = 1;
+ }\r
+ AddEncodeElement(xmlWriter, "x264Tune", "string", tune);\r
+ AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");\r
+ AddEncodeElement(xmlWriter, "qsvPreset", "string", parsed.QsvPreset.ToString().ToLower());\r
+\r
+ int videoQualityType = 0;\r
+ if (parsed.VideoBitrate != null) videoQualityType = 1;\r
else if (parsed.Quality != null) videoQualityType = 2;\r
\r
AddEncodeElement(xmlWriter, "VideoQualityType", "integer", videoQualityType.ToString());\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized string similar to Preset Version.\r
+ /// </summary>\r
+ public static string Preset_OldVersion_Header {\r
+ get {\r
+ return ResourceManager.GetString("Preset_OldVersion_Header", resourceCulture);\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Looks up a localized string similar to The preset you are trying to import is from a different version of HandBrake. \r
+ ///Some values may be reset to default as a result. \r
+ ///\r
+ ///Do you wish to proceed?.\r
+ /// </summary>\r
+ public static string Preset_OldVersion_Message {\r
+ get {\r
+ return ResourceManager.GetString("Preset_OldVersion_Message", resourceCulture);\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Looks up a localized string similar to Unable to import preset!.\r
+ /// </summary>\r
+ public static string Preset_UnableToImport_Header {\r
+ get {\r
+ return ResourceManager.GetString("Preset_UnableToImport_Header", resourceCulture);\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Looks up a localized string similar to Unable to import the preset as it appears to be corrupted or from an older version of HandBrake..\r
+ /// </summary>\r
+ public static string Preset_UnableToImport_Message {\r
+ get {\r
+ return ResourceManager.GetString("Preset_UnableToImport_Message", resourceCulture);\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to The Built-in presets have been reset..\r
/// </summary>\r
<data name="Updated" xml:space="preserve">\r
<value>Updated</value>\r
</data>\r
+ <data name="Preset_OldVersion_Header" xml:space="preserve">\r
+ <value>Preset Version</value>\r
+ </data>\r
+ <data name="Preset_OldVersion_Message" xml:space="preserve">\r
+ <value>The preset you are trying to import is from a different version of HandBrake. \r
+Some values may be reset to default as a result. \r
+\r
+Do you wish to proceed?</value>\r
+ </data>\r
+ <data name="Preset_UnableToImport_Header" xml:space="preserve">\r
+ <value>Unable to import preset!</value>\r
+ </data>\r
+ <data name="Preset_UnableToImport_Message" xml:space="preserve">\r
+ <value>Unable to import the preset as it appears to be corrupted or from an older version of HandBrake.</value>\r
+ </data>\r
</root>
\ No newline at end of file
if (!string.IsNullOrEmpty(filename))\r
{\r
PList plist = new PList(filename);\r
+\r
+ object build;\r
+ plist.TryGetValue("PresetBuildNumber", out build);\r
+\r
+ string buildNumber = build as string;\r
+ if (buildNumber == null)\r
+ {\r
+ MessageBox.Show(\r
+ Resources.Preset_UnableToImport_Message,\r
+ Resources.Preset_UnableToImport_Header,\r
+ MessageBoxButton.YesNo, MessageBoxImage.Question);\r
+ return;\r
+ }\r
+\r
+ if (buildNumber != userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString(CultureInfo.InvariantCulture))\r
+ {\r
+ MessageBoxResult result = MessageBox.Show(\r
+ Resources.Preset_OldVersion_Message,\r
+ Resources.Preset_OldVersion_Header,\r
+ MessageBoxButton.YesNo, MessageBoxImage.Question);\r
+\r
+ if (result == MessageBoxResult.No)\r
+ {\r
+ return;\r
+ }\r
+ }\r
+\r
Preset preset = PlistPresetFactory.CreatePreset(plist);\r
\r
if (this.presetService.CheckIfPresetExists(preset.Name))\r