blob: 47673c112f434ca9c958f6a4cb1c4cf5b914141d (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// --------------------------------------------------------------------------------------------------------------------
// <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 System;
using System.Reflection;
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()
{
Version version = Assembly.GetEntryAssembly().GetName().Version;
IHandBrakeInstance instance = HandBrakeInstanceManager.GetScanInstance(1);
return IsNightly() ? string.Format("Nightly {0} ({1})", instance.Version, instance.Build) : string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
}
/// <summary>
/// The is nightly.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static bool IsNightly()
{
Version version = Assembly.GetEntryAssembly().GetName().Version;
// The MSBuild.xml script sets 0.0.0 for nightly builds.
return version.Major == 0 && version.Minor == 0 && version.Build == 0;
}
/// <summary>
/// The get platform bitness.
/// </summary>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static string GetPlatformBitnessVersion()
{
return System.Environment.Is64BitProcess ? "64bit Version" : "32bit Version";
}
/// <summary>
/// Is a 64 bit app.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static bool Is64Bit()
{
return System.Environment.Is64BitProcess;
}
}
}
|