--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Threading;\r
+using System.Diagnostics;\r
+ \r
+\r
+namespace Handbrake.Functions\r
+{\r
+ class CLI\r
+ {\r
+ public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)\r
+ {\r
+ Process hbProc = new Process();\r
+ hbProc.StartInfo.FileName = "hbcli.exe";\r
+ hbProc.StartInfo.Arguments = query;\r
+ hbProc.StartInfo.RedirectStandardOutput = stdout;\r
+ hbProc.StartInfo.RedirectStandardError = stderr;\r
+ hbProc.StartInfo.UseShellExecute = useShellExec;\r
+ hbProc.StartInfo.CreateNoWindow = noWindow;\r
+ hbProc.Start(); \r
+\r
+ // Set the process Priority\r
+ switch (Properties.Settings.Default.processPriority)\r
+ {\r
+ case "Realtime":\r
+ hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
+ break;\r
+ case "High":\r
+ hbProc.PriorityClass = ProcessPriorityClass.High;\r
+ break;\r
+ case "Above Normal":\r
+ hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;\r
+ break;\r
+ case "Normal":\r
+ hbProc.PriorityClass = ProcessPriorityClass.Normal;\r
+ break;\r
+ case "Low":\r
+ hbProc.PriorityClass = ProcessPriorityClass.Idle;\r
+ break;\r
+ default:\r
+ hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;\r
+ break;\r
+ }\r
+ return hbProc;\r
+ }\r
+ }\r
+}\r