//}*/\r
}\r
\r
- #endregion\r
-\r
- #region Private Helper Methods\r
-\r
/// <summary>\r
/// Save a copy of the log to the users desired location or a default location\r
/// if this feature is enabled in options.\r
/// <param name="destination">\r
/// The Destination File Path\r
/// </param>\r
- protected void CopyLog(string destination)\r
+ public void ProcessLogs(string destination)\r
{\r
try\r
{\r
}\r
}\r
\r
+ #endregion\r
+\r
+ #region Private Helper Methods\r
+\r
/// <summary>\r
/// The HandBrakeCLI process has exited.\r
/// </summary>\r
{\r
/*\r
* TODO\r
- * - Multi HandBrake Instance Support for Queue Saving.\r
* - Rewrite the batch script generator. \r
*/\r
\r
#region Private Variables\r
\r
- /// <summary>\r
- /// HandBrakes Queue file with a place holder for an extra string.\r
- /// Use this with String.Format()\r
- /// </summary>\r
- private const string QueueFile = "hb_queue_recovery{0}.xml";\r
-\r
/// <summary>\r
/// A Lock object to maintain thread safety\r
/// </summary>\r
/// </summary>\r
private readonly List<QueueTask> queue = new List<QueueTask>();\r
\r
+ /// <summary>\r
+ /// HandBrakes Queue file with a place holder for an extra string.\r
+ /// </summary>\r
+ private readonly string queueFile;\r
+\r
/// <summary>\r
/// The ID of the job last added\r
/// </summary>\r
public QueueManager(int instanceId)\r
{\r
this.instanceId = instanceId;\r
+\r
+ // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.\r
+ this.queueFile = instanceId == 0 ? "hb_queue_recovery.xml" : string.Format("hb_queue_recovery{0}.xml", instanceId);\r
}\r
\r
#region Events\r
public void BackupQueue(string exportPath)\r
{\r
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");\r
- string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(QueueFile, string.Empty);\r
+ string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(this.queueFile, string.Empty);\r
\r
if (File.Exists(tempPath))\r
{\r
public void RestoreQueue(string importPath)\r
{\r
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");\r
- string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(QueueFile, string.Empty));\r
+ string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(this.queueFile, string.Empty));\r
\r
if (File.Exists(tempPath))\r
{\r
/// </summary>\r
public class QueueProcessor : IQueueProcessor\r
{\r
- /*\r
- * TODO\r
- * - Hookup the logging to write to disk\r
- * \r
- */\r
-\r
/// <summary>\r
/// Initializes a new instance of the <see cref="QueueProcessor"/> class.\r
/// </summary>\r
"Put down that cocktail...\nyour Handbrake encode is done.");\r
\r
// Handling Log Data \r
- // TODO - Still need to re-write this using CopyLog()\r
+ this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);\r
\r
// Move onto the next job.\r
this.ProcessNextJob();\r