OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 15 May 2008 23:54:19 +0000 (23:54 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 15 May 2008 23:54:19 +0000 (23:54 +0000)
- Fixed: http://forum.handbrake.fr/posting.php?mode=reply&f=12&t=6088

git-svn-id: svn://localhost/HandBrake/trunk@1462 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/frmActivityWindow.Designer.cs
win/C#/frmActivityWindow.cs

index dea0620..dcd58d5 100644 (file)
@@ -82,7 +82,6 @@ namespace Handbrake
             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
index de67bc8..7c4d302 100644 (file)
@@ -34,9 +34,17 @@ namespace Handbrake
             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
@@ -47,7 +55,7 @@ namespace Handbrake
                 Thread.Sleep(5000);\r
             }\r
         }\r
-        \r
+\r
         private delegate void UpdateUIHandler();\r
         private void updateTextFromThread()\r
         {\r
@@ -57,11 +65,11 @@ namespace Handbrake
                 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
@@ -74,6 +82,7 @@ namespace Handbrake
                 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
@@ -90,6 +99,7 @@ namespace Handbrake
                     line = sr.ReadLine();\r
                 }\r
                 sr.Close();\r
+\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -101,7 +111,8 @@ namespace Handbrake
 \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