summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
index d6c972b5e..c854e5a05 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
@@ -63,6 +63,17 @@ namespace HandBrake.ApplicationServices.Utilities
/// <returns>The Enum Value</returns>
public static T GetValue(string description)
{
+ return GetValue(description, false);
+ }
+
+ /// <summary>
+ /// Get the Enumeration for a given Enum Description
+ /// </summary>
+ /// <param name="description">The String description</param>
+ /// <param name="insensitiveCase">Turn of sensitivity to cases.</param>
+ /// <returns>The Enum Value</returns>
+ public static T GetValue(string description, bool insensitiveCase)
+ {
foreach (T val in Enum.GetValues(typeof(T)))
{
string currDescription = GetDescription(val);
@@ -71,6 +82,12 @@ namespace HandBrake.ApplicationServices.Utilities
{
return val;
}
+
+ if (insensitiveCase && currDescription.ToLower() == description.ToLower() ||
+ currDisplay.ToLower() == description.ToLower())
+ {
+ return val;
+ }
}
throw new ArgumentOutOfRangeException("The Description for the enum was not recognized.");