blob: 89c375190c485a0be56c8f18b4ab327991df2ece (
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
54
55
56
57
58
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HandBrakeVersionHelper.cs" company="HandBrake Project (https://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.Interop
{
using System;
using System.Runtime.InteropServices;
using HandBrake.Interop.Interop.HbLib;
public class HandBrakeVersionHelper
{
/// <summary>
/// Gets the HandBrake version string.
/// </summary>
public static string Version
{
get
{
var versionPtr = HBFunctions.hb_get_version(IntPtr.Zero); // Pointer isn't actually used.
return Marshal.PtrToStringAnsi(versionPtr);
}
}
/// <summary>
/// Gets the HandBrake build number.
/// </summary>
public static int Build
{
get
{
return HBFunctions.hb_get_build(IntPtr.Zero);
}
}
public static string GetVersion()
{
return IsNightly() ? string.Format("Nightly {0} ({1})", Version, Build) : string.Format("{0} ({1})", Version, Build);
}
public static string GetVersionShort()
{
return string.Format("{0} {1}", Version, Build);
}
public static bool IsNightly()
{
// 01 = Unofficial Builds. 00 = Official Tagged Releases.
return Build.ToString().EndsWith("01");
}
}
}
|