diff options
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Functions/Main.cs | 49 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Functions/Win7.cs | 2 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/Encode.cs | 8 |
3 files changed, 4 insertions, 55 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Main.cs b/win/C#/HandBrake.ApplicationServices/Functions/Main.cs index 0696101c1..a92d2d245 100644 --- a/win/C#/HandBrake.ApplicationServices/Functions/Main.cs +++ b/win/C#/HandBrake.ApplicationServices/Functions/Main.cs @@ -5,8 +5,6 @@ namespace HandBrake.ApplicationServices.Functions
{
- using System;
- using System.Collections.Generic;
using System.Diagnostics;
/// <summary>
@@ -17,51 +15,10 @@ namespace HandBrake.ApplicationServices.Functions /// <summary>
/// Get the Process ID of HandBrakeCLI for the current instance.
/// </summary>
- /// <param name="before">List of processes before the new process was started</param>
- /// <returns>Int - Process ID</returns>
- public static int GetCliProcess(Process[] before)
+ /// <returns>A list of processes</returns>
+ public static Process[] GetCliProcess()
{
- // This is a bit of a cludge. Maybe someone has a better idea on how to impliment this.
- // Since we used CMD to start HandBrakeCLI, we don't get the process ID from hbProc.
- // Instead we take the processes before and after, and get the ID of HandBrakeCLI.exe
- // avoiding any previous instances of HandBrakeCLI.exe in before.
- // Kill the current process.
-
- DateTime startTime = DateTime.Now;
- TimeSpan duration;
-
- Process[] hbProcesses = Process.GetProcessesByName("HandBrakeCLI");
- while (hbProcesses.Length == 0)
- {
- hbProcesses = Process.GetProcessesByName("HandBrakeCLI");
- duration = DateTime.Now - startTime;
- if (duration.Seconds > 5 && hbProcesses.Length == 0)
- // Make sure we don't wait forever if the process doesn't start
- return -1;
- }
-
- Process hbProcess = null;
- foreach (Process process in hbProcesses)
- {
- bool found = false;
- // Check if the current CLI instance was running before we started the current one
- foreach (Process bprocess in before)
- {
- if (process.Id == bprocess.Id)
- found = true;
- }
-
- // If it wasn't running before, we found the process we want.
- if (!found)
- {
- hbProcess = process;
- break;
- }
- }
- if (hbProcess != null)
- return hbProcess.Id;
-
- return -1;
+ return Process.GetProcessesByName("HandBrakeCLI");
}
/// <summary>
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs b/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs index 0123139ba..8d694d2f8 100644 --- a/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs +++ b/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs @@ -53,7 +53,7 @@ namespace HandBrake.ApplicationServices.Functions {
return;
}
- windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal); // todo CHECK THIS
+ windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);
windowsTaskbar.SetProgressValue(percentage, 100);
}
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index 79b82a2ea..e5dc74cec 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -18,8 +18,6 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Properties;
using HandBrake.ApplicationServices.Services.Interfaces;
- using Timer = System.Threading.Timer;
-
/// <summary>
/// Class which handles the CLI
/// </summary>
@@ -28,11 +26,6 @@ namespace HandBrake.ApplicationServices.Services #region Private Variables
/// <summary>
- /// An Encode Job
- /// </summary>
- private Job job;
-
- /// <summary>
/// The Log Buffer
/// </summary>
private StringBuilder logBuffer;
@@ -152,7 +145,6 @@ namespace HandBrake.ApplicationServices.Services /// </param>
protected void Run(Job encJob, bool enableLogging)
{
- this.job = encJob;
try
{
IsEncoding = true;
|