]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Mon, 3 Dec 2007 11:21:51 +0000 (11:21 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 3 Dec 2007 11:21:51 +0000 (11:21 +0000)
- Fixed Exception when only single chapter was added to the queue

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

win/C#/Functions/QueryParser.cs

index bbd6a718ea7cad5754d3e4e9e996895b47d09b15..f49115ac81910cd332cf77ccff5bd00ad5316103 100644 (file)
@@ -11,7 +11,7 @@ namespace Handbrake.Functions
 \r
         // All the Main Window GUI options\r
         #region Varibles\r
\r
+\r
         private string q_source;\r
         /// <summary>\r
         /// Returns a String \r
@@ -399,7 +399,7 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        private string  q_videoTargetSize;\r
+        private string q_videoTargetSize;\r
         /// <summary>\r
         /// Returns a string with the video target size\r
         /// </summary>\r
@@ -524,14 +524,14 @@ namespace Handbrake.Functions
         {\r
             QueryParser thisQuery = new QueryParser();\r
 \r
-            #region reg exp \r
+            #region reg exp\r
             //Source\r
             Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");\r
             Match source = r1.Match(input.Replace('"', '\"'));\r
             Match title = Regex.Match(input, @"-t ([0-9]*)");\r
             Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
             Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");\r
-  \r
+\r
             //Destination\r
             Regex r2 = new Regex(@"(-o)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");\r
             Match destination = r2.Match(input.Replace('"', '\"'));\r
@@ -563,7 +563,7 @@ namespace Handbrake.Functions
             Match largerMp4 = Regex.Match(input, @"-4");\r
             Match ipodAtom = Regex.Match(input, @"-I");\r
             Match optimizeMP4 = Regex.Match(input, @"-O");\r
-                \r
+\r
             //Audio Settings Tab\r
             Match subtitles = Regex.Match(input, @"-s ([0-9]*)");\r
             Match audioBitrate = Regex.Match(input, @"-B ([0-9]*)");\r
@@ -573,7 +573,7 @@ namespace Handbrake.Functions
 \r
             //H264 Tab\r
             Match x264 = Regex.Match(input, @"-x ([,a-zA-Z0-9=:-]*)");\r
-            \r
+\r
             //Program Options\r
             Match verbose = Regex.Match(input, @"-v");\r
             #endregion\r
@@ -584,21 +584,22 @@ namespace Handbrake.Functions
                 // Source\r
                 //\r
                 #region Source Tab\r
-   \r
+\r
                 thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", "");\r
                 if (title.Success != false)\r
                     thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));\r
 \r
                 if (chapters.Success != false)\r
                 {\r
-                     string[] actTitles = new string[2];\r
-                     actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
-                     thisQuery.q_chaptersStart = int.Parse(actTitles[0]);\r
-                     thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);\r
-                 }\r
+                    string[] actTitles = new string[2];\r
+                    actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
+                    thisQuery.q_chaptersStart = int.Parse(actTitles[0]);\r
+                    if (actTitles.Length > 1)\r
+                        thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);\r
+                }\r
 \r
-                 if (format.Success != false)\r
-                     thisQuery.q_format = format.ToString().Replace("-f ", "");\r
+                if (format.Success != false)\r
+                    thisQuery.q_format = format.ToString().Replace("-f ", "");\r
 \r
                 #endregion\r
 \r
@@ -606,14 +607,14 @@ namespace Handbrake.Functions
                 // Destination\r
                 //\r
                 #region Destination\r
-                 thisQuery.q_destination = destination.ToString().Replace("-o ","").Replace("\"", "");\r
+                thisQuery.q_destination = destination.ToString().Replace("-o ", "").Replace("\"", "");\r
 \r
-                 string videoEncoderConvertion;\r
-                 string audioEncoderConvertion;\r
+                string videoEncoderConvertion;\r
+                string audioEncoderConvertion;\r
 \r
-                 videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
-                 switch (videoEncoderConvertion)\r
-                 {\r
+                videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
+                switch (videoEncoderConvertion)\r
+                {\r
                     case "ffmpeg":\r
                         videoEncoderConvertion = "Mpeg 4";\r
                         break;\r
@@ -632,12 +633,12 @@ namespace Handbrake.Functions
                     default:\r
                         videoEncoderConvertion = "Mpeg 4";\r
                         break;\r
-                 }\r
-                 thisQuery.q_videoEncoder = videoEncoderConvertion;\r
+                }\r
+                thisQuery.q_videoEncoder = videoEncoderConvertion;\r
 \r
-                 audioEncoderConvertion = audioEncoder.ToString().Replace("-E ", "");\r
-                 switch (audioEncoderConvertion)\r
-                 {\r
+                audioEncoderConvertion = audioEncoder.ToString().Replace("-E ", "");\r
+                switch (audioEncoderConvertion)\r
+                {\r
                     case "faac":\r
                         audioEncoderConvertion = "AAC";\r
                         break;\r
@@ -653,24 +654,24 @@ namespace Handbrake.Functions
                     default:\r
                         audioEncoderConvertion = "AAC";\r
                         break;\r
-                 }\r
-                 thisQuery.q_audioEncoder =audioEncoderConvertion;\r
+                }\r
+                thisQuery.q_audioEncoder = audioEncoderConvertion;\r
 \r
 \r
-                 if (width.Success != false)\r
+                if (width.Success != false)\r
                     thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));\r
 \r
-                 if (height.Success != false)\r
+                if (height.Success != false)\r
                     thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));\r
 \r
