diff options
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs | 19 |
1 files changed, 10 insertions, 9 deletions
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))
{
|