this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\r
this.Text = "Activity Window";\r
-\r
this.panel1.ResumeLayout(false);\r
this.ResumeLayout(false);\r
\r
this.rtf_actLog.Text = string.Empty;\r
\r
read_file = file;\r
- monitorFile = new Thread(autoUpdate);\r
- monitorFile.Start();\r
\r
+ string logFile = Path.Combine(Path.GetTempPath(), read_file);\r
+ if (File.Exists(logFile))\r
+ {\r
+ monitorFile = new Thread(autoUpdate);\r
+ monitorFile.Start();\r
+ }\r
+ else\r
+ {\r
+ MessageBox.Show("The log file could not be found. Maybe you cleared your system's tempory folder or maybe you just havn't run an encode yet.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
}\r
\r
private void autoUpdate(object state)\r
Thread.Sleep(5000);\r
}\r
}\r
- \r
+\r
private delegate void UpdateUIHandler();\r
private void updateTextFromThread()\r
{\r
return;\r
}\r
rtf_actLog.Text = readFile();\r
- this.rtf_actLog.SelectionStart = this.rtf_actLog.Text.Length -1;\r
+ this.rtf_actLog.SelectionStart = this.rtf_actLog.Text.Length - 1;\r
this.rtf_actLog.ScrollToCaret();\r
\r
//if (rtf_actLog.Text.Contains("HandBrake has exited."))\r
- //monitorFile.Abort();\r
+ //monitorFile.Abort();\r
}\r
\r
private string readFile()\r
string logFile = Path.Combine(Path.GetTempPath(), read_file);\r
string logFile2 = Path.Combine(Path.GetTempPath(), "hb_encode_log_AppReadable.dat");\r
\r
+\r
// Make sure the application readable log file does not already exist. FileCopy fill fail if it does.\r
if (File.Exists(logFile2))\r
File.Delete(logFile2);\r
line = sr.ReadLine();\r
}\r
sr.Close();\r
+\r
}\r
catch (Exception exc)\r
{\r
\r
protected override void OnClosing(CancelEventArgs e)\r
{\r
- monitorFile.Abort();\r
+ if (monitorFile != null)\r
+ monitorFile.Abort();\r
e.Cancel = true;\r
this.Hide();\r
base.OnClosing(e);\r