summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-01-15 17:42:32 +0000
committersr55 <[email protected]>2011-01-15 17:42:32 +0000
commita1439b0bafd132abd69073d17b730b72b8bb4b8d (patch)
tree8726309a1de66dd24c1bb58ccfba34fbc06b2fa8 /win
parent994040e5568bc19512e18384354f7df62cf98f66 (diff)
WinGui:
- Some updates to the new queue processing code. (still not active) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3744 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Encode.cs10
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs8
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs19
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs8
4 files changed, 24 insertions, 21 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
index 90c224ac4..e2046da91 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
@@ -288,10 +288,6 @@ namespace HandBrake.ApplicationServices.Services
//}*/
}
- #endregion
-
- #region Private Helper Methods
-
/// <summary>
/// Save a copy of the log to the users desired location or a default location
/// if this feature is enabled in options.
@@ -299,7 +295,7 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="destination">
/// The Destination File Path
/// </param>
- protected void CopyLog(string destination)
+ public void ProcessLogs(string destination)
{
try
{
@@ -334,6 +330,10 @@ namespace HandBrake.ApplicationServices.Services
}
}
+ #endregion
+
+ #region Private Helper Methods
+
/// <summary>
/// The HandBrakeCLI process has exited.
/// </summary>
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
index 399afdec7..7ba739617 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
@@ -84,5 +84,13 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
/// </summary>
void SafelyStop();
+
+ /// <summary>
+ /// Copy the log file to the desired destinations
+ /// </summary>
+ /// <param name="destination">
+ /// The destination.
+ /// </param>
+ void ProcessLogs(string destination);
}
} \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs
index 05602f13d..5edbf39b0 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -21,19 +21,12 @@
{
/*
* TODO
- * - Multi HandBrake Instance Support for Queue Saving.
* - Rewrite the batch script generator.
*/
#region Private Variables
/// <summary>
- /// HandBrakes Queue file with a place holder for an extra string.
- /// Use this with String.Format()
- /// </summary>
- private const string QueueFile = "hb_queue_recovery{0}.xml";
-
- /// <summary>
/// A Lock object to maintain thread safety
/// </summary>
static readonly object QueueLock = new object();
@@ -44,6 +37,11 @@
private readonly List<QueueTask> queue = new List<QueueTask>();
/// <summary>
+ /// HandBrakes Queue file with a place holder for an extra string.
+ /// </summary>
+ private readonly string queueFile;
+
+ /// <summary>
/// The ID of the job last added
/// </summary>
private int lastJobId;
@@ -64,6 +62,9 @@
public QueueManager(int instanceId)
{
this.instanceId = instanceId;
+
+ // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
+ this.queueFile = instanceId == 0 ? "hb_queue_recovery.xml" : string.Format("hb_queue_recovery{0}.xml", instanceId);
}
#region Events
@@ -233,7 +234,7 @@
public void BackupQueue(string exportPath)
{
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
- string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(QueueFile, string.Empty);
+ string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(this.queueFile, string.Empty);
if (File.Exists(tempPath))
{
@@ -256,7 +257,7 @@
public void RestoreQueue(string importPath)
{
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
- string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(QueueFile, string.Empty));
+ string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(this.queueFile, string.Empty));
if (File.Exists(tempPath))
{
diff --git a/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index d49d4379a..162527164 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -19,12 +19,6 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public class QueueProcessor : IQueueProcessor
{
- /*
- * TODO
- * - Hookup the logging to write to disk
- *
- */
-
/// <summary>
/// Initializes a new instance of the <see cref="QueueProcessor"/> class.
/// </summary>
@@ -204,7 +198,7 @@ namespace HandBrake.ApplicationServices.Services
"Put down that cocktail...\nyour Handbrake encode is done.");
// Handling Log Data
- // TODO - Still need to re-write this using CopyLog()
+ this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);
// Move onto the next job.
this.ProcessNextJob();