summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-12-29 14:25:17 +0000
committersr55 <[email protected]>2012-12-29 14:25:17 +0000
commit3bb7333006c2ace5e3aaabfc80c5a00dcd92350e (patch)
treee135a842cb4a14b5acf5315c46105ca98fda7cb4 /win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs
parenta27835f8854129a45b8e9f3c28614966848ff9dd (diff)
WinGui: Add the plist keys and fix numerous bugs in the x264 preset/tune/profile/level code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5115 b64f7644-9d1e-0410-96f1-a4d463321fa5
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.");