OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 20 Feb 2010 21:59:23 +0000 (21:59 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 20 Feb 2010 21:59:23 +0000 (21:59 +0000)
- Some tweaks to the StyleCop Settings File.
- Some abbreviations added to the ReSharper config file.
- Some more warnings cleaned up.

git-svn-id: svn://localhost/HandBrake/trunk@3130 b64f7644-9d1e-0410-96f1-a4d463321fa5

12 files changed:
win/C#/EncodeQueue/Encode.cs
win/C#/EncodeQueue/Job.cs
win/C#/EncodeQueue/Queue.cs
win/C#/Functions/Win32.cs
win/C#/HandBrakeCS.5.0.ReSharper
win/C#/Model/AudioTrack.cs
win/C#/Model/DriveInformation.cs
win/C#/Model/SourceType.cs
win/C#/Model/Subtitle.cs
win/C#/Program.cs
win/C#/Settings.StyleCop
win/C#/frmMain.Designer.cs

index 28ef3ae..60f460a 100644 (file)
 /*  Encode.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr/>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
-using System.Diagnostics;\r
-using System.IO;\r
-using System.Windows.Forms;\r
-using Handbrake.Functions;\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr/>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.EncodeQueue\r
 {\r
+    using System;\r
+    using System.Diagnostics;\r
+    using System.IO;\r
+    using System.Windows.Forms;\r
+    using Functions;\r
+    using Properties;\r
+\r
     /// <summary>\r
     /// Class which handles the CLI\r
     /// </summary>\r
     public class Encode\r
     {\r
         /// <summary>\r
-        /// Process ID\r
+        /// Fires when a new CLI Job starts\r
         /// </summary>\r
-        private int ProcessID { get; set; }\r
+        public event EventHandler EncodeStarted;\r
 \r
         /// <summary>\r
-        /// The HB Process\r
+        /// Fires when a CLI job finishes.\r
         /// </summary>\r
-        public Process HbProcess { get; set; }\r
-        \r
+        public event EventHandler EncodeEnded;\r
+\r
         /// <summary>\r
-        /// The Process Handle\r
+        /// Gets or sets The HB Process\r
         /// </summary>\r
-        public IntPtr ProcessHandle { get; set; }\r
-        \r
+        public Process HbProcess { get; set; }\r
+\r
         /// <summary>\r
-        /// Returns true of HandBrakeCLI.exe is running\r
+        /// Gets or sets The Process Handle\r
         /// </summary>\r
-        public Boolean IsEncoding { get; set; }     \r
+        public IntPtr ProcessHandle { get; set; }\r
 \r
         /// <summary>\r
-        /// Fires when a new CLI Job starts\r
+        /// Gets or sets a value indicating whether HandBrakeCLI.exe is running\r
         /// </summary>\r
-        public event EventHandler EncodeStarted;\r
+        public bool IsEncoding { get; set; }\r
 \r
         /// <summary>\r
-        /// Fires when a CLI job finishes.\r
+        /// Gets or sets the Process ID\r
         /// </summary>\r
-        public event EventHandler EncodeEnded;\r
+        private int ProcessID { get; set; }\r
 \r
         /// <summary>\r
         /// Create a preview sample video\r
         /// </summary>\r
-        /// <param name="query"></param>\r
+        /// <param name="query">\r
+        /// The CLI Query\r
+        /// </param>\r
         public void CreatePreviewSample(string query)\r
         {\r
-            Run(query);\r
+            this.Run(query);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Kill the CLI process\r
+        /// </summary>\r
+        public void Stop()\r
+        {\r
+            if (this.HbProcess != null)\r
+                this.HbProcess.Kill();\r
+\r
+            Process[] list = Process.GetProcessesByName("HandBrakeCLI");\r
+            foreach (Process process in list)\r
+                process.Kill();\r
+\r
+            this.IsEncoding = false;\r
+\r
+            if (this.EncodeEnded != null)\r
+                this.EncodeEnded(this, new EventArgs());\r
+        }\r
+\r
+        /// <summary>\r
+        /// Attempt to Safely kill a DirectRun() CLI\r
+        /// NOTE: This will not work with a MinGW CLI\r
+        /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html\r
+        /// </summary>\r
+        public void SafelyClose()\r
+        {\r
+            if ((int)this.ProcessHandle == 0)\r
+                return;\r
+\r
+            // Allow the CLI to exit cleanly\r
+            Win32.SetForegroundWindow((int)this.ProcessHandle);\r
+            SendKeys.Send("^C");\r
+\r
+            // HbProcess.StandardInput.AutoFlush = true;\r
+            // HbProcess.StandardInput.WriteLine("^C");\r
         }\r
 \r
         /// <summary>\r
         /// Execute a HandBrakeCLI process.\r
         /// </summary>\r
-        /// <param name="query">The CLI Query</param>\r
+        /// <param name="query">\r
+        /// The CLI Query\r
+        /// </param>\r
         protected void Run(string query)\r
         {\r
             try\r
             {\r
-                if (EncodeStarted != null)\r
-                    EncodeStarted(this, new EventArgs());\r
+                if (this.EncodeStarted != null)\r
+                    this.EncodeStarted(this, new EventArgs());\r
 \r
-                IsEncoding = true;\r
+                this.IsEncoding = true;\r
 \r
                 string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
-                string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs", "last_encode_log.txt");\r
+                string logPath =\r
+                    Path.Combine(\r
+                        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs", \r
+                        "last_encode_log.txt");\r
                 string strCmdLine = String.Format(@" /C """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath);\r
-                ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);\r
+                var cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);\r
 \r
-                if (Properties.Settings.Default.enocdeStatusInGui)\r
+                if (Settings.Default.enocdeStatusInGui)\r
                 {\r
                     cliStart.RedirectStandardOutput = true;\r
                     cliStart.UseShellExecute = false;\r
-                    if (!Properties.Settings.Default.showCliForInGuiEncodeStatus)\r
+                    if (!Settings.Default.showCliForInGuiEncodeStatus)\r
                         cliStart.CreateNoWindow = true;\r
                 }\r
-                if (Properties.Settings.Default.cli_minimized)\r
+                if (Settings.Default.cli_minimized)\r
                     cliStart.WindowStyle = ProcessWindowStyle.Minimized;\r
 \r
                 Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
-                HbProcess = Process.Start(cliStart);\r
-                ProcessID = Main.GetCliProcess(before);\r
+                this.HbProcess = Process.Start(cliStart);\r
+                this.ProcessID = Main.GetCliProcess(before);\r
 \r
-                if (HbProcess != null)\r
-                    ProcessHandle = HbProcess.MainWindowHandle; // Set the process Handle\r
+                if (this.HbProcess != null)\r
+                    this.ProcessHandle = this.HbProcess.MainWindowHandle; // Set the process Handle\r
 \r
                 // Set the process Priority\r
                 Process hbCliProcess = null;\r
-                if (ProcessID != -1)\r
-                    hbCliProcess = Process.GetProcessById(ProcessID);\r
+                if (this.ProcessID != -1)\r
+                    hbCliProcess = Process.GetProcessById(this.ProcessID);\r
 \r
                 if (hbCliProcess != null)\r
-                    switch (Properties.Settings.Default.processPriority)\r
+                    switch (Settings.Default.processPriority)\r
                     {\r
                         case "Realtime":\r
                             hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
@@ -121,7 +164,12 @@ namespace Handbrake.EncodeQueue
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show("It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\n   Detailed Error Information: error occured in runCli()\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                MessageBox.Show(\r
+                    "It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\nDetailed Error Information: error occured in runCli()\n\n" +\r
+                    exc,\r
+                    "Error", \r
+                    MessageBoxButtons.OK, \r
+                    MessageBoxIcon.Error);\r
             }\r
         }\r
 \r
@@ -130,31 +178,34 @@ namespace Handbrake.EncodeQueue
         /// TODO: Code to handle the Log data has yet to be written.\r
         /// TODO: Code to handle the % / ETA info has to be written.\r
         /// </summary>\r
+        /// <param name="query">\r
+        /// The query.\r
+        /// </param>\r
         protected void DirectRun(string query)\r
         {\r
             try\r
             {\r
-                if (EncodeStarted != null)\r
-                    EncodeStarted(this, new EventArgs());\r
+                if (this.EncodeStarted != null)\r
+                    this.EncodeStarted(this, new EventArgs());\r
 \r
-                IsEncoding = true;\r
+                this.IsEncoding = true;\r
 \r
                 // Setup the job\r
                 string handbrakeCLIPath = Path.Combine(Environment.CurrentDirectory, "HandBrakeCLI.exe");\r
-                Process hbProc = new Process\r
-                {\r
-                    StartInfo =\r
-                    {\r
-                        FileName = handbrakeCLIPath,\r
-                        Arguments = query,\r
-                        UseShellExecute = false,\r
-                        RedirectStandardOutput = true,\r
-                        RedirectStandardError = true,\r
-                        RedirectStandardInput = true,\r
-                        CreateNoWindow = false,\r
-                        WindowStyle = ProcessWindowStyle.Minimized\r
-                    }\r
-                };\r
+                var hbProc = new Process\r
+                                 {\r
+                                     StartInfo =\r
+                                         {\r
+                                             FileName = handbrakeCLIPath, \r
+                                             Arguments = query, \r
+                                             UseShellExecute = false, \r
+                                             RedirectStandardOutput = true, \r
+                                             RedirectStandardError = true, \r
+                                             RedirectStandardInput = true, \r
+                                             CreateNoWindow = false, \r
+                                             WindowStyle = ProcessWindowStyle.Minimized\r
+                                         }\r
+                                 };\r
 \r
                 // Setup the redirects\r
                 hbProc.ErrorDataReceived += new DataReceivedEventHandler(HbProcErrorDataReceived);\r
@@ -164,7 +215,7 @@ namespace Handbrake.EncodeQueue
                 hbProc.Start();\r
 \r
                 // Set the Process Priority\r
-                switch (Properties.Settings.Default.processPriority)\r
+                switch (Settings.Default.processPriority)\r
                 {\r
                     case "Realtime":\r
                         hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
@@ -187,10 +238,9 @@ namespace Handbrake.EncodeQueue
                 }\r
 \r
                 // Set the class items\r
-                HbProcess = hbProc;\r
-                ProcessID = hbProc.Id;\r
-                ProcessHandle = hbProc.Handle;\r
-\r
+                this.HbProcess = hbProc;\r
+                this.ProcessID = hbProc.Id;\r
+                this.ProcessHandle = hbProc.Handle;\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -199,79 +249,21 @@ namespace Handbrake.EncodeQueue
         }\r
 \r
         /// <summary>\r
-        /// Kill the CLI process\r
-        /// </summary>\r
-        public void Stop()\r
-        {\r
-            if (HbProcess != null)\r
-                HbProcess.Kill();\r
-\r
-            Process[] list = Process.GetProcessesByName("HandBrakeCLI");\r
-            foreach (Process process in list)\r
-                    process.Kill();\r
-\r
-            IsEncoding = false;\r
-\r
-            if (EncodeEnded != null)\r
-                EncodeEnded(this, new EventArgs());\r
-        }\r
-\r
-        /// <summary>\r
-        /// Attempt to Safely kill a DirectRun() CLI\r
-        /// NOTE: This will not work with a MinGW CLI\r
-        /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html\r
-        /// </summary>\r
-        public void SafelyClose()\r
-        {\r
-            if ((int)ProcessHandle == 0)\r
-                return;\r
-\r
-            // Allow the CLI to exit cleanly\r
-            Win32.SetForegroundWindow((int)ProcessHandle);\r
-            SendKeys.Send("^C");\r
-\r
-            // HbProcess.StandardInput.AutoFlush = true;\r
-            // HbProcess.StandardInput.WriteLine("^C");\r
-        }\r
-\r
-        /// <summary>\r
-        /// Recieve the Standard Error information and process it\r
-        /// </summary>\r
-        /// <param name="sender"></param>\r
-        /// <param name="e"></param>\r
-        private static void HbProcErrorDataReceived(object sender, DataReceivedEventArgs e)\r
-        {\r
-            // TODO: Recieve the Log data and process it\r
-            throw new NotImplementedException();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Standard Input Data Recieved from the CLI\r
-        /// </summary>\r
-        /// <param name="sender"></param>\r
-        /// <param name="e"></param>\r
-        private static void HbProcOutputDataReceived(object sender, DataReceivedEventArgs e)\r
-        {\r
-            // TODO: Recieve the %, ETA, FPS etc and process it\r
-            throw new NotImplementedException();\r
-        }\r
-\r
-        /// <summary>\r
         /// Perform an action after an encode. e.g a shutdown, standby, restart etc.\r
         /// </summary>\r
         protected void Finish()\r
         {\r
-            if (EncodeEnded != null)\r
-                EncodeEnded(this, new EventArgs());\r
+            if (this.EncodeEnded != null)\r
+                this.EncodeEnded(this, new EventArgs());\r
 \r
-            IsEncoding = false;\r
+            this.IsEncoding = false;\r
 \r
-            //Growl\r
-            if (Properties.Settings.Default.growlQueue)\r
+            // Growl\r
+            if (Settings.Default.growlQueue)\r
                 GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");\r
 \r
             // Do something whent he encode ends.\r
-            switch (Properties.Settings.Default.CompletionOption)\r
+            switch (Settings.Default.CompletionOption)\r
             {\r
                 case "Shutdown":\r
                     Process.Start("Shutdown", "-s -t 60");\r
@@ -299,7 +291,9 @@ namespace Handbrake.EncodeQueue
         /// <summary>\r
         /// Add the CLI Query to the Log File.\r
         /// </summary>\r
-        /// <param name="encJob"></param>\r
+        /// <param name="encJob">\r
+        /// The Encode Job Object\r
+        /// </param>\r
         protected void AddCLIQueryToLog(Job encJob)\r
         {\r
             try\r
@@ -308,12 +302,12 @@ namespace Handbrake.EncodeQueue
                                 "\\HandBrake\\logs";\r
                 string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
 \r
-                StreamReader reader =\r
+                var reader =\r
                     new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));\r
-                String log = reader.ReadToEnd();\r
+                string log = reader.ReadToEnd();\r
                 reader.Close();\r
 \r
-                StreamWriter writer = new StreamWriter(File.Create(logPath));\r
+                var writer = new StreamWriter(File.Create(logPath));\r
 \r
                 writer.Write("### CLI Query: " + encJob.Query + "\n\n");\r
                 writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");\r
@@ -321,7 +315,8 @@ namespace Handbrake.EncodeQueue
                 writer.WriteLine(log);\r
                 writer.Flush();\r
                 writer.Close();\r
-            } catch (Exception)\r
+            }\r
+            catch (Exception)\r
             {\r
                 return;\r
             }\r
@@ -331,17 +326,21 @@ namespace Handbrake.EncodeQueue
         /// Save a copy of the log to the users desired location or a default location\r
         /// if this feature is enabled in options.\r
         /// </summary>\r
-        /// <param name="destination"></param>\r
+        /// <param name="destination">\r
+        /// The Destination File Path\r
+        /// </param>\r
         protected void CopyLog(string destination)\r
         {\r
             try\r
             {\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
+                                "\\HandBrake\\logs";\r
                 string tempLogFile = Path.Combine(logDir, "last_encode_log.txt");\r
 \r
                 string encodeDestinationPath = Path.GetDirectoryName(destination);\r
-                String destinationFile = Path.GetFileName(destination);\r
-                string encodeLogFile = destinationFile + " " + DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + ".txt";\r
+                string destinationFile = Path.GetFileName(destination);\r
+                string encodeLogFile = destinationFile + " " +\r
+                                       DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + ".txt";\r
 \r
                 // Make sure the log directory exists.\r
                 if (!Directory.Exists(logDir))\r
@@ -351,19 +350,52 @@ namespace Handbrake.EncodeQueue
                 File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));\r
 \r
                 // Save a copy of the log file in the same location as the enocde.\r
-                if (Properties.Settings.Default.saveLogWithVideo)\r
+                if (Settings.Default.saveLogWithVideo)\r
                     File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));\r
 \r
                 // Save a copy of the log file to a user specified location\r
-                if (Directory.Exists(Properties.Settings.Default.saveLogPath))\r
-                    if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath)\r
-                        File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));\r
+                if (Directory.Exists(Settings.Default.saveLogPath))\r
+                    if (Settings.Default.saveLogPath != String.Empty && Settings.Default.saveLogToSpecifiedPath)\r
+                        File.Copy(tempLogFile, Path.Combine(Settings.Default.saveLogPath, encodeLogFile));\r
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",\r
-                                MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                MessageBox.Show(\r
+                    "Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc,\r
+                    "Error",\r
+                    MessageBoxButtons.OK,\r
+                    MessageBoxIcon.Error);\r
             }\r
         }\r
+\r
+        /// <summary>\r
+        /// Recieve the Standard Error information and process it\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The Sender Object\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// DataReceived EventArgs\r
+        /// </param>\r
+        private static void HbProcErrorDataReceived(object sender, DataReceivedEventArgs e)\r
+        {\r
+            // TODO: Recieve the Log data and process it\r
+            throw new NotImplementedException();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Standard Input Data Recieved from the CLI\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The Sender Object\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// DataReceived EventArgs\r
+        /// </param>\r
+        private static void HbProcOutputDataReceived(object sender, DataReceivedEventArgs e)\r
+        {\r
+            // TODO: Recieve the %, ETA, FPS etc and process it\r
+            throw new NotImplementedException();\r
+        }\r
     }\r
 }
\ No newline at end of file
index 7dfe7e5..6c87cd6 100644 (file)
@@ -1,13 +1,13 @@
 /*  QueueItem.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.EncodeQueue\r
 {\r
+    /// <summary>\r
+    /// The job.\r
+    /// </summary>\r
     public struct Job\r
     {\r
         /// <summary>\r
@@ -21,9 +21,9 @@ namespace Handbrake.EncodeQueue
         public string Query { get; set; }\r
 \r
         /// <summary>\r
-        /// record if this is a user or GUI generated query\r
+        /// Gets or sets a value indicating whether if this is a user or GUI generated query\r
         /// </summary>\r
-        public Boolean CustomQuery { get; set; }\r
+        public bool CustomQuery { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets the source file of encoding.\r
@@ -36,11 +36,15 @@ namespace Handbrake.EncodeQueue
         public string Destination { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets whether or not this instance is empty.\r
+        /// Gets a value indicating whether or not this instance is empty.\r
         /// </summary>\r
         public bool IsEmpty\r
         {\r
-            get { return Id == 0 && string.IsNullOrEmpty(Query) && string.IsNullOrEmpty(Source) && string.IsNullOrEmpty(Destination); }\r
+            get\r
+            {\r
+                return this.Id == 0 && string.IsNullOrEmpty(this.Query) && string.IsNullOrEmpty(this.Source) &&\r
+                       string.IsNullOrEmpty(this.Destination);\r
+            }\r
         }\r
     }\r
 }
\ No newline at end of file
index da9b786..891c2de 100644 (file)
@@ -1,25 +1,38 @@
 /*  Queue.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr/>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Collections.ObjectModel;\r
-using System.IO;\r
-using System.Threading;\r
-using System.Windows.Forms;\r
-using System.Xml.Serialization;\r
-using Handbrake.Functions;\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr/>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.EncodeQueue\r
 {\r
+    using System;\r
+    using System.Collections.Generic;\r
+    using System.Collections.ObjectModel;\r
+    using System.IO;\r
+    using System.Threading;\r
+    using System.Windows.Forms;\r
+    using System.Xml.Serialization;\r
+    using Functions;\r
+\r
+    /// <summary>\r
+    /// The HandBrake Queue\r
+    /// </summary>\r
     public class Queue : Encode\r
     {\r
+        /// <summary>\r
+        /// An XML Serializer\r
+        /// </summary>\r
         private static XmlSerializer serializer;\r
+\r
+        /// <summary>\r
+        /// The Queue Job List\r
+        /// </summary>\r
         private readonly List<Job> queue = new List<Job>();\r
-        private int NextJobId;\r
+\r
+        /// <summary>\r
+        /// The Next Job ID\r
+        /// </summary>\r
+        private int nextJobId;\r
 \r
         /// <summary>\r
         /// Fires when a pause to the encode queue has been requested.\r
@@ -38,11 +51,11 @@ namespace Handbrake.EncodeQueue
         /// <returns>The job that was removed from the queue.</returns>\r
         private Job GetNextJob()\r
         {\r
-            Job job = queue[0];\r
-            LastEncode = job;\r
-            Remove(0); // Remove the item which we are about to pass out.\r
+            Job job = this.queue[0];\r
+            this.LastEncode = job;\r
+            this.Remove(0); // Remove the item which we are about to pass out.\r
 \r
-            WriteQueueStateToFile("hb_queue_recovery.xml");\r
+            this.WriteQueueStateToFile("hb_queue_recovery.xml");\r
 \r
             return job;\r
         }\r
@@ -52,7 +65,7 @@ namespace Handbrake.EncodeQueue
         /// </summary>\r
         public ReadOnlyCollection<Job> CurrentQueue\r
         {\r
-            get { return queue.AsReadOnly(); }\r
+            get { return this.queue.AsReadOnly(); }\r
         }\r
 \r
         /// <summary>\r
@@ -60,23 +73,30 @@ namespace Handbrake.EncodeQueue
         /// </summary>\r
         public int Count\r
         {\r
-            get { return queue.Count; }\r
+            get { return this.queue.Count; }\r
         }\r
 \r
         /// <summary>\r
         /// Adds an item to the queue.\r
         /// </summary>\r
-        /// <param name="query">The query that will be passed to the HandBrake CLI.</param>\r
-        /// <param name="source">The location of the source video.</param>\r
-        /// <param name="destination">The location where the encoded video will be.</param>\r
-        /// <param name="customJob">Custom job</param>\r
-        /// <param name="scanInfo">The Scan</param>\r
+        /// <param name="query">\r
+        /// The query that will be passed to the HandBrake CLI.\r
+        /// </param>\r
+        /// <param name="source">\r
+        /// The location of the source video.\r
+        /// </param>\r
+        /// <param name="destination">\r
+        /// The location where the encoded video will be.\r
+        /// </param>\r
+        /// <param name="customJob">\r
+        /// Custom job\r
+        /// </param>\r
         public void Add(string query, string source, string destination, bool customJob)\r
         {\r
-            Job newJob = new Job { Id = NextJobId++, Query = query, Source = source, Destination = destination, CustomQuery = customJob };\r
+            Job newJob = new Job { Id = this.nextJobId++, Query = query, Source = source, Destination = destination, CustomQuery = customJob };\r
 \r
-            queue.Add(newJob);\r
-            WriteQueueStateToFile("hb_queue_recovery.xml");\r
+            this.queue.Add(newJob);\r
+            this.WriteQueueStateToFile("hb_queue_recovery.xml");\r
         }\r
 \r
         /// <summary>\r
@@ -85,19 +105,19 @@ namespace Handbrake.EncodeQueue
         /// <param name="index">The zero-based location of the job in the queue.</param>\r
         public void Remove(int index)\r
         {\r
-            queue.RemoveAt(index);\r
-            WriteQueueStateToFile("hb_queue_recovery.xml");\r
+            this.queue.RemoveAt(index);\r
+            this.WriteQueueStateToFile("hb_queue_recovery.xml");\r
         }\r
 \r
         /// <summary>\r
         /// Retrieve a job from the queue\r
         /// </summary>\r
-        /// <param name="index"></param>\r
-        /// <returns></returns>\r
+        /// <param name="index">the job id</param>\r
+        /// <returns>A job for the given index or blank job object</returns>\r
         public Job GetJob(int index)\r
         {\r
-            if (queue.Count >= (index +1))\r
-                return queue[index];\r
+            if (this.queue.Count >= (index + 1))\r
+                return this.queue[index];\r
 \r
             return new Job();\r
         }\r
@@ -125,15 +145,15 @@ namespace Handbrake.EncodeQueue
         /// <param name="index">The zero-based location of the job in the queue.</param>\r
         public void MoveDown(int index)\r
         {\r
-            if (index < queue.Count - 1)\r
+            if (index < this.queue.Count - 1)\r
             {\r
-                Job item = queue[index];\r
+                Job item = this.queue[index];\r
 \r
-                queue.RemoveAt(index);\r
-                queue.Insert((index + 1), item);\r
+                this.queue.RemoveAt(index);\r
+                this.queue.Insert((index + 1), item);\r
             }\r
 \r
-            WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
+            this.WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
         }\r
 \r
         /// <summary>\r
@@ -168,11 +188,11 @@ namespace Handbrake.EncodeQueue
         /// <param name="file">The location of the file to write the batch file to.</param>\r
         public void WriteBatchScriptToFile(string file)\r
         {\r
-            string queries = "";\r
-            foreach (Job queue_item in queue)\r
+            string queries = string.Empty;\r
+            foreach (Job queueItem in this.queue)\r
             {\r
-                string q_item = queue_item.Query;\r
-                string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + q_item;\r
+                string qItem = queueItem.Query;\r
+                string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + qItem;\r
 \r
                 if (queries == string.Empty)\r
                     queries = queries + fullQuery;\r
@@ -181,7 +201,7 @@ namespace Handbrake.EncodeQueue
             }\r
             string strCmdLine = queries;\r
 \r
-            if (file != "")\r
+            if (file != string.Empty)\r
             {\r
                 try\r
                 {\r
@@ -224,10 +244,10 @@ namespace Handbrake.EncodeQueue
 \r
                         if (list != null)\r
                             foreach (Job item in list)\r
-                                queue.Add(item);\r
+                                this.queue.Add(item);\r
 \r
                         if (file != "hb_queue_recovery.xml")\r
-                            WriteQueueStateToFile("hb_queue_recovery.xml");\r
+                            this.WriteQueueStateToFile("hb_queue_recovery.xml");\r
                     }\r
                 }\r
             }\r
@@ -240,7 +260,7 @@ namespace Handbrake.EncodeQueue
         /// <returns>Whether or not the supplied destination is already in the queue.</returns>\r
         public bool CheckForDestinationDuplicate(string destination)\r
         {\r
-            foreach (Job checkItem in queue)\r
+            foreach (Job checkItem in this.queue)\r
             {\r
                 if (checkItem.Destination.Contains(destination.Replace("\\\\", "\\")))\r
                     return true;\r
@@ -254,15 +274,15 @@ namespace Handbrake.EncodeQueue
         #region Encoding\r
 \r
         /// <summary>\r
-        /// Gets the last encode that was processed.\r
+        /// Gets or sets the last encode that was processed.\r
         /// </summary>\r
         /// <returns></returns> \r
         public Job LastEncode { get; set; }\r
 \r
         /// <summary>\r
-        /// Request Pause\r
+        /// Gets a value indicating whether Request Pause\r
         /// </summary>\r
-        public Boolean PauseRequested { get; private set; }\r
+        public bool PauseRequested { get; private set; }\r
 \r
         /// <summary>\r
         /// Starts encoding the first job in the queue and continues encoding until all jobs\r
@@ -272,14 +292,14 @@ namespace Handbrake.EncodeQueue
         {\r
             if (this.Count != 0)\r
             {\r
-                if (PauseRequested)\r
-                    PauseRequested = false;\r
+                if (this.PauseRequested)\r
+                    this.PauseRequested = false;\r
                 else\r
                 {\r
-                    PauseRequested = false;\r
+                    this.PauseRequested = false;\r
                     try\r
                     {\r
-                        Thread theQueue = new Thread(StartQueue) { IsBackground = true };\r
+                        Thread theQueue = new Thread(this.StartQueue) {IsBackground = true};\r
                         theQueue.Start();\r
                     }\r
                     catch (Exception exc)\r
@@ -295,50 +315,50 @@ namespace Handbrake.EncodeQueue
         /// </summary>\r
         public void Pause()\r
         {\r
-            PauseRequested = true;\r
+            this.PauseRequested = true;\r
 \r
-            if (QueuePauseRequested != null)\r
-                QueuePauseRequested(this, new EventArgs());\r
+            if (this.QueuePauseRequested != null)\r
+                this.QueuePauseRequested(this, new EventArgs());\r
         }\r
 \r
         /// <summary>\r
         /// Run through all the jobs on the queue.\r
         /// </summary>\r
-        /// <param name="state"></param>\r
+        /// <param name="state">Object State</param>\r
         private void StartQueue(object state)\r
         {\r
             // Run through each item on the queue\r
             while (this.Count != 0)\r
             {\r
-                Job encJob = GetNextJob();\r
+                Job encJob = this.GetNextJob();\r
                 string query = encJob.Query;\r
-                WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
+                this.WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
 \r
                 Run(query);\r
 \r
                 HbProcess.WaitForExit();\r
 \r
                 AddCLIQueryToLog(encJob);\r
-                CopyLog(LastEncode.Destination);\r
+                this.CopyLog(this.LastEncode.Destination);\r
 \r
                 HbProcess.Close();\r
                 HbProcess.Dispose();\r
 \r
                 IsEncoding = false;\r
 \r
-                //Growl\r
+                // Growl\r
                 if (Properties.Settings.Default.growlEncode)\r
                     GrowlCommunicator.Notify("Encode Completed", "Put down that cocktail...\nyour Handbrake encode is done.");\r
 \r
-                while (PauseRequested) // Need to find a better way of doing this.\r
+                while (this.PauseRequested) // Need to find a better way of doing this.\r
                 {\r
                     Thread.Sleep(2000);\r
                 }\r
             }\r
-            LastEncode = new Job();\r
+            this.LastEncode = new Job();\r
 \r
-            if (QueueCompleted != null)\r
-                QueueCompleted(this, new EventArgs());\r
+            if (this.QueueCompleted != null)\r
+                this.QueueCompleted(this, new EventArgs());\r
 \r
             // After the encode is done, we may want to shutdown, suspend etc.\r
             Finish();\r
index b5ca77c..4b35017 100644 (file)
@@ -52,13 +52,43 @@ namespace Handbrake.Functions
         /// </summary>\r
         public struct MEMORYSTATUS // Unused var's are required here.\r
         {\r
+            /// <summary>\r
+            /// Unknown\r
+            /// </summary>\r
             public UInt32 dwLength;\r
+\r
+            /// <summary>\r
+            /// Memory Load\r
+            /// </summary>\r
             public UInt32 dwMemoryLoad;\r
+\r
+            /// <summary>\r
+            /// </summary>\r
             public UInt32 dwTotalPhys; // Used\r
+\r
+            /// <summary>\r
+            /// Available Physical Memory\r
+            /// </summary>\r
             public UInt32 dwAvailPhys;\r
+\r
+            /// <summary>\r
+            /// Total Page File\r
+            /// </summary>\r
             public UInt32 dwTotalPageFile;\r
+\r
+            /// <summary>\r
+            /// Available Page File\r
+            /// </summary>\r
             public UInt32 dwAvailPageFile;\r
+\r
+            /// <summary>\r
+            /// Total Virtual Memory\r
+            /// </summary>\r
             public UInt32 dwTotalVirtual;\r
+\r
+            /// <summary>\r
+            /// Available Virtual Memory\r
+            /// </summary>\r
             public UInt32 dwAvailVirtual;\r
         }\r
 \r
index 8565476..7807448 100644 (file)
       <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />\r
       <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />\r
       <Abbreviation Text="CLI" />\r
+      <Abbreviation Text="DRC" />\r
+      <Abbreviation Text="ID" />\r
     </Naming2>\r
   </CodeStyleSettings>\r
 </Configuration>
\ No newline at end of file
index 822488b..410cfa5 100644 (file)
@@ -1,8 +1,7 @@
 /*  AudioTrack.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.Model\r
 {\r
@@ -12,46 +11,47 @@ namespace Handbrake.Model
     public class AudioTrack\r
     {\r
         /// <summary>\r
+        /// Initializes a new instance of the <see cref="AudioTrack"/> class. \r
         /// Audio Track instance\r
         /// </summary>\r
         public AudioTrack()\r
         {\r
             // Default Values\r
-            Track = "Automatic";\r
-            MixDown = "Automatic";\r
-            SampleRate = "Auto";\r
-            Bitrate = "Auto";\r
-            DRC = "1";\r
+            this.Track = "Automatic";\r
+            this.MixDown = "Automatic";\r
+            this.SampleRate = "Auto";\r
+            this.Bitrate = "Auto";\r
+            this.DRC = "1";\r
         }\r
 \r
         /// <summary>\r
-        /// Audio Track Name\r
+        /// Gets or sets Audio Track Name\r
         /// </summary>\r
         public string Track { get; set; }\r
 \r
         /// <summary>\r
-        /// Audio Mixdown\r
+        /// Gets or sets Audio Mixdown\r
         /// </summary>\r
         public string MixDown { get; set; }\r
 \r
         /// <summary>\r
-        /// Audio Encoder\r
+        /// Gets or sets Audio Encoder\r
         /// </summary>\r
         public string Encoder { get; set; }\r
 \r
         /// <summary>\r
-        /// Audio Bitrate\r
+        /// Gets or sets Audio Bitrate\r
         /// </summary>\r
         public string Bitrate { get; set; }\r
 \r
         /// <summary>\r
-        /// Audio SampleRate\r
+        /// Gets or sets Audio SampleRate\r
         /// </summary>\r
         public string SampleRate { get; set; }\r
 \r
         /// <summary>\r
-        /// Dynamic Range Compression\r
+        /// Gets or sets Dynamic Range Compression\r
         /// </summary>\r
         public string DRC { get; set; }\r
     }\r
-}\r
+}
\ No newline at end of file
index 9367e7e..8db3ed8 100644 (file)
@@ -1,20 +1,22 @@
 /*  DriveInformation.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.Model\r
 {\r
+    /// <summary>\r
+    /// Information about a DVD drive\r
+    /// </summary>\r
     public class DriveInformation\r
     {\r
         /// <summary>\r
-        /// The Drive Volume Name\r
+        /// Gets or sets The Drive Volume Name\r
         /// </summary>\r
         public string VolumeLabel { get; set; }\r
 \r
         /// <summary>\r
-        /// The Root Directory\r
+        /// Gets or sets The Root Directory\r
         /// </summary>\r
         public string RootDirectory { get; set; }\r
     }\r
index c5a1bf4..4cc8b41 100644 (file)
@@ -1,11 +1,13 @@
 /*  SourceType.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.Model\r
 {\r
+    /// <summary>\r
+    /// The Type of source that the user has scanned\r
+    /// </summary>\r
     public enum SourceType\r
     {\r
         /// <summary>\r
index 0eead59..9254ab4 100644 (file)
@@ -1,89 +1,86 @@
 /*  Subtitle.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-using System.Windows.Forms;\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.Model\r
 {\r
+    using System.Windows.Forms;\r
+\r
     /// <summary>\r
     /// Subtitle Information\r
     /// </summary>\r
     public class SubtitleInfo\r
     {\r
         /// <summary>\r
-        /// Subtitle Track\r
+        /// Gets or sets the Subtitle Track\r
         /// </summary>\r
         public string Track { get; set; }\r
 \r
         /// <summary>\r
-        /// Forced Subtitle\r
+        /// Gets or sets the Forced Subtitle\r
         /// </summary>\r
         public string Forced { get; set; }\r
 \r
         /// <summary>\r
-        /// Burned In Subtitle\r
+        /// Gets or sets the Burned In Subtitle\r
         /// </summary>\r
         public string Burned { get; set; }\r
 \r
         /// <summary>\r
-        /// Default Subtitle Track\r
+        /// Gets or sets the Default Subtitle Track\r
         /// </summary>\r
         public string Default { get; set; }\r
 \r
         /// <summary>\r
-        /// SRT Language\r
+        /// Gets or sets the SRT Language\r
         /// </summary>\r
         public string SrtLang { get; set; }\r
 \r
         /// <summary>\r
-        /// SRT Character Code\r
+        /// Gets or sets the SRT Character Code\r
         /// </summary>\r
         public string SrtCharCode { get; set; }\r
 \r
         /// <summary>\r
-        /// SRT Offset\r
+        /// Gets or sets the SRT Offset\r
         /// </summary>\r
         public int SrtOffset { get; set; }\r
 \r
         /// <summary>\r
-        /// Path to the SRT file\r
+        /// Gets or sets the Path to the SRT file\r
         /// </summary>\r
         public string SrtPath { get; set; }\r
 \r
         /// <summary>\r
-        /// SRT Filename\r
+        /// Gets or sets the SRT Filename\r
         /// </summary>\r
         public string SrtFileName { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns if this is an SRT subtitle.\r
+        /// Gets a value indicating whether this is an SRT subtitle.\r
         /// </summary>\r
         public bool IsSrtSubtitle\r
         {\r
-            get\r
-            {\r
-                return SrtFileName != "-";\r
-            }\r
+            get { return this.SrtFileName != "-"; }\r
         }\r
 \r
         /// <summary>\r
-        /// A ListViewItem Containing information about this subitlte\r
+        /// Gets A ListViewItem Containing information about this subitlte\r
         /// </summary>\r
         public ListViewItem ListView\r
         {\r
             get\r
             {\r
-                ListViewItem listTrack = new ListViewItem(Track);\r
-                listTrack.SubItems.Add(Forced);\r
-                listTrack.SubItems.Add(Burned);\r
-                listTrack.SubItems.Add(Default);\r
-                listTrack.SubItems.Add(SrtLang);\r
-                listTrack.SubItems.Add(SrtCharCode);\r
-                listTrack.SubItems.Add(SrtOffset.ToString());\r
+                var listTrack = new ListViewItem(this.Track);\r
+                listTrack.SubItems.Add(this.Forced);\r
+                listTrack.SubItems.Add(this.Burned);\r
+                listTrack.SubItems.Add(this.Default);\r
+                listTrack.SubItems.Add(this.SrtLang);\r
+                listTrack.SubItems.Add(this.SrtCharCode);\r
+                listTrack.SubItems.Add(this.SrtOffset.ToString());\r
                 return listTrack;\r
             }\r
         }\r
     }\r
-}\r
+}
\ No newline at end of file
index 282f9f5..805d339 100644 (file)
@@ -1,23 +1,25 @@
-/*  Program.cs \r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
-using System.Windows.Forms;\r
-using System.IO;\r
-using Handbrake.Presets;\r
+/*  Program.cs\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake\r
 {\r
-    static class Program\r
+    using System;\r
+    using System.IO;\r
+    using System.Windows.Forms;\r
+    using Presets;\r
+\r
+    /// <summary>\r
+    /// HandBrake Starts Here\r
+    /// </summary>\r
+    public static class Program\r
     {\r
         /// <summary>\r
         /// The main entry point for the application.\r
         /// </summary>\r
         [STAThread]\r
-        static void Main()\r
+        public static void Main()\r
         {\r
             Screen scr = Screen.PrimaryScreen;\r
             if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620))\r
@@ -40,5 +42,4 @@ namespace Handbrake
             }\r
         }\r
     }\r
-\r
 }
\ No newline at end of file
index e6b8a06..5b5f06b 100644 (file)
@@ -2,6 +2,13 @@
   <GlobalSettings>\r
     <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>\r
   </GlobalSettings>\r
+  <Parsers>\r
+    <Parser ParserId="Microsoft.StyleCop.CSharp.CsParser">\r
+      <ParserSettings>\r
+        <BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>\r
+      </ParserSettings>\r
+    </Parser>\r
+  </Parsers>\r
   <Analyzers>\r
     <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">\r
       <Rules>\r
             <BooleanProperty Name="Enabled">False</BooleanProperty>\r
           </RuleSettings>\r
         </Rule>\r
+        <Rule Name="DocumentationTextMustContainWhitespace">\r
+          <RuleSettings>\r
+            <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+          </RuleSettings>\r
+        </Rule>\r
       </Rules>\r
       <AnalyzerSettings>\r
         <StringProperty Name="CompanyName">HandBrake Project</StringProperty>\r
index e40022c..dad2201 100644 (file)
@@ -1077,7 +1077,7 @@ namespace Handbrake
             this.x264Panel.Name = "x264Panel";\r
             this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
             this.x264Panel.TabIndex = 0;\r
-            this.x264Panel.X264Query = "";\r
+            this.x264Panel.X264Query = " -x ";\r
             // \r
             // tab_query\r
             // \r