OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / QueryParser.cs
index ff621c6..0b7c2a3 100644 (file)
@@ -41,8 +41,12 @@ namespace Handbrake.Functions
         public string CropBottom { get; private set; }\r
         public string CropLeft { get; private set; }\r
         public string CropRight { get; private set; }\r
-        public Boolean Anamorphic { get; private set; }\r
-        public Boolean LooseAnamorphic { get; private set; }\r
+        public int AnamorphicMode { get; private set; }\r
+        public Boolean keepDisplayAsect { get; private set; }\r
+        public double displayWidthValue { get; private set; }\r
+        public int pixelAspectWidth { get; private set; }\r
+        public int pixelAspectHeight { get; private set; }\r
+        public int AnamorphicModulus { get; private set; }\r
         #endregion\r
 \r
         #region Video Filters\r
@@ -93,10 +97,6 @@ namespace Handbrake.Functions
 \r
             #region Regular Expressions\r
 \r
-            // Useful Destination Finder\r
-            //Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9?';!^%&*()_\-:\\\s\.]+)(?:\"")");\r
-            //Match source = r1.Match(input.Replace('"', '\"'));\r
-\r
             //Source\r
             Match title = Regex.Match(input, @"-t ([0-9]*)");\r
             Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
@@ -113,8 +113,15 @@ namespace Handbrake.Functions
             Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");\r
             Match maxHeight = Regex.Match(input, @"-Y ([0-9]*)");\r
             Match crop = Regex.Match(input, @"--crop ([0-9]*):([0-9]*):([0-9]*):([0-9]*)");\r
-            Match lanamorphic = Regex.Match(input, @" -P");\r
-            Match anamorphic = Regex.Match(input, @" -p ");\r
+\r
+            Match looseAnamorphic = Regex.Match(input, @"--loose-anamorphic");\r
+            Match strictAnamorphic = Regex.Match(input, @"--strict-anamorphic");\r
+            Match customAnamorphic = Regex.Match(input, @"--custom-anamorphic");\r
+\r
+            Match keepDisplayAsect = Regex.Match(input, @"--keep-display-aspect");\r
+            Match displayWidth = Regex.Match(input, @"--display-width ([0-9*])");\r
+            Match pixelAspect = Regex.Match(input, @"--pixel-aspect ([0-9]*):([0-9]*)");\r
+            Match modulus = Regex.Match(input, @"--modulus ([0-9*])");\r
 \r
             // Picture Settings - Filters\r
             Match decomb = Regex.Match(input, @" --decomb");\r
@@ -196,16 +203,16 @@ namespace Handbrake.Functions
                 #region Picture Tab\r
 \r
                 if (width.Success)\r
-                    thisQuery.Width = int.Parse(width.ToString().Replace("-w ", ""));\r
-\r
+                    thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", ""));\r
+                                                              \r
                 if (height.Success)\r
-                    thisQuery.Height = int.Parse(height.ToString().Replace("-l ", ""));\r
+                    thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", ""));\r
 \r
                 if (maxWidth.Success)\r
-                    thisQuery.MaxWidth = int.Parse(maxWidth.ToString().Replace("-X ", ""));\r
+                    thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", ""));\r
 \r
                 if (maxHeight.Success)\r
-                    thisQuery.MaxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", ""));\r
+                    thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", ""));\r
 \r
                 if (crop.Success)\r
                 {\r
@@ -215,10 +222,31 @@ namespace Handbrake.Functions
                     thisQuery.CropBottom = actCropValues[1];\r
                     thisQuery.CropLeft = actCropValues[2];\r
                     thisQuery.CropRight = actCropValues[3];\r
-                }\r
+                } \r
+\r
+                if (strictAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 1;\r
+                else if (looseAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 2;\r
+                else if (customAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 3;\r
+                else\r
+                    thisQuery.AnamorphicMode = 0;\r
+\r
+                thisQuery.keepDisplayAsect = keepDisplayAsect.Success;\r
+\r
+                if (displayWidth.Success)\r
+                    thisQuery.displayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
+\r
+                if (pixelAspect.Success)\r
+                    thisQuery.pixelAspectWidth = int.Parse(pixelAspect.Groups[0].Value.Replace("--pixel-aspect ", ""));\r
+\r
+                if (pixelAspect.Success)\r
+                    thisQuery.pixelAspectHeight = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
+\r
+                if (modulus.Success)\r
+                    thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));\r
 \r
-                thisQuery.Anamorphic = anamorphic.Success;\r
-                thisQuery.LooseAnamorphic = lanamorphic.Success;\r
 \r
                 #endregion\r
 \r
@@ -400,7 +428,6 @@ namespace Handbrake.Functions
 \r
             return thisQuery;\r
         }\r
-\r
         private static string getMixDown(string mixdown)\r
         {\r
             switch (mixdown.Trim())\r