-                 #endregion\r
+                #endregion\r
 \r
                 //\r
                 //Picture Settings Tab\r
                 //\r
                 #region Picture Tab\r
-                 if (crop.Success != false)\r
-                 {\r
+                if (crop.Success != false)\r
+                {\r
                     thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
                     string[] actCropValues = new string[3];\r
                     actCropValues = thisQuery.q_cropValues.Split(':');\r
@@ -678,60 +679,60 @@ namespace Handbrake.Functions
                     thisQuery.q_cropbottom = actCropValues[1];\r
                     thisQuery.q_cropLeft = actCropValues[2];\r
                     thisQuery.q_cropRight = actCropValues[3];\r
-                 }\r
-\r
-                 thisQuery.q_detelecine = detelecine.Success;\r
-                 thisQuery.q_deBlock = deblock.Success;\r
-\r
-                 thisQuery.q_deinterlace = "None";\r
-                 if (deinterlace.Success != false)\r
-                 {\r
-                     switch (deinterlace.ToString().Replace("--deinterlace=", ""))\r
-                     {\r
-                         case "fast":\r
-                             thisQuery.q_deinterlace = "Original (Fast)";\r
-                             break;\r
-                         case "slow":\r
-                             thisQuery.q_deinterlace = "yadif (Slow)";\r
-                             break;\r
-                         case "slower":\r
-                             thisQuery.q_deinterlace = "yadif + mcdeint (Slower)";\r
-                             break;\r
-                         case "slowest":\r
-                             thisQuery.q_deinterlace = "yadif + mcdeint (Slowest)";\r
-                             break;\r
-                         default:\r
-                             thisQuery.q_deinterlace = "None";\r
-                             break;\r
-                     }\r
-                 }\r
-\r
-                 thisQuery.q_denoise = "None";\r
-                 if (denoise.Success != false)\r
-                 {\r
-                     switch (denoise.ToString().Replace("--denoise=", ""))\r
-                     {\r
-                         case "weak":\r
-                             thisQuery.q_denoise = "Weak";\r
-                             break;\r
-                         case "medium":\r
-                             thisQuery.q_denoise = "Medium";\r
-                             break;\r
-                         case "strong":\r
-                             thisQuery.q_denoise = "Strong";\r
-                             break;\r
-                         default:\r
-                             thisQuery.q_denoise = "None";\r
-                             break;\r
-                     }\r
-                    \r
-                 }\r
-                 thisQuery.q_anamorphic = anamorphic.Success;\r
-                 thisQuery.q_chapterMarkers = chapterMarkers.Success;\r
-                 thisQuery.q_vfr = vfr.Success;\r
-                 thisQuery.q_looseAnamorphic = lanamorphic.Success;\r
-                \r
-                 #endregion\r
+                }\r
+\r
+                thisQuery.q_detelecine = detelecine.Success;\r
+                thisQuery.q_deBlock = deblock.Success;\r
+\r
+                thisQuery.q_deinterlace = "None";\r
+                if (deinterlace.Success != false)\r
+                {\r
+                    switch (deinterlace.ToString().Replace("--deinterlace=", ""))\r
+                    {\r
+                        case "fast":\r
+                            thisQuery.q_deinterlace = "Original (Fast)";\r
+                            break;\r
+                        case "slow":\r
+                            thisQuery.q_deinterlace = "yadif (Slow)";\r
+                            break;\r
+                        case "slower":\r
+                            thisQuery.q_deinterlace = "yadif + mcdeint (Slower)";\r
+                            break;\r
+                        case "slowest":\r
+                            thisQuery.q_deinterlace = "yadif + mcdeint (Slowest)";\r
+                            break;\r
+                        default:\r
+                            thisQuery.q_deinterlace = "None";\r
+                            break;\r
+                    }\r
+                }\r
+\r
+                thisQuery.q_denoise = "None";\r
+                if (denoise.Success != false)\r
+                {\r
+                    switch (denoise.ToString().Replace("--denoise=", ""))\r
+                    {\r
+                        case "weak":\r
+                            thisQuery.q_denoise = "Weak";\r
+                            break;\r
+                        case "medium":\r
+                            thisQuery.q_denoise = "Medium";\r
+                            break;\r
+                        case "strong":\r
+                            thisQuery.q_denoise = "Strong";\r
+                            break;\r
+                        default:\r
+                            thisQuery.q_denoise = "None";\r
+                            break;\r
+                    }\r
+\r
+                }\r
+                thisQuery.q_anamorphic = anamorphic.Success;\r
+                thisQuery.q_chapterMarkers = chapterMarkers.Success;\r
+                thisQuery.q_vfr = vfr.Success;\r
+                thisQuery.q_looseAnamorphic = lanamorphic.Success;\r
+\r
+                #endregion\r
 \r
                 //\r
                 //Video Settings Tab\r
@@ -782,7 +783,7 @@ namespace Handbrake.Functions
                 thisQuery.q_audioTrackMix = "Automatic";\r
                 if (audioChannelsMix.Success != false)\r
                 {\r
-                    switch (audioChannelsMix.ToString().Replace("-6 ", "").Replace(" ",""))\r
+                    switch (audioChannelsMix.ToString().Replace("-6 ", "").Replace(" ", ""))\r
                     {\r
                         case "mono":\r
                             thisQuery.q_audioTrackMix = "Mono";\r
@@ -803,7 +804,7 @@ namespace Handbrake.Functions
                             thisQuery.q_audioTrackMix = "Automatic";\r
                             break;\r
                     }\r
-                   \r
+\r
                 }\r
                 if (subtitles.Success != false)\r
                     thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");\r