diff options
author | sr55 <[email protected]> | 2010-12-03 21:08:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-12-03 21:08:10 +0000 |
commit | f1f5d2c1b9c020dc07d1c8e8f3c1120310972fa1 (patch) | |
tree | 62503a261a17e48de4ed03ce2acc9ec48f047617 /win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs | |
parent | 5d6b22826353d5028799362292cd85e5da91cfaf (diff) |
WinGui:
- Sort the versioning out for the upcoming release.
- Move the EnumHelper to the correct library. It was in the wrong place.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3699 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs new file mode 100644 index 000000000..6cf7342a9 --- /dev/null +++ b/win/C#/HandBrake.ApplicationServices/Functions/EnumHelper.cs @@ -0,0 +1,35 @@ +/* EnumHelper.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Functions
+{
+ using System.ComponentModel;
+ using System.Reflection;
+ using System;
+
+ /// <summary>
+ /// Enum Helpers
+ /// </summary>
+ public class EnumHelper
+ {
+ /// <summary>
+ /// Get the description of an Enum
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <returns>
+ /// The Description string
+ /// </returns>
+ public static string GetDescription(Enum value)
+ {
+ FieldInfo fieldInfo = value.GetType().GetField(value.ToString());
+ DescriptionAttribute[] attributes =
+ (DescriptionAttribute[])fieldInfo.GetCustomAttributes(
+ typeof(DescriptionAttribute), false);
+ return (attributes.Length > 0) ? attributes[0].Description : value.ToString();
+ }
+ }
+}
|