3 This file is part of the HandBrake source code.
\r
4 Homepage: <http://handbrake.m0k.org/>.
\r
5 It may be used under the terms of the GNU General Public License. */
\r
8 using System.Collections.Generic;
\r
9 using System.Threading;
\r
10 using System.Diagnostics;
\r
11 using System.Windows.Forms;
\r
12 using System.Globalization;
\r
15 namespace Handbrake.Functions
\r
20 /// CLI output is based on en-US locale,
\r
21 /// we use this CultureInfo as IFormatProvider to *.Parse() calls
\r
23 static readonly public CultureInfo Culture = new CultureInfo("en-US", false);
\r
25 Process hbProc = new Process();
\r
27 public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)
\r
31 string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
\r
32 string logPath = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat");
\r
34 string strCmdLine = String.Format(@"cmd /c """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath);
\r
36 ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);
\r
37 hbProc = Process.Start(cliStart);
\r
39 // Set the process Priority
\r
40 switch (Properties.Settings.Default.processPriority)
\r
43 hbProc.PriorityClass = ProcessPriorityClass.RealTime;
\r
46 hbProc.PriorityClass = ProcessPriorityClass.High;
\r
48 case "Above Normal":
\r
49 hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
\r
52 hbProc.PriorityClass = ProcessPriorityClass.Normal;
\r
55 hbProc.PriorityClass = ProcessPriorityClass.Idle;
\r
58 hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
\r
64 MessageBox.Show("Internal Software Error. Please Restart the Program");
\r