summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
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/HandBrakeWPF
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/HandBrakeWPF')
-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
11 files changed, 66 insertions, 196 deletions
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>