OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / Presets.cs
index 353846b..3faa8b8 100644 (file)
@@ -4,7 +4,7 @@ using System.Text;
 using System.Windows.Forms;\r
 using System.IO;\r
 using System.Text.RegularExpressions;\r
-\r
+using System.Diagnostics;\r
 \r
 namespace Handbrake.Functions\r
 {\r
@@ -158,6 +158,25 @@ namespace Handbrake.Functions
         }\r
 \r
         /// <summary>\r
+        /// Update the presets.dat file with the latest version of HandBrake's presets from the CLI\r
+        /// </summary>\r
+        public void grabCLIPresets()\r
+        {\r
+            string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
+            string presetsPath = Path.Combine(Application.StartupPath, "presets.dat");\r
+\r
+            string strCmdLine = String.Format(@"cmd /c """"{0}"" --preset-list >""{1}"" 2>&1""", handbrakeCLIPath, presetsPath);\r
+\r
+            ProcessStartInfo hbGetPresets = new ProcessStartInfo("CMD.exe", strCmdLine);\r
+            hbGetPresets.WindowStyle = ProcessWindowStyle.Hidden;\r
+\r
+            Process hbproc = Process.Start(hbGetPresets);\r
+            hbproc.WaitForExit();\r
+            hbproc.Dispose();\r
+            hbproc.Close();\r
+        }\r
+\r
+        /// <summary>\r
         /// Load in the preset data from presets.dat and user_presets.dat\r
         /// Load it into the 2 arraylist's presets and user_presets\r
         /// </summary>\r