summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions/CLI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/Functions/CLI.cs')
-rw-r--r--win/C#/Functions/CLI.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs
index 3ed958d50..f6c774d68 100644
--- a/win/C#/Functions/CLI.cs
+++ b/win/C#/Functions/CLI.cs
@@ -2,15 +2,17 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Diagnostics;
+using System.Windows.Forms;
namespace Handbrake.Functions
{
class CLI
{
+ Process hbProc = new Process();
+
public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)
{
- Process hbProc = new Process();
hbProc.StartInfo.FileName = "hbcli.exe";
hbProc.StartInfo.Arguments = query;
hbProc.StartInfo.RedirectStandardOutput = stdout;
@@ -43,5 +45,23 @@ namespace Handbrake.Functions
}
return hbProc;
}
+
+ public void killCLI()
+ {
+ try
+ {
+ hbProc.Kill();
+ }
+ catch (Exception)
+ {
+ // No need to do anything. Chances are the process was already dead.
+ }
+ }
+
+ public void closeCLI()
+ {
+ hbProc.Close();
+ hbProc.Dispose();
+ }
}
}