OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Program.cs
1 /*  Program.cs \r
2         \r
3            This file is part of the HandBrake source code.\r
4            Homepage: <http://handbrake.fr>.\r
5            It may be used under the terms of the GNU General Public License. */\r
6 \r
7 using System;\r
8 using System.Windows.Forms;\r
9 using System.IO;\r
10 using Handbrake.Presets;\r
11 \r
12 namespace Handbrake\r
13 {\r
14     static class Program\r
15     {\r
16         /// <summary>\r
17         /// The main entry point for the application.\r
18         /// </summary>\r
19         [STAThread]\r
20         static void Main()\r
21         {\r
22             // Check the system meets the system requirements.\r
23             Boolean launch = true;\r
24             try\r
25             {\r
26                 // Make sure the screen resolution is not below 1024x768\r
27                 Screen scr = Screen.PrimaryScreen;\r
28                 if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 720))\r
29                 {\r
30                     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
31                     launch = false;\r
32                 }\r
33             }\r
34             catch (Exception exc)\r
35             {\r
36                 MessageBox.Show("frmMain.cs - systemCheck() " + exc);\r
37             }\r
38 \r
39             // Either Launch or Close the Application\r
40             if (launch)\r
41             {\r
42                 string appDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake";\r
43                 if (!Directory.Exists(appDir))\r
44                     Directory.CreateDirectory(appDir);\r
45 \r
46                 string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
47                 if (!Directory.Exists(logDir))\r
48                     Directory.CreateDirectory(logDir);\r
49 \r
50                 if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.xml"))\r
51                 {\r
52                     PresetsHandler x = new PresetsHandler();\r
53                     x.updateBuiltInPresets();\r
54                 }\r
55 \r
56                 Application.EnableVisualStyles();\r
57                 Application.SetCompatibleTextRenderingDefault(false);\r
58                 Application.Run(new frmMain());\r
59             }\r
60             else\r
61                 Application.Exit();\r
62         }\r
63     }\r
64 \r
65 }