summaryrefslogtreecommitdiffstats
path: root/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs
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/C#/HandBrake.ApplicationServices/Services/QueueManager.cs
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/C#/HandBrake.ApplicationServices/Services/QueueManager.cs')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs19
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))
{