2 This file is part of the HandBrake source code.
\r
3 Homepage: <http://handbrake.fr>.
\r
4 It may be used under the terms of the GNU General Public License. */
\r
10 using System.Windows.Forms;
\r
14 /// HandBrake Starts Here
\r
16 public static class Program
\r
19 /// The main entry point for the application.
\r
22 public static void Main()
\r
24 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
\r
26 const string failedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n";
\r
27 const string nightlyCLIMissing =
\r
28 "If you have downloaded the \"HandBrakeGUI\" nightly, " +
\r
29 "please make sure you have also downloaded the \"HandBrakeCLI\" nightly and extracted it's contents to the same folder. ";
\r
30 string missingFiles = string.Empty;
\r
32 // Verify HandBrakeCLI.exe and ilibgcc_s_sjlj-1.dll exists
\r
33 if (!File.Exists(Path.Combine(Application.StartupPath, "HandBrakeCLI.exe")))
\r
35 missingFiles += "\"HandBrakeCLI.exe\" was not found.";
\r
38 if (missingFiles != string.Empty)
\r
40 MessageBox.Show(failedInstall + missingFiles + "\n\n"+ nightlyCLIMissing, "Error", MessageBoxButtons.OK,
\r
41 MessageBoxIcon.Error);
\r
45 // Make sure we have a recent version for svn builds
\r
46 string version = Properties.Settings.Default.hb_version;
\r
47 if (version.Contains("svn"))
\r
49 version = version.Replace("svn", string.Empty).Trim();
\r
51 int.TryParse(version, out build);
\r
52 if (build < Properties.Settings.Default.hb_min_cli)
\r
55 "It appears you are trying to use a CLI executable that is too old for this version of the HandBrake GUI.\n" +
\r
56 "Please update the HandBrakeCLI.exe to a newer build. ",
\r
58 MessageBoxButtons.OK,
\r
59 MessageBoxIcon.Error);
\r
64 // Check were not running on a screen that's going to cause some funnies to happen.
\r
65 Screen scr = Screen.PrimaryScreen;
\r
66 if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620))
\r
67 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 1024x620 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
70 string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs");
\r
71 if (!Directory.Exists(logDir))
\r
72 Directory.CreateDirectory(logDir);
\r
74 if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml")))
\r
76 PresetsHandler x = new PresetsHandler();
\r
77 x.UpdateBuiltInPresets();
\r
80 Application.EnableVisualStyles();
\r
81 Application.SetCompatibleTextRenderingDefault(false);
\r
82 Application.Run(new frmMain());
\r
87 /// Throw up an error message for any unhandled exceptions.
\r
89 /// <param name="sender">The sender</param>
\r
90 /// <param name="e">Unhandled Exception EventArgs </param>
\r
91 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
\r
94 "An unexpected error has occured.\n\nSender:" + sender + "\n\nException:" + e.ExceptionObject,
\r
95 "Unhandled Exception",
\r
96 MessageBoxButtons.OK,
\r
97 MessageBoxIcon.Error);
\r