// Startup Functions \r
private void queueRecovery()\r
{\r
- if (Main.CheckQueueRecovery())\r
+ DialogResult result = DialogResult.None;\r
+ List<string> queueFiles = Main.CheckQueueRecovery();\r
+ if (queueFiles.Count == 1)\r
{\r
- DialogResult result =\r
- MessageBox.Show(\r
+ result = MessageBox.Show(\r
"HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?",\r
"Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
+ }\r
+ else if (queueFiles.Count > 1)\r
+ {\r
+ result = MessageBox.Show(\r
+ "HandBrake has detected multiple unfinished queue files. These will be from multiple instances of HandBrake running. Would you like to recover all unfinished jobs?",\r
+ "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
+ }\r
\r
- if (result == DialogResult.Yes)\r
- encodeQueue.LoadQueueFromFile("hb_queue_recovery.xml"); // Start Recovery\r
- else\r
+ if (result == DialogResult.Yes)\r
+ {\r
+ foreach (string file in queueFiles)\r
+ {\r
+ encodeQueue.LoadQueueFromFile(file); // Start Recovery\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (Main.IsMultiInstance) return; // Don't tamper with the files if we are multi instance\r
+\r
+ string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");\r
+ foreach (string file in queueFiles)\r
{\r
- // Remove the Queue recovery file if the user doesn't want to recovery the last queue.\r
- string queuePath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml");\r
- if (File.Exists(queuePath))\r
- File.Delete(queuePath);\r
+ if (File.Exists(Path.Combine(tempPath, file)))\r
+ File.Delete(Path.Combine(tempPath, file));\r
}\r
}\r
}\r