diff options
author | sr55 <[email protected]> | 2009-01-23 21:08:28 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-01-23 21:08:28 +0000 |
commit | e98a23579ed5e4ca68d9c82af3ac50dfd833e86e (patch) | |
tree | d016ac9c57c3190a4f1881e3f747600b6d93bfc2 /win/C#/Functions | |
parent | 041ee4d8203087656775caecb5a312f246bdc2ae (diff) |
WinGui:
- Few more bits of code refactored.
- Added a 10 second limit for the CLI to respond at GUI startup. This will prevent the app from locking if the CLI stalls.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2093 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/Encode.cs | 1 | ||||
-rw-r--r-- | win/C#/Functions/Main.cs | 23 |
2 files changed, 22 insertions, 2 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index b6a4a0a43..3f126d7e5 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -136,6 +136,7 @@ namespace Handbrake.Functions /// if this feature is enabled in options.
/// </summary>
/// <param name="query"></param>
+ /// <param name="destination"></param>
public void copyLog(string query, string destination)
{
// The user may wish to do something with the log.
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 05bb00f56..af0ce7f72 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -173,7 +173,7 @@ namespace Handbrake.Functions data_chpt.Rows[n].Cells[1].ValueType = typeof(string);
i++;
}
-
+
return data_chpt;
}
@@ -324,7 +324,7 @@ namespace Handbrake.Functions if (line == null) line = "";
Match m = Regex.Match(line, @"HandBrake ([0-9\.]*)*(svn[0-9]*[M]*)* \([0-9]*\)");
- if (m.Success != false)
+ if (m.Success)
{
string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");
string[] arr = data.Split(' ');
@@ -332,6 +332,9 @@ namespace Handbrake.Functions cliVersionData.Add(arr[1]);
return cliVersionData;
}
+ if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.
+ killCLI();
+
}
}
catch (Exception e)
@@ -343,6 +346,22 @@ namespace Handbrake.Functions cliVersionData.Add("0");
return cliVersionData;
}
+ private void killCLI()
+ {
+ string AppName = "HandBrakeCLI";
+ AppName = AppName.ToUpper();
+
+ System.Diagnostics.Process[] prs = Process.GetProcesses();
+ foreach (System.Diagnostics.Process proces in prs)
+ {
+ if (proces.ProcessName.ToUpper() == AppName)
+ {
+ proces.Refresh();
+ if (!proces.HasExited)
+ proces.Kill();
+ }
+ }
+ }
/// <summary>
/// Check if the queue recovery file contains records.
|