summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
blob: cc5c903ef76f853cb0d89f0eb8364cfc7f3a9841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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.ApplicationServices.Utilities
{
    using HandBrake.ApplicationServices.Interop;
    using HandBrake.ApplicationServices.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");
        }
    }
}