summaryrefslogtreecommitdiffstats
path: root/win/C#/frmMain.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r--win/C#/frmMain.cs36
1 files changed, 26 insertions, 10 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 7f46139a2..91ed40423 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -211,21 +211,37 @@ namespace Handbrake
// Startup Functions
private void queueRecovery()
{
- if (Main.CheckQueueRecovery())
+ DialogResult result = DialogResult.None;
+ List<string> queueFiles = Main.CheckQueueRecovery();
+ if (queueFiles.Count == 1)
{
- DialogResult result =
- MessageBox.Show(
+ result = MessageBox.Show(
"HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?",
"Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ }
+ else if (queueFiles.Count > 1)
+ {
+ result = MessageBox.Show(
+ "HandBrake has detected multiple unfinished queue files. These will be from multiple instances of HandBrake running. Would you like to recover all unfinished jobs?",
+ "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ }
- if (result == DialogResult.Yes)
- encodeQueue.LoadQueueFromFile("hb_queue_recovery.xml"); // Start Recovery
- else
+ if (result == DialogResult.Yes)
+ {
+ foreach (string file in queueFiles)
+ {
+ encodeQueue.LoadQueueFromFile(file); // Start Recovery
+ }
+ }
+ else
+ {
+ if (Main.IsMultiInstance) return; // Don't tamper with the files if we are multi instance
+
+ string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
+ foreach (string file in queueFiles)
{
- // Remove the Queue recovery file if the user doesn't want to recovery the last queue.
- string queuePath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml");
- if (File.Exists(queuePath))
- File.Delete(queuePath);
+ if (File.Exists(Path.Combine(tempPath, file)))
+ File.Delete(Path.Combine(tempPath, file));
}
}
}