OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / QueryParser.cs
index 78a73b5..413f8fa 100644 (file)
@@ -9,10 +9,11 @@ using System.Globalization;
 using System.Text.RegularExpressions;\r
 using System.Windows.Forms;\r
 using System.Collections;\r
+using Handbrake.Model;\r
 \r
 namespace Handbrake.Functions\r
 {\r
-    internal class QueryParser\r
+    public class QueryParser\r
     {\r
         private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
 \r
@@ -40,10 +41,10 @@ namespace Handbrake.Functions
         public string CropLeft { get; set; }\r
         public string CropRight { get; set; }\r
         public int AnamorphicMode { get; set; }\r
-        public Boolean keepDisplayAsect { get; set; }\r
-        public double displayWidthValue { get; set; }\r
-        public int pixelAspectWidth { get; set; }\r
-        public int pixelAspectHeight { get; set; }\r
+        public Boolean KeepDisplayAsect { get; set; }\r
+        public double DisplayWidthValue { get; set; }\r
+        public int PixelAspectWidth { get; set; }\r
+        public int PixelAspectHeight { get; set; }\r
         public int AnamorphicModulus { get; set; }\r
 \r
         // Video Filters\r
@@ -234,16 +235,16 @@ namespace Handbrake.Functions
                 else\r
                     thisQuery.AnamorphicMode = 0;\r
 \r
-                thisQuery.keepDisplayAsect = keepDisplayAsect.Success;\r
+                thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;\r
 \r
                 if (displayWidth.Success)\r
-                    thisQuery.displayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
+                    thisQuery.DisplayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));\r
 \r
                 if (pixelAspect.Success)\r
-                    thisQuery.pixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
+                    thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));\r
 \r
                 if (pixelAspect.Success && pixelAspect.Groups.Count >=3)\r
-                    thisQuery.pixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));\r
+                    thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));\r
 \r
                 if (modulus.Success)\r
                     thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));\r
@@ -365,7 +366,7 @@ namespace Handbrake.Functions
                     trackDRCvalues = drcValues.ToString().Replace("-D ", "").Split(',');\r
 \r
                 // Create new Audio Track Classes and store them in the ArrayList\r
-                ArrayList AllAudioTrackInfo = new ArrayList();\r
+                ArrayList allAudioTrackInfo = new ArrayList();\r
                 for (int x = 0; x < encoderCount; x++)\r
                 {\r
                     AudioTrack track = new AudioTrack();\r
@@ -375,11 +376,11 @@ namespace Handbrake.Functions
 \r
                     if (trackMixes != null)\r
                         if (trackMixes.Length >= (x + 1))                        // Audio Mix\r
-                            track.MixDown = getMixDown(trackMixes[x].Trim());\r
+                            track.MixDown = GetMixDown(trackMixes[x].Trim());\r
 \r
                     if (trackEncoders != null)\r
                         if (trackEncoders.Length >= (x + 1))                     // Audio Mix\r
-                            track.Encoder = getAudioEncoder(trackEncoders[x].Trim());\r
+                            track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());\r
 \r
                     if (trackBitrates != null)\r
                         if (trackBitrates.Length >= (x + 1))                     // Audio Encoder\r
@@ -393,9 +394,9 @@ namespace Handbrake.Functions
                         if (trackDRCvalues.Length >= (x + 1))                   // Audio DRC Values\r
                             track.DRC = trackDRCvalues[x].Trim();\r
 \r
-                    AllAudioTrackInfo.Add(track);\r
+                    allAudioTrackInfo.Add(track);\r
                 }\r
-                thisQuery.AudioInformation = AllAudioTrackInfo;\r
+                thisQuery.AudioInformation = allAudioTrackInfo;\r
 \r
                 // Subtitle Stuff\r
                 if (subtitles.Success)\r
@@ -431,7 +432,13 @@ namespace Handbrake.Functions
 \r
             return thisQuery;\r
         }\r
-        private static string getMixDown(string mixdown)\r
+\r
+        /// <summary>\r
+        /// Get the GUI equiv to a CLI mixdown\r
+        /// </summary>\r
+        /// <param name="mixdown"></param>\r
+        /// <returns></returns>\r
+        private static string GetMixDown(string mixdown)\r
         {\r
             switch (mixdown.Trim())\r
             {\r
@@ -449,7 +456,13 @@ namespace Handbrake.Functions
                     return "Automatic";\r
             }\r
         }\r
-        private static string getAudioEncoder(string audioEnc)\r
+\r
+        /// <summary>\r
+        /// Get the GUI equiv to a CLI audio encoder\r
+        /// </summary>\r
+        /// <param name="audioEnc"></param>\r
+        /// <returns></returns>\r
+        private static string GetAudioEncoder(string audioEnc)\r
         {\r
             switch (audioEnc)\r
             {\r
@@ -468,23 +481,4 @@ namespace Handbrake.Functions
             }\r
         }\r
     }\r
-\r
-    public class AudioTrack\r
-    {\r
-        public AudioTrack()\r
-        {\r
-            // Default Values\r
-            Track = "Automatic";\r
-            MixDown = "Automatic";\r
-            SampleRate = "Auto";\r
-            Bitrate = "Auto";\r
-            DRC = "1";\r
-        }\r
-        public string Track { get; set; }\r
-        public string MixDown { get; set; }\r
-        public string Encoder { get; set; }\r
-        public string Bitrate { get; set; }\r
-        public string SampleRate { get; set; }\r
-        public string DRC { get; set; }\r
-    }\r
 }
\ No newline at end of file