OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 23 Oct 2008 21:01:24 +0000 (21:01 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 23 Oct 2008 21:01:24 +0000 (21:01 +0000)
- Hack to fix a bug introduced in 1819. Level 1 verbose caused an arithmetic error with sr.Peek().

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

win/C#/Parsing/Title.cs

index a2205fc..c2a21b8 100644 (file)
@@ -181,8 +181,8 @@ namespace Handbrake.Parsing
         public static Title[] ParseList(string output)\r
         {\r
             List<Title> titles = new List<Title>();\r
-\r
             StringReader sr = new StringReader(output);\r
+\r
             while ((char)sr.Peek() == '+')\r
             {\r
                 titles.Add(Title.Parse(sr));\r
@@ -190,10 +190,22 @@ namespace Handbrake.Parsing
                  * Fix for the line "+ combing detected, may be interlaced or telecined"\r
                  * If the next character is not a [ or +, then there are titles left to parse, but we are not where\r
                  * we expect to be in the output, so read one line ahead to skip over the unknown line\r
+                 * \r
+                 * HACK: FIX THIS PROPERLY\r
+                 * The try cactch is used to fix a bug introduced with 1819. The level of verbosity needs to be 2\r
+                 * in order for the code to run correctly without the hack below. It gets upset about 2 lines of\r
+                 * log missing with -v 1. To fix this just break out the loop so that sr.Peek() isn't run.\r
                  */\r
+                try\r
+                {\r
+                    if ((char)sr.Peek() != '[' && (char)sr.Peek() != '+') // Hack, Fix later\r
+                        sr.ReadLine();\r
+                }\r
+                catch (Exception)\r
+                {\r
+                    break;\r
+                }\r
 \r
-                if ((char)sr.Peek() != '[' && (char)sr.Peek() != '+' ) // Hack, Fix later\r
-                    sr.ReadLine();\r
             }\r
 \r
             return titles.ToArray();\r