diff options
author | sr55 <[email protected]> | 2012-06-30 14:07:50 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-06-30 14:07:50 +0000 |
commit | ca023df6b2119d7bf29ade5c07f644fdf2de8731 (patch) | |
tree | 6ac3b68670cc9db3876c18239d56f0461ae7953b /win/CS/HandBrake.ApplicationServices | |
parent | 4d6d9e007cbfadd9f63860038a8048a2c8da390a (diff) |
WinGui: Refactor the Update service and add a new options tab to deal with updates.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4799 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
4 files changed, 0 insertions, 245 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 865a24b9a..7fa820e4c 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -117,8 +117,6 @@ <Compile Include="Model\EncodeTask.cs" />
<Compile Include="Model\Encoding\OutputFormat.cs" />
<Compile Include="Model\Encoding\SubtitleTrack.cs" />
- <Compile Include="Model\General\UpdateCheckInformation.cs" />
- <Compile Include="Model\General\UpdateCheckResult.cs" />
<Compile Include="Model\Preset.cs" />
<Compile Include="Model\PresetPictureSettingsMode.cs" />
<Compile Include="Model\QueueItemStatus.cs" />
@@ -152,7 +150,6 @@ <Compile Include="Services\QueueManager.cs" />
<Compile Include="Services\QueueProcessor.cs" />
<Compile Include="Services\ScanService.cs" />
- <Compile Include="Services\UpdateService.cs" />
<Compile Include="Services\UserSettingService.cs" />
<Compile Include="ASUserSettingConstants.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckInformation.cs b/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckInformation.cs deleted file mode 100644 index 86045c938..000000000 --- a/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckInformation.cs +++ /dev/null @@ -1,57 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="UpdateCheckInformation.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>
-// Provides information about an update check.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Model.General
-{
- using System;
-
- /// <summary>
- /// Provides information about an update check.
- /// </summary>
- public struct UpdateCheckInformation
- {
- /// <summary>
- /// Gets or sets a value indicating whether a New Version is Available.
- /// </summary>
- public bool NewVersionAvailable { get; set; }
-
- /// <summary>
- /// Gets a value indicating whether an Error Occured.
- /// </summary>
- public bool ErrorOccured
- {
- get { return this.Error != null; }
- }
-
- /// <summary>
- /// Gets or sets Information about an update to HandBrake
- /// </summary>
- public Uri DescriptionUrl { get; set; }
-
- /// <summary>
- /// Gets or sets HandBrake's version from the appcast.xml file.
- /// </summary>
- public string Version { get; set; }
-
- /// <summary>
- /// Gets or sets HandBrake's Build from the appcast.xml file.
- /// </summary>
- public string Build { get; set; }
-
- /// <summary>
- /// Gets or sets the URL for update file.
- /// </summary>
- public string DownloadFile { get; set; }
-
- /// <summary>
- /// Gets or sets the error that occurred, if any. This will be null if no error occured.
- /// </summary>
- public Exception Error { get; set; }
- }
-}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckResult.cs b/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckResult.cs deleted file mode 100644 index f29cc8560..000000000 --- a/win/CS/HandBrake.ApplicationServices/Model/General/UpdateCheckResult.cs +++ /dev/null @@ -1,78 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="UpdateCheckResult.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>
-// Used in EndUpdateCheck() for update checking and the IAsyncResult design pattern.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Model.General
-{
- using System;
- using System.Threading;
-
- /// <summary>
- /// Used in EndUpdateCheck() for update checking and the IAsyncResult design pattern.
- /// </summary>
- public class UpdateCheckResult : IAsyncResult
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="UpdateCheckResult"/> class.
- /// </summary>
- /// <param name="asyncState">
- /// The async state.
- /// </param>
- /// <param name="info">
- /// The info.
- /// </param>
- public UpdateCheckResult(object asyncState, UpdateCheckInformation info)
- {
- this.AsyncState = asyncState;
- this.Result = info;
- }
-
- /// <summary>
- /// Gets whether the check was executed in debug mode.
- /// </summary>
- public object AsyncState { get; private set; }
-
- /// <summary>
- /// Gets the result of the update check.
- /// </summary>
- public UpdateCheckInformation Result { get; private set; }
-
- /// <summary>
- /// Gets AsyncWaitHandle.
- /// </summary>
- /// <exception cref="NotImplementedException">
- /// This is not implemented as it is not used.
- /// </exception>
- public WaitHandle AsyncWaitHandle
- {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether CompletedSynchronously.
- /// </summary>
- /// <exception cref="NotImplementedException">
- /// This is not implemented as it is not used.
- /// </exception>
- public bool CompletedSynchronously
- {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether IsCompleted.
- /// </summary>
- /// <exception cref="NotImplementedException">
- /// This is not implemented as it is not used.
- /// </exception>
- public bool IsCompleted
- {
- get { throw new NotImplementedException(); }
- }
- }
-}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/UpdateService.cs b/win/CS/HandBrake.ApplicationServices/Services/UpdateService.cs deleted file mode 100644 index 899a953c4..000000000 --- a/win/CS/HandBrake.ApplicationServices/Services/UpdateService.cs +++ /dev/null @@ -1,107 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="UpdateService.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>
-// The Update Service
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.ApplicationServices.Services
-{
- using System;
- using System.IO;
- using System.Net;
- using System.Threading;
-
- using HandBrake.ApplicationServices.Model.General;
- using HandBrake.ApplicationServices.Utilities;
-
- /// <summary>
- /// The Update Service
- /// </summary>
- public class UpdateService
- {
- /*
- * TODO: Refactor this to use Caliburn Invocation
- */
-
- /// <summary>
- /// Begins checking for an update to HandBrake.
- /// </summary>
- /// <param name="callback">
- /// The method that will be called when the check is finished.
- /// </param>
- /// <param name="debug">
- /// Whether or not to execute this in debug mode.
- /// </param>
- /// <param name="url">
- /// The url.
- /// </param>
- /// <param name="currentBuild">
- /// The current Build.
- /// </param>
- /// <param name="skipBuild">
- /// The skip Build.
- /// </param>
- public static void BeginCheckForUpdates(AsyncCallback callback, bool debug, string url, int currentBuild, int skipBuild)
- {
- ThreadPool.QueueUserWorkItem(delegate
- {
- try
- {
- // Initialize variables
- WebRequest request = WebRequest.Create(url);
- WebResponse response = request.GetResponse();
- AppcastReader reader = new AppcastReader();
-
- // Get the data, convert it to a string, and parse it into the AppcastReader
- reader.GetUpdateInfo(new StreamReader(response.GetResponseStream()).ReadToEnd());
-
- // Further parse the information
- string build = reader.Build;
-
- int latest = int.Parse(build);
- int current = currentBuild;
- int skip = skipBuild;
-
- // If the user wanted to skip this version, don't report the update
- if (latest == skip)
- {
- UpdateCheckInformation info = new UpdateCheckInformation { NewVersionAvailable = false };
- callback(new UpdateCheckResult(debug, info));
- return;
- }
-
- UpdateCheckInformation info2 = new UpdateCheckInformation
- {
- NewVersionAvailable = latest > current,
- DescriptionUrl = reader.DescriptionUrl,
- DownloadFile = reader.DownloadFile,
- Build = reader.Build,
- Version = reader.Version,
- };
- callback(new UpdateCheckResult(debug, info2));
- }
- catch (Exception exc)
- {
- callback(new UpdateCheckResult(debug, new UpdateCheckInformation { Error = exc }));
- }
- });
- }
-
- /// <summary>
- /// End Check for Updates
- /// </summary>
- /// <param name="result">
- /// The result.
- /// </param>
- /// <returns>
- /// Update Check information
- /// </returns>
- public static UpdateCheckInformation EndCheckForUpdates(IAsyncResult result)
- {
- return ((UpdateCheckResult)result).Result;
- }
- }
-}
|