summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/Functions/Main.cs18
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs8
2 files changed, 20 insertions, 6 deletions
diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs
index db154ab2f..4de00af90 100644
--- a/win/CS/Functions/Main.cs
+++ b/win/CS/Functions/Main.cs
@@ -397,17 +397,19 @@ namespace Handbrake.Functions
{
string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
List<string> queueFiles = new List<string>();
+ List<string> removeFiles = new List<string>();
DirectoryInfo info = new DirectoryInfo(tempPath);
- FileInfo[] logFiles = info.GetFiles("*.xml");
+ IEnumerable<FileInfo> logFiles = info.GetFiles("*.xml").Where(f => f.Name.StartsWith("hb_queue_recovery"));
foreach (FileInfo file in logFiles)
{
- if (!file.Name.Contains("hb_queue_recovery"))
- continue;
-
- using (FileStream strm = new FileStream(Path.Combine(file.DirectoryName, file.Name), FileMode.Open, FileAccess.Read))
+ using (FileStream strm = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
{
List<QueueTask> list = Ser.Deserialize(strm) as List<QueueTask>;
+ if (list != null && list.Count == 0)
+ {
+ removeFiles.Add(file.FullName);
+ }
if (list != null && list.Count != 0)
{
@@ -420,6 +422,12 @@ namespace Handbrake.Functions
}
}
+ // Cleanup old/unused queue files for now.
+ foreach (string file in removeFiles)
+ {
+ File.Delete(file);
+ }
+
return queueFiles;
}
catch (Exception exc)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
index c138708a7..6cddd2707 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -315,6 +315,7 @@ namespace HandBrake.ApplicationServices.Services
if (File.Exists(tempPath))
{
+ bool invokeUpdate = false;
using (FileStream strm = new FileStream((!string.IsNullOrEmpty(importPath) ? importPath : tempPath), FileMode.Open, FileAccess.Read))
{
if (strm.Length != 0)
@@ -338,9 +339,14 @@ namespace HandBrake.ApplicationServices.Services
}
}
- this.InvokeQueueChanged(EventArgs.Empty);
+ invokeUpdate = true;
}
}
+
+ if (invokeUpdate)
+ {
+ this.InvokeQueueChanged(EventArgs.Empty);
+ }
}
}