summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncodeServiceWrapper.cs18
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScanServiceWrapper.cs18
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs21
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs20
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs11
10 files changed, 106 insertions, 12 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index fa21353ed..49ff66bd2 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -264,6 +264,14 @@ namespace HandBrake.ApplicationServices.Services
//}*/
}
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ // Nothing to do.
+ }
+
#endregion
#region Private Helper Methods
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
index 426cad897..eddc49d9b 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
@@ -96,5 +96,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// The destination.
/// </param>
void ProcessLogs(string destination);
+
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ void Shutdown();
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncodeServiceWrapper.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncodeServiceWrapper.cs
new file mode 100644
index 000000000..95f20e455
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncodeServiceWrapper.cs
@@ -0,0 +1,18 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IEncodeServiceWrapper.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>
+// IEncodeServiceWrapper Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Interfaces
+{
+ /// <summary>
+ /// EncodeServiceWrapper Interface
+ /// </summary>
+ public interface IEncodeServiceWrapper : IEncode
+ {
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs
index b695bab49..dd5746387 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs
@@ -34,7 +34,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <summary>
/// Gets the IEncodeService instance.
/// </summary>
- IEncode EncodeService { get; }
+ IEncodeServiceWrapper EncodeService { get; }
/// <summary>
/// Gets the IQueueManager instance.
@@ -64,6 +64,6 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="service">
/// The service.
/// </param>
- void SwapEncodeService(IEncode service);
+ void SwapEncodeService(IEncodeServiceWrapper service);
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
index cd69084eb..59213e5d0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
@@ -101,5 +101,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// The path to the log file.
/// </param>
void DebugScanLog(string path);
+
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ void Shutdown();
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScanServiceWrapper.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScanServiceWrapper.cs
new file mode 100644
index 000000000..febe4aa29
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScanServiceWrapper.cs
@@ -0,0 +1,18 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IScanServiceWrapper.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>
+// ScanServiceWrapper Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Services.Interfaces
+{
+ /// <summary>
+ /// ScanServiceWrapper Interface
+ /// </summary>
+ public interface IScanServiceWrapper : IScan
+ {
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 404a47fac..5c3deb80f 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -12,6 +12,7 @@ namespace HandBrake.ApplicationServices.Services
using System;
using System.Diagnostics;
+ using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Base;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -163,7 +164,7 @@ namespace HandBrake.ApplicationServices.Services
}
catch (Exception exc)
{
- this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error has occured in EncodeService.Run()"));
+ this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error has occured."));
}
}
@@ -184,7 +185,15 @@ namespace HandBrake.ApplicationServices.Services
/// </param>
public override void Stop(Exception exc)
{
- this.instance.StopEncode();
+ try
+ {
+ this.IsEncoding = false;
+ this.instance.StopEncode();
+ }
+ catch(Exception)
+ {
+ // Do Nothing.
+ }
this.Invoke_encodeCompleted(
exc == null
@@ -202,6 +211,14 @@ namespace HandBrake.ApplicationServices.Services
throw new NotImplementedException("This Method is not used in the LibEncode service. You should use the Stop() method instead! ");
}
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ // Nothing to do for this implementation.
+ }
+
#region HandBrakeInstance Event Handlers.
/// <summary>
/// Log a message
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 73f5fca57..c3598d922 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -183,6 +183,14 @@ namespace HandBrake.ApplicationServices.Services
throw new NotImplementedException("Only Available when using the CLI mode. Not LibHB");
}
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ // Nothing to do for this implementation.
+ }
+
#endregion
#region Private Methods
@@ -205,7 +213,8 @@ namespace HandBrake.ApplicationServices.Services
{
this.logging.Clear();
- string source = sourcePath.ToString().EndsWith("\\") ? sourcePath.ToString() : "\"" + sourcePath + "\"";
+ string source = sourcePath.ToString().EndsWith("\\") ? string.Format("\"{0}\\\\\"", sourcePath.ToString().TrimEnd('\\'))
+ : "\"" + sourcePath + "\"";
currentSourceScanPath = source;
IsScanning = true;
@@ -240,7 +249,14 @@ namespace HandBrake.ApplicationServices.Services
/// </param>
private void InstanceScanCompleted(object sender, EventArgs e)
{
- this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = currentSourceScanPath};
+ // TODO -> Might be a better place to fix this.
+ string path = currentSourceScanPath;
+ if (currentSourceScanPath.Contains("\""))
+ {
+ path = currentSourceScanPath.Trim('\"');
+ }
+
+ this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };
IsScanning = false;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index bbb085916..29eba5172 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -43,7 +43,7 @@ namespace HandBrake.ApplicationServices.Services
/// <exception cref="ArgumentNullException">
/// Services are not setup
/// </exception>
- public QueueProcessor(IQueueManager queueManager, IEncode encodeService, IUserSettingService userSettingService)
+ public QueueProcessor(IQueueManager queueManager, IEncodeServiceWrapper encodeService, IUserSettingService userSettingService)
{
this.userSettingService = userSettingService;
this.QueueManager = queueManager;
@@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Gets the IEncodeService instance.
/// </summary>
- public IEncode EncodeService { get; private set; }
+ public IEncodeServiceWrapper EncodeService { get; private set; }
/// <summary>
/// Gets the IQueueManager instance.
@@ -188,7 +188,7 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="service">
/// The service.
/// </param>
- public void SwapEncodeService(IEncode service)
+ public void SwapEncodeService(IEncodeServiceWrapper service)
{
this.EncodeService = service;
}
@@ -260,8 +260,8 @@ namespace HandBrake.ApplicationServices.Services
QueueTask job = this.QueueManager.GetNextJobForProcessing();
if (job != null)
{
- this.EncodeService.Start(job, true);
this.InvokeJobProcessingStarted(new QueueProgressEventArgs(job));
+ this.EncodeService.Start(job, true);
}
else
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index 9eb05eb39..e2ce19ff0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -16,8 +16,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Threading;
using System.Windows.Forms;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Parsing;
@@ -194,6 +192,15 @@ namespace HandBrake.ApplicationServices.Services
throw new GeneralApplicationException("Debug Run Failed", string.Empty, e);
}
}
+
+ /// <summary>
+ /// Shutdown the service.
+ /// </summary>
+ public void Shutdown()
+ {
+ // Nothing to do for this implementation.
+ }
+
#endregion
#region Private Methods