summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-03-19 21:48:51 +0000
committersr55 <[email protected]>2013-03-19 21:48:51 +0000
commit97a88523f2b6352847d705cbf527fd5ee0f5247b (patch)
treecbab432a54aa755707eaf4b33632e36cc913da66 /win/CS/HandBrake.ApplicationServices
parentfd9089288f0644a4ce568b2e17abffebffeb65db (diff)
WinGui: Part 1: Fix numerous issues around app versioning. Hopefully the GUI and CLI will no longer be out of sync.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5350 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.Nightly.tmpl42
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ServerService.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs10
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs57
10 files changed, 111 insertions, 30 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
index 2a4aa18c0..7e3ee4583 100644
--- a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
@@ -50,11 +50,6 @@ namespace HandBrake.ApplicationServices
public const string SaveLogCopyDirectory = "SaveLogCopyDirectory";
/// <summary>
- /// HandBrakes version
- /// </summary>
- public const string HandBrakeVersion = "HandBrakeVersion";
-
- /// <summary>
/// HandBrakes build
/// </summary>
public const string HandBrakeBuild = "HandBrakeBuild";
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index efeeffb47..445b09c36 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -106,6 +106,7 @@
<Compile Include="Utilities\PList.cs" />
<Compile Include="Utilities\PlistUtility.cs" />
<Compile Include="Utilities\SystemInfo.cs" />
+ <Compile Include="Utilities\VersionHelper.cs" />
<Compile Include="Utilities\Win32.cs" />
<Compile Include="Utilities\Win7.cs" />
<Compile Include="Model\DriveInformation.cs" />
@@ -160,6 +161,7 @@
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
+ <None Include="Properties\AssemblyInfo.cs.Nightly.tmpl" />
<None Include="Properties\AssemblyInfo.cs.tmpl" />
</ItemGroup>
<ItemGroup>
diff --git a/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.Nightly.tmpl b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.Nightly.tmpl
new file mode 100644
index 000000000..faa879725
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.Nightly.tmpl
@@ -0,0 +1,42 @@
+/* AssemblyInfo.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HandBrake")]
+[assembly: AssemblyDescription("HandBrake is a GPL-licensed, multiplatform, multithreaded video transcoder.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HandBrake Team")]
+[assembly: AssemblyProduct("HandBrake")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5e4e3f97-5252-41f6-aae9-3846f62cbc66")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.0.0.$WCREV$")]
+[assembly: NeutralResourcesLanguage("")]
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 555b004f2..db4ef3abd 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -66,9 +66,7 @@ namespace HandBrake.ApplicationServices.Services.Base
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
header =
- GeneralUtilities.CreateCliLogHeader(
- userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+ GeneralUtilities.CreateCliLogHeader();
this.LogIndex = 0;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 850c3b860..55aefd7ea 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -71,19 +71,14 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
/// <param name="handBrakeInstance">
/// The hand Brake Instance.
/// </param>
- public LibScan(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)
+ public LibScan(IHandBrakeInstance handBrakeInstance)
{
logging = new StringBuilder();
- header = GeneralUtilities.CreateCliLogHeader(
- userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+ header = GeneralUtilities.CreateCliLogHeader();
instance = handBrakeInstance;
instance.Initialize(1);
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 5edfb4e1e..5e7d461f5 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -306,7 +306,7 @@ namespace HandBrake.ApplicationServices.Services
{
Category = category,
Name = presetName[0].Replace("+", string.Empty).Trim(),
- Version = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ Version = VersionHelper.GetVersion(),
Description = string.Empty, // Maybe one day we will populate this.
IsBuildIn = true,
UsePictureFilters = true,
@@ -354,7 +354,7 @@ namespace HandBrake.ApplicationServices.Services
List<Preset> preset = this.presets.Where(p => p.IsBuildIn).ToList();
if (preset.Count > 0)
{
- if (preset[0].Version != this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion))
+ if (preset[0].Version != VersionHelper.GetVersion())
{
this.UpdateBuiltInPresets();
return true;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index 40329f14d..1ad531dfe 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -74,9 +74,7 @@ namespace HandBrake.ApplicationServices.Services
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
- header = GeneralUtilities.CreateCliLogHeader(
- userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+ header = GeneralUtilities.CreateCliLogHeader();
}
#region Events
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
index d8966c192..199e371a9 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
@@ -173,8 +173,8 @@ namespace HandBrake.ApplicationServices.Services
// Setup the services we are going to use.
IHandBrakeInstance instance = new HandBrakeInstance();
- scanService = new LibScan(new UserSettingService(), instance); // TODO this needs wired up with castle
- encodeService = new LibEncode(new UserSettingService(), instance);
+ scanService = new LibScan(instance);
+ encodeService = new LibEncode(new UserSettingService(), instance); // TODO this needs wired up with castle
shutdownFlag = new ManualResetEvent(false);
shutdownFlag.WaitOne();
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 378898c05..097663f9c 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -84,20 +84,14 @@ namespace HandBrake.ApplicationServices.Utilities
/// <summary>
/// Add the CLI Query to the Log File.
/// </summary>
- /// <param name="version">
- /// The version.
- /// </param>
- /// <param name="build">
- /// The build.
- /// </param>
/// <returns>
/// The create cli log header.
/// </returns>
- public static StringBuilder CreateCliLogHeader(string version, int build)
+ public static StringBuilder CreateCliLogHeader()
{
var logHeader = new StringBuilder();
- logHeader.AppendLine(String.Format("HandBrake {0} {1}", version, build));
+ logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion()));
logHeader.AppendLine(String.Format("OS: {0}", Environment.OSVersion));
logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
logHeader.Append(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
new file mode 100644
index 000000000..a8860f5ee
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
@@ -0,0 +1,57 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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;
+
+ /// <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;
+ return IsNightly() ? string.Format("svn{0} (Nightly Build)", version.Revision) : 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";
+ }
+ }
+}