summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-04-12 15:03:25 +0000
committersr55 <[email protected]>2015-04-12 15:03:25 +0000
commitdaa18af4633c27170a8bd7f880d232ca3c688d9b (patch)
treefb12ff1d1acb7da99ad922e911d2548e5363f3fb /win/CS/HandBrake.ApplicationServices/Services
parentca97a5f5239a29e87470509add1fd68099e35f2c (diff)
WinGui: Misc IScan API tweaks.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7087 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs35
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs7
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs31
5 files changed, 39 insertions, 44 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
index 227a73f5e..9a2a7a848 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
@@ -175,14 +175,6 @@ namespace HandBrake.ApplicationServices.Services.Encode
#region Methods
/// <summary>
- /// A Stop Method to be implemeneted.
- /// </summary>
- public virtual void Stop()
- {
- // Do Nothing
- }
-
- /// <summary>
/// Save a copy of the log to the users desired location or a default location
/// if this feature is enabled in options.
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
index 3c92f9a6f..8aac4fcf0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
@@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
/// <summary>
/// Kill the process
/// </summary>
- public override void Stop()
+ public void Stop()
{
try
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs
index 8e54cda12..41c44fb76 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs
@@ -10,12 +10,12 @@
namespace HandBrake.ApplicationServices.Services.Scan.EventArgs
{
using System;
- using System.Runtime.Serialization;
+
+ using HandBrake.ApplicationServices.Services.Scan.Model;
/// <summary>
/// Scan Progress Event Args
/// </summary>
- [DataContract]
public class ScanCompletedEventArgs : EventArgs
{
/// <summary>
@@ -30,36 +30,41 @@ namespace HandBrake.ApplicationServices.Services.Scan.EventArgs
/// <param name="errorInformation">
/// The error information.
/// </param>
- public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation)
+ /// <param name="scannedSource">
+ /// The scanned Source.
+ /// </param>
+ public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation, Source scannedSource)
{
this.Successful = !cancelled && exception == null && string.IsNullOrEmpty(errorInformation);
this.Cancelled = cancelled;
this.Exception = exception;
this.ErrorInformation = errorInformation;
+ this.ScannedSource = scannedSource;
}
/// <summary>
- /// Gets or sets a value indicating whether Successful.
+ /// Gets a value indicating whether Successful.
+ /// </summary>
+ public bool Successful { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating whether Cancelled.
/// </summary>
- [DataMember]
- public bool Successful { get; set; }
+ public bool Cancelled { get; private set; }
/// <summary>
- /// Gets or sets a value indicating whether Cancelled.
+ /// Gets the Exception.
/// </summary>
- [DataMember]
- public bool Cancelled { get; set; }
+ public Exception Exception { get; private set; }
/// <summary>
- /// Gets or sets Exception.
+ /// Gets ErrorInformation.
/// </summary>
- [DataMember]
- public Exception Exception { get; set; }
+ public string ErrorInformation { get; private set; }
/// <summary>
- /// Gets or sets ErrorInformation.
+ /// Gets the scanned source.
/// </summary>
- [DataMember]
- public string ErrorInformation { get; set; }
+ public Source ScannedSource { get; private set; }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs
index 086a97487..0d4c6b3c2 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs
@@ -65,11 +65,6 @@ namespace HandBrake.ApplicationServices.Services.Scan.Interfaces
bool IsScanning { get; }
/// <summary>
- /// Gets the Souce Data.
- /// </summary>
- Source SouceData { get; }
-
- /// <summary>
/// Gets ActivityLog.
/// </summary>
string ActivityLog { get; }
@@ -90,7 +85,7 @@ namespace HandBrake.ApplicationServices.Services.Scan.Interfaces
/// <param name="configuration">
/// The configuraiton.
/// </param>
- void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuration);
+ void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuration);
/// <summary>
/// Get a Preview image for the current job and preview number.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs
index 524042606..a560493ab 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs
@@ -86,7 +86,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
/// <summary>
/// The post scan operation.
/// </summary>
- private Action<bool> postScanOperation;
+ private Action<bool, Source> postScanOperation;
#endregion
@@ -97,6 +97,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
{
this.logging = new StringBuilder();
this.header = GeneralUtilities.CreateLogHeader();
+ this.IsScanning = false;
}
#region Events
@@ -126,11 +127,6 @@ namespace HandBrake.ApplicationServices.Services.Scan
public bool IsScanning { get; private set; }
/// <summary>
- /// Gets the Souce Data.
- /// </summary>
- public Source SouceData { get; private set; }
-
- /// <summary>
/// Gets ActivityLog.
/// </summary>
public string ActivityLog
@@ -165,7 +161,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
/// <param name="configuraiton">
/// The configuraiton.
/// </param>
- public void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuraiton)
+ public void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuraiton)
{
// Try to cleanup any previous scan instances.
if (this.instance != null)
@@ -326,7 +322,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
this.Stop();
if (this.ScanCompleted != null)
- this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()"));
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()", null));
}
}
@@ -370,20 +366,30 @@ namespace HandBrake.ApplicationServices.Services.Scan
}
// Process into internal structures.
+ Source sourceData = null;
if (this.instance != null && this.instance.Titles != null)
{
- this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };
+ sourceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };
}
this.IsScanning = false;
if (this.postScanOperation != null)
{
- this.postScanOperation(true);
+ try
+ {
+ this.postScanOperation(true, sourceData);
+ }
+ catch (Exception exc)
+ {
+ Debug.WriteLine(exc);
+ }
+
+ this.postScanOperation = null; // Reset
}
else
{
- if (this.ScanCompleted != null) this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty));
+ if (this.ScanCompleted != null) this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty, sourceData));
}
}
@@ -446,9 +452,6 @@ namespace HandBrake.ApplicationServices.Services.Scan
/// <param name="titles">
/// The titles.
/// </param>
- /// <param name="featureTitle">
- /// The feature Title.
- /// </param>
/// <returns>
/// The convert titles.
/// </returns>