OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Program.cs
index 6ab76bb..f2bae96 100644 (file)
@@ -6,6 +6,8 @@
 \r
 using System;\r
 using System.Windows.Forms;\r
+using System.IO;\r
+using Handbrake.Presets;\r
 \r
 namespace Handbrake\r
 {\r
@@ -22,10 +24,10 @@ namespace Handbrake
             try\r
             {\r
                 // Make sure the screen resolution is not below 1024x768\r
-                System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;\r
+                Screen scr = Screen.PrimaryScreen;\r
                 if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 720))\r
                 {\r
-                    MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width.ToString() + "x" + scr.Bounds.Height.ToString() + " \nScreen resolution is too Low. Must be 1024x720 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                    MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width + "x" + scr.Bounds.Height + " \nScreen resolution is too Low. Must be 1024x720 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                     launch = false;\r
                 }\r
             }\r
@@ -35,8 +37,22 @@ namespace Handbrake
             }\r
 \r
             // Either Launch or Close the Application\r
-            if (launch == true)\r
+            if (launch)\r
             {\r
+                string appDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake";\r
+                if (!Directory.Exists(appDir))\r
+                    Directory.CreateDirectory(appDir);\r
+\r
+                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+                if (!Directory.Exists(logDir))\r
+                    Directory.CreateDirectory(logDir);\r
+\r
+                if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml"))\r
+                {\r
+                    PresetsHandler x = new PresetsHandler();\r
+                    x.updateBuiltInPresets();\r
+                }\r
+\r
                 Application.EnableVisualStyles();\r
                 Application.SetCompatibleTextRenderingDefault(false);\r
                 Application.Run(new frmMain());\r