/// The main entry point for the application.\r
/// </summary>\r
[STAThread]\r
- public static void Main()\r
+ public static void Main(string[] args)\r
{\r
// Handle any unhandled exceptions\r
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);\r
\r
Application.EnableVisualStyles();\r
Application.SetCompatibleTextRenderingDefault(false);\r
- Application.Run(new frmMain());\r
+ Application.Run(new frmMain(args));\r
}\r
}\r
\r
\r
#region Application Startup\r
\r
- public frmMain()\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="frmMain"/> class.\r
+ /// </summary>\r
+ /// <param name="args">\r
+ /// The arguments passed in on application startup.\r
+ /// </param>\r
+ public frmMain(string[] args)\r
{\r
// Load and setup the splash screen in this thread\r
splash.Show(this);\r
// Event Handlers and Queue Recovery\r
events();\r
queueRecovery();\r
+\r
+ // If have a file passed in via command arguemtents, check it's a file and try scanning it.\r
+ if (args.Length >= 1 && File.Exists(args[0]))\r
+ {\r
+ this.StartScan(args[0], 0);\r
+ }\r
}\r
\r
private void UpdateCheckDone(IAsyncResult result)\r
drp_dvdtitle.SelectedIndex = 0;\r
}\r
\r
- // Enable the creation of chapter markers if the file is an image of a dvd.\r
- int start, end;\r
- int.TryParse(drop_chapterStart.Items[0].ToString(), out start);\r
- int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);\r
- if (end > start)\r
- Check_ChapterMarkers.Enabled = true;\r
- else\r
+ // Enable the creation of chapter markers if the file is an image of a dvd\r
+ if (drop_chapterStart.Items.Count > 0)\r
{\r
- Check_ChapterMarkers.Enabled = false;\r
- Check_ChapterMarkers.Checked = false;\r
- data_chpt.Rows.Clear();\r
+ int start, end;\r
+ int.TryParse(drop_chapterStart.Items[0].ToString(), out start);\r
+ int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);\r
+ if (end > start) Check_ChapterMarkers.Enabled = true;\r
+ else\r
+ {\r
+ Check_ChapterMarkers.Enabled = false;\r
+ Check_ChapterMarkers.Checked = false;\r
+ data_chpt.Rows.Clear();\r
+ }\r
}\r
\r
// If no titles were found, Display an error message\r
"Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
\r
if (result == DialogResult.No)\r
+ {\r
e.Cancel = true;\r
+ return;\r
+ }\r
\r
// Try to safely close out if we can, or kill the cli if using in-gui status\r
if (Settings.Default.enocdeStatusInGui)\r