// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Version Utility
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.Interop.Utilities
{
using System;
using System.Runtime.InteropServices;
using HandBrake.Interop.Interop.HbLib;
public class VersionHelper
{
///
/// Gets the HandBrake version string.
///
public static string Version
{
get
{
var versionPtr = HBFunctions.hb_get_version(IntPtr.Zero); // Pointer isn't actually used.
return Marshal.PtrToStringAnsi(versionPtr);
}
}
///
/// Gets the HandBrake build number.
///
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");
}
}
}