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 // Handle any unhandled exceptions
\r
28 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
\r
30 // Attempt to upgrade / keep the users settings between versions
\r
31 if (Settings.Default.UpdateRequired)
\r
33 Settings.Default.Upgrade();
\r
34 Settings.Default.UpdateRequired = false;
\r
37 // Make sure we have any pre-requesits before trying to launch
\r
38 const string FailedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n";
\r
39 const string NightlyCLIMissing =
\r
40 "If you have downloaded the \"HandBrakeGUI\" nightly, " +
\r
41 "please make sure you have also downloaded the \"HandBrakeCLI\" nightly and extracted it's contents to the same folder. ";
\r
42 string missingFiles = string.Empty;
\r
44 // Verify HandBrakeCLI.exe exists
\r
45 if (!File.Exists(Path.Combine(Application.StartupPath, "HandBrakeCLI.exe")))
\r
47 missingFiles += "\"HandBrakeCLI.exe\" was not found.";
\r
50 if (missingFiles != string.Empty)
\r
53 FailedInstall + missingFiles + "\n\n" + NightlyCLIMissing,
\r
55 MessageBoxButtons.OK,
\r
56 MessageBoxIcon.Error);
\r
60 // Check were not running on a screen that's going to cause some funnies to happen.
\r
61 Screen scr = Screen.PrimaryScreen;
\r
62 if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620))
\r
63 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
66 string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs");
\r
67 if (!Directory.Exists(logDir))
\r
68 Directory.CreateDirectory(logDir);
\r
70 if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml")))
\r
72 PresetsHandler x = new PresetsHandler();
\r
73 x.UpdateBuiltInPresets();
\r
76 Application.EnableVisualStyles();
\r
77 Application.SetCompatibleTextRenderingDefault(false);
\r
78 Application.Run(new frmMain());
\r
83 /// Throw up an error message for any unhandled exceptions.
\r
85 /// <param name="sender">The sender</param>
\r
86 /// <param name="e">Unhandled Exception EventArgs </param>
\r
87 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
\r
91 frmExceptionWindow exceptionWindow = new frmExceptionWindow();
\r
92 exceptionWindow.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString());
\r
93 exceptionWindow.ShowDialog();
\r
98 "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject,
\r
99 "Unhandled Exception",
\r
100 MessageBoxButtons.OK,
\r
101 MessageBoxIcon.Error);
\r