diff options
Diffstat (limited to 'win/C#/Functions/CLI.cs')
-rw-r--r-- | win/C#/Functions/CLI.cs | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs index f6c774d68..85d1c5569 100644 --- a/win/C#/Functions/CLI.cs +++ b/win/C#/Functions/CLI.cs @@ -13,35 +13,43 @@ namespace Handbrake.Functions public Process runCli(object s, string query, bool stderr, bool stdout, bool useShellExec, bool noWindow)
{
- hbProc.StartInfo.FileName = "hbcli.exe";
- hbProc.StartInfo.Arguments = query;
- hbProc.StartInfo.RedirectStandardOutput = stdout;
- hbProc.StartInfo.RedirectStandardError = stderr;
- hbProc.StartInfo.UseShellExecute = useShellExec;
- hbProc.StartInfo.CreateNoWindow = noWindow;
- hbProc.Start();
+ try
+ {
+ hbProc = new Process();
+ hbProc.StartInfo.FileName = "hbcli.exe";
+ hbProc.StartInfo.Arguments = query;
+ hbProc.StartInfo.RedirectStandardOutput = stdout;
+ hbProc.StartInfo.RedirectStandardError = stderr;
+ hbProc.StartInfo.UseShellExecute = useShellExec;
+ hbProc.StartInfo.CreateNoWindow = noWindow;
+ hbProc.Start();
- // Set the process Priority
- switch (Properties.Settings.Default.processPriority)
+ // Set the process Priority
+ switch (Properties.Settings.Default.processPriority)
+ {
+ case "Realtime":
+ hbProc.PriorityClass = ProcessPriorityClass.RealTime;
+ break;
+ case "High":
+ hbProc.PriorityClass = ProcessPriorityClass.High;
+ break;
+ case "Above Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
+ break;
+ case "Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.Normal;
+ break;
+ case "Low":
+ hbProc.PriorityClass = ProcessPriorityClass.Idle;
+ break;
+ default:
+ hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
+ break;
+ }
+ }
+ catch
{
- case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
- break;
- case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
- break;
- case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
- break;
- case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
- break;
- case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
- break;
- default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
- break;
+ MessageBox.Show("Internal Software Error. Please Restart the Program");
}
return hbProc;
}
@@ -63,5 +71,10 @@ namespace Handbrake.Functions hbProc.Close();
hbProc.Dispose();
}
+
+ public void setNull()
+ {
+ hbProc = new Process();
+ }
}
}
|