summaryrefslogtreecommitdiffstats
path: root/win/C#/EncodeQueue
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-06-14 13:31:24 +0000
committersr55 <[email protected]>2009-06-14 13:31:24 +0000
commitb023bb532c17e1284230172b660baa32b5750318 (patch)
tree33a5bfe14b29a2ed932e782b94469956cea5874d /win/C#/EncodeQueue
parent729ff4e83ad9c402fd322922e38c6b75f55508e0 (diff)
WinGui:
- Small tweaks to Encode.cs - write2disk queue recovery feature is now completely handled in QueueHandler - Auto naming is on by default. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2533 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/EncodeQueue')
-rw-r--r--win/C#/EncodeQueue/Encode.cs7
-rw-r--r--win/C#/EncodeQueue/QueueHandler.cs24
2 files changed, 17 insertions, 14 deletions
diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs
index c0e0b7c3e..80125fc30 100644
--- a/win/C#/EncodeQueue/Encode.cs
+++ b/win/C#/EncodeQueue/Encode.cs
@@ -33,7 +33,7 @@ namespace Handbrake.EncodeQueue
{
cliStart.RedirectStandardOutput = true;
cliStart.UseShellExecute = false;
-
+
}
if (Properties.Settings.Default.cli_minimized == "Checked")
cliStart.WindowStyle = ProcessWindowStyle.Minimized;
@@ -43,7 +43,8 @@ namespace Handbrake.EncodeQueue
currentEncode.processID = Main.getCliProcess(before);
currentEncode.isEncoding = true;
currentEncode.currentQuery = query;
- currentEncode.processHandle = (int)currentEncode.hbProcProcess.MainWindowHandle; // Set the process Handle
+ if (currentEncode.hbProcProcess != null)
+ currentEncode.processHandle = (int)currentEncode.hbProcProcess.MainWindowHandle; // Set the process Handle
// Set the process Priority
Process hbCliProcess = null;
@@ -75,7 +76,7 @@ namespace Handbrake.EncodeQueue
}
catch (Exception exc)
{
- MessageBox.Show("An error occured in runCli()\n Error Information: \n\n" + exc);
+ MessageBox.Show("It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\n Detailed Error Information: error occured in runCli()\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return currentEncode;
diff --git a/win/C#/EncodeQueue/QueueHandler.cs b/win/C#/EncodeQueue/QueueHandler.cs
index d16f10ffb..68cfe306a 100644
--- a/win/C#/EncodeQueue/QueueHandler.cs
+++ b/win/C#/EncodeQueue/QueueHandler.cs
@@ -36,6 +36,9 @@ namespace Handbrake.EncodeQueue
String query = job.Query;
lastQueueItem = job;
remove(0); // Remove the item which we are about to pass out.
+
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
+
return query;
}
@@ -57,6 +60,7 @@ namespace Handbrake.EncodeQueue
id++;
queue.Add(newJob);
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
/// <summary>
@@ -82,6 +86,7 @@ namespace Handbrake.EncodeQueue
public void remove(int index)
{
queue.RemoveAt(index);
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
/// <summary>
@@ -106,6 +111,7 @@ namespace Handbrake.EncodeQueue
queue.RemoveAt(index);
queue.Insert((index - 1), item);
}
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
}
/// <summary>
@@ -121,13 +127,14 @@ namespace Handbrake.EncodeQueue
queue.RemoveAt(index);
queue.Insert((index + 1), item);
}
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
}
/// <summary>
/// Writes the current queue to disk. hb_queue_recovery.xml
/// This function is called after getNextItemForEncoding()
/// </summary>
- public void write2disk(string file)
+ public void updateQueueRecoveryFile(string file)
{
string tempPath = file == "hb_queue_recovery.xml" ? Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml") : file;
@@ -191,11 +198,7 @@ namespace Handbrake.EncodeQueue
/// </summary>
public void recoverQueue(string file)
{
- string tempPath;
- if (file == "hb_queue_recovery.xml")
- tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml");
- else
- tempPath = file;
+ string tempPath = file == "hb_queue_recovery.xml" ? Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml") : file;
if (File.Exists(tempPath))
{
@@ -210,7 +213,7 @@ namespace Handbrake.EncodeQueue
queue.Add(item);
if (file != "hb_queue_recovery.xml")
- write2disk("hb_queue_recovery.xml");
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
}
}
@@ -226,7 +229,6 @@ namespace Handbrake.EncodeQueue
public void startEncode()
{
- Thread theQueue;
if (this.count() != 0)
{
if (isPaused)
@@ -236,7 +238,7 @@ namespace Handbrake.EncodeQueue
isPaused = false;
try
{
- theQueue = new Thread(startProc) { IsBackground = true };
+ Thread theQueue = new Thread(startProcess) { IsBackground = true };
theQueue.Start();
}
catch (Exception exc)
@@ -256,7 +258,7 @@ namespace Handbrake.EncodeQueue
encodeHandler.closeCLI(encodeProcess);
}
- private void startProc(object state)
+ private void startProcess(object state)
{
try
{
@@ -264,7 +266,7 @@ namespace Handbrake.EncodeQueue
while (this.count() != 0)
{
string query = getNextItemForEncoding();
- write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
encodeProcess = encodeHandler.runCli(query);
EncodeStarted(null);