diff options
author | sr55 <[email protected]> | 2018-08-13 20:03:21 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-08-13 20:03:36 +0100 |
commit | 223dc7bd007bfd665948f7e11a9f4681d580cb35 (patch) | |
tree | 555d05cf996ed38f3da083749b0c1711def98aec /win/CS/HandBrake.Interop/Utilities | |
parent | d2fc28fc9adfc3da47659cc65e2695c7569ac4c2 (diff) |
WinGui: Minor code tidyup.
Diffstat (limited to 'win/CS/HandBrake.Interop/Utilities')
-rw-r--r-- | win/CS/HandBrake.Interop/Utilities/VersionHelper.cs | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs index 2975a4793..08c4c95af 100644 --- a/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs +++ b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs @@ -9,8 +9,10 @@ namespace HandBrake.Interop.Utilities { - using HandBrake.Interop.Interop; - using HandBrake.Interop.Interop.Interfaces; + using System; + using System.Runtime.InteropServices; + + using HandBrake.Interop.Interop.HbLib; /// <summary> /// Version Utility @@ -25,15 +27,12 @@ namespace HandBrake.Interop.Utilities /// </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); + return IsNightly() ? string.Format("Nightly {0} ({1})", Version, Build) : string.Format("{0} ({1})", Version, Build); } public static string GetVersionShort() { - IHandBrakeInstance instance = HandBrakeInstanceManager.MasterInstance; - return string.Format("{0} {1}", instance.Version, instance.Build); + return string.Format("{0} {1}", Version, Build); } /// <summary> @@ -44,10 +43,31 @@ namespace HandBrake.Interop.Utilities /// </returns> public static bool IsNightly() { - IHandBrakeInstance instance = HandBrakeInstanceManager.MasterInstance; - // 01 = Unofficial Builds. 00 = Official Tagged Releases. - return instance.Build.ToString().EndsWith("01"); + return Build.ToString().EndsWith("01"); + } + + /// <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); + } } } } |