namespace Handbrake\r
{\r
using System;\r
+ using System.Diagnostics;\r
using System.IO;\r
using System.Windows.Forms;\r
\r
using HandBrake.ApplicationServices;\r
\r
+ using Handbrake.Presets;\r
using Handbrake.Properties;\r
\r
- using Presets;\r
-\r
/// <summary>\r
/// HandBrake Starts Here\r
/// </summary>\r
/// <summary>\r
/// The main entry point for the application.\r
/// </summary>\r
+ /// <param name="args">\r
+ /// The args.\r
+ /// </param>\r
[STAThread]\r
- public static void Main()\r
+ public static void Main(string[] args)\r
{\r
+ InstanceId = Process.GetProcessesByName("HandBrake").Length;\r
+\r
// Handle any unhandled exceptions\r
- AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);\r
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainUnhandledException);\r
\r
// Attempt to upgrade / keep the users settings between versions\r
if (Settings.Default.UpdateRequired)\r
{\r
Settings.Default.Upgrade();\r
Settings.Default.UpdateRequired = false;\r
+ Functions.Main.SetCliVersionData();\r
}\r
\r
// Make sure we have any pre-requesits before trying to launch\r
\r
Application.EnableVisualStyles();\r
Application.SetCompatibleTextRenderingDefault(false);\r
- Application.Run(new frmMain());\r
+ Application.Run(new frmMain(args));\r
}\r
}\r
\r
/// </summary>\r
private static void InitializeApplicationServices()\r
{\r
- Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
- Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,\r
+ string versionId = String.Format("Windows GUI {1} {0}", Settings.Default.hb_build, Settings.Default.hb_version);\r
+ Init.SetupSettings(versionId, InstanceId, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
+ Settings.Default.growlEncode, Settings.Default.growlQueue,\r
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
- Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus);\r
+ Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="sender">The sender</param>\r
/// <param name="e">Unhandled Exception EventArgs </param>\r
- private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)\r
+ private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)\r
{\r
- try\r
- {\r
- frmExceptionWindow exceptionWindow = new frmExceptionWindow();\r
- exceptionWindow.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString());\r
- exceptionWindow.ShowDialog();\r
- }\r
- catch (Exception)\r
- {\r
- MessageBox.Show(\r
- "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject,\r
- "Unhandled Exception",\r
- MessageBoxButtons.OK,\r
- MessageBoxIcon.Error);\r
- }\r
+ MessageBox.Show(\r
+ "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject,\r
+ "Unhandled Exception",\r
+ MessageBoxButtons.OK,\r
+ MessageBoxIcon.Error);\r
}\r
+\r
+ public static int InstanceId;\r
}\r
}
\ No newline at end of file