]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Thu, 15 Jul 2010 18:15:54 +0000 (18:15 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 15 Jul 2010 18:15:54 +0000 (18:15 +0000)
- Cleanup

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3439 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/HandBrake.ApplicationServices/Functions/Main.cs
win/C#/HandBrake.ApplicationServices/Functions/Win7.cs
win/C#/HandBrake.ApplicationServices/Services/Encode.cs

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