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
12 using Handbrake.Properties;
\r
17 /// HandBrake Starts Here
\r
19 public static class Program
\r
22 /// The main entry point for the application.
\r
25 public static void Main()
\r
27 if (Settings.Default.UpdateRequired)
\r
29 Settings.Default.Upgrade();
\r
30 Settings.Default.UpdateRequired = false;
\r
33 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
\r
35 const string failedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n";
\r
36 const string nightlyCLIMissing =
\r
37 "If you have downloaded the \"HandBrakeGUI\" nightly, " +
\r
38 "please make sure you have also downloaded the \"HandBrakeCLI\" nightly and extracted it's contents to the same folder. ";
\r
39 string missingFiles = string.Empty;
\r
41 // Verify HandBrakeCLI.exe and ilibgcc_s_sjlj-1.dll exists
\r
42 if (!File.Exists(Path.Combine(Application.StartupPath, "HandBrakeCLI.exe")))
\r
44 missingFiles += "\"HandBrakeCLI.exe\" was not found.";
\r
47 if (missingFiles != string.Empty)
\r
50 failedInstall + missingFiles + "\n\n" + nightlyCLIMissing,
\r
52 MessageBoxButtons.OK,
\r
53 MessageBoxIcon.Error);
\r
57 // Check were not running on a screen that's going to cause some funnies to happen.
\r
58 Screen scr = Screen.PrimaryScreen;
\r
59 if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620))
\r
60 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
63 string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs");
\r
64 if (!Directory.Exists(logDir))
\r
65 Directory.CreateDirectory(logDir);
\r
67 if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml")))
\r
69 PresetsHandler x = new PresetsHandler();
\r
70 x.UpdateBuiltInPresets();
\r
73 Application.EnableVisualStyles();
\r
74 Application.SetCompatibleTextRenderingDefault(false);
\r
75 Application.Run(new frmMain());
\r
80 /// Throw up an error message for any unhandled exceptions.
\r
82 /// <param name="sender">The sender</param>
\r
83 /// <param name="e">Unhandled Exception EventArgs </param>
\r
84 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
\r
87 "An unexpected error has occured.\n\nSender:" + sender + "\n\nException:" + e.ExceptionObject,
\r
88 "Unhandled Exception",
\r
89 MessageBoxButtons.OK,
\r
90 MessageBoxIcon.Error);
\r