OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 25 Jul 2010 16:20:32 +0000 (16:20 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 25 Jul 2010 16:20:32 +0000 (16:20 +0000)
- Fix some issues with the log window repeating the log header.

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

win/C#/HandBrake.ApplicationServices/Services/Scan.cs
win/C#/frmActivityWindow.cs

index da8d34f..558dbb8 100644 (file)
@@ -94,7 +94,7 @@ namespace HandBrake.ApplicationServices.Services
 \r
                 if (logBuffer == null)\r
                 {\r
-                    ResetLogReader();\r
+                    ResetLogReader(false);\r
                     ReadLastScanFile();  \r
                 }\r
 \r
@@ -149,12 +149,12 @@ namespace HandBrake.ApplicationServices.Services
                 if (this.ScanStared != null)\r
                     this.ScanStared(this, new EventArgs());\r
 \r
-                ResetLogReader();\r
+                ResetLogReader(true);\r
 \r
                 string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
                 string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
                                 "\\HandBrake\\logs";\r
-                string dvdInfoPath = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId));\r
+                string dvdInfoPath = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString()));\r
 \r
                 // Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)\r
                 if (File.Exists(dvdInfoPath))\r
@@ -219,8 +219,8 @@ namespace HandBrake.ApplicationServices.Services
                 // we'll need to make a copy of it.\r
                 string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
                                 "\\HandBrake\\logs";\r
-                string logFile = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId));\r
-                string logFile2 = Path.Combine(logDir, string.Format("tmp_appReadable_log{0}.txt", Init.InstanceId));\r
+                string logFile = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString()));\r
+                string logFile2 = Path.Combine(logDir, string.Format("tmp_appReadable_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString()));\r
 \r
                 try\r
                 {\r
@@ -233,7 +233,7 @@ namespace HandBrake.ApplicationServices.Services
                         File.Copy(logFile, logFile2, true);\r
                     else\r
                     {\r
-                        ResetLogReader();\r
+                        ResetLogReader(true);\r
                         return;\r
                     }\r
 \r
@@ -257,7 +257,7 @@ namespace HandBrake.ApplicationServices.Services
                 catch (Exception exc)\r
                 {\r
                     Console.WriteLine(exc.ToString());\r
-                    ResetLogReader();\r
+                    ResetLogReader(true);\r
                 }\r
             }\r
         }\r
@@ -265,11 +265,15 @@ namespace HandBrake.ApplicationServices.Services
         /// <summary>\r
         /// Reset the Log Reader\r
         /// </summary>\r
-        private void ResetLogReader()\r
+        /// <param name="addHeader">\r
+        /// The add Header.\r
+        /// </param>\r
+        private void ResetLogReader(bool addHeader)\r
         {\r
             logFilePosition = 0;\r
             logBuffer = new StringBuilder();\r
-            logBuffer.AppendLine(Logging.CreateCliLogHeader(null));\r
+            if (addHeader)\r
+                logBuffer.AppendLine(Logging.CreateCliLogHeader(null));\r
         }\r
 \r
         /// <summary>\r
index 62799e9..598851f 100644 (file)
@@ -199,6 +199,7 @@ namespace Handbrake
         private void stopWindowRefresh(object sender, EventArgs e)\r
         {\r
             windowTimer.Dispose();\r
+            Reset();\r
             LogMonitor(null);\r
         }\r
 \r