summaryrefslogtreecommitdiffstats
path: root/win/C#/EncodeQueue
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-01-16 21:32:19 +0000
committersr55 <[email protected]>2010-01-16 21:32:19 +0000
commitf1cc4752f0f6b3c5160bc39b7d1115b18fbae4f1 (patch)
treeb7e9dd3fccc6d9547c209bdb5eb46eb448466d2e /win/C#/EncodeQueue
parenta6a1746f4f521a01b5fe2fe82d09c1b4ffa82bdc (diff)
WinGui:
- Improve the In-Gui encode status option. by default, the CLI window is not completely hidden when this is set however there is an option to show it to allow "ctrl-c" clean exits. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3073 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/EncodeQueue')
-rw-r--r--win/C#/EncodeQueue/Encode.cs53
1 files changed, 34 insertions, 19 deletions
diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs
index 8061bc349..9a3b4269d 100644
--- a/win/C#/EncodeQueue/Encode.cs
+++ b/win/C#/EncodeQueue/Encode.cs
@@ -54,6 +54,8 @@ namespace Handbrake.EncodeQueue
{
cliStart.RedirectStandardOutput = true;
cliStart.UseShellExecute = false;
+ if (!Properties.Settings.Default.showCliForInGuiEncodeStatus)
+ cliStart.CreateNoWindow = true;
}
if (Properties.Settings.Default.cli_minimized)
cliStart.WindowStyle = ProcessWindowStyle.Minimized;
@@ -102,14 +104,19 @@ namespace Handbrake.EncodeQueue
/// <summary>
/// Kill the CLI process
/// </summary>
- protected void Stop()
+ public void Stop()
{
- if (EncodeEnded != null)
- EncodeEnded(this, new EventArgs());
-
if (HbProcess != null)
HbProcess.Kill();
+
+ Process[] list = Process.GetProcessesByName("HandBrakeCLI");
+ foreach (Process process in list)
+ process.Kill();
+
IsEncoding = false;
+
+ if (EncodeEnded != null)
+ EncodeEnded(this, new EventArgs());
}
/// <summary>
@@ -156,21 +163,29 @@ namespace Handbrake.EncodeQueue
/// <param name="encJob"></param>
protected void AddCLIQueryToLog(Job encJob)
{
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
- string logPath = Path.Combine(logDir, "last_encode_log.txt");
-
- StreamReader reader = new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));
- String log = reader.ReadToEnd();
- reader.Close();
-
- StreamWriter writer = new StreamWriter(File.Create(logPath));
-
- writer.Write("### CLI Query: " + encJob.Query + "\n\n");
- writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");
- writer.Write("#########################################\n\n");
- writer.WriteLine(log);
- writer.Flush();
- writer.Close();
+ try
+ {
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
+ "\\HandBrake\\logs";
+ string logPath = Path.Combine(logDir, "last_encode_log.txt");
+
+ StreamReader reader =
+ new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));
+ String log = reader.ReadToEnd();
+ reader.Close();
+
+ StreamWriter writer = new StreamWriter(File.Create(logPath));
+
+ writer.Write("### CLI Query: " + encJob.Query + "\n\n");
+ writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");
+ writer.Write("#########################################\n\n");
+ writer.WriteLine(log);
+ writer.Flush();
+ writer.Close();
+ } catch (Exception exc)
+ {
+
+ }
}
/// <summary>