summaryrefslogtreecommitdiffstats
path: root/win
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
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')
-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
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj3
-rw-r--r--win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs2
-rw-r--r--win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl60
-rw-r--r--win/CS/HandBrakeWPF/Services/Interfaces/IUpdateVersionService.cs22
-rw-r--r--win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UpdateVersionService.cs146
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs7
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml8
-rw-r--r--win/CS/build.xml19
22 files changed, 190 insertions, 232 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";
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 7622293d2..09270768b 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -207,8 +207,6 @@
<Compile Include="Model\AdvancedChoice.cs" />
<Compile Include="Services\ErrorService.cs" />
<Compile Include="Services\Interfaces\IErrorService.cs" />
- <Compile Include="Services\Interfaces\IUpdateVersionService.cs" />
- <Compile Include="Services\UpdateVersionService.cs" />
<Compile Include="Startup\CastleBootstrapper.cs" />
<Compile Include="UserSettingConstants.cs" />
<Compile Include="ViewModels\AboutViewModel.cs" />
@@ -317,6 +315,7 @@
<None Include="Installer\Installer64.nsi" />
<None Include="Installer\MakeNightly.nsi.tmpl" />
<None Include="Installer\MakeNightly64.nsi.tmpl" />
+ <None Include="Properties\AssemblyInfo.cs.Nightly.tmpl" />
<None Include="Properties\AssemblyInfo.cs.tmpl" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
diff --git a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
index ee0df3b88..cfafe3cec 100644
--- a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
@@ -87,7 +87,6 @@ namespace HandBrakeWPF.Helpers
int.TryParse(build, out buildValue);
userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue);
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, version);
success = true;
}
@@ -119,7 +118,6 @@ namespace HandBrakeWPF.Helpers
{
userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, 0);
userSettingService.SetUserSetting(UserSettingConstants.HandBrakePlatform, string.Empty);
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, string.Empty);
userSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, string.Empty);
errorService.ShowError(
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
index a202e0bbb..77106e397 100644
--- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
+++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
@@ -56,5 +56,5 @@ using System.Windows;
// 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.9.9.5314")]
+[assembly: AssemblyVersion("0.0.0.5311")]
[assembly: NeutralResourcesLanguage("")] \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl
new file mode 100644
index 000000000..0a30129c7
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl
@@ -0,0 +1,60 @@
+/* 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;
+using System.Windows;
+
+// 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 an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HandBrake")]
+[assembly: AssemblyProduct("HandBrake")]
+[assembly: AssemblyCopyright("Copyright © HandBrake Team 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)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// 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("")] \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IUpdateVersionService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IUpdateVersionService.cs
deleted file mode 100644
index 3a84e68fc..000000000
--- a/win/CS/HandBrakeWPF/Services/Interfaces/IUpdateVersionService.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IUpdateVersionService.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>
-// Defines the IUpdateVersionService type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services.Interfaces
-{
- /// <summary>
- /// The IUpdateVersionService Interface
- /// </summary>
- public interface IUpdateVersionService
- {
- /// <summary>
- /// Get's HandBrakes version data from the CLI.
- /// </summary>
- void SetCliVersionData();
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs
index 9cb6707f9..f66aff538 100644
--- a/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs
@@ -68,7 +68,7 @@ namespace HandBrakeWPF.Services
else
{
HandbrakeInstance = new HandBrakeInstance();
- this.scanService = new LibScan(userSettingService, HandbrakeInstance);
+ this.scanService = new LibScan(HandbrakeInstance);
}
}
catch(Exception exc)
diff --git a/win/CS/HandBrakeWPF/Services/UpdateVersionService.cs b/win/CS/HandBrakeWPF/Services/UpdateVersionService.cs
deleted file mode 100644
index e0de1d88a..000000000
--- a/win/CS/HandBrakeWPF/Services/UpdateVersionService.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="UpdateVersionService.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>
-// Defines the UpdateVersionService type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services
-{
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Security.Cryptography;
- using System.Text.RegularExpressions;
- using System.Windows;
-
- using HandBrake.ApplicationServices;
- using HandBrake.ApplicationServices.Services.Interfaces;
-
- using HandBrakeWPF.Services.Interfaces;
-
- /// <summary>
- /// Update Version Service - Handlers Update and Versioning.
- /// </summary>
- public class UpdateVersionService : IUpdateVersionService
- {
- /// <summary>
- /// The Backing field for the user setting service
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// The Error Service Backing field.
- /// </summary>
- private readonly IErrorService errorService;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="UpdateVersionService"/> class.
- /// </summary>
- /// <param name="userSettingService">
- /// The user setting service.
- /// </param>
- /// <param name="errorService">
- /// The error Service.
- /// </param>
- public UpdateVersionService(IUserSettingService userSettingService, IErrorService errorService)
- {
- this.userSettingService = userSettingService;
- this.errorService = errorService;
- }
-
- /// <summary>
- /// Get's HandBrakes version data from the CLI.
- /// </summary>
- public void SetCliVersionData()
- {
- string line;
-
- // 0 = SVN Build / Version
- // 1 = Build Date
-
- // Get the SHA1 Hash of HandBrakeCLI
- byte[] hash;
- string starupPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
-
- using (Stream stream = File.OpenRead(Path.Combine(starupPath, "HandBrakeCLI.exe")))
- {
- hash = SHA1.Create().ComputeHash(stream);
- }
- string base64Hash = Convert.ToBase64String(hash);
-
- // Compare the hash with the last known hash. If it's the same, return.
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.HandBrakeExeHash) == base64Hash)
- {
- return;
- }
-
- // It's not the same, so start the CLI to get it's version data.
- Process cliProcess = new Process();
- ProcessStartInfo handBrakeCli = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")
- {
- UseShellExecute = false,
- RedirectStandardError = true,
- RedirectStandardOutput = true,
- CreateNoWindow = true
- };
- cliProcess.StartInfo = handBrakeCli;
-
- try
- {
- cliProcess.Start();
-
- // Retrieve standard output and report back to parent thread until the process is complete
- TextReader stdOutput = cliProcess.StandardError;
-
- while (!cliProcess.HasExited)
- {
- line = stdOutput.ReadLine() ?? string.Empty;
- Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \(([0-9]*)\)");
- Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -");
-
- if (m.Success)
- {
- string version = m.Groups[1].Success ? m.Groups[1].Value : string.Empty;
- string build = m.Groups[2].Success ? m.Groups[2].Value : string.Empty;
-
- int buildValue;
- int.TryParse(build, out buildValue);
-
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue);
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, version);
- }
-
- if (platform.Success)
- {
- userSettingService.SetUserSetting(UserSettingConstants.HandBrakePlatform, platform.Value.Replace("-", string.Empty).Trim());
- }
-
- if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.
- {
- Process cli = Process.GetProcessById(cliProcess.Id);
- if (!cli.HasExited)
- {
- cli.Kill();
- }
- }
- }
-
- userSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, base64Hash);
- }
- catch (Exception e)
- {
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, string.Empty);
- userSettingService.SetUserSetting(UserSettingConstants.HandBrakePlatform, string.Empty);
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, string.Empty);
- userSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, string.Empty);
-
- this.errorService.ShowError("Unable to Initialise HandBrake", "This error is unrecoverable. Maybe try restarting.", e);
-
- Application.Current.Shutdown();
- }
- }
- }
-}
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index ae0369d7f..6f3428de3 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -76,7 +76,6 @@ namespace HandBrakeWPF.Startup
this.windsorContainer.Register(Component.For<ILogViewModel>().ImplementedBy<LogViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IAboutViewModel>().ImplementedBy<AboutViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IOptionsViewModel>().ImplementedBy<OptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
- this.windsorContainer.Register(Component.For<IUpdateVersionService>().ImplementedBy<UpdateVersionService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<ITitleSpecificViewModel>().ImplementedBy<TitleSpecificViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IQueueSelectionViewModel>().ImplementedBy<QueueSelectionViewModel>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs
index 2fa4913a6..cb9cef3e7 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs
@@ -9,7 +9,7 @@
namespace HandBrakeWPF.ViewModels
{
- using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -33,12 +33,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- string nightly = UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
- return string.Format(
- "{0} ({1}) {2}",
- UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- UserSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
- nightly);
+ return string.Format("{0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 4f2bc251b..af4dce85b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1355,12 +1355,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- string nightly = UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
- return string.Format(
- "{0} ({1}) {2}",
- UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- UserSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
- nightly);
+ return string.Format("{0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion());
}
}
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 0b10fc645..75810a442 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -114,14 +114,6 @@
</item>
<item>
<key>
- <string>HandBrakeVersion</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">NotSet</anyType>
- </value>
- </item>
- <item>
- <key>
<string>updateStatus</string>
</key>
<value>
diff --git a/win/CS/build.xml b/win/CS/build.xml
index b64c12461..7d667af0d 100644
--- a/win/CS/build.xml
+++ b/win/CS/build.xml
@@ -27,7 +27,7 @@
<!-- Dependencies -->
<PropertyGroup>
- <NightlyDependsOn>PreBuild;BuildRelease;NightlyPostBuild</NightlyDependsOn>
+ <NightlyDependsOn>NightlyPreBuild;BuildRelease;NightlyPostBuild</NightlyDependsOn>
</PropertyGroup>
<PropertyGroup>
@@ -47,12 +47,19 @@
</MSBuild>
</Target>
- <!-- Pre Build Events -->
+ <!-- Pre Build Events. You must do a full checkout as it takes the svn from the main directory. $(ProjectDir). is not used. -->
+ <Target Name="NightlyPreBuild">
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs.Nightly.tmpl $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi" Condition="$(Platform) == 'x86'" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi" Condition="$(Platform) == 'x64'" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs.Nightly.tmpl $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs" />
+ </Target>
+
<Target Name="PreBuild">
- <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs.tmpl $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs" />
- <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi" Condition="$(Platform) == 'x86'" />
- <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi" Condition="$(Platform) == 'x64'" />
- <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs.tmpl $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs.tmpl $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly.nsi" Condition="$(Platform) == 'x86'" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeNightly64.nsi" Condition="$(Platform) == 'x64'" />
+ <Exec Command="subwcrev.exe ../../ $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs.tmpl $(ProjectDir)HandBrake.ApplicationServices\Properties\AssemblyInfo.cs" />
</Target>
<!-- Post Build Events -->