diff options
Diffstat (limited to 'win/CS/HandBrake.Interop/Utilities/VersionHelper.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/Utilities/VersionHelper.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs new file mode 100644 index 000000000..2975a4793 --- /dev/null +++ b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs @@ -0,0 +1,53 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="VersionHelper.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Version Utility +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Utilities +{ + using HandBrake.Interop.Interop; + using HandBrake.Interop.Interop.Interfaces; + + /// <summary> + /// Version Utility + /// </summary> + public class VersionHelper + { + /// <summary> + /// The get build. + /// </summary> + /// <returns> + /// The <see cref="int"/>. + /// </returns> + public static string GetVersion() + { + IHandBrakeInstance instance = HandBrakeInstanceManager.MasterInstance; + + return IsNightly() ? string.Format("Nightly {0} ({1})", instance.Version, instance.Build) : string.Format("{0} ({1})", instance.Version, instance.Build); + } + + public static string GetVersionShort() + { + IHandBrakeInstance instance = HandBrakeInstanceManager.MasterInstance; + return string.Format("{0} {1}", instance.Version, instance.Build); + } + + /// <summary> + /// The is nightly. + /// </summary> + /// <returns> + /// The <see cref="string"/>. + /// </returns> + public static bool IsNightly() + { + IHandBrakeInstance instance = HandBrakeInstanceManager.MasterInstance; + + // 01 = Unofficial Builds. 00 = Official Tagged Releases. + return instance.Build.ToString().EndsWith("01"); + } + } +} |