diff options
author | sr55 <[email protected]> | 2008-08-24 17:57:54 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-08-24 17:57:54 +0000 |
commit | 163bce7432c717a0d102568a0d582375f507e3f7 (patch) | |
tree | a62dc6dbd0d64b31a79e2630db4133b37885d668 /win/C#/Functions/Queue.cs | |
parent | b4553cd70fde71ac12974aa83dec4508f8f690ab (diff) |
WinGui:
- Adds checkbox to enable decomb.
- Program Options updated with an option to customize decomb values.
- Queue Recovery feature. If you close the GUI without letting a queue complete, the user will be prompted if they'd like to recover the queue on next launch.
- Small bugfix with the queue HandBrakeCLI monitor thread not stopping when the GUI is closed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1653 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions/Queue.cs')
-rw-r--r-- | win/C#/Functions/Queue.cs | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/win/C#/Functions/Queue.cs b/win/C#/Functions/Queue.cs index e566c2e08..ad4ecaf44 100644 --- a/win/C#/Functions/Queue.cs +++ b/win/C#/Functions/Queue.cs @@ -2,6 +2,8 @@ using System.Collections.Generic;
using System.Text;
using System.Collections;
+using System.IO;
+using System.Windows.Forms;
namespace Handbrake.Functions
{
@@ -23,7 +25,7 @@ namespace Handbrake.Functions {
string query = queue[0].ToString();
lastQuery = query;
- remove(0);
+ remove(0); // Remove the item which we are about to pass out.
return query;
}
@@ -102,5 +104,55 @@ namespace Handbrake.Functions }
}
+ /// <summary>
+ /// Writes the current queue to disk. hb_queue_recovery.dat
+ /// This function is called after getNextItemForEncoding()
+ /// </summary>
+ public void write2disk()
+ {
+ try
+ {
+ string tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.dat");
+ using (StreamWriter writer = new StreamWriter(tempPath))
+ {
+ foreach (string item in queue)
+ {
+ writer.WriteLine(item);
+ }
+ writer.Close();
+ writer.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ // Any Errors will be out of diskspace/permissions problems. Don't report them as they'll annoy the user.
+ }
+ }
+
+ /// <summary>
+ /// Recover the queue from hb_queue_recovery.dat
+ /// </summary>
+ public void recoverQueue()
+ {
+ try
+ {
+ string tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.dat");
+ using (StreamReader reader = new StreamReader(tempPath))
+ {
+ string queue_item = reader.ReadLine();
+
+ while (queue_item != null)
+ {
+ this.add(queue_item);
+ queue_item = reader.ReadLine();
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show("HandBrake was unable to recover the queue. \nError Information:" + exc.ToString(),"Queue Recovery Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
}
}
|