OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 22 Feb 2010 21:23:28 +0000 (21:23 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 22 Feb 2010 21:23:28 +0000 (21:23 +0000)
- Some more cleanup

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

win/C#/Parsing/Parser.cs
win/C#/Parsing/Subtitle.cs
win/C#/Parsing/Title.cs
win/C#/Settings.StyleCop
win/C#/frmActivityWindow.Designer.cs
win/C#/frmActivityWindow.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs

index e643d3b..3dd2fde 100644 (file)
@@ -1,8 +1,7 @@
 /*  Parser.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.Parsing\r
 {\r
@@ -15,31 +14,29 @@ namespace Handbrake.Parsing
     /// <summary>\r
     /// A delegate to handle custom events regarding data being parsed from the buffer\r
     /// </summary>\r
-    /// <param name="Sender">The object which raised this delegate</param>\r
-    /// <param name="Data">The data parsed from the stream</param>\r
-    public delegate void DataReadEventHandler(object Sender, string Data);\r
+    /// <param name="sender">The object which raised this delegate</param>\r
+    /// <param name="data">The data parsed from the stream</param>\r
+    public delegate void DataReadEventHandler(object sender, string data);\r
 \r
     /// <summary>\r
     /// A delegate to handle events regarding progress during DVD scanning\r
     /// </summary>\r
-    /// <param name="Sender">The object who's raising the event</param>\r
-    /// <param name="CurrentTitle">The title number currently being processed</param>\r
-    /// <param name="TitleCount">The total number of titiles to be processed</param>\r
-    public delegate void ScanProgressEventHandler(object Sender, int CurrentTitle, int TitleCount);\r
+    /// <param name="sender">The object who's raising the event</param>\r
+    /// <param name="currentTitle">The title number currently being processed</param>\r
+    /// <param name="titleCount">The total number of titiles to be processed</param>\r
+    public delegate void ScanProgressEventHandler(object sender, int currentTitle, int titleCount);\r
 \r
     /// <summary>\r
     /// A delegate to handle encode progress updates // EXPERIMENTAL\r
     /// </summary>\r
-    /// <param name="Sender">The object which raised the event</param>\r
-    /// <param name="CurrentTask">The current task being processed from the queue</param>\r
-    /// <param name="TaskCount">The total number of tasks in queue</param>\r
-    /// <param name="PercentComplete">The percentage this task is complete</param>\r
-    /// <param name="CurrentFps">The current encoding fps</param>\r
-    /// <param name="AverageFps">The average encoding fps for this task</param>\r
-    /// <param name="TimeRemaining">The estimated time remaining for this task to complete</param>\r
-    public delegate void EncodeProgressEventHandler(\r
-        object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, \r
-        TimeSpan TimeRemaining);\r
+    /// <param name="sender">The object which raised the event</param>\r
+    /// <param name="currentTask">The current task being processed from the queue</param>\r
+    /// <param name="taskCount">The total number of tasks in queue</param>\r
+    /// <param name="percentComplete">The percentage this task is complete</param>\r
+    /// <param name="currentFps">The current encoding fps</param>\r
+    /// <param name="averageFps">The average encoding fps for this task</param>\r
+    /// <param name="timeRemaining">The estimated time remaining for this task to complete</param>\r
+    public delegate void EncodeProgressEventHandler(object sender, int currentTask, int taskCount, float percentComplete, float currentFps, float averageFps, TimeSpan timeRemaining);\r
 \r
 \r
     /// <summary>\r
@@ -47,14 +44,20 @@ namespace Handbrake.Parsing
     /// </summary>\r
     internal class Parser : StreamReader\r
     {\r
-        private StringBuilder _buffer = new StringBuilder(string.Empty);\r
+        /// <summary>\r
+        /// The Buffer StringBuilder\r
+        /// </summary>\r
+        private StringBuilder buffer = new StringBuilder(string.Empty);\r
 \r
         /// <summary>\r
-        /// The output from the CLI process\r
+        /// Initializes a new instance of the <see cref="Parser"/> class. \r
+        /// Default constructor for this object\r
         /// </summary>\r
-        public string Buffer\r
+        /// <param name="baseStream">\r
+        /// The stream to parse from\r
+        /// </param>\r
+        public Parser(Stream baseStream) : base(baseStream)\r
         {\r
-            get { return _buffer.ToString(); }\r
         }\r
 \r
         /// <summary>\r
@@ -72,32 +75,30 @@ namespace Handbrake.Parsing
         /// </summary>\r
         public event ScanProgressEventHandler OnScanProgress;\r
 \r
-        #region Experimetnal Code\r
-\r
         /// <summary>\r
         /// Raised upon the catching of a "Scanning title # of #..." in the stream\r
         /// </summary>\r
         public event EncodeProgressEventHandler OnEncodeProgress;\r
 \r
-        #endregion\r
-\r
         /// <summary>\r
-        /// Initializes a new instance of the <see cref="Parser"/> class. \r
-        /// Default constructor for this object\r
+        /// Gets the buffer of data that came from the CLI standard input/error\r
         /// </summary>\r
-        /// <param name="baseStream">\r
-        /// The stream to parse from\r
-        /// </param>\r
-        public Parser(Stream baseStream)\r
-            : base(baseStream)\r
+        public string Buffer\r
         {\r
+            get { return buffer.ToString(); }\r
         }\r
 \r
+        /// <summary>\r
+        /// Read a line from standard in/err\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The read line\r
+        /// </returns>\r
         public override string ReadLine()\r
         {\r
             string tmp = base.ReadLine();\r
 \r
-            _buffer.Append(tmp + Environment.NewLine);\r
+            buffer.Append(tmp + Environment.NewLine);\r
 \r
             Match m = null;\r
             if (tmp.Contains("Scanning title"))\r
@@ -113,11 +114,17 @@ namespace Handbrake.Parsing
             return tmp;\r
         }\r
 \r
+        /// <summary>\r
+        /// Read to the end of the input stream\r
+        /// </summary>\r
+        /// <returns>\r
+        /// A string of the input data\r
+        /// </returns>\r
         public override string ReadToEnd()\r
         {\r
             string tmp = base.ReadToEnd();\r
 \r
-            _buffer.Append(tmp + Environment.NewLine);\r
+            buffer.Append(tmp + Environment.NewLine);\r
 \r
             if (OnReadToEnd != null)\r
                 OnReadToEnd(this, tmp);\r
@@ -128,13 +135,12 @@ namespace Handbrake.Parsing
         /// <summary>\r
         /// Pase the CLI status output (from standard output)\r
         /// </summary>\r
-        public void readEncodeStatus()\r
+        public void ReadEncodeStatus()\r
         {\r
             CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
             string tmp = base.ReadLine();\r
 \r
-            Match m = Regex.Match(tmp, \r
-                                  @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?");\r
+            Match m = Regex.Match(tmp, @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?");\r
             if (m.Success && OnEncodeProgress != null)\r
             {\r
                 int currentTask = int.Parse(m.Groups[1].Value);\r
index 178e447..a21040b 100644 (file)
@@ -1,8 +1,7 @@
 /*  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
+    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.Parsing\r
 {\r
@@ -15,54 +14,67 @@ namespace Handbrake.Parsing
     /// </summary>\r
     public class Subtitle\r
     {\r
-        private string m_language;\r
-        private int m_trackNumber;\r
-        private string m_type;\r
-        private string m_typecode;\r
+        /// <summary>\r
+        /// The Language\r
+        /// </summary>\r
+        private string language;\r
+\r
+        /// <summary>\r
+        /// The Track Number\r
+        /// </summary>\r
+        private int trackNumber;\r
+\r
+        /// <summary>\r
+        /// The type of subtitle\r
+        /// </summary>\r
+        private string type;\r
 \r
         /// <summary>\r
-        /// The track number of this Subtitle\r
+        /// The typecode\r
+        /// </summary>\r
+        private string typecode;\r
+\r
+        /// <summary>\r
+        /// Gets the track number of this Subtitle\r
         /// </summary>\r
         public int TrackNumber\r
         {\r
-            get { return m_trackNumber; }\r
+            get { return trackNumber; }\r
         }\r
 \r
         /// <summary>\r
-        /// The language (if detected) of this Subtitle\r
+        /// Gets the The language (if detected) of this Subtitle\r
         /// </summary>\r
         public string Language\r
         {\r
-            get { return m_language; }\r
+            get { return language; }\r
         }\r
 \r
         /// <summary>\r
-        /// Langauage Code\r
+        /// Gets the Langauage Code\r
         /// </summary>\r
         public string LanguageCode\r
         {\r
-            get { return m_typecode; }\r
+            get { return typecode; }\r
         }\r
 \r
-\r
         /// <summary>\r
-        /// Subtitle Type\r
+        /// Gets the Subtitle Type\r
         /// </summary>\r
         public string Type\r
         {\r
-            get { return m_type; }\r
+            get { return type; }\r
         }\r
 \r
-\r
         /// <summary>\r
-        /// Override of the ToString method to make this object easier to use in the UI\r
+        /// Parse the input strings related to subtitles\r
         /// </summary>\r
-        /// <returns>A string formatted as: {track #} {language}</returns>\r
-        public override string ToString()\r
-        {\r
-            return string.Format("{0} {1} ({2})", m_trackNumber, m_language, m_type);\r
-        }\r
-\r
+        /// <param name="output">\r
+        /// The output.\r
+        /// </param>\r
+        /// <returns>\r
+        /// A Subitle object\r
+        /// </returns>\r
         public static Subtitle Parse(StringReader output)\r
         {\r
             string curLine = output.ReadLine();\r
@@ -72,17 +84,26 @@ namespace Handbrake.Parsing
             {\r
                 var thisSubtitle = new Subtitle\r
                                        {\r
-                                           m_trackNumber = int.Parse(m.Groups[1].Value.Trim()), \r
-                                           m_language = m.Groups[2].Value, \r
-                                           m_typecode = m.Groups[3].Value, \r
-                                           m_type = m.Groups[4].Value\r
+                                           trackNumber = int.Parse(m.Groups[1].Value.Trim()), \r
+                                           language = m.Groups[2].Value, \r
+                                           typecode = m.Groups[3].Value, \r
+                                           type = m.Groups[4].Value\r
                                        };\r
                 return thisSubtitle;\r
             }\r
             return null;\r
         }\r
 \r
-        public static Subtitle[] ParseList(StringReader output)\r
+        /// <summary>\r
+        /// Parse a list of Subtitle tracks from an input string.\r
+        /// </summary>\r
+        /// <param name="output">\r
+        /// The output.\r
+        /// </param>\r
+        /// <returns>\r
+        /// An array of Subtitle objects\r
+        /// </returns>\r
+        public static IEnumerable<Subtitle> ParseList(StringReader output)\r
         {\r
             var subtitles = new List<Subtitle>();\r
             while ((char) output.Peek() != '+')\r
@@ -96,5 +117,14 @@ namespace Handbrake.Parsing
             }\r
             return subtitles.ToArray();\r
         }\r
+\r
+        /// <summary>\r
+        /// Override of the ToString method to make this object easier to use in the UI\r
+        /// </summary>\r
+        /// <returns>A string formatted as: {track #} {language}</returns>\r
+        public override string ToString()\r
+        {\r
+            return string.Format("{0} {1} ({2})", trackNumber, language, type);\r
+        }\r
     }\r
 }
\ No newline at end of file
index 764c7cd..0494f5b 100644 (file)
@@ -1,8 +1,7 @@
 /*  Title.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.Parsing\r
 {\r
@@ -18,19 +17,70 @@ namespace Handbrake.Parsing
     /// </summary>\r
     public class Title\r
     {\r
+        /// <summary>\r
+        /// The Culture Info\r
+        /// </summary>\r
         private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
-        private readonly List<AudioTrack> m_audioTracks;\r
-        private readonly List<Chapter> m_chapters;\r
-        private readonly List<Subtitle> m_subtitles;\r
-        private List<string> m_angles = new List<string>();\r
-        private float m_aspectRatio;\r
-        private float m_fps;\r
-        private int[] m_autoCrop;\r
+\r
+        /// <summary>\r
+        /// A collection of Audio Tracks\r
+        /// </summary>\r
+        private readonly List<AudioTrack> audioTracks;\r
+\r
+        /// <summary>\r
+        /// A Collection of Chapters\r
+        /// </summary>\r
+        private readonly List<Chapter> chapters;\r
+\r
+        /// <summary>\r
+        /// A Collection of Subtitles\r
+        /// </summary>\r
+        private readonly List<Subtitle> subtitles;\r
+\r
+        /// <summary>\r
+        /// A collection of angles \r
+        /// </summary>\r
+        private List<string> angles = new List<string>();\r
+\r
+        /// <summary>\r
+        /// The source aspect ratio\r
+        /// </summary>\r
+        private float aspectRatio;\r
+\r
+        /// <summary>\r
+        /// The source framerate\r
+        /// </summary>\r
+        private float fps;\r
+\r
+        /// <summary>\r
+        /// Source autocrop values\r
+        /// </summary>\r
+        private int[] autoCrop;\r
+\r
+        /// <summary>\r
+        /// Source name\r
+        /// </summary>\r
         private string source;\r
-        private TimeSpan m_duration;\r
-        private Size m_resolution;\r
-        private int m_titleNumber;\r
-        private Size m_parVal;\r
+\r
+        /// <summary>\r
+        /// The duration of the source\r
+        /// </summary>\r
+        private TimeSpan duration;\r
+\r
+        /// <summary>\r
+        /// The source resolution\r
+        /// </summary>\r
+        private Size resolution;\r
+\r
+        /// <summary>\r
+        /// The Title number\r
+        /// </summary>\r
+        private int titleNumber;\r
+\r
+        /// <summary>\r
+        /// The par values for this title.\r
+        /// </summary>\r
+        private Size parVal;\r
 \r
         /// <summary>\r
         /// Initializes a new instance of the <see cref="Title"/> class. \r
@@ -38,33 +88,33 @@ namespace Handbrake.Parsing
         /// </summary>\r
         public Title()\r
         {\r
-            m_audioTracks = new List<AudioTrack>();\r
-            m_chapters = new List<Chapter>();\r
-            m_subtitles = new List<Subtitle>();\r
+            audioTracks = new List<AudioTrack>();\r
+            chapters = new List<Chapter>();\r
+            subtitles = new List<Subtitle>();\r
         }\r
 \r
         /// <summary>\r
-        /// Collection of chapters in this Title\r
+        /// Gets a Collection of chapters in this Title\r
         /// </summary>\r
         public List<Chapter> Chapters\r
         {\r
-            get { return m_chapters; }\r
+            get { return chapters; }\r
         }\r
 \r
         /// <summary>\r
-        /// Collection of audio tracks associated with this Title\r
+        /// Gets a Collection of audio tracks associated with this Title\r
         /// </summary>\r
         public List<AudioTrack> AudioTracks\r
         {\r
-            get { return m_audioTracks; }\r
+            get { return audioTracks; }\r
         }\r
 \r
         /// <summary>\r
-        /// Collection of subtitles associated with this Title\r
+        /// Gets aCollection of subtitles associated with this Title\r
         /// </summary>\r
         public List<Subtitle> Subtitles\r
         {\r
-            get { return m_subtitles; }\r
+            get { return subtitles; }\r
         }\r
 \r
         /// <summary>\r
@@ -72,11 +122,11 @@ namespace Handbrake.Parsing
         /// </summary>\r
         public int TitleNumber\r
         {\r
-            get { return m_titleNumber; }\r
+            get { return titleNumber; }\r
         }\r
 \r
         /// <summary>\r
-        /// Source Name\r
+        /// Gets the Source Name\r
         /// </summary>\r
         public string SourceName\r
         {\r
@@ -84,39 +134,39 @@ namespace Handbrake.Parsing
         }\r
 \r
         /// <summary>\r
-        /// The length in time of this Title\r
+        /// Gets the length in time of this Title\r
         /// </summary>\r
         public TimeSpan Duration\r
         {\r
-            get { return m_duration; }\r
+            get { return duration; }\r
         }\r
 \r
         /// <summary>\r
-        /// The resolution (width/height) of this Title\r
+        /// Gets the resolution (width/height) of this Title\r
         /// </summary>\r
         public Size Resolution\r
         {\r
-            get { return m_resolution; }\r
+            get { return resolution; }\r
         }\r
 \r
         /// <summary>\r
-        /// The aspect ratio of this Title\r
+        /// Gets the aspect ratio of this Title\r
         /// </summary>\r
         public float AspectRatio\r
         {\r
-            get { return m_aspectRatio; }\r
+            get { return aspectRatio; }\r
         }\r
 \r
         /// <summary>\r
-        /// Par Value\r
+        /// Gets Par Value\r
         /// </summary>\r
         public Size ParVal\r
         {\r
-            get { return m_parVal; }\r
+            get { return parVal; }\r
         }\r
 \r
         /// <summary>\r
-        /// The automatically detected crop region for this Title.\r
+        /// Gets the automatically detected crop region for this Title.\r
         /// This is an int array with 4 items in it as so:\r
         /// 0: \r
         /// 1: \r
@@ -125,23 +175,24 @@ namespace Handbrake.Parsing
         /// </summary>\r
         public int[] AutoCropDimensions\r
         {\r
-            get { return m_autoCrop; }\r
+            get { return autoCrop; }\r
         }\r
 \r
         /// <summary>\r
-        /// Collection of Angles in this Title\r
+        /// Gets a Collection of Angles in this Title\r
         /// </summary>\r
         public List<string> Angles\r
         {\r
-            get { return m_angles; }\r
+            get { return angles; }\r
         }\r
 \r
+\r
         /// <summary>\r
-        /// Collection of Angles in this Title\r
+        /// Gets the FPS of the source.\r
         /// </summary>\r
         public float Fps\r
         {\r
-            get { return m_fps; }\r
+            get { return fps; }\r
         }\r
 \r
         /// <summary>\r
@@ -150,15 +201,14 @@ namespace Handbrake.Parsing
         /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>\r
         public override string ToString()\r
         {\r
-            return string.Format("{0} ({1:00}:{2:00}:{3:00})", m_titleNumber, m_duration.Hours, \r
-                                 m_duration.Minutes, m_duration.Seconds);\r
+            return string.Format("{0} ({1:00}:{2:00}:{3:00})", titleNumber, duration.Hours, duration.Minutes, duration.Seconds);\r
         }\r
 \r
         /// <summary>\r
         /// Parse the Title Information\r
         /// </summary>\r
-        /// <param name="output"></param>\r
-        /// <returns></returns>\r
+        /// <param name="output">A stingreader of output data</param>\r
+        /// <returns>A Title</returns>\r
         public static Title Parse(StringReader output)\r
         {\r
             var thisTitle = new Title();\r
@@ -166,7 +216,7 @@ namespace Handbrake.Parsing
             Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");\r
             // Match track number for this title\r
             if (m.Success)\r
-                thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim());\r
+                thisTitle.titleNumber = int.Parse(m.Groups[1].Value.Trim());\r
 \r
             // If we are scanning a groupd of files, we'll want to get the source name.\r
             string path = output.ReadLine();\r
@@ -185,42 +235,39 @@ namespace Handbrake.Parsing
                     int.TryParse(angleList, out angleCount);\r
 \r
                     for (int i = 1; i <= angleCount; i++)\r
-                        thisTitle.m_angles.Add(i.ToString());\r
+                        thisTitle.angles.Add(i.ToString());\r
                 }\r
             }\r
 \r
             // Get duration for this title\r
             m = Regex.Match(output.ReadLine(), @"^  \+ duration: ([0-9]{2}:[0-9]{2}:[0-9]{2})");\r
             if (m.Success)\r
-                thisTitle.m_duration = TimeSpan.Parse(m.Groups[1].Value);\r
+                thisTitle.duration = TimeSpan.Parse(m.Groups[1].Value);\r
 \r
             // Get resolution, aspect ratio and FPS for this title\r
-            m = Regex.Match(output.ReadLine(), \r
-                            @"^  \+ size: ([0-9]*)x([0-9]*), pixel aspect: ([0-9]*)/([0-9]*), display aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");\r
-            // size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps\r
-\r
+            m = Regex.Match(output.ReadLine(), @"^  \+ size: ([0-9]*)x([0-9]*), pixel aspect: ([0-9]*)/([0-9]*), display aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");\r
             if (m.Success)\r
             {\r
-                thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
-                thisTitle.m_parVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value));\r
-                thisTitle.m_aspectRatio = float.Parse(m.Groups[5].Value, Culture);\r
-                thisTitle.m_fps = float.Parse(m.Groups[6].Value, Culture);\r
+                thisTitle.resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
+                thisTitle.parVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value));\r
+                thisTitle.aspectRatio = float.Parse(m.Groups[5].Value, Culture);\r
+                thisTitle.fps = float.Parse(m.Groups[6].Value, Culture);\r
             }\r
 \r
             // Get autocrop region for this title\r
             m = Regex.Match(output.ReadLine(), @"^  \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");\r
             if (m.Success)\r
-                thisTitle.m_autoCrop = new[]\r
+                thisTitle.autoCrop = new[]\r
                                            {\r
                                                int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), \r
                                                int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)\r
                                            };\r
 \r
-            thisTitle.m_chapters.AddRange(Chapter.ParseList(output));\r
+            thisTitle.chapters.AddRange(Chapter.ParseList(output));\r
 \r
-            thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));\r
+            thisTitle.audioTracks.AddRange(AudioTrack.ParseList(output));\r
 \r
-            thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));\r
+            thisTitle.subtitles.AddRange(Subtitle.ParseList(output));\r
 \r
             return thisTitle;\r
         }\r
@@ -228,8 +275,8 @@ namespace Handbrake.Parsing
         /// <summary>\r
         /// Return a list of parsed titles\r
         /// </summary>\r
-        /// <param name="output"></param>\r
-        /// <returns></returns>\r
+        /// <param name="output">The Output</param>\r
+        /// <returns>A List of titles</returns>\r
         public static Title[] ParseList(string output)\r
         {\r
             var titles = new List<Title>();\r
index ded06b4..d6aed59 100644 (file)
       </Rules>\r
       <AnalyzerSettings />\r
     </Analyzer>\r
+    <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.OrderingRules">\r
+      <Rules>\r
+        <Rule Name="ElementsMustBeOrderedByAccess">\r
+          <RuleSettings>\r
+            <BooleanProperty Name="Enabled">False</BooleanProperty>\r
+          </RuleSettings>\r
+        </Rule>\r
+      </Rules>\r
+      <AnalyzerSettings />\r
+    </Analyzer>\r
   </Analyzers>\r
 </StyleCopSettings>
\ No newline at end of file
index eeb5e35..4d2d081 100644 (file)
@@ -78,7 +78,7 @@ namespace Handbrake
             this.mnu_copy_log.Name = "mnu_copy_log";\r
             this.mnu_copy_log.Size = new System.Drawing.Size(253, 22);\r
             this.mnu_copy_log.Text = "Copy";\r
-            this.mnu_copy_log.Click += new System.EventHandler(this.mnu_copy_log_Click);\r
+            this.mnu_copy_log.Click += new System.EventHandler(this.MnuCopyLogClick);\r
             // \r
             // mnu_openLogFolder\r
             // \r
@@ -86,7 +86,7 @@ namespace Handbrake
             this.mnu_openLogFolder.Name = "mnu_openLogFolder";\r
             this.mnu_openLogFolder.Size = new System.Drawing.Size(253, 22);\r
             this.mnu_openLogFolder.Text = "Open Individual Log File Directory";\r
-            this.mnu_openLogFolder.Click += new System.EventHandler(this.mnu_openLogFolder_Click);\r
+            this.mnu_openLogFolder.Click += new System.EventHandler(this.MnuOpenLogFolderClick);\r
             // \r
             // ToolTip\r
             // \r
@@ -124,7 +124,7 @@ namespace Handbrake
             this.btn_encode_log.Name = "btn_encode_log";\r
             this.btn_encode_log.Size = new System.Drawing.Size(152, 22);\r
             this.btn_encode_log.Text = "Encode Log";\r
-            this.btn_encode_log.Click += new System.EventHandler(this.btn_encode_log_Click);\r
+            this.btn_encode_log.Click += new System.EventHandler(this.BtnEncodeLogClick);\r
             // \r
             // btn_scan_log\r
             // \r
@@ -132,7 +132,7 @@ namespace Handbrake
             this.btn_scan_log.Name = "btn_scan_log";\r
             this.btn_scan_log.Size = new System.Drawing.Size(152, 22);\r
             this.btn_scan_log.Text = "Scan Log";\r
-            this.btn_scan_log.Click += new System.EventHandler(this.btn_scan_log_Click);\r
+            this.btn_scan_log.Click += new System.EventHandler(this.BtnScanLogClick);\r
             // \r
             // btn_copy\r
             // \r
@@ -142,7 +142,7 @@ namespace Handbrake
             this.btn_copy.Name = "btn_copy";\r
             this.btn_copy.Size = new System.Drawing.Size(122, 22);\r
             this.btn_copy.Text = "Copy to clipboard";\r
-            this.btn_copy.Click += new System.EventHandler(this.btn_copy_Click);\r
+            this.btn_copy.Click += new System.EventHandler(this.BtnCopyClick);\r
             // \r
             // panel1\r
             // \r
index 07e8f3d..879dd54 100644 (file)
@@ -1,8 +1,7 @@
 /*  frmActivityWindow.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\r
 {\r
@@ -16,51 +15,141 @@ namespace Handbrake
     using Functions;\r
     using Timer = System.Threading.Timer;\r
 \r
+    /// <summary>\r
+    /// The Activity Log Window\r
+    /// </summary>\r
     public partial class frmActivityWindow : Form\r
     {\r
-        private delegate void SetTextCallback(StringBuilder text);\r
+        /// <summary>\r
+        /// The current position in the log file\r
+        /// </summary>\r
+        private int position;\r
 \r
-        private delegate void SetTextClearCallback();\r
+        /// <summary>\r
+        /// The previous mode\r
+        /// </summary>\r
+        private string lastMode;\r
 \r
-        private int Position;\r
-        private string LastMode;\r
-        private string CurrentMode;\r
-        private Timer WindowTimer;\r
+        /// <summary>\r
+        /// The current mode\r
+        /// </summary>\r
+        private string currentMode;\r
 \r
+        /// <summary>\r
+        /// A Timer for this window\r
+        /// </summary>\r
+        private Timer windowTimer;\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="frmActivityWindow"/> class.\r
+        /// </summary>\r
+        /// <param name="mode">\r
+        /// The mode.\r
+        /// </param>\r
         public frmActivityWindow(string mode)\r
         {\r
             InitializeComponent();\r
 \r
-            Position = 0;\r
+            position = 0;\r
             if (mode == "scan")\r
                 SetScanMode();\r
             else\r
                 SetEncodeMode();\r
         }\r
 \r
+        /// <summary>\r
+        /// A callback function for updating the ui\r
+        /// </summary>\r
+        /// <param name="text">\r
+        /// The text.\r
+        /// </param>\r
+        private delegate void SetTextCallback(StringBuilder text);\r
+\r
+        /// <summary>\r
+        /// Clear text callback\r
+        /// </summary>\r
+        private delegate void SetTextClearCallback();\r
+\r
+        // Public\r
+\r
+        /// <summary>\r
+        /// Gets or sets SetLogFile.\r
+        /// </summary>\r
+        public string SetLogFile\r
+        {\r
+            get { return string.IsNullOrEmpty(currentMode) ? string.Empty : currentMode; }\r
+            set { currentMode = value; }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Set the window to scan mode\r
+        /// </summary>\r
+        public void SetScanMode()\r
+        {\r
+            Reset();\r
+            SetLogFile = "last_scan_log.txt";\r
+            this.Text = "Activity Window (Scan Log)";\r
+        }\r
+\r
+        /// <summary>\r
+        /// Set the window to encode mode\r
+        /// </summary>\r
+        public void SetEncodeMode()\r
+        {\r
+            Reset();\r
+            SetLogFile = "last_encode_log.txt";\r
+            this.Text = "Activity Window (Enocde Log)";\r
+        }\r
+\r
+        // Logging\r
+\r
+        /// <summary>\r
+        /// On Window load, start a new timer\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
         private void NewActivityWindow_Load(object sender, EventArgs e)\r
         {\r
-            WindowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);\r
+            windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);\r
         }\r
 \r
+        /// <summary>\r
+        /// Append new text to the window\r
+        /// </summary>\r
+        /// <param name="n">\r
+        /// The n.\r
+        /// </param>\r
         private void LogMonitor(object n)\r
         {\r
-            if (SetLogFile != LastMode) Reset();\r
+            if (SetLogFile != lastMode) Reset();\r
 \r
             // Perform the window update\r
             switch (SetLogFile)\r
             {\r
                 case "last_scan_log.txt":\r
                     AppendWindowText(ReadFile("last_scan_log.txt"));\r
-                    LastMode = "last_scan_log.txt";\r
+                    lastMode = "last_scan_log.txt";\r
                     break;\r
                 case "last_encode_log.txt":\r
                     AppendWindowText(ReadFile("last_encode_log.txt"));\r
-                    LastMode = "last_encode_log.txt";\r
+                    lastMode = "last_encode_log.txt";\r
                     break;\r
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Read the log file\r
+        /// </summary>\r
+        /// <param name="file">\r
+        /// The file.\r
+        /// </param>\r
+        /// <returns>\r
+        /// A string builder containing the log data\r
+        /// </returns>\r
         private StringBuilder ReadFile(string file)\r
         {\r
             StringBuilder appendText = new StringBuilder();\r
@@ -85,7 +174,7 @@ namespace Handbrake
                     else\r
                     {\r
                         appendText.AppendFormat("Waiting for the log file to be generated ...\n");\r
-                        Position = 0;\r
+                        position = 0;\r
                         ClearWindowText();\r
                         PrintLogHeader();\r
                         return appendText;\r
@@ -98,10 +187,10 @@ namespace Handbrake
                     int i = 1;\r
                     while ((line = sr.ReadLine()) != null)\r
                     {\r
-                        if (i > Position)\r
+                        if (i > position)\r
                         {\r
                             appendText.AppendLine(line);\r
-                            Position++;\r
+                            position++;\r
                         }\r
                         i++;\r
                     }\r
@@ -112,13 +201,18 @@ namespace Handbrake
                 {\r
                     Reset();\r
                     appendText = new StringBuilder();\r
-                    appendText.AppendFormat(\r
-                        "\nThe Log file is currently in use. Waiting for the log file to become accessible ...\n");\r
+                    appendText.AppendLine("\nThe Log file is currently in use. Waiting for the log file to become accessible ...\n");\r
                 }\r
             }\r
             return appendText;\r
         }\r
 \r
+        /// <summary>\r
+        /// Append text to the RTF box\r
+        /// </summary>\r
+        /// <param name="text">\r
+        /// The text.\r
+        /// </param>\r
         private void AppendWindowText(StringBuilder text)\r
         {\r
             try\r
@@ -127,7 +221,7 @@ namespace Handbrake
                 {\r
                     if (rtf_actLog.InvokeRequired)\r
                     {\r
-                        IAsyncResult invoked = BeginInvoke(new SetTextCallback(AppendWindowText), new object[] {text});\r
+                        IAsyncResult invoked = BeginInvoke(new SetTextCallback(AppendWindowText), new object[] { text });\r
                         EndInvoke(invoked);\r
                     }\r
                     else\r
@@ -141,6 +235,9 @@ namespace Handbrake
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Clear the contents of the log window\r
+        /// </summary>\r
         private void ClearWindowText()\r
         {\r
             try\r
@@ -163,6 +260,9 @@ namespace Handbrake
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Display the log header\r
+        /// </summary>\r
         private void PrintLogHeader()\r
         {\r
             try\r
@@ -179,19 +279,19 @@ namespace Handbrake
                         lock (rtf_actLog)\r
                         {\r
                             // Print the log header. This function will be re-implimented later. Do not delete.\r
-                            rtf_actLog.AppendText(String.Format("### Windows GUI {1} {0} \n", \r
-                                                                Properties.Settings.Default.hb_build, \r
-                                                                Properties.Settings.Default.hb_version));\r
-                            rtf_actLog.AppendText(String.Format("### Running: {0} \n###\n", Environment.OSVersion));\r
-                            rtf_actLog.AppendText(String.Format("### CPU: {0} \n", SystemInfo.GetCpuCount));\r
-                            rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", SystemInfo.TotalPhysicalMemory));\r
-                            rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", \r
-                                                                SystemInfo.ScreenBounds.Bounds.Width, \r
-                                                                SystemInfo.ScreenBounds.Bounds.Height));\r
-                            rtf_actLog.AppendText(String.Format("### Temp Dir: {0} \n", Path.GetTempPath()));\r
-                            rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
-                            rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
-                            rtf_actLog.AppendText("#########################################\n\n");\r
+                            StringBuilder header = new StringBuilder();\r
+\r
+                            header.AppendLine(String.Format("### Windows GUI {1} {0} \n", Properties.Settings.Default.hb_build, Properties.Settings.Default.hb_version));\r
+                            header.AppendLine(String.Format("### Running: {0} \n###\n", Environment.OSVersion));\r
+                            header.AppendLine(String.Format("### CPU: {0} \n", SystemInfo.GetCpuCount));\r
+                            header.AppendLine(String.Format("### Ram: {0} MB \n", SystemInfo.TotalPhysicalMemory));\r
+                            header.AppendLine(String.Format("### Screen: {0}x{1} \n", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));\r
+                            header.AppendLine(String.Format("### Temp Dir: {0} \n", Path.GetTempPath()));\r
+                            header.AppendLine(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
+                            header.AppendLine(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
+                            header.AppendLine("#########################################\n\n");\r
+\r
+                            rtf_actLog.AppendText(header.ToString());\r
                         }\r
                     }\r
                 }\r
@@ -202,48 +302,45 @@ namespace Handbrake
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Reset Everything\r
+        /// </summary>\r
         private void Reset()\r
         {\r
-            if (WindowTimer != null)\r
-                WindowTimer.Dispose();\r
-            Position = 0;\r
+            if (windowTimer != null)\r
+                windowTimer.Dispose();\r
+            position = 0;\r
             ClearWindowText();\r
             PrintLogHeader();\r
-            WindowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);\r
-        }\r
-\r
-        #region Public\r
-\r
-        public string SetLogFile\r
-        {\r
-            get { return string.IsNullOrEmpty(CurrentMode) ? string.Empty : CurrentMode; }\r
-            set { CurrentMode = value; }\r
-        }\r
-\r
-        public void SetScanMode()\r
-        {\r
-            Reset();\r
-            SetLogFile = "last_scan_log.txt";\r
-            this.Text = "Activity Window (Scan Log)";\r
-        }\r
-\r
-        public void SetEncodeMode()\r
-        {\r
-            Reset();\r
-            SetLogFile = "last_encode_log.txt";\r
-            this.Text = "Activity Window (Enocde Log)";\r
+            windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);\r
         }\r
 \r
-        #endregion\r
-\r
-        #region User Interface\r
+        // Menus and Buttons\r
 \r
-        private void mnu_copy_log_Click(object sender, EventArgs e)\r
+        /// <summary>\r
+        /// Copy log to clipboard\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void MnuCopyLogClick(object sender, EventArgs e)\r
         {\r
             Clipboard.SetDataObject(rtf_actLog.SelectedText != string.Empty ? rtf_actLog.SelectedText : rtf_actLog.Text, true);\r
         }\r
 \r
-        private void mnu_openLogFolder_Click(object sender, EventArgs e)\r
+        /// <summary>\r
+        /// Open the log folder\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void MnuOpenLogFolderClick(object sender, EventArgs e)\r
         {\r
             string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
             string windir = Environment.GetEnvironmentVariable("WINDIR");\r
@@ -251,33 +348,66 @@ namespace Handbrake
                               {\r
                                   StartInfo =\r
                                       {\r
-                                          FileName = windir + @"\explorer.exe", \r
+                                          FileName = windir + @"\explorer.exe",\r
                                           Arguments = logDir\r
                                       }\r
                               };\r
             prc.Start();\r
         }\r
 \r
-        private void btn_copy_Click(object sender, EventArgs e)\r
+        /// <summary>\r
+        /// Copy the log\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void BtnCopyClick(object sender, EventArgs e)\r
         {\r
             Clipboard.SetDataObject(rtf_actLog.SelectedText != string.Empty ? rtf_actLog.SelectedText : rtf_actLog.Text, true);\r
         }\r
 \r
-        private void btn_scan_log_Click(object sender, EventArgs e)\r
+        /// <summary>\r
+        /// Set scan mode\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void BtnScanLogClick(object sender, EventArgs e)\r
         {\r
             SetScanMode();\r
         }\r
 \r
-        private void btn_encode_log_Click(object sender, EventArgs e)\r
+        /// <summary>\r
+        /// Set the encode mode\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void BtnEncodeLogClick(object sender, EventArgs e)\r
         {\r
             SetEncodeMode();\r
         }\r
 \r
-        #endregion\r
+        // Overrides\r
 \r
+        /// <summary>\r
+        /// override onclosing\r
+        /// </summary>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
         protected override void OnClosing(CancelEventArgs e)\r
         {\r
-            WindowTimer.Dispose();\r
+            windowTimer.Dispose();\r
             e.Cancel = true;\r
             this.Dispose();\r
             base.OnClosing(e);\r
index dad2201..505b49a 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 = " -x ";\r
+            this.x264Panel.X264Query = " -x  -x ";\r
             // \r
             // tab_query\r
             // \r
index ca36cb9..8dd436c 100644 (file)
@@ -2001,7 +2001,7 @@ namespace Handbrake
                 Parser encode = new Parser(encodeQueue.HbProcess.StandardOutput.BaseStream);\r
                 encode.OnEncodeProgress += EncodeOnEncodeProgress;\r
                 while (!encode.EndOfStream)\r
-                    encode.readEncodeStatus();\r
+                    encode.ReadEncodeStatus();\r
             }\r
             catch (Exception exc)\r
             {\r